moved widget creation to gtk_clist_construct for the gtk-- folks.
This commit is contained in:
parent
75fbe1adae
commit
005f39e02e
@ -415,49 +415,13 @@ gtk_clist_init (GtkCList * clist)
|
|||||||
clist->selection = NULL;
|
clist->selection = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/* Constructors */
|
||||||
* GTKCLIST PUBLIC INTERFACE
|
void
|
||||||
* gtk_clist_new_with_titles
|
gtk_clist_construct (GtkCList * clist,
|
||||||
* gtk_clist_new
|
gint columns,
|
||||||
*/
|
gchar *titles[])
|
||||||
GtkWidget *
|
|
||||||
gtk_clist_new_with_titles (int columns,
|
|
||||||
gchar * titles[])
|
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
GtkWidget *widget;
|
|
||||||
GtkCList *clist;
|
|
||||||
|
|
||||||
if (titles == NULL)
|
|
||||||
return NULL;
|
|
||||||
|
|
||||||
widget = gtk_clist_new (columns);
|
|
||||||
if (!widget)
|
|
||||||
return NULL;
|
|
||||||
else
|
|
||||||
clist = GTK_CLIST (widget);
|
|
||||||
|
|
||||||
/* set column titles */
|
|
||||||
GTK_CLIST_SET_FLAGS (clist, CLIST_SHOW_TITLES);
|
|
||||||
for (i = 0; i < columns; i++)
|
|
||||||
{
|
|
||||||
gtk_clist_set_column_title (clist, i, titles[i]);
|
|
||||||
}
|
|
||||||
|
|
||||||
return widget;
|
|
||||||
}
|
|
||||||
|
|
||||||
GtkWidget *
|
|
||||||
gtk_clist_new (int columns)
|
|
||||||
{
|
|
||||||
GtkCList *clist;
|
|
||||||
|
|
||||||
/* sanity check */
|
|
||||||
if (columns < 1)
|
|
||||||
return NULL;
|
|
||||||
|
|
||||||
clist = gtk_type_new (gtk_clist_get_type ());
|
|
||||||
GTK_CLIST_UNSET_FLAGS (clist, CLIST_SHOW_TITLES);
|
|
||||||
|
|
||||||
/* initalize memory chunks */
|
/* initalize memory chunks */
|
||||||
clist->row_mem_chunk = g_mem_chunk_new ("clist row mem chunk",
|
clist->row_mem_chunk = g_mem_chunk_new ("clist row mem chunk",
|
||||||
@ -482,6 +446,53 @@ gtk_clist_new (int columns)
|
|||||||
/* create scrollbars */
|
/* create scrollbars */
|
||||||
create_scrollbars (clist);
|
create_scrollbars (clist);
|
||||||
|
|
||||||
|
if (titles)
|
||||||
|
{
|
||||||
|
GTK_CLIST_SET_FLAGS (clist, CLIST_SHOW_TITLES);
|
||||||
|
for (i = 0; i < columns; i++)
|
||||||
|
gtk_clist_set_column_title (clist, i, titles[i]);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
GTK_CLIST_UNSET_FLAGS (clist, CLIST_SHOW_TITLES);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* GTKCLIST PUBLIC INTERFACE
|
||||||
|
* gtk_clist_new_with_titles
|
||||||
|
* gtk_clist_new
|
||||||
|
*/
|
||||||
|
GtkWidget *
|
||||||
|
gtk_clist_new_with_titles (gint columns,
|
||||||
|
gchar * titles[])
|
||||||
|
{
|
||||||
|
GtkCList *clist;
|
||||||
|
GtkWidget *widget;
|
||||||
|
|
||||||
|
if (titles == NULL)
|
||||||
|
return NULL;
|
||||||
|
|
||||||
|
widget = gtk_clist_new (columns);
|
||||||
|
if (!widget)
|
||||||
|
return NULL;
|
||||||
|
else
|
||||||
|
clist = GTK_CLIST (widget);
|
||||||
|
|
||||||
|
gtk_clist_construct (clist, columns, titles);
|
||||||
|
return widget;
|
||||||
|
}
|
||||||
|
|
||||||
|
GtkWidget *
|
||||||
|
gtk_clist_new (gint columns)
|
||||||
|
{
|
||||||
|
GtkCList *clist;
|
||||||
|
|
||||||
|
if (columns < 1)
|
||||||
|
return NULL;
|
||||||
|
|
||||||
|
clist = gtk_type_new (gtk_clist_get_type ());
|
||||||
|
gtk_clist_construct (clist, columns, NULL);
|
||||||
return GTK_WIDGET (clist);
|
return GTK_WIDGET (clist);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -268,9 +268,14 @@ struct _GtkCell
|
|||||||
|
|
||||||
guint gtk_clist_get_type (void);
|
guint gtk_clist_get_type (void);
|
||||||
|
|
||||||
|
/* constructers useful for gtk-- wrappers */
|
||||||
|
void gtk_clist_construct (GtkCList * clist,
|
||||||
|
gint columns,
|
||||||
|
gchar * titles[]);
|
||||||
|
|
||||||
/* create a new GtkCList */
|
/* create a new GtkCList */
|
||||||
GtkWidget *gtk_clist_new (int columns);
|
GtkWidget *gtk_clist_new (gint columns);
|
||||||
GtkWidget *gtk_clist_new_with_titles (int columns,
|
GtkWidget *gtk_clist_new_with_titles (gint columns,
|
||||||
gchar * titles[]);
|
gchar * titles[]);
|
||||||
|
|
||||||
/* set the border style of the clist */
|
/* set the border style of the clist */
|
||||||
|
Loading…
Reference in New Issue
Block a user