GTK+
The GIMP Toolkit
|
A cell can contain a pixmap, text or both. To set them the following
functions are used. void gtk_clist_set_text( GtkCList *clist,
gint row,
gint column,
const gchar *text );
void gtk_clist_set_pixmap( GtkCList *clist,
gint row,
gint column,
GdkPixmap *pixmap,
GdkBitmap *mask );
void gtk_clist_set_pixtext( GtkCList *clist,
gint row,
gint column,
gchar *text,
guint8 spacing,
GdkPixmap *pixmap,
GdkBitmap *mask ); |
It's quite straightforward. All the calls have the CList as the first
argument, followed by the row and column of the cell, followed by the
data to be set. The spacing argument in gtk_clist_set_pixtext is
the number of pixels between the pixmap and the beginning of the
text. In all cases the data is copied into the widget. To read back the data, we instead use gint gtk_clist_get_text( GtkCList *clist,
gint row,
gint column,
gchar **text );
gint gtk_clist_get_pixmap( GtkCList *clist,
gint row,
gint column,
GdkPixmap **pixmap,
GdkBitmap **mask );
gint gtk_clist_get_pixtext( GtkCList *clist,
gint row,
gint column,
gchar **text,
guint8 *spacing,
GdkPixmap **pixmap,
GdkBitmap **mask ); |
The returned pointers are all pointers to the data stored within the
widget, so the referenced data should not be modified or released. It
isn't necessary to read it all back in case you aren't interested. Any
of the pointers that are meant for return values (all except the
clist) can be NULL. So if we want to read back only the text from a
cell that is of type pixtext, then we would do the following, assuming
that clist, row and column already exist: gchar *mytext;
gtk_clist_get_pixtext(clist, row, column, &mytext, NULL, NULL, NULL); |
There is one more call that is related to what's inside a cell in the
clist, and that's GtkCellType gtk_clist_get_cell_type( GtkCList *clist,
gint row,
gint column ); |
which returns the type of data in a cell. The return value is one of GTK_CELL_EMPTY
GTK_CELL_TEXT
GTK_CELL_PIXMAP
GTK_CELL_PIXTEXT
GTK_CELL_WIDGET |
There is also a function that will let us set the indentation, both
vertical and horizontal, of a cell. The indentation value is of type
gint, given in pixels, and can be both positive and negative. void gtk_clist_set_shift( GtkCList *clist,
gint row,
gint column,
gint vertical,
gint horizontal ); |
|