+1998-10-01 Martin Baulig <martin@home-of-linux.org>
+
+ * gtk/gtkclist.h (GtkCListColumn): Added `visible'.
+
+ * gtk/gtkclist.c (gtk_clist_set_column_visibility): New function.
+ Makes it possible to individually show and hide columns.
+ (size_allocate_columns): Adapted to keep track of hidden columns.
+ (size_allocate_title_buttons): Likewise.
+
Sat Oct 3 17:54:48 1998 Tim Janik <timj@gtk.org>
* gtk/gtkargcollector.c (GTK_ARG_COLLECT_VALUE): for unknown foreign
+1998-10-01 Martin Baulig <martin@home-of-linux.org>
+
+ * gtk/gtkclist.h (GtkCListColumn): Added `visible'.
+
+ * gtk/gtkclist.c (gtk_clist_set_column_visibility): New function.
+ Makes it possible to individually show and hide columns.
+ (size_allocate_columns): Adapted to keep track of hidden columns.
+ (size_allocate_title_buttons): Likewise.
+
Sat Oct 3 17:54:48 1998 Tim Janik <timj@gtk.org>
* gtk/gtkargcollector.c (GTK_ARG_COLLECT_VALUE): for unknown foreign
+1998-10-01 Martin Baulig <martin@home-of-linux.org>
+
+ * gtk/gtkclist.h (GtkCListColumn): Added `visible'.
+
+ * gtk/gtkclist.c (gtk_clist_set_column_visibility): New function.
+ Makes it possible to individually show and hide columns.
+ (size_allocate_columns): Adapted to keep track of hidden columns.
+ (size_allocate_title_buttons): Likewise.
+
Sat Oct 3 17:54:48 1998 Tim Janik <timj@gtk.org>
* gtk/gtkargcollector.c (GTK_ARG_COLLECT_VALUE): for unknown foreign
+1998-10-01 Martin Baulig <martin@home-of-linux.org>
+
+ * gtk/gtkclist.h (GtkCListColumn): Added `visible'.
+
+ * gtk/gtkclist.c (gtk_clist_set_column_visibility): New function.
+ Makes it possible to individually show and hide columns.
+ (size_allocate_columns): Adapted to keep track of hidden columns.
+ (size_allocate_title_buttons): Likewise.
+
Sat Oct 3 17:54:48 1998 Tim Janik <timj@gtk.org>
* gtk/gtkargcollector.c (GTK_ARG_COLLECT_VALUE): for unknown foreign
+1998-10-01 Martin Baulig <martin@home-of-linux.org>
+
+ * gtk/gtkclist.h (GtkCListColumn): Added `visible'.
+
+ * gtk/gtkclist.c (gtk_clist_set_column_visibility): New function.
+ Makes it possible to individually show and hide columns.
+ (size_allocate_columns): Adapted to keep track of hidden columns.
+ (size_allocate_title_buttons): Likewise.
+
Sat Oct 3 17:54:48 1998 Tim Janik <timj@gtk.org>
* gtk/gtkargcollector.c (GTK_ARG_COLLECT_VALUE): for unknown foreign
+1998-10-01 Martin Baulig <martin@home-of-linux.org>
+
+ * gtk/gtkclist.h (GtkCListColumn): Added `visible'.
+
+ * gtk/gtkclist.c (gtk_clist_set_column_visibility): New function.
+ Makes it possible to individually show and hide columns.
+ (size_allocate_columns): Adapted to keep track of hidden columns.
+ (size_allocate_title_buttons): Likewise.
+
Sat Oct 3 17:54:48 1998 Tim Janik <timj@gtk.org>
* gtk/gtkargcollector.c (GTK_ARG_COLLECT_VALUE): for unknown foreign
+1998-10-01 Martin Baulig <martin@home-of-linux.org>
+
+ * gtk/gtkclist.h (GtkCListColumn): Added `visible'.
+
+ * gtk/gtkclist.c (gtk_clist_set_column_visibility): New function.
+ Makes it possible to individually show and hide columns.
+ (size_allocate_columns): Adapted to keep track of hidden columns.
+ (size_allocate_title_buttons): Likewise.
+
Sat Oct 3 17:54:48 1998 Tim Janik <timj@gtk.org>
* gtk/gtkargcollector.c (GTK_ARG_COLLECT_VALUE): for unknown foreign
}
}
+void
+gtk_clist_set_column_visibility (GtkCList * clist, gint column, gint visible)
+{
+ g_return_if_fail (clist != NULL);
+ g_return_if_fail (GTK_IS_CLIST (clist));
+
+ if (column < 0 || column >= clist->columns)
+ return;
+
+ if (clist->column[column].visible && !visible)
+ gtk_widget_hide (clist->column[column].button);
+ else if (!clist->column[column].visible && visible)
+ gtk_widget_show (clist->column[column].button);
+
+ clist->column[column].visible = visible ? TRUE : FALSE;
+}
+
void
gtk_clist_column_title_active (GtkCList * clist,
gint column)
for (i = 0; i < clist->columns; i++)
{
+ if (!clist->column[i].visible)
+ continue;
if (gtk_widget_intersect (clist->column[i].button, area, &child_area))
gtk_widget_draw (clist->column[i].button, &child_area);
}
{
gint i, last_button = 0;
GtkAllocation button_allocation;
+ gint visible_columns = clist->columns;
if (!GTK_WIDGET_REALIZED (clist))
return;
button_allocation.width = 0;
button_allocation.height = clist->column_title_area.height;
- for (i = 0; i < clist->columns; i++)
+ for (i = clist->columns-1; i > 0; i--)
+ if (!clist->column[i].visible)
+ visible_columns = i;
+ else
+ break;
+
+ for (i = 0; i < visible_columns; i++)
{
button_allocation.width += clist->column[i].area.width;
- if (i == clist->columns - 1)
+ if (i == visible_columns - 1)
button_allocation.width += 2 * (CELL_SPACING + COLUMN_INSET);
- else
+ else if (clist->column[i].visible)
button_allocation.width += CELL_SPACING + (2 * COLUMN_INSET);
- if (i == (clist->columns - 1) || clist->column[i + 1].button)
+ if (i == (visible_columns - 1) || clist->column[i + 1].button)
{
gtk_widget_size_allocate (clist->column[last_button].button, &button_allocation);
button_allocation.x += button_allocation.width;
size_allocate_columns (GtkCList * clist)
{
gint i, xoffset = 0;
+ gint visible_columns = clist->columns;
- for (i = 0; i < clist->columns; i++)
+ for (i = visible_columns-1; i > 0; i--)
+ if (!clist->column[i].visible)
+ visible_columns = i;
+ else
+ break;
+
+ for (i = 0; i < visible_columns; i++)
{
clist->column[i].area.x = xoffset + CELL_SPACING + COLUMN_INSET;
- if (i == clist->columns - 1)
+ if (i == visible_columns - 1)
{
gint width;
clist->column[i].area.width = clist->column[i].width;
}
- xoffset += clist->column[i].area.width + CELL_SPACING + (2 * COLUMN_INSET);
+ if (clist->column[i].visible)
+ xoffset += clist->column[i].area.width +
+ CELL_SPACING + (2 * COLUMN_INSET);
}
+
+ for (i = visible_columns; i < clist->columns; i++)
+ clist->column[i].area.width = 0;
}
/*
column[i].button = NULL;
column[i].window = NULL;
column[i].width = 0;
+ column[i].visible = 1;
column[i].width_set = FALSE;
column[i].justification = GTK_JUSTIFY_LEFT;
}
gint width;
GtkJustification justification;
+ gint visible : 1;
gint width_set : 1;
};
void gtk_clist_column_titles_active (GtkCList *clist);
void gtk_clist_column_titles_passive (GtkCList *clist);
+/* set visibility of a column */
+void gtk_clist_set_column_visibility (GtkCList *clist,
+ gint column,
+ gint visible);
+
/* set the title in the column title button */
void gtk_clist_set_column_title (GtkCList *clist,
gint column,