vdk 2.4.0
Public Member Functions | Public Attributes | List of all members
VDKCombo Class Reference

Provides a simplified wrapper for gtkcombo. More...

#include <combo.h>

Inheritance diagram for VDKCombo:
Inheritance graph
[legend]
Collaboration diagram for VDKCombo:
Collaboration graph
[legend]

Public Member Functions

 VDKCombo (VDKForm *owner, char *def=(char *) NULL, GtkWidget *combo=NULL)
 
void SetBackground (VDKRgb rgb, GtkStateType state)
 
- Public Member Functions inherited from VDKObject
VDKRgb GetBackground (GtkStateType state=GTK_STATE_NORMAL)
 
VDKRgb GetForeground (GtkStateType state=GTK_STATE_NORMAL)
 
 VDKObject (VDKForm *owner=NULL)
 
 VDKObject (VDKForm *owner, GtkWidget *widget)
 
virtual ~VDKObject ()
 
bool Destroy ()
 
virtual int isA ()
 
VDKFormOwner ()
 
virtual GtkWidget * Widget ()
 
GtkWidget * ConnectingWidget ()
 
GtkWidget * WrappedWidget ()
 
virtual void SetFont (VDKFont *f)
 
VDKFontGetFont ()
 
void SetVisible (bool visible)
 
bool GetVisible ()
 
void SetCursor (VDKCursorType)
 
VDKCursorType GetCursor ()
 
virtual void SetForeground (VDKRgb color, GtkStateType state=GTK_STATE_NORMAL)
 
void SetSize (int w, int h)
 
void SetUsize (VDKPoint s)
 
virtual void SetTip (char *)
 
virtual void Add (VDKObject *obj, int justify=l_justify, int expand=TRUE, int fill=TRUE, int padding=0)
 
ItemListItems ()
 
void Draw (GdkRectangle *area=NULL)
 
virtual void Setup ()
 
void SignalEmit (int signal)
 
void SignalEmit (char *sig)
 
void SignalEmitParent (int signal)
 
void SignalEmitParent (char *sig)
 
void GrabFocus ()
 
VDKObjectParent (VDKObject *p=NULL)
 
int SignalConnect (VDKObject *obj, char *signal, bool(VDKObject::*method)(VDKObject *), bool gtk=true, bool after=false)
 
int SignalConnect (char *signal, bool(VDKObject::*method)(VDKObject *), bool gtk=true, bool after=false)
 
bool SignalDisconnect (int connection)
 
int EventConnect (VDKObject *obj, char *event, bool(VDKObject::*method)(VDKObject *, GdkEvent *), bool after=false)
 
int EventConnect (char *, bool(VDKObject::*)(VDKObject *, GdkEvent *), bool after=false)
 
bool EventDisconnect (int connection)
 

Public Attributes

VDKReadWriteValueProp< VDKCombo, char * > Text
 
VDKReadWriteValueProp< VDKCombo, bool > Editable
 
VDKReadWriteValueProp< VDKCombo, bool > Sorted
 
VDKReadWriteValueProp< VDKCombo, bool > Hidden
 
VDKReadWriteValueProp< VDKCombo, bool > CaseSensitive
 
VDKReadWriteValueProp< VDKCombo, StringListPopdownStrings
 
VDKReadOnlyValueProp< VDKCombo, int > Selected
 
- Public Attributes inherited from VDKObject
VDKReadWriteValueProp< VDKObject, VDKRgbNormalBackground
 
VDKReadWriteValueProp< VDKObject, VDKFont * > Font
 
SizeObjectProp Usize
 
VDKReadWriteValueProp< VDKObject, bool > Enabled
 
VDKReadWriteValueProp< VDKObject, VDKCursorType > Cursor
 
VDKReadWriteValueProp< VDKObject, bool > Visible
 

Additional Inherited Members

- Protected Attributes inherited from VDKObject
VDKObjectSignal s_clicked
 
GtkWidget * widget
 
GtkWidget * sigwid
 
VDKObjectparent
 

Detailed Description

Provides a simplified wrapper for gtkcombo.

Author
Eric T. Wienke eric@.nosp@m.liqu.nosp@m.idsil.nosp@m.ver..nosp@m.com
Signals
  • activate_signal received when the Enter key is pressed in the Entry.
  • changed_signal received when text in Entry is changed.
  • selection_changed_signal, received when the selection in the List is changed. This happens when an item has been selected or unselected. This means that the signal is received more than once on a new selection. Always check the Selected property for a value of -1.
  • focus_in_signal received when Entry gets focus.
  • focus_out_signal received when Entry loses focus.

Constructor & Destructor Documentation

◆ VDKCombo()

VDKCombo::VDKCombo ( VDKForm owner,
char *  def = (char*) NULL,
GtkWidget *  combo = NULL 
)

Constructor

Parameters
defis an optional initial value to be shown in the Entrybox.
combointernal use, leave it as NULL.

Member Function Documentation

◆ SetBackground()

void VDKCombo::SetBackground ( VDKRgb  color,
GtkStateType  state 
)
virtual

Sets object background

Parameters
colora VDKRgb object
statecan be one of the gtk+ widget states

Reimplemented from VDKObject.

Member Data Documentation

◆ CaseSensitive

VDKReadWriteValueProp<VDKCombo,bool> VDKCombo::CaseSensitive

Default: false. Whether the Combo box should check for equality in the list case-sensitive or not.

◆ Editable

VDKReadWriteValueProp<VDKCombo,bool> VDKCombo::Editable

Same as Editable property in VDKEntry. Setting it to false allows you to provide a read-only list to select from, without the user being able to enter text.

◆ Hidden

VDKReadWriteValueProp<VDKCombo,bool> VDKCombo::Hidden

Entry text visibility flag. (As in VDKEntry)

◆ PopdownStrings

VDKReadWriteValueProp<VDKCombo,StringList> VDKCombo::PopdownStrings

A StringList corresponding to the Text of the Listitems. Use this function to add items to the list,

StringList sl = mycombo->PopdownStrings;
VDKString s("New line");
sl.add(s);
mycombo->PopdownStrings = sl;
Implements famous cont referenced string objects.
Definition: vdkstring.h:46
void add(const T &t)
Definition: value_sem_list.h:288

Since StringList is of type VDKValueList<VDKString> you can use all functions of VDKValueList to manipulate the list. It is very convenient to access the StringList by index:

int sel = mycombo->Selected;
char *seltext = (sel == -1) ? "None" :
(char*)(mycombo->GetPopdownStrings())[sel];
printf("Selected item is %s\n",seltext);
Tip
Note the use of the get function GetPopdownStrings() instead of the property because it was used within an expression.
mycombo->PopdownStrings[sel];
would result in a compilation error. You can however use a typecast:
((StringList)mycombo->PopdownStrings)[sel]

◆ Selected

VDKReadOnlyValueProp<VDKCombo,int> VDKCombo::Selected

Returns the index of the currently selected item in the dropdown list or -1 if no item is selected. See PopdownStrings for example usage.

◆ Sorted

VDKReadWriteValueProp<VDKCombo,bool> VDKCombo::Sorted

Default: false. Setting Sorted to true will automatically sort the listitems alphabetically and maintain the list sorted whenever a new item is added

◆ Text

VDKReadWriteValueProp<VDKCombo,char*> VDKCombo::Text

Set/Get the text in the Entry


The documentation for this class was generated from the following files: