GTK+ 1.2 Tutorial
Prev | Chapter 11. CList Widget | Next

# Working with titles

When you create a CList widget, you will also get a set of title buttons automatically. They live in the top of the CList window, and can act either as normal buttons that respond to being pressed, or they can be passive, in which case they are nothing more than a title. There are four different calls that aid us in setting the status of the title buttons.

    void gtk_clist_column_title_active( GtkCList *clist,
                                         gint     column );

    void gtk_clist_column_title_passive( GtkCList *clist,
                                         gint      column );

    void gtk_clist_column_titles_active( GtkCList *clist );

    void gtk_clist_column_titles_passive( GtkCList *clist );

An active title is one which acts as a normal button, a passive one is just a label. The first two calls above will activate/deactivate the title button above the specific column, while the last two calls activate/deactivate all title buttons in the supplied clist widget.

But of course there are those cases when we don't want them at all, and so they can be hidden and shown at will using the following two calls.

    void gtk_clist_column_titles_show( GtkCList *clist );

    void gtk_clist_column_titles_hide( GtkCList *clist );

For titles to be really useful we need a mechanism to set and change them, and this is done using

    void gtk_clist_set_column_title( GtkCList *clist,
                                     gint      column,
                                     gchar    *title );

Note that only the title of one column can be set at a time, so if all the titles are known from the beginning, then I really suggest using gtk_clist_new_with_titles (as described above) to set them. It saves you coding time, and makes your program smaller. There are some cases where getting the job done the manual way is better, and that's when not all titles will be text. CList provides us with title buttons that can in fact incorporate whole widgets, for example a pixmap. It's all done through

    void gtk_clist_set_column_widget( GtkCList  *clist,
                                      gint       column,
                                      GtkWidget *widget );

which should require no special explanation.

Prev | Home | Next
Modes of operation | Up | Manipulating the list itself