"Fossies" - the Fresh Open Source Software Archive

Member "google-gadgets-for-linux-0.11.2/ggadget/anchor_element.h" (15 Mar 2009, 2193 Bytes) of package /linux/misc/old/google-gadgets-for-linux-0.11.2.tar.gz:


As a special service "Fossies" has tried to format the requested source page into HTML format using (guessed) C and C++ source code syntax highlighting (style: standard) with prefixed line numbers and code folding option. Alternatively you can here view or download the uninterpreted source code file.

    1 /*
    2   Copyright 2008 Google Inc.
    3 
    4   Licensed under the Apache License, Version 2.0 (the "License");
    5   you may not use this file except in compliance with the License.
    6   You may obtain a copy of the License at
    7 
    8        http://www.apache.org/licenses/LICENSE-2.0
    9 
   10   Unless required by applicable law or agreed to in writing, software
   11   distributed under the License is distributed on an "AS IS" BASIS,
   12   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
   13   See the License for the specific language governing permissions and
   14   limitations under the License.
   15 */
   16 
   17 #ifndef GGADGET_ANCHOR_ELEMENT_H__
   18 #define GGADGET_ANCHOR_ELEMENT_H__
   19 
   20 #include <stdlib.h>
   21 #include <ggadget/basic_element.h>
   22 
   23 namespace ggadget {
   24 
   25 class TextFrame;
   26 
   27 /**
   28  * @ingroup Elements
   29  * Class of <a href=
   30  * "http://code.google.com/apis/desktop/docs/gadget_apiref.html#a">
   31  * anchor element</a>.
   32  */
   33 class AnchorElement : public BasicElement {
   34  public:
   35   DEFINE_CLASS_ID(0x50ef5c291807400c, BasicElement);
   36 
   37   AnchorElement(View *view, const char *name);
   38   virtual ~AnchorElement();
   39 
   40  protected:
   41   virtual void DoClassRegister();
   42 
   43  public:
   44   /**
   45    * Gets the mouseover text color or texture image of the element.
   46    */
   47   Variant GetOverColor() const;
   48   /**
   49    * Sets the mouseover text color or texture image of the element.
   50    * The image is repeated if necessary, not stretched.
   51    */
   52   void SetOverColor(const Variant &color);
   53 
   54   /** Gets the URL to be launched when this link is clicked. */
   55   std::string GetHref() const;
   56   /** Sets the URL to be launched when this link is clicked. */
   57   void SetHref(const char *href);
   58 
   59   //@{
   60   /** Gets the text frame containing the text content of this anchor. */
   61   TextFrame *GetTextFrame();
   62   const TextFrame *GetTextFrame() const;
   63   //@}
   64 
   65  public:
   66   static BasicElement *CreateInstance(View *view, const char *name);
   67 
   68  protected:
   69   virtual void DoDraw(CanvasInterface *canvas);
   70   virtual EventResult HandleMouseEvent(const MouseEvent &event);
   71   virtual void GetDefaultSize(double *width, double *height) const;
   72 
   73  private:
   74   DISALLOW_EVIL_CONSTRUCTORS(AnchorElement);
   75 
   76   class Impl;
   77   Impl *impl_;
   78 };
   79 
   80 } // namespace ggadget
   81 
   82 #endif // GGADGET_ANCHOR_ELEMENT_H__