GtkOL Reference Manual

CControl

    CControl implements the basics of an application visual control definition. A control is not always responsible of its GUI drawing. It can be derived to a widget control or used as a part of it i.e. be a windowed one or not. A control handles logical drag and drop properties, size and position but only attributes affectation are resolved at this level, there is no special GTK+ handling and most of the ccontrol functions are overwritten to do so.

XML serialization

<ccontrol [draggable="bool" dropsite="bool"] [x="SInt32" y="SInt32" w="SInt32" h="SInt32"]>
   ...
</ccontrol>

Metaclass declaration

DECLARE_GENERIC_METACLASS ('ctrl', CControl, CComponent);

Hierarchy Definition

    [CClass]
        [CSerialized]
            [CMetaModule]
                [CObject]
                    CComponent
                        CControl

API description

#include "ccomponent.h"
#include "cgraphics.h"

class CControl : public CComponent
{
   
public :

      CControl           (CComponent *inOwner, 
const CObjectListener *inListener=NULL);
      
virtual ~CControl  ();

   
public :

      
virtual void       SetBounds        (const TBounds &inBounds);
      
virtual TBounds    GetBounds        () const;

      
virtual void       SetDraggable     (const Bool inDraggable);
      Bool               GetDraggable     () 
const;

      
virtual void       SetDropSite      (const Bool inDropSite);
      Bool               GetDropSite      () 
const;
       
      
virtual CPixbuf *  GetControlPixbuf () const =0;

      
virtual void       Serialize        (CXMLElementNode *&ioXMLElementNode, const int inMode) THROWABLE;

   protected :

      TBounds            m_Bounds;

      Bool               m_Draggable;
      Bool               m_DropSite;

      Bool               m_SerializeBounds;
      Bool               m_SerializeDnD;

      SECTION_GENERIC_METACLASS;
};

API details

CControl::CControl             (CComponent *inOwner, const CObjectListener *inListener=NULL);
The CControl constructor. No particular handling but setting the attributes default values :
m_Draggable       (false),
m_DropSite        (false),
m_SerializeBounds (false),
m_SerializeDnD    (true),
m_Bounds          ()

virtual CControl::~CControl    ();
CControl destructor.

virtual void       CControl::SetBounds        (const TBounds &inBounds);
Control bounds affectation. Nothing done here but keeping a local copy of the specified bounds into the m_Bounds attribute.

virtual TBounds    CControl::GetBounds        () const;
The m_Bounds attribute reader.

virtual void       CControl::SetDraggable     (const Bool inDraggable);
Control draggable state affectation. m_Draggable attribute member affectation i.e. if the control might be a drag and drop source.

Bool               CControl::GetDraggable     () const;
The m_Draggable attribute reader.

virtual void       CControl::SetDropSite      (const Bool inDropSite);
Control draggable state affectation. m_DropSite attribute member affectation i.e. if the control might be a drag and drop target.

Bool               CControl::GetDropSite      () const;
The m_DropSite attribute reader.

virtual CPixbuf *  CControl::GetControlPixbuf () const =0;
Pure virtual function. The derived definitions define the GetControlPixbuf request to return a friendly pixbuf representation of the control. It is essentialy called to handle drag and drop images.

virtual void       CControl::Serialize        (CXMLElementNode *&ioXMLElementNode, const int inMode) THROWABLE;
Serializes the component's control level based on the m_SerializeBounds and the m_SerializeDnD values.

TBounds            CControl::m_Bounds;
The control bounds attribute.

Bool               CControl::m_Draggable;
The control draggable state attribute.

Bool               CControl::m_DropSite;
The control dropsiteable state attribute.

Bool               CControl::m_SerializeBounds;
Derived classes may change the serialization behaviour of the control level on some widgets.

Bool               CControl::m_SerializeDnD;
Derived classes may change the serialization drag and drop behaviour of the control level on some widgets.