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

This class wraps gtkclist widget. More...

#include <vdkclist.h>

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

Public Member Functions

 VDKCustomList (VDKForm *owner, int columns=1, char **titles=NULL, GtkSelectionMode mode=GTK_SELECTION_SINGLE)
 
virtual ~VDKCustomList ()
 
void AddRow (char **texts, char **pixdata=NULL, int col=0)
 
void UpdateRow (int row, char **s, char **pixdata=NULL, int col=0)
 
void UpdateRow (int row, Tuple &t, char **pixdata=NULL, int col=0)
 
void UpdateCell (int row, int col, const char *s, char **pixdata=NULL)
 
void RemoveRow (int row)
 
VDKPoint Selection ()
 
VDKPoint Unselection ()
 
void SelectRow (int row, int col)
 
void SelectRow (VDKPoint p)
 
void UnselectRow (int row, int col)
 
void UnselectRow (VDKPoint p)
 
virtual void Clear ()
 
VDKIntArraySelections ()
 
- Public Member Functions inherited from VDKCustom
int ColumnClicked ()
 
GtkSelectionMode SelectionMode ()
 
GtkWidget * CustomWidget ()
 
void ActiveTitle (int col, bool flag=true)
 
void ActiveTitles (bool flag=true)
 
void EnableTitles (bool flag=true)
 
void Freeze ()
 
void Thaw ()
 
int Size ()
 
void ColumnSize (int col, int size)
 
void AutoResizeColumn (int col, bool flag)
 
virtual void SetForeground (VDKRgb, GtkStateType)
 
virtual void SetFont (VDKFont *)
 
- 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 ()
 
VDKFontGetFont ()
 
void SetVisible (bool visible)
 
bool GetVisible ()
 
void SetCursor (VDKCursorType)
 
VDKCursorType GetCursor ()
 
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

SelectionProp Selected
 
SelectionProp Unselected
 
TupleList Tuples
 
- Public Attributes inherited from VDKCustom
VDKReadWriteValueProp< VDKCustom, GtkPolicyType > VPolicy
 
VDKReadWriteValueProp< VDKCustom, GtkPolicyType > HPolicy
 
VDKReadWriteValueProp< VDKCustom, GtkShadowType > BorderShadow
 
VDKReadWriteValueProp< VDKCustom, int > RowHeight
 
VDKReadWriteValueProp< VDKCustom, bool > AutoResize
 
VDKReadWriteValueProp< VDKCustom, VDKRgbSelectedForeground
 
VDKReadWriteValueProp< VDKCustom, VDKRgbUnselectedBackground
 
VDKReadWriteValueProp< VDKCustom, VDKRgbUnselectedForeground
 
VDKObjectArray Titles
 
VDKReadOnlyValueProp< VDKCustom, int > SelectedTitle
 
- 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 Member Functions inherited from VDKCustom
virtual void SetBackground (VDKRgb color, GtkStateType state=GTK_STATE_NORMAL)
 
- Protected Attributes inherited from VDKObject
VDKObjectSignal s_clicked
 
GtkWidget * widget
 
GtkWidget * sigwid
 
VDKObjectparent
 

Detailed Description

This class wraps gtkclist widget.

Signals
  • select_row signal, emitted on selecting a list cell (or double clicking on extended selection mode). Selected property contains selected cell coordinates. Selected is set to VDKPoint(-1,-1) if no cell is selected.
  • unselect_row_signal, emitted on unselecting a cell. Unselected property contains unselected cell coordinates.
  • click_column_signal, emitted on clicking over a column titile, ColumnClicked() returns wich column was clicked.
Tip
Use Selected property property like this:
VDKPoint p = list->Selected;
int row = p.x;
int col = p.y;
// or simpler
int row = list->Selected.Row();
int col = list->Selected.Col();
Programming hints
Data contained into a VDKCustomList are organized as a list of tuples, a VDKTuple is a derived clas of an VDKArray<VDKString> that add equality and less-than operators (See vdkclist.h for further informations). You can access to data using [] operator on Tuples property like this:
VDKTuple tuple = list->Tuples[j]; // access to j-th tuple
VDKString s = list->Tuples[j][i]; // access to j-th,i-th string
Recall that Tuples is a read-only property, directly modifying a tuple does not reflect into the list widget, use VDKCustomList::UpdateRow() method at this end.
Examples
Into ./testvdk/testvdk.cc and .h

