return to index
VDKObject class <vdkobj.h>
Description
This class is the base class of a wide hierarchy, provides common functionalities
to all derived classes.
Public members
int Tag an int value at user hand (default
0)
Properties
VDKRgb NormalBackground
VDKRgb PrelightBackground
VDKRgb InsensitiveBackground
VDKRgb ActiveBackground
VDKRgb SelectedBackground
VDKRgb Foreground
VDKFont* Font
bool Enabled
VDKCursorType Cursor
VDKPoint Usize
bool Visible
Methods
-
VDKObject(VDKForm* owner);
Constructor, make an object that belongs to <owner> form.
-
VDKObject(VDKForm* owner, GtkWidget* widget);
Contructor, makes an object instance from an already gtk+ created object.
(See tips)
-
virtual ~VDKObject();
Destructor.
-
void Destroy()
Explicitely destroy an object freeing associated memory.
Tip: never use delete operator otherwise garbage collection will fail
and program probably will crash.
-
void Draw(GdkRectangle* area = NULL);
Draw the object into the interested area, if area = NULL the entire
object will be drawn. This call generate an expose event.
-
VDKForm* Owner();
Returns object owner form.
-
VDKObject* Parent(VDKObject* parent = NULL)
If parent != NULL set object parent and returns old parent, otherwise
returns parent.
-
GtkWidget* Widget();
Returns underlying GTK+ widget.
-
GtkWidget* WrappedWidget()
Returns underlying wrapped Gtk+ widget, useful in those cases when
VDKObject is a composite one.
An example is VDKText where Widget() return packing box not text itself.
Tip: In doubt use always this instead of Widget(), is always safe.
-
virtual void SetFont(VDKFont* font);
Set object font.
-
void GrabFocus()
Makes the widget to gain focus.
-
VDKFont* GetFont();
Get object used font
-
void SetCursor ( VDKCursorType cursor)
Set object cursor
-
VDKCursorType GetCursor()
Get object cursor
-
virtual void SetForeground(VDKRgb color,
GtkStateType state = GTK_STATE_NORMAL);
Set object foreground color.
-
virtual void SetBackground(VDKRgb color,
GtkStateType state = GTK_STATE_NORMAL);
Set object background color.
-
void SetSize(int w, int h);
Set object size.
-
void Enable(bool flag = true);
Set object sensitive/unsensitive.
-
bool GetEnabled()
Returns if object is sensitive or not.
-
virtual void SetTip(char* );
Set object tip.
-
virtual void Add(VDKObject* obj, int justify =
l_justify, int expand = TRUE,
int fill = TRUE , int padding = 1);
Add an object to the object.
-
ItemList& Items();
Return contained objects list.
-
void AddItem(VDKObject* item);
-
void RemoveItem(VDKObject* item);
Internal use only, user doesn't care.
-
virtual void Setup()
Called whewnever a VDKObject is added to a container. At base class
level does nothing, user can override it to initialize his own derived
object when added to a container.
-
VDKObject::GetBackground(GtkState = GTK_STATE_NORMAL)
-
VDKObject:: GetForeground()
Useful to access to actual colors in use.
Using signals and events
Tip:
All non-container widget can answer to realize_signal using static
tables.
Static tables
-
int SignalDetach( object, signal)
Macro, disables <object> answering to<signal>. Returns disabled
slot, -1 on failure.
-
void SignalAttach(int signal)
Reactivates the signal into <slot>. <slot> should be achieved
with a previous SIGNAL_DETACH call.
-
int EventDetach(object, event)
Macro, disables <object> answering to<event>. Returns disabled
slot, -1 on failure.
-
void EventAttach(int signal)
Reactivates the event into <slot>. <slot> should be achieved
with a previous EVENT_DETACH call.
-
void SignalEmit(int signal)
Emit signal <signal>
-
void SignalEmitParent(int signal)
Emit signal <signal> starting at parent level
Dynamic tables
-
int SignalConnect(VDKObject* object, char* signal,
bool (_owner_class::*Pmf)(VDKObject* sender),
bool gtk = true, bool after = false )
Connect <object> of a method of <this> trough <signal>. Return
an integer that is the connected "slot" number.
Usage: int slot = Connect(button,"clicked",&MyForm::ButtonClicked)
Tip: use this to connect a object contained into a form or another
container with a container method.
Tip: signal names are those provided by Gtk+
-
int SignalConnect(char* signal,
bool (_owner_class::*Pmf)(VDKObject* sender),
bool gtk = true, bool after = false )
Connect <this> of a method of <this> trough <signal>. Return
an integer that is the connected "slot" number.
Usage: int slot = Connect("clicked",&MyButton::ButtonClicked);
Tip: use this to connect an object with an object method.
-
bool SignalDisconnect(int slot)
Disconnect signal, <slot> must be retrieved from a ConnectSignal()
call.
-
int EventConnect(VDKObject* object, char* event,
bool (_owner_class::*Pmf)(VDKObject* sender,
GdkEvent*) , bool after = false)
Connect <object> of a method of <this> trough <event>. Return
an integer that is the connected "slot" number.
Usage: int slot = Connect(button,"button_press_event",&MyForm::ButtonPressed)
Tip: use this to connect a object contained into a form or another
container with a container method.
Tip: event names are those provided by Gtk+
-
int EventConnect(char* event,
bool (_owner_class::*Pmf)(VDKObject* sender,
GdkEvent*) , bool after = false)
Connect <this> of a method of <this> trough <event>. Return
an integer that is the connected "slot" number.
Usage: int slot = Connect("button_press-event",&MyButton::ButtonPressed);
Tip: use this to connect an object with an object method.
-
bool EventDisconnect(int slot)
Disconnect event, <slot> must be retrieved from a ConnectEvent()
call.
-
void SignalEmit(char* signal)
Emit signal <signal>
-
void SignalEmitParent(char* signal)
Emit signal <signal> starting at parent level
Using properties
-
VDKRgb XxxxxBackground
Setting this property will set/get object background color. Naming
convention follows Gtk+ one.
Example: form->NormalBackground = VDKRgb(255,0,0);
(Tip: VDKRgb is a structure defined in vdkutils.h. Remember that
some objects are transparent, so if you want to set the background color,
you actually have to set the background color of the parent, VDKlabel is
an example.
-
VDKRgb Foreground
Setting this property will set/get object foreground color.
-
VDKCursorType Cursor
Setting this property will set/get object cursor type.
-
VDKPoint Usize
Setting this property will set/get object minimu size.
-
bool Enabled
Setting this property will set/get object sensitivity.
-
VDKFont* Font
Setting this property will set the object font.
obj->Font = new VDKFont(obj,"X-font-string-chock-full-o-dashes-goes-in-here");
-
bool Visible
Setting this property will show/hide or get object visibility.