Constructor & Destructor Documentation

◆ VDKCustomList()

VDKCustomList::VDKCustomList ( VDKForm owner,
int  columns = 1,
char **  titles = NULL,
GtkSelectionMode  mode = GTK_SELECTION_SINGLE 
)

Constructor.

Parameters
columnscolumns number
titlesarray of titles strings
modeselection mode

◆ ~VDKCustomList()

VDKCustomList::~VDKCustomList ( )
virtual

Destructor

Member Function Documentation

◆ AddRow()

void VDKCustomList::AddRow ( char **  texts,
char **  pixdata = NULL,
int  col = 0 
)

Add a row to list.

Parameters
textsstrings array to fill row cells
pixdataa cell can have a pixmap
wichcolumn has the pixmap (if any)

◆ Clear()

void VDKCustomList::Clear ( )
virtual

Clear widget

Reimplemented from VDKCustom.

◆ RemoveRow()

void VDKCustomList::RemoveRow ( int  row)

Removes a row

Parameters
row,whicrow should be removed

◆ Selection()

VDKPoint VDKCustomList::Selection ( )
inline

Returns selected cell coordinates

◆ Selections()

VDKIntArray & VDKCustomList::Selections ( )

Returns an array filled with all selected row number. Valid only in multiple or extended selection mode, in other cases array will have size == 0

◆ SelectRow() [1/2]

void VDKCustomList::SelectRow ( int  row,
int  col 
)

Selects a row

Parameters
row,cellcoordinate
col

◆ SelectRow() [2/2]

void VDKCustomList::SelectRow ( VDKPoint  p)
inline

Selects a row

Parameters
p,cellcoordinates

◆ Unselection()

VDKPoint VDKCustomList::Unselection ( )
inline

Returns unselected cell coordinates

◆ UnselectRow() [1/2]

void VDKCustomList::UnselectRow ( int  row,
int  col 
)

Unselects a row

Parameters
row,cellcoordinate
col

◆ UnselectRow() [2/2]

void VDKCustomList::UnselectRow ( VDKPoint  p)
inline

Selects a row

Parameters
p,cellcoordinates

◆ UpdateCell()

void VDKCustomList::UpdateCell ( int  row,
int  col,
const char *  s,
char **  pixdata = NULL 
)

Updates a cell

Parameters
rowcell coordinates
col
pixdataa cell can have a pixmap
wichcolumn has the pixmap (if any)

◆ UpdateRow() [1/2]

void VDKCustomList::UpdateRow ( int  row,
char **  s,
char **  pixdata = NULL,
int  col = 0 
)

Updates a row

Parameters
rowwich row should be updated
pixdataa cell can have a pixmap
wichcolumn has the pixmap (if any)

◆ UpdateRow() [2/2]

void VDKCustomList::UpdateRow ( int  row,
Tuple t,
char **  pixdata = NULL,
int  col = 0 
)

Same as above

Member Data Documentation

◆ Selected

SelectionProp VDKCustomList::Selected

Use this to know wich cell is selected or Selected.Row() or Selected.Col() <read-only>

◆ Tuples

TupleList VDKCustomList::Tuples

A tuple is a VDKArray<VDKString>. use this property to access data on row/cell basis like this:

Tuple tuple = list->Tuples[0];
char * p = (char*) tuple[0];
// or more simply
char *p = (char*) list->Tuples[0][0];

◆ Unselected

SelectionProp VDKCustomList::Unselected

Use this to know wich cell is unselected or Unselected.Row() or Unselected.Col() <read-only>


The documentation for this class was generated from the following files:
VDKPoint
Provides a simple point object.
Definition: vdkutils.h:94
VDKPoint::x
int x
Definition: vdkutils.h:99
VDKString
Implements famous cont referenced string objects.
Definition: vdkstring.h:45
Tuple
Definition: vdkcustom.h:43