change a few cell styles of inserted row (change_style): change style of
Fri Oct 16 15:59:02 1998 Lars Hamann <lars@gtk.org> * gtk/testgtk.c (insert_row_clist) (create_clist): change a few cell styles of inserted row (change_style): change style of focus_row * gtk/gtkclist.c (gtk_clist_get_row_style) (gtk_clist_set_row_style) (gtk_clist_get_cell_style) (gtk_clist_set_cell_style): new functions to set/get row/cell styles. (gtk_clist_realize): attach row and cell style, allocate row colors. (gtk_clist_unrealize): detach row and cell styles. (get_cell_style): new function. get correct cell style. (draw_cell_pixmap): new function. (draw_row): draw cells with row or cell styles. (row_new): set cell and row styles to NULL. (row_delete): detach & unref cell and row styles. * gtk/gtkctree.c (ctree_detach_styles) (ctree_attach_styles): new functions to attach/detach styles and allocate colors. (gtk_ctree_realize) (gtk_ctree_unrealize): attach/detach cell and row styles of invisible nodes. (draw_cell_pixmap): new function. (get_cell_style): new function. get correct cell style. (gtk_ctree_draw_expander): new function. draw tree expander. (gtk_ctree_draw_lines): new function.draw tree lines. (draw_row): draw cells with row or cell styles. (row_new): set cell and row styles to NULL. (row_delete): detach & unref cell and row styles. (gtk_ctree_node_get_row_style) (gtk_ctree_node_set_row_style) (gtk_ctree_node_get_cell_style) (gtk_ctree_node_set_cell_style): Analogons of GtkCList functions (gtk_ctree_set_spacing): new function. set spacing between tree expander and cell contents (gtk_ctree_set_expander_style): new function. set expander style of ctree. (ctree_is_hot_spot): few changes due to draw_row modifications.
This commit is contained in:
39
ChangeLog
39
ChangeLog
@ -1,4 +1,41 @@
|
||||
Wed, 14 Oct 1998 10:17:13 +0200 Paolo Molaro <lupus@debian.org>
|
||||
Fri Oct 16 15:59:02 1998 Lars Hamann <lars@gtk.org>
|
||||
|
||||
* gtk/testgtk.c (insert_row_clist) (create_clist): change a few cell
|
||||
styles of inserted row
|
||||
(change_style): change style of focus_row
|
||||
|
||||
* gtk/gtkclist.c (gtk_clist_get_row_style) (gtk_clist_set_row_style)
|
||||
(gtk_clist_get_cell_style) (gtk_clist_set_cell_style): new functions
|
||||
to set/get row/cell styles.
|
||||
(gtk_clist_realize): attach row and cell style, allocate row colors.
|
||||
(gtk_clist_unrealize): detach row and cell styles.
|
||||
(get_cell_style): new function. get correct cell style.
|
||||
(draw_cell_pixmap): new function.
|
||||
(draw_row): draw cells with row or cell styles.
|
||||
(row_new): set cell and row styles to NULL.
|
||||
(row_delete): detach & unref cell and row styles.
|
||||
|
||||
* gtk/gtkctree.c (ctree_detach_styles) (ctree_attach_styles):
|
||||
new functions to attach/detach styles and allocate colors.
|
||||
(gtk_ctree_realize) (gtk_ctree_unrealize): attach/detach cell and row
|
||||
styles of invisible nodes.
|
||||
(draw_cell_pixmap): new function.
|
||||
(get_cell_style): new function. get correct cell style.
|
||||
(gtk_ctree_draw_expander): new function. draw tree expander.
|
||||
(gtk_ctree_draw_lines): new function.draw tree lines.
|
||||
(draw_row): draw cells with row or cell styles.
|
||||
(row_new): set cell and row styles to NULL.
|
||||
(row_delete): detach & unref cell and row styles.
|
||||
(gtk_ctree_node_get_row_style) (gtk_ctree_node_set_row_style)
|
||||
(gtk_ctree_node_get_cell_style) (gtk_ctree_node_set_cell_style):
|
||||
Analogons of GtkCList functions
|
||||
(gtk_ctree_set_spacing): new function. set spacing between
|
||||
tree expander and cell contents
|
||||
(gtk_ctree_set_expander_style): new function. set expander style
|
||||
of ctree.
|
||||
(ctree_is_hot_spot): few changes due to draw_row modifications.
|
||||
|
||||
Wed 14 Oct 1998 10:17:13 +0200 Paolo Molaro <lupus@debian.org>
|
||||
|
||||
* gtk/gtkcombo.c: try completion on MOD1-TAB.
|
||||
Handle case when the combo->list is empty.
|
||||
|
||||
@ -1,4 +1,41 @@
|
||||
Wed, 14 Oct 1998 10:17:13 +0200 Paolo Molaro <lupus@debian.org>
|
||||
Fri Oct 16 15:59:02 1998 Lars Hamann <lars@gtk.org>
|
||||
|
||||
* gtk/testgtk.c (insert_row_clist) (create_clist): change a few cell
|
||||
styles of inserted row
|
||||
(change_style): change style of focus_row
|
||||
|
||||
* gtk/gtkclist.c (gtk_clist_get_row_style) (gtk_clist_set_row_style)
|
||||
(gtk_clist_get_cell_style) (gtk_clist_set_cell_style): new functions
|
||||
to set/get row/cell styles.
|
||||
(gtk_clist_realize): attach row and cell style, allocate row colors.
|
||||
(gtk_clist_unrealize): detach row and cell styles.
|
||||
(get_cell_style): new function. get correct cell style.
|
||||
(draw_cell_pixmap): new function.
|
||||
(draw_row): draw cells with row or cell styles.
|
||||
(row_new): set cell and row styles to NULL.
|
||||
(row_delete): detach & unref cell and row styles.
|
||||
|
||||
* gtk/gtkctree.c (ctree_detach_styles) (ctree_attach_styles):
|
||||
new functions to attach/detach styles and allocate colors.
|
||||
(gtk_ctree_realize) (gtk_ctree_unrealize): attach/detach cell and row
|
||||
styles of invisible nodes.
|
||||
(draw_cell_pixmap): new function.
|
||||
(get_cell_style): new function. get correct cell style.
|
||||
(gtk_ctree_draw_expander): new function. draw tree expander.
|
||||
(gtk_ctree_draw_lines): new function.draw tree lines.
|
||||
(draw_row): draw cells with row or cell styles.
|
||||
(row_new): set cell and row styles to NULL.
|
||||
(row_delete): detach & unref cell and row styles.
|
||||
(gtk_ctree_node_get_row_style) (gtk_ctree_node_set_row_style)
|
||||
(gtk_ctree_node_get_cell_style) (gtk_ctree_node_set_cell_style):
|
||||
Analogons of GtkCList functions
|
||||
(gtk_ctree_set_spacing): new function. set spacing between
|
||||
tree expander and cell contents
|
||||
(gtk_ctree_set_expander_style): new function. set expander style
|
||||
of ctree.
|
||||
(ctree_is_hot_spot): few changes due to draw_row modifications.
|
||||
|
||||
Wed 14 Oct 1998 10:17:13 +0200 Paolo Molaro <lupus@debian.org>
|
||||
|
||||
* gtk/gtkcombo.c: try completion on MOD1-TAB.
|
||||
Handle case when the combo->list is empty.
|
||||
|
||||
@ -1,4 +1,41 @@
|
||||
Wed, 14 Oct 1998 10:17:13 +0200 Paolo Molaro <lupus@debian.org>
|
||||
Fri Oct 16 15:59:02 1998 Lars Hamann <lars@gtk.org>
|
||||
|
||||
* gtk/testgtk.c (insert_row_clist) (create_clist): change a few cell
|
||||
styles of inserted row
|
||||
(change_style): change style of focus_row
|
||||
|
||||
* gtk/gtkclist.c (gtk_clist_get_row_style) (gtk_clist_set_row_style)
|
||||
(gtk_clist_get_cell_style) (gtk_clist_set_cell_style): new functions
|
||||
to set/get row/cell styles.
|
||||
(gtk_clist_realize): attach row and cell style, allocate row colors.
|
||||
(gtk_clist_unrealize): detach row and cell styles.
|
||||
(get_cell_style): new function. get correct cell style.
|
||||
(draw_cell_pixmap): new function.
|
||||
(draw_row): draw cells with row or cell styles.
|
||||
(row_new): set cell and row styles to NULL.
|
||||
(row_delete): detach & unref cell and row styles.
|
||||
|
||||
* gtk/gtkctree.c (ctree_detach_styles) (ctree_attach_styles):
|
||||
new functions to attach/detach styles and allocate colors.
|
||||
(gtk_ctree_realize) (gtk_ctree_unrealize): attach/detach cell and row
|
||||
styles of invisible nodes.
|
||||
(draw_cell_pixmap): new function.
|
||||
(get_cell_style): new function. get correct cell style.
|
||||
(gtk_ctree_draw_expander): new function. draw tree expander.
|
||||
(gtk_ctree_draw_lines): new function.draw tree lines.
|
||||
(draw_row): draw cells with row or cell styles.
|
||||
(row_new): set cell and row styles to NULL.
|
||||
(row_delete): detach & unref cell and row styles.
|
||||
(gtk_ctree_node_get_row_style) (gtk_ctree_node_set_row_style)
|
||||
(gtk_ctree_node_get_cell_style) (gtk_ctree_node_set_cell_style):
|
||||
Analogons of GtkCList functions
|
||||
(gtk_ctree_set_spacing): new function. set spacing between
|
||||
tree expander and cell contents
|
||||
(gtk_ctree_set_expander_style): new function. set expander style
|
||||
of ctree.
|
||||
(ctree_is_hot_spot): few changes due to draw_row modifications.
|
||||
|
||||
Wed 14 Oct 1998 10:17:13 +0200 Paolo Molaro <lupus@debian.org>
|
||||
|
||||
* gtk/gtkcombo.c: try completion on MOD1-TAB.
|
||||
Handle case when the combo->list is empty.
|
||||
|
||||
@ -1,4 +1,41 @@
|
||||
Wed, 14 Oct 1998 10:17:13 +0200 Paolo Molaro <lupus@debian.org>
|
||||
Fri Oct 16 15:59:02 1998 Lars Hamann <lars@gtk.org>
|
||||
|
||||
* gtk/testgtk.c (insert_row_clist) (create_clist): change a few cell
|
||||
styles of inserted row
|
||||
(change_style): change style of focus_row
|
||||
|
||||
* gtk/gtkclist.c (gtk_clist_get_row_style) (gtk_clist_set_row_style)
|
||||
(gtk_clist_get_cell_style) (gtk_clist_set_cell_style): new functions
|
||||
to set/get row/cell styles.
|
||||
(gtk_clist_realize): attach row and cell style, allocate row colors.
|
||||
(gtk_clist_unrealize): detach row and cell styles.
|
||||
(get_cell_style): new function. get correct cell style.
|
||||
(draw_cell_pixmap): new function.
|
||||
(draw_row): draw cells with row or cell styles.
|
||||
(row_new): set cell and row styles to NULL.
|
||||
(row_delete): detach & unref cell and row styles.
|
||||
|
||||
* gtk/gtkctree.c (ctree_detach_styles) (ctree_attach_styles):
|
||||
new functions to attach/detach styles and allocate colors.
|
||||
(gtk_ctree_realize) (gtk_ctree_unrealize): attach/detach cell and row
|
||||
styles of invisible nodes.
|
||||
(draw_cell_pixmap): new function.
|
||||
(get_cell_style): new function. get correct cell style.
|
||||
(gtk_ctree_draw_expander): new function. draw tree expander.
|
||||
(gtk_ctree_draw_lines): new function.draw tree lines.
|
||||
(draw_row): draw cells with row or cell styles.
|
||||
(row_new): set cell and row styles to NULL.
|
||||
(row_delete): detach & unref cell and row styles.
|
||||
(gtk_ctree_node_get_row_style) (gtk_ctree_node_set_row_style)
|
||||
(gtk_ctree_node_get_cell_style) (gtk_ctree_node_set_cell_style):
|
||||
Analogons of GtkCList functions
|
||||
(gtk_ctree_set_spacing): new function. set spacing between
|
||||
tree expander and cell contents
|
||||
(gtk_ctree_set_expander_style): new function. set expander style
|
||||
of ctree.
|
||||
(ctree_is_hot_spot): few changes due to draw_row modifications.
|
||||
|
||||
Wed 14 Oct 1998 10:17:13 +0200 Paolo Molaro <lupus@debian.org>
|
||||
|
||||
* gtk/gtkcombo.c: try completion on MOD1-TAB.
|
||||
Handle case when the combo->list is empty.
|
||||
|
||||
@ -1,4 +1,41 @@
|
||||
Wed, 14 Oct 1998 10:17:13 +0200 Paolo Molaro <lupus@debian.org>
|
||||
Fri Oct 16 15:59:02 1998 Lars Hamann <lars@gtk.org>
|
||||
|
||||
* gtk/testgtk.c (insert_row_clist) (create_clist): change a few cell
|
||||
styles of inserted row
|
||||
(change_style): change style of focus_row
|
||||
|
||||
* gtk/gtkclist.c (gtk_clist_get_row_style) (gtk_clist_set_row_style)
|
||||
(gtk_clist_get_cell_style) (gtk_clist_set_cell_style): new functions
|
||||
to set/get row/cell styles.
|
||||
(gtk_clist_realize): attach row and cell style, allocate row colors.
|
||||
(gtk_clist_unrealize): detach row and cell styles.
|
||||
(get_cell_style): new function. get correct cell style.
|
||||
(draw_cell_pixmap): new function.
|
||||
(draw_row): draw cells with row or cell styles.
|
||||
(row_new): set cell and row styles to NULL.
|
||||
(row_delete): detach & unref cell and row styles.
|
||||
|
||||
* gtk/gtkctree.c (ctree_detach_styles) (ctree_attach_styles):
|
||||
new functions to attach/detach styles and allocate colors.
|
||||
(gtk_ctree_realize) (gtk_ctree_unrealize): attach/detach cell and row
|
||||
styles of invisible nodes.
|
||||
(draw_cell_pixmap): new function.
|
||||
(get_cell_style): new function. get correct cell style.
|
||||
(gtk_ctree_draw_expander): new function. draw tree expander.
|
||||
(gtk_ctree_draw_lines): new function.draw tree lines.
|
||||
(draw_row): draw cells with row or cell styles.
|
||||
(row_new): set cell and row styles to NULL.
|
||||
(row_delete): detach & unref cell and row styles.
|
||||
(gtk_ctree_node_get_row_style) (gtk_ctree_node_set_row_style)
|
||||
(gtk_ctree_node_get_cell_style) (gtk_ctree_node_set_cell_style):
|
||||
Analogons of GtkCList functions
|
||||
(gtk_ctree_set_spacing): new function. set spacing between
|
||||
tree expander and cell contents
|
||||
(gtk_ctree_set_expander_style): new function. set expander style
|
||||
of ctree.
|
||||
(ctree_is_hot_spot): few changes due to draw_row modifications.
|
||||
|
||||
Wed 14 Oct 1998 10:17:13 +0200 Paolo Molaro <lupus@debian.org>
|
||||
|
||||
* gtk/gtkcombo.c: try completion on MOD1-TAB.
|
||||
Handle case when the combo->list is empty.
|
||||
|
||||
@ -1,4 +1,41 @@
|
||||
Wed, 14 Oct 1998 10:17:13 +0200 Paolo Molaro <lupus@debian.org>
|
||||
Fri Oct 16 15:59:02 1998 Lars Hamann <lars@gtk.org>
|
||||
|
||||
* gtk/testgtk.c (insert_row_clist) (create_clist): change a few cell
|
||||
styles of inserted row
|
||||
(change_style): change style of focus_row
|
||||
|
||||
* gtk/gtkclist.c (gtk_clist_get_row_style) (gtk_clist_set_row_style)
|
||||
(gtk_clist_get_cell_style) (gtk_clist_set_cell_style): new functions
|
||||
to set/get row/cell styles.
|
||||
(gtk_clist_realize): attach row and cell style, allocate row colors.
|
||||
(gtk_clist_unrealize): detach row and cell styles.
|
||||
(get_cell_style): new function. get correct cell style.
|
||||
(draw_cell_pixmap): new function.
|
||||
(draw_row): draw cells with row or cell styles.
|
||||
(row_new): set cell and row styles to NULL.
|
||||
(row_delete): detach & unref cell and row styles.
|
||||
|
||||
* gtk/gtkctree.c (ctree_detach_styles) (ctree_attach_styles):
|
||||
new functions to attach/detach styles and allocate colors.
|
||||
(gtk_ctree_realize) (gtk_ctree_unrealize): attach/detach cell and row
|
||||
styles of invisible nodes.
|
||||
(draw_cell_pixmap): new function.
|
||||
(get_cell_style): new function. get correct cell style.
|
||||
(gtk_ctree_draw_expander): new function. draw tree expander.
|
||||
(gtk_ctree_draw_lines): new function.draw tree lines.
|
||||
(draw_row): draw cells with row or cell styles.
|
||||
(row_new): set cell and row styles to NULL.
|
||||
(row_delete): detach & unref cell and row styles.
|
||||
(gtk_ctree_node_get_row_style) (gtk_ctree_node_set_row_style)
|
||||
(gtk_ctree_node_get_cell_style) (gtk_ctree_node_set_cell_style):
|
||||
Analogons of GtkCList functions
|
||||
(gtk_ctree_set_spacing): new function. set spacing between
|
||||
tree expander and cell contents
|
||||
(gtk_ctree_set_expander_style): new function. set expander style
|
||||
of ctree.
|
||||
(ctree_is_hot_spot): few changes due to draw_row modifications.
|
||||
|
||||
Wed 14 Oct 1998 10:17:13 +0200 Paolo Molaro <lupus@debian.org>
|
||||
|
||||
* gtk/gtkcombo.c: try completion on MOD1-TAB.
|
||||
Handle case when the combo->list is empty.
|
||||
|
||||
@ -1,4 +1,41 @@
|
||||
Wed, 14 Oct 1998 10:17:13 +0200 Paolo Molaro <lupus@debian.org>
|
||||
Fri Oct 16 15:59:02 1998 Lars Hamann <lars@gtk.org>
|
||||
|
||||
* gtk/testgtk.c (insert_row_clist) (create_clist): change a few cell
|
||||
styles of inserted row
|
||||
(change_style): change style of focus_row
|
||||
|
||||
* gtk/gtkclist.c (gtk_clist_get_row_style) (gtk_clist_set_row_style)
|
||||
(gtk_clist_get_cell_style) (gtk_clist_set_cell_style): new functions
|
||||
to set/get row/cell styles.
|
||||
(gtk_clist_realize): attach row and cell style, allocate row colors.
|
||||
(gtk_clist_unrealize): detach row and cell styles.
|
||||
(get_cell_style): new function. get correct cell style.
|
||||
(draw_cell_pixmap): new function.
|
||||
(draw_row): draw cells with row or cell styles.
|
||||
(row_new): set cell and row styles to NULL.
|
||||
(row_delete): detach & unref cell and row styles.
|
||||
|
||||
* gtk/gtkctree.c (ctree_detach_styles) (ctree_attach_styles):
|
||||
new functions to attach/detach styles and allocate colors.
|
||||
(gtk_ctree_realize) (gtk_ctree_unrealize): attach/detach cell and row
|
||||
styles of invisible nodes.
|
||||
(draw_cell_pixmap): new function.
|
||||
(get_cell_style): new function. get correct cell style.
|
||||
(gtk_ctree_draw_expander): new function. draw tree expander.
|
||||
(gtk_ctree_draw_lines): new function.draw tree lines.
|
||||
(draw_row): draw cells with row or cell styles.
|
||||
(row_new): set cell and row styles to NULL.
|
||||
(row_delete): detach & unref cell and row styles.
|
||||
(gtk_ctree_node_get_row_style) (gtk_ctree_node_set_row_style)
|
||||
(gtk_ctree_node_get_cell_style) (gtk_ctree_node_set_cell_style):
|
||||
Analogons of GtkCList functions
|
||||
(gtk_ctree_set_spacing): new function. set spacing between
|
||||
tree expander and cell contents
|
||||
(gtk_ctree_set_expander_style): new function. set expander style
|
||||
of ctree.
|
||||
(ctree_is_hot_spot): few changes due to draw_row modifications.
|
||||
|
||||
Wed 14 Oct 1998 10:17:13 +0200 Paolo Molaro <lupus@debian.org>
|
||||
|
||||
* gtk/gtkcombo.c: try completion on MOD1-TAB.
|
||||
Handle case when the combo->list is empty.
|
||||
|
||||
692
gtk/gtkclist.c
692
gtk/gtkclist.c
@ -213,6 +213,22 @@ static void gtk_clist_forall (GtkContainer *container,
|
||||
gpointer callback_data);
|
||||
|
||||
/* Drawing */
|
||||
static void get_cell_style (GtkCList *clist,
|
||||
GtkCListRow *clist_row,
|
||||
gint state,
|
||||
gint column,
|
||||
GtkStyle **style,
|
||||
GdkGC **fg_gc,
|
||||
GdkGC **bg_gc);
|
||||
static gint draw_cell_pixmap (GdkWindow *window,
|
||||
GdkRectangle *clip_rectangle,
|
||||
GdkGC *fg_gc,
|
||||
GdkPixmap *pixmap,
|
||||
GdkBitmap *mask,
|
||||
gint x,
|
||||
gint y,
|
||||
gint width,
|
||||
gint height);
|
||||
static void draw_row (GtkCList * clist,
|
||||
GdkRectangle * area,
|
||||
gint row,
|
||||
@ -1418,7 +1434,8 @@ gtk_clist_set_row_height (GtkCList * clist,
|
||||
{
|
||||
text_height = height - (GTK_WIDGET (clist)->style->font->ascent +
|
||||
GTK_WIDGET (clist) ->style->font->descent + 1);
|
||||
clist->row_center_offset = (text_height / 2) + GTK_WIDGET (clist)->style->font->ascent + 1.5;
|
||||
clist->row_center_offset = ((text_height / 2) + 1.5 +
|
||||
GTK_WIDGET (clist)->style->font->ascent);
|
||||
}
|
||||
|
||||
if (!GTK_CLIST_FROZEN (clist))
|
||||
@ -1704,6 +1721,9 @@ gtk_clist_set_foreground (GtkCList * clist,
|
||||
{
|
||||
clist_row->foreground = *color;
|
||||
clist_row->fg_set = TRUE;
|
||||
if (GTK_WIDGET_REALIZED (clist))
|
||||
gdk_color_alloc (gtk_widget_get_colormap (GTK_WIDGET (clist)),
|
||||
&clist_row->foreground);
|
||||
}
|
||||
else
|
||||
clist_row->fg_set = FALSE;
|
||||
@ -1732,6 +1752,9 @@ gtk_clist_set_background (GtkCList * clist,
|
||||
{
|
||||
clist_row->background = *color;
|
||||
clist_row->bg_set = TRUE;
|
||||
if (GTK_WIDGET_REALIZED (clist))
|
||||
gdk_color_alloc (gtk_widget_get_colormap (GTK_WIDGET (clist)),
|
||||
&clist_row->background);
|
||||
}
|
||||
else
|
||||
clist_row->bg_set = FALSE;
|
||||
@ -2517,12 +2540,15 @@ gtk_clist_finalize (GtkObject * object)
|
||||
static void
|
||||
gtk_clist_realize (GtkWidget * widget)
|
||||
{
|
||||
gint i;
|
||||
GtkCList *clist;
|
||||
GdkWindowAttr attributes;
|
||||
gint attributes_mask;
|
||||
GdkGCValues values;
|
||||
GtkCListRow *clist_row;
|
||||
GList *list;
|
||||
gint attributes_mask;
|
||||
gint border_width;
|
||||
gint i;
|
||||
gint j;
|
||||
|
||||
g_return_if_fail (widget != NULL);
|
||||
g_return_if_fail (GTK_IS_CLIST (widget));
|
||||
@ -2552,7 +2578,8 @@ gtk_clist_realize (GtkWidget * widget)
|
||||
attributes_mask = GDK_WA_X | GDK_WA_Y | GDK_WA_VISUAL | GDK_WA_COLORMAP;
|
||||
|
||||
/* main window */
|
||||
widget->window = gdk_window_new (gtk_widget_get_parent_window (widget), &attributes, attributes_mask);
|
||||
widget->window = gdk_window_new (gtk_widget_get_parent_window (widget),
|
||||
&attributes, attributes_mask);
|
||||
gdk_window_set_user_data (widget->window, clist);
|
||||
|
||||
widget->style = gtk_style_attach (widget->style, widget->window);
|
||||
@ -2566,28 +2593,35 @@ gtk_clist_realize (GtkWidget * widget)
|
||||
attributes.width = clist->column_title_area.width;
|
||||
attributes.height = clist->column_title_area.height;
|
||||
|
||||
clist->title_window = gdk_window_new (widget->window, &attributes, attributes_mask);
|
||||
clist->title_window = gdk_window_new (widget->window, &attributes,
|
||||
attributes_mask);
|
||||
gdk_window_set_user_data (clist->title_window, clist);
|
||||
|
||||
gtk_style_set_background (widget->style, clist->title_window, GTK_STATE_SELECTED);
|
||||
gtk_style_set_background (widget->style, clist->title_window,
|
||||
GTK_STATE_SELECTED);
|
||||
gdk_window_show (clist->title_window);
|
||||
|
||||
/* set things up so column buttons are drawn in title window */
|
||||
for (i = 0; i < clist->columns; i++)
|
||||
if (clist->column[i].button)
|
||||
gtk_widget_set_parent_window (clist->column[i].button, clist->title_window);
|
||||
gtk_widget_set_parent_window (clist->column[i].button,
|
||||
clist->title_window);
|
||||
|
||||
/* clist-window */
|
||||
attributes.x = clist->internal_allocation.x + widget->style->klass->xthickness;
|
||||
attributes.y = clist->internal_allocation.y + widget->style->klass->ythickness +
|
||||
clist->column_title_area.height;
|
||||
attributes.x = (clist->internal_allocation.x +
|
||||
widget->style->klass->xthickness);
|
||||
attributes.y = (clist->internal_allocation.y +
|
||||
widget->style->klass->ythickness +
|
||||
clist->column_title_area.height);
|
||||
attributes.width = clist->clist_window_width;
|
||||
attributes.height = clist->clist_window_height;
|
||||
|
||||
clist->clist_window = gdk_window_new (widget->window, &attributes, attributes_mask);
|
||||
clist->clist_window = gdk_window_new (widget->window, &attributes,
|
||||
attributes_mask);
|
||||
gdk_window_set_user_data (clist->clist_window, clist);
|
||||
|
||||
gdk_window_set_background (clist->clist_window, &widget->style->bg[GTK_STATE_PRELIGHT]);
|
||||
gdk_window_set_background (clist->clist_window,
|
||||
&widget->style->bg[GTK_STATE_PRELIGHT]);
|
||||
gdk_window_show (clist->clist_window);
|
||||
gdk_window_get_size (clist->clist_window, &clist->clist_window_width,
|
||||
&clist->clist_window_height);
|
||||
@ -2599,8 +2633,9 @@ gtk_clist_realize (GtkWidget * widget)
|
||||
GDK_POINTER_MOTION_MASK |
|
||||
GDK_POINTER_MOTION_HINT_MASK |
|
||||
GDK_KEY_PRESS_MASK);
|
||||
attributes.cursor = clist->cursor_drag = gdk_cursor_new (GDK_SB_H_DOUBLE_ARROW);
|
||||
attributes_mask = GDK_WA_CURSOR;
|
||||
attributes.cursor = gdk_cursor_new (GDK_SB_H_DOUBLE_ARROW);
|
||||
clist->cursor_drag = attributes.cursor;
|
||||
|
||||
attributes.x = LIST_WIDTH (clist) + 1;
|
||||
attributes.y = 0;
|
||||
@ -2609,7 +2644,8 @@ gtk_clist_realize (GtkWidget * widget)
|
||||
|
||||
for (i = 0; i < clist->columns; i++)
|
||||
{
|
||||
clist->column[i].window = gdk_window_new (clist->title_window, &attributes, attributes_mask);
|
||||
clist->column[i].window = gdk_window_new (clist->title_window,
|
||||
&attributes, attributes_mask);
|
||||
gdk_window_set_user_data (clist->column[i].window, clist);
|
||||
}
|
||||
|
||||
@ -2633,6 +2669,34 @@ gtk_clist_realize (GtkWidget * widget)
|
||||
GDK_GC_FOREGROUND |
|
||||
GDK_GC_FUNCTION |
|
||||
GDK_GC_SUBWINDOW);
|
||||
|
||||
/* attach optional row/cell styles, allocate foreground/background colors */
|
||||
list = clist->row_list;
|
||||
for (i = 0; i < clist->rows; i++)
|
||||
{
|
||||
clist_row = list->data;
|
||||
list = list->next;
|
||||
|
||||
if (clist_row->style)
|
||||
clist_row->style = gtk_style_attach (clist_row->style,
|
||||
clist->clist_window);
|
||||
|
||||
if (clist_row->fg_set || clist_row->bg_set)
|
||||
{
|
||||
GdkColormap *colormap;
|
||||
|
||||
colormap = gtk_widget_get_colormap (widget);
|
||||
if (clist_row->fg_set)
|
||||
gdk_color_alloc (colormap, &clist_row->foreground);
|
||||
if (clist_row->bg_set)
|
||||
gdk_color_alloc (colormap, &clist_row->background);
|
||||
}
|
||||
|
||||
for (j = 0; j < clist->columns; j++)
|
||||
if (clist_row->cell[j].style)
|
||||
clist_row->cell[j].style =
|
||||
gtk_style_attach (clist_row->cell[j].style, clist->clist_window);
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
@ -2648,6 +2712,28 @@ gtk_clist_unrealize (GtkWidget * widget)
|
||||
|
||||
GTK_CLIST_SET_FLAG (clist, CLIST_FROZEN);
|
||||
|
||||
/* detach optional row/cell styles */
|
||||
|
||||
if (GTK_WIDGET_REALIZED (widget))
|
||||
{
|
||||
GtkCListRow *clist_row;
|
||||
GList *list;
|
||||
gint j;
|
||||
|
||||
list = clist->row_list;
|
||||
for (i = 0; i < clist->rows; i++)
|
||||
{
|
||||
clist_row = list->data;
|
||||
list = list->next;
|
||||
|
||||
if (clist_row->style)
|
||||
gtk_style_detach (clist_row->style);
|
||||
for (j = 0; j < clist->columns; j++)
|
||||
if (clist_row->cell[j].style)
|
||||
gtk_style_detach (clist_row->cell[j].style);
|
||||
}
|
||||
}
|
||||
|
||||
gdk_cursor_destroy (clist->cursor_drag);
|
||||
gdk_gc_destroy (clist->xor_gc);
|
||||
gdk_gc_destroy (clist->fg_gc);
|
||||
@ -3620,9 +3706,102 @@ gtk_clist_forall (GtkContainer *container,
|
||||
|
||||
/*
|
||||
* DRAWING
|
||||
* get_cell_style
|
||||
* draw_cell_pixmap
|
||||
* draw_row
|
||||
* draw_rows
|
||||
*/
|
||||
|
||||
static void
|
||||
get_cell_style (GtkCList *clist,
|
||||
GtkCListRow *clist_row,
|
||||
gint state,
|
||||
gint column,
|
||||
GtkStyle **style,
|
||||
GdkGC **fg_gc,
|
||||
GdkGC **bg_gc)
|
||||
{
|
||||
if (clist_row->cell[column].style)
|
||||
{
|
||||
if (style)
|
||||
*style = clist_row->cell[column].style;
|
||||
if (fg_gc)
|
||||
*fg_gc = clist_row->cell[column].style->fg_gc[state];
|
||||
if (bg_gc)
|
||||
*bg_gc = clist_row->cell[column].style->bg_gc[state];
|
||||
}
|
||||
else if (clist_row->style)
|
||||
{
|
||||
if (style)
|
||||
*style = clist_row->style;
|
||||
if (fg_gc)
|
||||
*fg_gc = clist_row->style->fg_gc[state];
|
||||
if (bg_gc)
|
||||
*bg_gc = clist_row->style->bg_gc[state];
|
||||
}
|
||||
else
|
||||
{
|
||||
if (style)
|
||||
*style = GTK_WIDGET (clist)->style;
|
||||
if (fg_gc)
|
||||
*fg_gc = GTK_WIDGET (clist)->style->fg_gc[state];
|
||||
if (bg_gc)
|
||||
*bg_gc = GTK_WIDGET (clist)->style->bg_gc[state];
|
||||
|
||||
if (state != GTK_STATE_SELECTED)
|
||||
{
|
||||
if (fg_gc && clist_row->fg_set)
|
||||
*fg_gc = clist->fg_gc;
|
||||
if (bg_gc && clist_row->bg_set)
|
||||
*bg_gc = clist->bg_gc;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static gint
|
||||
draw_cell_pixmap (GdkWindow *window,
|
||||
GdkRectangle *clip_rectangle,
|
||||
GdkGC *fg_gc,
|
||||
GdkPixmap *pixmap,
|
||||
GdkBitmap *mask,
|
||||
gint x,
|
||||
gint y,
|
||||
gint width,
|
||||
gint height)
|
||||
{
|
||||
gint xsrc = 0;
|
||||
gint ysrc = 0;
|
||||
|
||||
if (mask)
|
||||
{
|
||||
gdk_gc_set_clip_mask (fg_gc, mask);
|
||||
gdk_gc_set_clip_origin (fg_gc, x, y);
|
||||
}
|
||||
|
||||
if (x < clip_rectangle->x)
|
||||
{
|
||||
xsrc = clip_rectangle->x - x;
|
||||
width -= xsrc;
|
||||
x = clip_rectangle->x;
|
||||
}
|
||||
if (x + width > clip_rectangle->x + clip_rectangle->width)
|
||||
width = clip_rectangle->x + clip_rectangle->width - x;
|
||||
|
||||
if (y < clip_rectangle->y)
|
||||
{
|
||||
ysrc = clip_rectangle->y - y;
|
||||
height -= ysrc;
|
||||
y = clip_rectangle->y;
|
||||
}
|
||||
if (y + height > clip_rectangle->y + clip_rectangle->height)
|
||||
height = clip_rectangle->y + clip_rectangle->height - y;
|
||||
|
||||
gdk_draw_pixmap (window, fg_gc, pixmap, xsrc, ysrc, x, y, width, height);
|
||||
gdk_gc_set_clip_origin (fg_gc, 0, 0);
|
||||
|
||||
return x + MAX (width, 0);
|
||||
}
|
||||
|
||||
static void
|
||||
draw_row (GtkCList * clist,
|
||||
GdkRectangle * area,
|
||||
@ -3630,19 +3809,18 @@ draw_row (GtkCList * clist,
|
||||
GtkCListRow * clist_row)
|
||||
{
|
||||
GtkWidget *widget;
|
||||
GdkGC *fg_gc, *bg_gc;
|
||||
GdkRectangle row_rectangle, cell_rectangle, clip_rectangle, intersect_rectangle,
|
||||
*rect;
|
||||
gint i, offset = 0, width, height, pixmap_width = 0;
|
||||
gint xsrc, ysrc, xdest, ydest;
|
||||
GdkRectangle *rect;
|
||||
GdkRectangle row_rectangle;
|
||||
GdkRectangle cell_rectangle;
|
||||
GdkRectangle clip_rectangle;
|
||||
GdkRectangle intersect_rectangle;
|
||||
gint state;
|
||||
gint i;
|
||||
|
||||
g_return_if_fail (clist != NULL);
|
||||
|
||||
/* bail now if we arn't drawable yet */
|
||||
if (!GTK_WIDGET_DRAWABLE (clist))
|
||||
return;
|
||||
|
||||
if (row < 0 || row >= clist->rows)
|
||||
if (!GTK_WIDGET_DRAWABLE (clist) || row < 0 || row >= clist->rows)
|
||||
return;
|
||||
|
||||
widget = GTK_WIDGET (clist);
|
||||
@ -3671,35 +3849,23 @@ draw_row (GtkCList * clist,
|
||||
clip_rectangle.y = row_rectangle.y;
|
||||
clip_rectangle.height = row_rectangle.height;
|
||||
|
||||
/* select GC for background rectangle */
|
||||
if (clist_row->state == GTK_STATE_SELECTED)
|
||||
{
|
||||
fg_gc = widget->style->fg_gc[GTK_STATE_SELECTED];
|
||||
bg_gc = widget->style->bg_gc[GTK_STATE_SELECTED];
|
||||
}
|
||||
else
|
||||
if (clist_row->state == GTK_STATE_NORMAL)
|
||||
{
|
||||
state = GTK_STATE_PRELIGHT;
|
||||
if (clist_row->fg_set)
|
||||
{
|
||||
gdk_gc_set_foreground (clist->fg_gc, &clist_row->foreground);
|
||||
fg_gc = clist->fg_gc;
|
||||
}
|
||||
else
|
||||
fg_gc = widget->style->fg_gc[GTK_STATE_NORMAL];
|
||||
|
||||
if (clist_row->bg_set)
|
||||
{
|
||||
gdk_gc_set_foreground (clist->bg_gc, &clist_row->background);
|
||||
bg_gc = clist->bg_gc;
|
||||
}
|
||||
else
|
||||
bg_gc = widget->style->bg_gc[GTK_STATE_PRELIGHT];
|
||||
}
|
||||
state = clist_row->state;
|
||||
|
||||
/* draw the cell borders and background */
|
||||
if (area)
|
||||
{
|
||||
if (gdk_rectangle_intersect (area, &cell_rectangle, &intersect_rectangle))
|
||||
rect = &intersect_rectangle;
|
||||
if (gdk_rectangle_intersect (area, &cell_rectangle,
|
||||
&intersect_rectangle))
|
||||
gdk_draw_rectangle (clist->clist_window,
|
||||
widget->style->base_gc[GTK_STATE_NORMAL],
|
||||
TRUE,
|
||||
@ -3713,7 +3879,8 @@ draw_row (GtkCList * clist,
|
||||
{
|
||||
cell_rectangle.y += clist->row_height + CELL_SPACING;
|
||||
|
||||
if (gdk_rectangle_intersect (area, &cell_rectangle, &intersect_rectangle))
|
||||
if (gdk_rectangle_intersect (area, &cell_rectangle,
|
||||
&intersect_rectangle))
|
||||
gdk_draw_rectangle (clist->clist_window,
|
||||
widget->style->base_gc[GTK_STATE_NORMAL],
|
||||
TRUE,
|
||||
@ -3723,26 +3890,13 @@ draw_row (GtkCList * clist,
|
||||
intersect_rectangle.height);
|
||||
}
|
||||
|
||||
if (!gdk_rectangle_intersect (area, &row_rectangle, &intersect_rectangle))
|
||||
if (!gdk_rectangle_intersect (area, &row_rectangle,&intersect_rectangle))
|
||||
return;
|
||||
|
||||
if (clist_row->state == GTK_STATE_SELECTED || clist_row->bg_set)
|
||||
gdk_draw_rectangle (clist->clist_window,
|
||||
bg_gc,
|
||||
TRUE,
|
||||
intersect_rectangle.x,
|
||||
intersect_rectangle.y,
|
||||
intersect_rectangle.width,
|
||||
intersect_rectangle.height);
|
||||
else
|
||||
gdk_window_clear_area (clist->clist_window,
|
||||
intersect_rectangle.x,
|
||||
intersect_rectangle.y,
|
||||
intersect_rectangle.width,
|
||||
intersect_rectangle.height);
|
||||
}
|
||||
else
|
||||
{
|
||||
rect = &clip_rectangle;
|
||||
gdk_draw_rectangle (clist->clist_window,
|
||||
widget->style->base_gc[GTK_STATE_NORMAL],
|
||||
TRUE,
|
||||
@ -3764,75 +3918,68 @@ draw_row (GtkCList * clist,
|
||||
cell_rectangle.width,
|
||||
cell_rectangle.height);
|
||||
}
|
||||
|
||||
if (clist_row->state == GTK_STATE_SELECTED || clist_row->bg_set)
|
||||
gdk_draw_rectangle (clist->clist_window,
|
||||
bg_gc,
|
||||
TRUE,
|
||||
row_rectangle.x,
|
||||
row_rectangle.y,
|
||||
row_rectangle.width,
|
||||
row_rectangle.height);
|
||||
else
|
||||
gdk_window_clear_area (clist->clist_window,
|
||||
row_rectangle.x,
|
||||
row_rectangle.y,
|
||||
row_rectangle.width,
|
||||
row_rectangle.height);
|
||||
}
|
||||
|
||||
/* iterate and draw all the columns (row cells) and draw their contents */
|
||||
for (i = 0; i < clist->columns; i++)
|
||||
{
|
||||
GtkStyle *style;
|
||||
GdkGC *fg_gc;
|
||||
GdkGC *bg_gc;
|
||||
|
||||
gint width;
|
||||
gint height;
|
||||
gint pixmap_width;
|
||||
gint offset = 0;
|
||||
gint row_center_offset;
|
||||
|
||||
if (!clist->column[i].visible)
|
||||
continue;
|
||||
|
||||
get_cell_style (clist, clist_row, state, i, &style, &fg_gc, &bg_gc);
|
||||
|
||||
clip_rectangle.x = clist->column[i].area.x + clist->hoffset;
|
||||
clip_rectangle.width = clist->column[i].area.width;
|
||||
|
||||
/* calculate clipping region clipping region */
|
||||
if (!area)
|
||||
{
|
||||
rect = &clip_rectangle;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (!gdk_rectangle_intersect (area, &clip_rectangle,
|
||||
clip_rectangle.x -= COLUMN_INSET + CELL_SPACING;
|
||||
clip_rectangle.width += (2 * COLUMN_INSET + CELL_SPACING +
|
||||
(i + 1 == clist->columns) * CELL_SPACING);
|
||||
|
||||
if (area && !gdk_rectangle_intersect (area, &clip_rectangle,
|
||||
&intersect_rectangle))
|
||||
continue;
|
||||
rect = &intersect_rectangle;
|
||||
}
|
||||
|
||||
gdk_draw_rectangle (clist->clist_window, bg_gc, TRUE,
|
||||
rect->x, rect->y, rect->width, rect->height);
|
||||
|
||||
clip_rectangle.x += COLUMN_INSET + CELL_SPACING;
|
||||
clip_rectangle.width -= (2 * COLUMN_INSET + CELL_SPACING +
|
||||
(i + 1 == clist->columns) * CELL_SPACING);
|
||||
|
||||
/* calculate real width for column justification */
|
||||
pixmap_width = 0;
|
||||
offset = 0;
|
||||
switch (clist_row->cell[i].type)
|
||||
{
|
||||
case GTK_CELL_EMPTY:
|
||||
continue;
|
||||
break;
|
||||
|
||||
case GTK_CELL_TEXT:
|
||||
width = gdk_string_width (GTK_WIDGET (clist)->style->font,
|
||||
width = gdk_string_width (style->font,
|
||||
GTK_CELL_TEXT (clist_row->cell[i])->text);
|
||||
break;
|
||||
|
||||
case GTK_CELL_PIXMAP:
|
||||
gdk_window_get_size (GTK_CELL_PIXMAP (clist_row->cell[i])->pixmap, &width, &height);
|
||||
pixmap_width = width;
|
||||
gdk_window_get_size (GTK_CELL_PIXMAP (clist_row->cell[i])->pixmap,
|
||||
&pixmap_width, &height);
|
||||
width = pixmap_width;
|
||||
break;
|
||||
|
||||
case GTK_CELL_PIXTEXT:
|
||||
gdk_window_get_size (GTK_CELL_PIXTEXT (clist_row->cell[i])->pixmap, &width, &height);
|
||||
pixmap_width = width;
|
||||
width += GTK_CELL_PIXTEXT (clist_row->cell[i])->spacing;
|
||||
width += gdk_string_width (GTK_WIDGET (clist)->style->font,
|
||||
GTK_CELL_PIXTEXT (clist_row->cell[i])->text);
|
||||
gdk_window_get_size (GTK_CELL_PIXTEXT (clist_row->cell[i])->pixmap,
|
||||
&pixmap_width, &height);
|
||||
width = (pixmap_width +
|
||||
GTK_CELL_PIXTEXT (clist_row->cell[i])->spacing +
|
||||
gdk_string_width (style->font,
|
||||
GTK_CELL_PIXTEXT
|
||||
(clist_row->cell[i])->text));
|
||||
break;
|
||||
|
||||
case GTK_CELL_WIDGET:
|
||||
/* unimplimented */
|
||||
continue;
|
||||
break;
|
||||
|
||||
default:
|
||||
continue;
|
||||
break;
|
||||
@ -3841,168 +3988,72 @@ draw_row (GtkCList * clist,
|
||||
switch (clist->column[i].justification)
|
||||
{
|
||||
case GTK_JUSTIFY_LEFT:
|
||||
offset = clip_rectangle.x;
|
||||
offset = clip_rectangle.x + clist_row->cell[i].horizontal;
|
||||
break;
|
||||
|
||||
case GTK_JUSTIFY_RIGHT:
|
||||
offset = (clip_rectangle.x + clip_rectangle.width) - width;
|
||||
offset = (clip_rectangle.x + clist_row->cell[i].horizontal +
|
||||
clip_rectangle.width - width);
|
||||
break;
|
||||
|
||||
case GTK_JUSTIFY_CENTER:
|
||||
offset = (clip_rectangle.x + (clip_rectangle.width / 2)) - (width / 2);
|
||||
break;
|
||||
|
||||
case GTK_JUSTIFY_FILL:
|
||||
offset = (clip_rectangle.x + (clip_rectangle.width / 2)) - (width / 2);
|
||||
break;
|
||||
|
||||
default:
|
||||
offset = 0;
|
||||
offset = (clip_rectangle.x + clist_row->cell[i].horizontal +
|
||||
(clip_rectangle.width / 2) - (width / 2));
|
||||
break;
|
||||
};
|
||||
|
||||
/* Draw Text or Pixmap */
|
||||
/* Draw Text and/or Pixmap */
|
||||
switch (clist_row->cell[i].type)
|
||||
{
|
||||
case GTK_CELL_EMPTY:
|
||||
continue;
|
||||
break;
|
||||
|
||||
case GTK_CELL_TEXT:
|
||||
gdk_gc_set_clip_rectangle (fg_gc, rect);
|
||||
|
||||
gdk_draw_string (clist->clist_window,
|
||||
widget->style->font,
|
||||
fg_gc,
|
||||
offset + clist_row->cell[i].horizontal,
|
||||
row_rectangle.y + clist->row_center_offset +
|
||||
clist_row->cell[i].vertical,
|
||||
GTK_CELL_TEXT (clist_row->cell[i])->text);
|
||||
|
||||
gdk_gc_set_clip_rectangle (fg_gc, NULL);
|
||||
break;
|
||||
|
||||
case GTK_CELL_PIXMAP:
|
||||
xsrc = 0;
|
||||
ysrc = 0;
|
||||
xdest = offset + clist_row->cell[i].horizontal;
|
||||
ydest = (clip_rectangle.y + (clip_rectangle.height / 2)) - height / 2 +
|
||||
clist_row->cell[i].vertical;
|
||||
|
||||
if (xdest < clip_rectangle.x)
|
||||
{
|
||||
xsrc = clip_rectangle.x - xdest;
|
||||
pixmap_width -= xsrc;
|
||||
xdest = clip_rectangle.x;
|
||||
}
|
||||
|
||||
if (xdest + pixmap_width > clip_rectangle.x + clip_rectangle.width)
|
||||
pixmap_width = (clip_rectangle.x + clip_rectangle.width) - xdest;
|
||||
|
||||
if (ydest < clip_rectangle.y)
|
||||
{
|
||||
ysrc = clip_rectangle.y - ydest;
|
||||
height -= ysrc;
|
||||
ydest = clip_rectangle.y;
|
||||
}
|
||||
|
||||
if (ydest + height > clip_rectangle.y + clip_rectangle.height)
|
||||
height = (clip_rectangle.y + clip_rectangle.height) - ydest;
|
||||
|
||||
if (GTK_CELL_PIXMAP (clist_row->cell[i])->mask)
|
||||
{
|
||||
gdk_gc_set_clip_mask (fg_gc, GTK_CELL_PIXMAP (clist_row->cell[i])->mask);
|
||||
gdk_gc_set_clip_origin (fg_gc, xdest, ydest);
|
||||
}
|
||||
gdk_draw_pixmap (clist->clist_window,
|
||||
fg_gc,
|
||||
draw_cell_pixmap (clist->clist_window, &clip_rectangle, fg_gc,
|
||||
GTK_CELL_PIXMAP (clist_row->cell[i])->pixmap,
|
||||
xsrc, ysrc,
|
||||
xdest, ydest,
|
||||
GTK_CELL_PIXMAP (clist_row->cell[i])->mask,
|
||||
offset,
|
||||
clip_rectangle.y + clist_row->cell[i].vertical +
|
||||
(clip_rectangle.height - height) / 2,
|
||||
pixmap_width, height);
|
||||
|
||||
if (GTK_CELL_PIXMAP (clist_row->cell[i])->mask)
|
||||
{
|
||||
gdk_gc_set_clip_origin (fg_gc, 0, 0);
|
||||
gdk_gc_set_clip_mask (fg_gc, NULL);
|
||||
}
|
||||
break;
|
||||
|
||||
case GTK_CELL_PIXTEXT:
|
||||
/* draw the pixmap */
|
||||
xsrc = 0;
|
||||
ysrc = 0;
|
||||
xdest = offset + clist_row->cell[i].horizontal;
|
||||
ydest = (clip_rectangle.y + (clip_rectangle.height / 2)) - height / 2 +
|
||||
clist_row->cell[i].vertical;
|
||||
|
||||
if (xdest < clip_rectangle.x)
|
||||
{
|
||||
xsrc = clip_rectangle.x - xdest;
|
||||
pixmap_width -= xsrc;
|
||||
xdest = clip_rectangle.x;
|
||||
}
|
||||
|
||||
if (xdest + pixmap_width > clip_rectangle.x + clip_rectangle.width)
|
||||
pixmap_width = (clip_rectangle.x + clip_rectangle.width) - xdest;
|
||||
|
||||
if (ydest < clip_rectangle.y)
|
||||
{
|
||||
ysrc = clip_rectangle.y - ydest;
|
||||
height -= ysrc;
|
||||
ydest = clip_rectangle.y;
|
||||
}
|
||||
|
||||
if (ydest + height > clip_rectangle.y + clip_rectangle.height)
|
||||
height = (clip_rectangle.y + clip_rectangle.height) - ydest;
|
||||
|
||||
if (GTK_CELL_PIXTEXT (clist_row->cell[i])->mask)
|
||||
{
|
||||
gdk_gc_set_clip_mask (fg_gc, GTK_CELL_PIXTEXT (clist_row->cell[i])->mask);
|
||||
gdk_gc_set_clip_origin (fg_gc, xdest, ydest);
|
||||
}
|
||||
|
||||
gdk_draw_pixmap (clist->clist_window,
|
||||
fg_gc,
|
||||
offset =
|
||||
draw_cell_pixmap (clist->clist_window, &clip_rectangle, fg_gc,
|
||||
GTK_CELL_PIXTEXT (clist_row->cell[i])->pixmap,
|
||||
xsrc, ysrc,
|
||||
xdest,
|
||||
ydest,
|
||||
GTK_CELL_PIXTEXT (clist_row->cell[i])->mask,
|
||||
offset,
|
||||
clip_rectangle.y + clist_row->cell[i].vertical+
|
||||
(clip_rectangle.height - height) / 2,
|
||||
pixmap_width, height);
|
||||
offset += GTK_CELL_PIXTEXT (clist_row->cell[i])->spacing;
|
||||
case GTK_CELL_TEXT:
|
||||
if (style != GTK_WIDGET (clist)->style)
|
||||
row_center_offset = (((clist->row_height - style->font->ascent -
|
||||
style->font->descent - 1) / 2) + 1.5 +
|
||||
style->font->ascent);
|
||||
else
|
||||
row_center_offset = clist->row_center_offset;
|
||||
|
||||
gdk_gc_set_clip_origin (fg_gc, 0, 0);
|
||||
|
||||
offset += pixmap_width + GTK_CELL_PIXTEXT (clist_row->cell[i])->spacing;
|
||||
|
||||
/* draw the string */
|
||||
gdk_gc_set_clip_rectangle (fg_gc, rect);
|
||||
|
||||
gdk_draw_string (clist->clist_window,
|
||||
widget->style->font,
|
||||
fg_gc,
|
||||
offset + clist_row->cell[i].horizontal,
|
||||
row_rectangle.y + clist->row_center_offset +
|
||||
gdk_gc_set_clip_rectangle (fg_gc, &clip_rectangle);
|
||||
gdk_draw_string (clist->clist_window, style->font, fg_gc,
|
||||
offset,
|
||||
row_rectangle.y + row_center_offset +
|
||||
clist_row->cell[i].vertical,
|
||||
GTK_CELL_PIXTEXT (clist_row->cell[i])->text);
|
||||
|
||||
(clist_row->cell[i].type == GTK_CELL_PIXTEXT) ?
|
||||
GTK_CELL_PIXTEXT (clist_row->cell[i])->text :
|
||||
GTK_CELL_TEXT (clist_row->cell[i])->text);
|
||||
gdk_gc_set_clip_rectangle (fg_gc, NULL);
|
||||
break;
|
||||
|
||||
case GTK_CELL_WIDGET:
|
||||
/* unimplimented */
|
||||
continue;
|
||||
break;
|
||||
|
||||
default:
|
||||
continue;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
/* draw focus rectangle */
|
||||
if (clist->focus_row == row && GTK_WIDGET_HAS_FOCUS (widget))
|
||||
{
|
||||
if (area)
|
||||
{
|
||||
if (gdk_rectangle_intersect (area, &row_rectangle,
|
||||
if (!area)
|
||||
gdk_draw_rectangle (clist->clist_window, clist->xor_gc, FALSE,
|
||||
row_rectangle.x, row_rectangle.y,
|
||||
row_rectangle.width - 1, row_rectangle.height - 1);
|
||||
else if (gdk_rectangle_intersect (area, &row_rectangle,
|
||||
&intersect_rectangle))
|
||||
{
|
||||
gdk_gc_set_clip_rectangle (clist->xor_gc, &intersect_rectangle);
|
||||
@ -4013,11 +4064,6 @@ draw_row (GtkCList * clist,
|
||||
gdk_gc_set_clip_rectangle (clist->xor_gc, NULL);
|
||||
}
|
||||
}
|
||||
else
|
||||
gdk_draw_rectangle (clist->clist_window, clist->xor_gc, FALSE,
|
||||
row_rectangle.x, row_rectangle.y,
|
||||
row_rectangle.width - 1, row_rectangle.height - 1);
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
@ -4993,10 +5039,12 @@ row_new (GtkCList * clist)
|
||||
clist_row->cell[i].type = GTK_CELL_EMPTY;
|
||||
clist_row->cell[i].vertical = 0;
|
||||
clist_row->cell[i].horizontal = 0;
|
||||
clist_row->cell[i].style = NULL;
|
||||
}
|
||||
|
||||
clist_row->fg_set = FALSE;
|
||||
clist_row->bg_set = FALSE;
|
||||
clist_row->style = NULL;
|
||||
clist_row->selectable = TRUE;
|
||||
clist_row->state = GTK_STATE_NORMAL;
|
||||
clist_row->data = NULL;
|
||||
@ -5012,8 +5060,23 @@ row_delete (GtkCList * clist,
|
||||
gint i;
|
||||
|
||||
for (i = 0; i < clist->columns; i++)
|
||||
{
|
||||
GTK_CLIST_CLASS_FW (clist)->set_cell_contents
|
||||
(clist, clist_row, i, GTK_CELL_EMPTY, NULL, 0, NULL, NULL);
|
||||
if (clist_row->cell[i].style)
|
||||
{
|
||||
if (GTK_WIDGET_REALIZED (clist))
|
||||
gtk_style_detach (clist_row->cell[i].style);
|
||||
gtk_style_unref (clist_row->cell[i].style);
|
||||
}
|
||||
}
|
||||
|
||||
if (clist_row->style)
|
||||
{
|
||||
if (GTK_WIDGET_REALIZED (clist))
|
||||
gtk_style_detach (clist_row->style);
|
||||
gtk_style_unref (clist_row->style);
|
||||
}
|
||||
|
||||
if (clist_row->destroy)
|
||||
clist_row->destroy (clist_row->data);
|
||||
@ -5038,28 +5101,23 @@ set_cell_contents (GtkCList *clist,
|
||||
{
|
||||
case GTK_CELL_EMPTY:
|
||||
break;
|
||||
|
||||
case GTK_CELL_TEXT:
|
||||
g_free (GTK_CELL_TEXT (clist_row->cell[column])->text);
|
||||
break;
|
||||
|
||||
case GTK_CELL_PIXMAP:
|
||||
gdk_pixmap_unref (GTK_CELL_PIXMAP (clist_row->cell[column])->pixmap);
|
||||
if (GTK_CELL_PIXMAP (clist_row->cell[column])->mask)
|
||||
gdk_bitmap_unref (GTK_CELL_PIXMAP (clist_row->cell[column])->mask);
|
||||
break;
|
||||
|
||||
case GTK_CELL_PIXTEXT:
|
||||
g_free (GTK_CELL_PIXTEXT (clist_row->cell[column])->text);
|
||||
gdk_pixmap_unref (GTK_CELL_PIXTEXT (clist_row->cell[column])->pixmap);
|
||||
if (GTK_CELL_PIXTEXT (clist_row->cell[column])->mask)
|
||||
gdk_bitmap_unref (GTK_CELL_PIXTEXT (clist_row->cell[column])->mask);
|
||||
break;
|
||||
|
||||
case GTK_CELL_WIDGET:
|
||||
/* unimplimented */
|
||||
break;
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
@ -5075,7 +5133,6 @@ set_cell_contents (GtkCList *clist,
|
||||
GTK_CELL_TEXT (clist_row->cell[column])->text = g_strdup (text);
|
||||
}
|
||||
break;
|
||||
|
||||
case GTK_CELL_PIXMAP:
|
||||
if (pixmap)
|
||||
{
|
||||
@ -5085,7 +5142,6 @@ set_cell_contents (GtkCList *clist,
|
||||
GTK_CELL_PIXMAP (clist_row->cell[column])->mask = mask;
|
||||
}
|
||||
break;
|
||||
|
||||
case GTK_CELL_PIXTEXT:
|
||||
if (text && pixmap)
|
||||
{
|
||||
@ -5096,7 +5152,6 @@ set_cell_contents (GtkCList *clist,
|
||||
GTK_CELL_PIXTEXT (clist_row->cell[column])->mask = mask;
|
||||
}
|
||||
break;
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
@ -5708,7 +5763,7 @@ update_extended_selection (GtkCList *clist,
|
||||
}
|
||||
else if (top >= clist->clist_window_height)
|
||||
{
|
||||
area.y = ROW_TOP_YPIXEL (clist, s1);
|
||||
area.y = ROW_TOP_YPIXEL (clist, s1) - 1;
|
||||
area.height = clist->clist_window_height - area.y;
|
||||
draw_rows (clist, &area);
|
||||
gtk_clist_moveto (clist, clist->focus_row, -1, 1, 0);
|
||||
@ -5718,7 +5773,7 @@ update_extended_selection (GtkCList *clist,
|
||||
else if (top + clist->row_height > clist->clist_window_height)
|
||||
gtk_clist_moveto (clist, clist->focus_row, -1, 1, 0);
|
||||
|
||||
y1 = ROW_TOP_YPIXEL (clist, s1);
|
||||
y1 = ROW_TOP_YPIXEL (clist, s1) - 1;
|
||||
h1 = (e1 - s1 + 1) * (clist->row_height + CELL_SPACING);
|
||||
}
|
||||
|
||||
@ -5742,7 +5797,7 @@ update_extended_selection (GtkCList *clist,
|
||||
}
|
||||
else if (top >= clist->clist_window_height)
|
||||
{
|
||||
area.y = ROW_TOP_YPIXEL (clist, s2);
|
||||
area.y = ROW_TOP_YPIXEL (clist, s2) - 1;
|
||||
area.height = clist->clist_window_height - area.y;
|
||||
draw_rows (clist, &area);
|
||||
gtk_clist_moveto (clist, clist->focus_row, -1, 1, 0);
|
||||
@ -5752,7 +5807,7 @@ update_extended_selection (GtkCList *clist,
|
||||
else if (top + clist->row_height > clist->clist_window_height)
|
||||
gtk_clist_moveto (clist, clist->focus_row, -1, 1, 0);
|
||||
|
||||
y2 = ROW_TOP_YPIXEL (clist, s2);
|
||||
y2 = ROW_TOP_YPIXEL (clist, s2) - 1;
|
||||
h2 = (e2 - s2 + 1) * (clist->row_height + CELL_SPACING);
|
||||
}
|
||||
|
||||
@ -6543,3 +6598,134 @@ real_sort_list (GtkCList *clist)
|
||||
if (thaw)
|
||||
gtk_clist_thaw (clist);
|
||||
}
|
||||
|
||||
/* gtk_clist_set_cell_style
|
||||
* gtk_clist_get_cell_style
|
||||
* gtk_clist_set_row_style
|
||||
* gtk_clist_get_row_style
|
||||
*/
|
||||
|
||||
void
|
||||
gtk_clist_set_cell_style (GtkCList *clist,
|
||||
gint row,
|
||||
gint column,
|
||||
GtkStyle *style)
|
||||
{
|
||||
GtkCListRow *clist_row;
|
||||
|
||||
g_return_if_fail (clist != NULL);
|
||||
g_return_if_fail (GTK_IS_CLIST (clist));
|
||||
|
||||
if (row < 0 || row >= clist->rows || column < 0 || column >= clist->columns)
|
||||
return;
|
||||
|
||||
clist_row = (g_list_nth (clist->row_list, row))->data;
|
||||
|
||||
if (clist_row->cell[column].style == style)
|
||||
return;
|
||||
|
||||
if (clist_row->cell[column].style)
|
||||
{
|
||||
if (GTK_WIDGET_REALIZED (clist))
|
||||
gtk_style_detach (clist_row->cell[column].style);
|
||||
gtk_style_unref (clist_row->cell[column].style);
|
||||
}
|
||||
|
||||
clist_row->cell[column].style = style;
|
||||
|
||||
if (clist_row->cell[column].style)
|
||||
{
|
||||
gtk_style_ref (clist_row->cell[column].style);
|
||||
|
||||
if (GTK_WIDGET_REALIZED (clist))
|
||||
clist_row->cell[column].style =
|
||||
gtk_style_attach (clist_row->cell[column].style,
|
||||
clist->clist_window);
|
||||
}
|
||||
|
||||
/* redraw the list if it's not frozen */
|
||||
if (!GTK_CLIST_FROZEN (clist))
|
||||
{
|
||||
if (gtk_clist_row_is_visible (clist, row) != GTK_VISIBILITY_NONE)
|
||||
GTK_CLIST_CLASS_FW (clist)->draw_row (clist, NULL, row, clist_row);
|
||||
}
|
||||
}
|
||||
|
||||
GtkStyle *
|
||||
gtk_clist_get_cell_style (GtkCList *clist,
|
||||
gint row,
|
||||
gint column)
|
||||
{
|
||||
GtkCListRow *clist_row;
|
||||
|
||||
g_return_val_if_fail (clist != NULL, NULL);
|
||||
g_return_val_if_fail (GTK_IS_CLIST (clist), NULL);
|
||||
|
||||
if (row < 0 || row >= clist->rows || column < 0 || column >= clist->columns)
|
||||
return NULL;
|
||||
|
||||
clist_row = (g_list_nth (clist->row_list, row))->data;
|
||||
|
||||
return clist_row->cell[column].style;
|
||||
}
|
||||
|
||||
void
|
||||
gtk_clist_set_row_style (GtkCList *clist,
|
||||
gint row,
|
||||
GtkStyle *style)
|
||||
{
|
||||
GtkCListRow *clist_row;
|
||||
|
||||
g_return_if_fail (clist != NULL);
|
||||
g_return_if_fail (GTK_IS_CLIST (clist));
|
||||
|
||||
if (row < 0 || row >= clist->rows)
|
||||
return;
|
||||
|
||||
clist_row = (g_list_nth (clist->row_list, row))->data;
|
||||
|
||||
if (clist_row->style == style)
|
||||
return;
|
||||
|
||||
if (clist_row->style)
|
||||
{
|
||||
if (GTK_WIDGET_REALIZED (clist))
|
||||
gtk_style_detach (clist_row->style);
|
||||
gtk_style_unref (clist_row->style);
|
||||
}
|
||||
|
||||
clist_row->style = style;
|
||||
|
||||
if (clist_row->style)
|
||||
{
|
||||
gtk_style_ref (clist_row->style);
|
||||
|
||||
if (GTK_WIDGET_REALIZED (clist))
|
||||
clist_row->style = gtk_style_attach (clist_row->style,
|
||||
clist->clist_window);
|
||||
}
|
||||
|
||||
/* redraw the list if it's not frozen */
|
||||
if (!GTK_CLIST_FROZEN (clist))
|
||||
{
|
||||
if (gtk_clist_row_is_visible (clist, row) != GTK_VISIBILITY_NONE)
|
||||
GTK_CLIST_CLASS_FW (clist)->draw_row (clist, NULL, row, clist_row);
|
||||
}
|
||||
}
|
||||
|
||||
GtkStyle *
|
||||
gtk_clist_get_row_style (GtkCList *clist,
|
||||
gint row)
|
||||
{
|
||||
GtkCListRow *clist_row;
|
||||
|
||||
g_return_val_if_fail (clist != NULL, NULL);
|
||||
g_return_val_if_fail (GTK_IS_CLIST (clist), NULL);
|
||||
|
||||
if (row < 0 || row >= clist->rows)
|
||||
return NULL;
|
||||
|
||||
clist_row = (g_list_nth (clist->row_list, row))->data;
|
||||
|
||||
return clist_row->style;
|
||||
}
|
||||
|
||||
@ -278,6 +278,8 @@ struct _GtkCListRow
|
||||
GdkColor foreground;
|
||||
GdkColor background;
|
||||
|
||||
GtkStyle *style;
|
||||
|
||||
gpointer data;
|
||||
GtkDestroyNotify destroy;
|
||||
|
||||
@ -291,8 +293,10 @@ struct _GtkCellText
|
||||
{
|
||||
GtkCellType type;
|
||||
|
||||
gint vertical;
|
||||
gint horizontal;
|
||||
gint16 vertical;
|
||||
gint16 horizontal;
|
||||
|
||||
GtkStyle *style;
|
||||
|
||||
gchar *text;
|
||||
};
|
||||
@ -301,8 +305,10 @@ struct _GtkCellPixmap
|
||||
{
|
||||
GtkCellType type;
|
||||
|
||||
gint vertical;
|
||||
gint horizontal;
|
||||
gint16 vertical;
|
||||
gint16 horizontal;
|
||||
|
||||
GtkStyle *style;
|
||||
|
||||
GdkPixmap *pixmap;
|
||||
GdkBitmap *mask;
|
||||
@ -312,8 +318,10 @@ struct _GtkCellPixText
|
||||
{
|
||||
GtkCellType type;
|
||||
|
||||
gint vertical;
|
||||
gint horizontal;
|
||||
gint16 vertical;
|
||||
gint16 horizontal;
|
||||
|
||||
GtkStyle *style;
|
||||
|
||||
gchar *text;
|
||||
guint8 spacing;
|
||||
@ -325,8 +333,10 @@ struct _GtkCellWidget
|
||||
{
|
||||
GtkCellType type;
|
||||
|
||||
gint vertical;
|
||||
gint horizontal;
|
||||
gint16 vertical;
|
||||
gint16 horizontal;
|
||||
|
||||
GtkStyle *style;
|
||||
|
||||
GtkWidget *widget;
|
||||
};
|
||||
@ -335,8 +345,10 @@ struct _GtkCell
|
||||
{
|
||||
GtkCellType type;
|
||||
|
||||
gint vertical;
|
||||
gint horizontal;
|
||||
gint16 vertical;
|
||||
gint16 horizontal;
|
||||
|
||||
GtkStyle *style;
|
||||
|
||||
union {
|
||||
gchar *text;
|
||||
@ -532,6 +544,23 @@ void gtk_clist_set_background (GtkCList *clist,
|
||||
gint row,
|
||||
GdkColor *color);
|
||||
|
||||
/* set / get cell styles */
|
||||
void gtk_clist_set_cell_style (GtkCList *clist,
|
||||
gint row,
|
||||
gint column,
|
||||
GtkStyle *style);
|
||||
|
||||
GtkStyle *gtk_clist_get_cell_style (GtkCList *clist,
|
||||
gint row,
|
||||
gint column);
|
||||
|
||||
void gtk_clist_set_row_style (GtkCList *clist,
|
||||
gint row,
|
||||
GtkStyle *style);
|
||||
|
||||
GtkStyle *gtk_clist_get_row_style (GtkCList *clist,
|
||||
gint row);
|
||||
|
||||
/* this sets a horizontal and vertical shift for drawing
|
||||
* the contents of a cell; it can be positive or negitive;
|
||||
* this is particulary useful for indenting items in a column
|
||||
|
||||
2335
gtk/gtkctree.c
2335
gtk/gtkctree.c
File diff suppressed because it is too large
Load Diff
@ -51,12 +51,20 @@ typedef enum
|
||||
|
||||
typedef enum
|
||||
{
|
||||
GTK_CTREE_LINES_NONE,
|
||||
GTK_CTREE_LINES_SOLID,
|
||||
GTK_CTREE_LINES_DOTTED,
|
||||
GTK_CTREE_LINES_TABBED,
|
||||
GTK_CTREE_LINES_NONE
|
||||
GTK_CTREE_LINES_TABBED
|
||||
} GtkCTreeLineStyle;
|
||||
|
||||
typedef enum
|
||||
{
|
||||
GTK_CTREE_EXPANDER_NONE,
|
||||
GTK_CTREE_EXPANDER_SQUARE,
|
||||
GTK_CTREE_EXPANDER_TRIANGLE,
|
||||
GTK_CTREE_EXPANDER_CIRCULAR
|
||||
} GtkCTreeExpanderStyle;
|
||||
|
||||
typedef enum
|
||||
{
|
||||
GTK_CTREE_EXPANSION_EXPAND,
|
||||
@ -97,6 +105,7 @@ struct _GtkCTree
|
||||
gint icon_height;
|
||||
|
||||
gint tree_indent;
|
||||
gint tree_spacing;
|
||||
gint tree_column;
|
||||
gint drag_row;
|
||||
GtkCTreeNode *drag_source;
|
||||
@ -108,6 +117,7 @@ struct _GtkCTree
|
||||
guint in_drag : 1;
|
||||
guint drag_rect : 1;
|
||||
guint line_style : 2;
|
||||
guint expander_style : 2;
|
||||
guint show_stub : 1;
|
||||
|
||||
GtkCTreeCompareDragFunc drag_compare;
|
||||
@ -361,6 +371,18 @@ gint gtk_ctree_get_node_info (GtkCTree *ctree,
|
||||
GdkBitmap **mask_opened,
|
||||
gboolean *is_leaf,
|
||||
gboolean *expanded);
|
||||
void gtk_ctree_node_set_row_style (GtkCTree *ctree,
|
||||
GtkCTreeNode *node,
|
||||
GtkStyle *style);
|
||||
GtkStyle * gtk_ctree_node_get_row_style (GtkCTree *ctree,
|
||||
GtkCTreeNode *node);
|
||||
void gtk_ctree_node_set_cell_style (GtkCTree *ctree,
|
||||
GtkCTreeNode *node,
|
||||
gint column,
|
||||
GtkStyle *style);
|
||||
GtkStyle * gtk_ctree_node_get_cell_style (GtkCTree *ctree,
|
||||
GtkCTreeNode *node,
|
||||
gint column);
|
||||
void gtk_ctree_node_set_foreground (GtkCTree *ctree,
|
||||
GtkCTreeNode *node,
|
||||
GdkColor *color);
|
||||
@ -390,6 +412,8 @@ GtkVisibility gtk_ctree_node_is_visible (GtkCTree *ctree,
|
||||
|
||||
void gtk_ctree_set_indent (GtkCTree *ctree,
|
||||
gint indent);
|
||||
void gtk_ctree_set_spacing (GtkCTree *ctree,
|
||||
gint spacing);
|
||||
void gtk_ctree_show_stub (GtkCTree *ctree,
|
||||
gboolean show_stub);
|
||||
void gtk_ctree_set_reorderable (GtkCTree *ctree,
|
||||
@ -398,6 +422,8 @@ void gtk_ctree_set_use_drag_icons (GtkCTree *ctree,
|
||||
gboolean use_icons);
|
||||
void gtk_ctree_set_line_style (GtkCTree *ctree,
|
||||
GtkCTreeLineStyle line_style);
|
||||
void gtk_ctree_set_expander_style (GtkCTree *ctree,
|
||||
GtkCTreeExpanderStyle expander_style);
|
||||
void gtk_ctree_set_drag_compare_func (GtkCTree *ctree,
|
||||
GtkCTreeCompareDragFunc cmp_func);
|
||||
|
||||
|
||||
498
gtk/testgtk.c
498
gtk/testgtk.c
@ -3468,6 +3468,46 @@ static char * mini_page_xpm[] = {
|
||||
" oooooooooo ",
|
||||
" "};
|
||||
|
||||
static char * gtk_mini_xpm[] = {
|
||||
"15 20 17 1",
|
||||
" c None",
|
||||
". c #14121F",
|
||||
"+ c #278828",
|
||||
"@ c #9B3334",
|
||||
"# c #284C72",
|
||||
"$ c #24692A",
|
||||
"% c #69282E",
|
||||
"& c #37C539",
|
||||
"* c #1D2F4D",
|
||||
"= c #6D7076",
|
||||
"- c #7D8482",
|
||||
"; c #E24A49",
|
||||
"> c #515357",
|
||||
", c #9B9C9B",
|
||||
"' c #2FA232",
|
||||
") c #3CE23D",
|
||||
"! c #3B6CCB",
|
||||
" ",
|
||||
" ***> ",
|
||||
" >.*!!!* ",
|
||||
" ***....#*= ",
|
||||
" *!*.!!!**!!# ",
|
||||
" .!!#*!#*!!!!# ",
|
||||
" @%#!.##.*!!$& ",
|
||||
" @;%*!*.#!#')) ",
|
||||
" @;;@%!!*$&)'' ",
|
||||
" @%.%@%$'&)$+' ",
|
||||
" @;...@$'*'*)+ ",
|
||||
" @;%..@$+*.')$ ",
|
||||
" @;%%;;$+..$)# ",
|
||||
" @;%%;@$$$'.$# ",
|
||||
" %;@@;;$$+))&* ",
|
||||
" %;;;@+$&)&* ",
|
||||
" %;;@'))+> ",
|
||||
" %;@'&# ",
|
||||
" >%$$ ",
|
||||
" >= "};
|
||||
|
||||
#define TESTGTK_CLIST_COLUMNS 20
|
||||
static gint clist_rows = 0;
|
||||
static GtkWidget *clist_omenu;
|
||||
@ -3480,11 +3520,14 @@ add1000_clist (GtkWidget *widget, gpointer data)
|
||||
char *texts[TESTGTK_CLIST_COLUMNS];
|
||||
GdkBitmap *mask;
|
||||
GdkPixmap *pixmap;
|
||||
GtkCList *clist;
|
||||
|
||||
pixmap = gdk_pixmap_create_from_xpm_d (GTK_CLIST (data)->clist_window,
|
||||
clist = GTK_CLIST (data);
|
||||
|
||||
pixmap = gdk_pixmap_create_from_xpm_d (clist->clist_window,
|
||||
&mask,
|
||||
>K_WIDGET (data)->style->white,
|
||||
mini_page_xpm);
|
||||
gtk_mini_xpm);
|
||||
|
||||
for (i = 0; i < TESTGTK_CLIST_COLUMNS; i++)
|
||||
{
|
||||
@ -3499,9 +3542,9 @@ add1000_clist (GtkWidget *widget, gpointer data)
|
||||
gtk_clist_freeze (GTK_CLIST (data));
|
||||
for (i = 0; i < 1000; i++)
|
||||
{
|
||||
sprintf (text[0], "Row %d", rand() % 10000 /*clist_rows++*/);
|
||||
row = gtk_clist_append (GTK_CLIST (data), texts);
|
||||
gtk_clist_set_pixtext (GTK_CLIST (data), row, 3, "Hello World", 5, pixmap, mask);
|
||||
sprintf (text[0], "Row %d", rand() % 10000);
|
||||
row = gtk_clist_append (clist, texts);
|
||||
gtk_clist_set_pixtext (clist, row, 3, "gtk+", 5, pixmap, mask);
|
||||
}
|
||||
|
||||
gtk_clist_thaw (GTK_CLIST (data));
|
||||
@ -3692,10 +3735,48 @@ insert_row_clist (GtkWidget *widget, gpointer data)
|
||||
"This", "is", "a", "inserted", "row."
|
||||
};
|
||||
|
||||
static GtkStyle *style1 = NULL;
|
||||
static GtkStyle *style2 = NULL;
|
||||
static GtkStyle *style3 = NULL;
|
||||
gint row;
|
||||
|
||||
if (GTK_CLIST (data)->focus_row >= 0)
|
||||
gtk_clist_insert (GTK_CLIST (data), GTK_CLIST (data)->focus_row, text);
|
||||
row = gtk_clist_insert (GTK_CLIST (data), GTK_CLIST (data)->focus_row,
|
||||
text);
|
||||
else
|
||||
gtk_clist_insert (GTK_CLIST (data), 0, text);
|
||||
row = gtk_clist_prepend (GTK_CLIST (data), text);
|
||||
|
||||
if (!style1)
|
||||
{
|
||||
GdkColor col1;
|
||||
GdkColor col2;
|
||||
|
||||
col1.red = 0;
|
||||
col1.green = 56000;
|
||||
col1.blue = 0;
|
||||
col2.red = 32000;
|
||||
col2.green = 0;
|
||||
col2.blue = 56000;
|
||||
|
||||
style1 = gtk_style_copy (GTK_WIDGET (data)->style);
|
||||
style1->bg[GTK_STATE_PRELIGHT] = col1;
|
||||
style1->bg[GTK_STATE_SELECTED] = col2;
|
||||
|
||||
style2 = gtk_style_copy (GTK_WIDGET (data)->style);
|
||||
style2->fg[GTK_STATE_PRELIGHT] = col1;
|
||||
style2->fg[GTK_STATE_SELECTED] = col2;
|
||||
|
||||
style3 = gtk_style_copy (GTK_WIDGET (data)->style);
|
||||
style3->fg[GTK_STATE_PRELIGHT] = col1;
|
||||
style3->bg[GTK_STATE_PRELIGHT] = col2;
|
||||
gdk_font_unref (style3->font);
|
||||
style3->font =
|
||||
gdk_font_load ("-*-courier-medium-*-*-*-*-120-*-*-*-*-*-*");
|
||||
}
|
||||
|
||||
gtk_clist_set_cell_style (GTK_CLIST (data), row, 3, style1);
|
||||
gtk_clist_set_cell_style (GTK_CLIST (data), row, 4, style2);
|
||||
gtk_clist_set_cell_style (GTK_CLIST (data), row, 0, style3);
|
||||
|
||||
clist_rows++;
|
||||
}
|
||||
@ -3749,7 +3830,9 @@ clist_toggle_sel_mode (GtkWidget *widget, GtkCList *clist)
|
||||
static void
|
||||
clist_click_column (GtkCList *clist, gint column, gpointer data)
|
||||
{
|
||||
if (column == clist->sort_column)
|
||||
if (column == 5)
|
||||
gtk_clist_set_column_visibility (clist, column, FALSE);
|
||||
else if (column == clist->sort_column)
|
||||
{
|
||||
if (clist->sort_type == GTK_SORT_ASCENDING)
|
||||
clist->sort_type = GTK_SORT_DESCENDING;
|
||||
@ -3770,10 +3853,11 @@ create_clist (void)
|
||||
|
||||
static char *titles[] =
|
||||
{
|
||||
"Title 0", "Title 1", "Title 2", "Title 3", "Title 4",
|
||||
"Title 5", "Title 6", "Title 7", "Title 8", "Title 9",
|
||||
"Title 10", "Title 11", "Title 12", "Title 13", "Title 14",
|
||||
"Title 15", "Title 16", "Title 17", "Title 18", "Title 19"
|
||||
"Title 0", "Title 1", "not resizeable", "max width 120",
|
||||
"min width 40", "hide column", "Title 6", "Title 7",
|
||||
"Title 8", "Title 9", "Title 10", "Title 11", "Title 12",
|
||||
"Title 13", "Title 14", "Title 15", "Title 16", "Title 17",
|
||||
"Title 18", "Title 19"
|
||||
};
|
||||
|
||||
static OptionMenuItem items[] =
|
||||
@ -3796,14 +3880,17 @@ create_clist (void)
|
||||
GtkWidget *undo_button;
|
||||
GtkWidget *label;
|
||||
|
||||
GtkStyle *style;
|
||||
GdkColor col1;
|
||||
GdkColor col2;
|
||||
|
||||
if (!window)
|
||||
{
|
||||
clist_rows = 0;
|
||||
window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
|
||||
|
||||
gtk_signal_connect (GTK_OBJECT (window), "destroy",
|
||||
GTK_SIGNAL_FUNC(gtk_widget_destroyed),
|
||||
&window);
|
||||
GTK_SIGNAL_FUNC (gtk_widget_destroyed), &window);
|
||||
|
||||
gtk_window_set_title (GTK_WINDOW (window), "clist");
|
||||
gtk_container_border_width (GTK_CONTAINER (window), 0);
|
||||
@ -3821,41 +3908,32 @@ create_clist (void)
|
||||
/*clist = gtk_clist_new (TESTGTK_CLIST_COLUMNS);*/
|
||||
|
||||
gtk_signal_connect (GTK_OBJECT (clist), "click_column",
|
||||
(GtkSignalFunc) clist_click_column,
|
||||
NULL);
|
||||
(GtkSignalFunc) clist_click_column, NULL);
|
||||
|
||||
/* control buttons */
|
||||
button = gtk_button_new_with_label ("Add 1,000 Rows With Pixmaps");
|
||||
gtk_box_pack_start (GTK_BOX (box2), button, TRUE, TRUE, 0);
|
||||
|
||||
gtk_signal_connect (GTK_OBJECT (button),
|
||||
"clicked",
|
||||
(GtkSignalFunc) add1000_clist,
|
||||
(gpointer) clist);
|
||||
gtk_signal_connect (GTK_OBJECT (button), "clicked",
|
||||
(GtkSignalFunc) add1000_clist, (gpointer) clist);
|
||||
|
||||
button = gtk_button_new_with_label ("Add 10,000 Rows");
|
||||
gtk_box_pack_start (GTK_BOX (box2), button, TRUE, TRUE, 0);
|
||||
|
||||
gtk_signal_connect (GTK_OBJECT (button),
|
||||
"clicked",
|
||||
(GtkSignalFunc) add10000_clist,
|
||||
(gpointer) clist);
|
||||
gtk_signal_connect (GTK_OBJECT (button), "clicked",
|
||||
(GtkSignalFunc) add10000_clist, (gpointer) clist);
|
||||
|
||||
button = gtk_button_new_with_label ("Clear List");
|
||||
gtk_box_pack_start (GTK_BOX (box2), button, TRUE, TRUE, 0);
|
||||
|
||||
gtk_signal_connect (GTK_OBJECT (button),
|
||||
"clicked",
|
||||
(GtkSignalFunc) clear_clist,
|
||||
(gpointer) clist);
|
||||
gtk_signal_connect (GTK_OBJECT (button), "clicked",
|
||||
(GtkSignalFunc) clear_clist, (gpointer) clist);
|
||||
|
||||
button = gtk_button_new_with_label ("Remove Row");
|
||||
gtk_box_pack_start (GTK_BOX (box2), button, TRUE, TRUE, 0);
|
||||
|
||||
gtk_signal_connect (GTK_OBJECT (button),
|
||||
"clicked",
|
||||
(GtkSignalFunc) remove_row_clist,
|
||||
(gpointer) clist);
|
||||
gtk_signal_connect (GTK_OBJECT (button), "clicked",
|
||||
(GtkSignalFunc) remove_row_clist, (gpointer) clist);
|
||||
|
||||
/* second layer of buttons */
|
||||
box2 = gtk_hbox_new (FALSE, 10);
|
||||
@ -3865,34 +3943,26 @@ create_clist (void)
|
||||
button = gtk_button_new_with_label ("Insert Row");
|
||||
gtk_box_pack_start (GTK_BOX (box2), button, TRUE, TRUE, 0);
|
||||
|
||||
gtk_signal_connect (GTK_OBJECT (button),
|
||||
"clicked",
|
||||
(GtkSignalFunc) insert_row_clist,
|
||||
(gpointer) clist);
|
||||
gtk_signal_connect (GTK_OBJECT (button), "clicked",
|
||||
(GtkSignalFunc) insert_row_clist, (gpointer) clist);
|
||||
|
||||
button = gtk_button_new_with_label ("Show Title Buttons");
|
||||
gtk_box_pack_start (GTK_BOX (box2), button, TRUE, TRUE, 0);
|
||||
|
||||
gtk_signal_connect (GTK_OBJECT (button),
|
||||
"clicked",
|
||||
(GtkSignalFunc) show_titles_clist,
|
||||
(gpointer) clist);
|
||||
gtk_signal_connect (GTK_OBJECT (button), "clicked",
|
||||
(GtkSignalFunc) show_titles_clist, (gpointer) clist);
|
||||
|
||||
button = gtk_button_new_with_label ("Hide Title Buttons");
|
||||
gtk_box_pack_start (GTK_BOX (box2), button, TRUE, TRUE, 0);
|
||||
|
||||
gtk_signal_connect (GTK_OBJECT (button),
|
||||
"clicked",
|
||||
(GtkSignalFunc) hide_titles_clist,
|
||||
(gpointer) clist);
|
||||
gtk_signal_connect (GTK_OBJECT (button), "clicked",
|
||||
(GtkSignalFunc) hide_titles_clist, (gpointer) clist);
|
||||
|
||||
button = gtk_button_new_with_label ("Warning Test");
|
||||
gtk_box_pack_start (GTK_BOX (box2), button, TRUE, TRUE, 0);
|
||||
|
||||
gtk_signal_connect (GTK_OBJECT (button),
|
||||
"clicked",
|
||||
(GtkSignalFunc) clist_warning_test,
|
||||
(gpointer) clist);
|
||||
gtk_signal_connect (GTK_OBJECT (button), "clicked",
|
||||
(GtkSignalFunc) clist_warning_test,(gpointer) clist);
|
||||
|
||||
box2 = gtk_hbox_new (FALSE, 10);
|
||||
gtk_container_border_width (GTK_CONTAINER (box2), 10);
|
||||
@ -3900,10 +3970,8 @@ create_clist (void)
|
||||
|
||||
undo_button = gtk_button_new_with_label ("Undo last selection");
|
||||
gtk_box_pack_start (GTK_BOX (box2), undo_button, TRUE, TRUE, 0);
|
||||
gtk_signal_connect (GTK_OBJECT (undo_button),
|
||||
"clicked",
|
||||
(GtkSignalFunc) undo_selection,
|
||||
(gpointer) clist);
|
||||
gtk_signal_connect (GTK_OBJECT (undo_button), "clicked",
|
||||
(GtkSignalFunc) undo_selection, (gpointer) clist);
|
||||
|
||||
label = gtk_label_new ("Selection Mode :");
|
||||
gtk_box_pack_start (GTK_BOX (box2), label, FALSE, TRUE, 0);
|
||||
@ -3940,6 +4008,10 @@ create_clist (void)
|
||||
for (i = 1; i < TESTGTK_CLIST_COLUMNS; i++)
|
||||
gtk_clist_set_column_width (GTK_CLIST (clist), i, 80);
|
||||
|
||||
gtk_clist_set_column_resizeable (GTK_CLIST (clist), 2, FALSE);
|
||||
gtk_clist_set_column_max_width (GTK_CLIST (clist), 3, 120);
|
||||
gtk_clist_set_column_min_width (GTK_CLIST (clist), 4, 40);
|
||||
|
||||
gtk_clist_set_selection_mode (GTK_CLIST (clist), GTK_SELECTION_EXTENDED);
|
||||
gtk_clist_set_policy (GTK_CLIST (clist), GTK_POLICY_AUTOMATIC,
|
||||
GTK_POLICY_AUTOMATIC);
|
||||
@ -3958,10 +4030,35 @@ create_clist (void)
|
||||
sprintf (text[1], "Right");
|
||||
sprintf (text[2], "Center");
|
||||
|
||||
col1.red = 56000;
|
||||
col1.green = 0;
|
||||
col1.blue = 0;
|
||||
col2.red = 0;
|
||||
col2.green = 56000;
|
||||
col2.blue = 32000;
|
||||
|
||||
style = gtk_style_new ();
|
||||
style->fg[GTK_STATE_PRELIGHT] = col1;
|
||||
style->bg[GTK_STATE_PRELIGHT] = col2;
|
||||
|
||||
gdk_font_unref (style->font);
|
||||
style->font =
|
||||
gdk_font_load ("-adobe-helvetica-bold-r-*-*-*-140-*-*-*-*-*-*");
|
||||
|
||||
for (i = 0; i < 10; i++)
|
||||
{
|
||||
sprintf (text[0], "Row %d", clist_rows++);
|
||||
gtk_clist_append (GTK_CLIST (clist), texts);
|
||||
|
||||
switch (i % 4)
|
||||
{
|
||||
case 2:
|
||||
gtk_clist_set_row_style (GTK_CLIST (clist), i, style);
|
||||
break;
|
||||
default:
|
||||
gtk_clist_set_cell_style (GTK_CLIST (clist), i, i % 4, style);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
gtk_container_border_width (GTK_CONTAINER (clist), 5);
|
||||
@ -4014,10 +4111,11 @@ static GtkWidget *vis_label;
|
||||
static GtkWidget *omenu1;
|
||||
static GtkWidget *omenu2;
|
||||
static GtkWidget *omenu3;
|
||||
static GtkWidget *omenu4;
|
||||
static GtkWidget *spin1;
|
||||
static GtkWidget *spin2;
|
||||
static GtkWidget *spin3;
|
||||
static GdkColor *col_bg;
|
||||
static gint line_style;
|
||||
|
||||
void after_press (GtkCTree *ctree, gpointer data)
|
||||
{
|
||||
@ -4150,6 +4248,55 @@ void select_all (GtkWidget *widget, GtkCTree *ctree)
|
||||
after_press (ctree, NULL);
|
||||
}
|
||||
|
||||
void change_style (GtkWidget *widget, GtkCTree *ctree)
|
||||
{
|
||||
static GtkStyle *style1 = NULL;
|
||||
static GtkStyle *style2 = NULL;
|
||||
|
||||
GtkCTreeNode *node;
|
||||
GdkColor col1;
|
||||
GdkColor col2;
|
||||
|
||||
if (GTK_CLIST (ctree)->focus_row >= 0)
|
||||
node = GTK_CTREE_NODE
|
||||
(g_list_nth (GTK_CLIST (ctree)->row_list,GTK_CLIST (ctree)->focus_row));
|
||||
else
|
||||
node = GTK_CTREE_NODE (GTK_CLIST (ctree)->row_list);
|
||||
|
||||
if (!node)
|
||||
return;
|
||||
|
||||
if (!style1)
|
||||
{
|
||||
col1.red = 0;
|
||||
col1.green = 56000;
|
||||
col1.blue = 0;
|
||||
col2.red = 32000;
|
||||
col2.green = 0;
|
||||
col2.blue = 56000;
|
||||
|
||||
style1 = gtk_style_new ();
|
||||
style1->bg[GTK_STATE_PRELIGHT] = col1;
|
||||
style1->fg[GTK_STATE_SELECTED] = col2;
|
||||
|
||||
style2 = gtk_style_new ();
|
||||
style2->bg[GTK_STATE_SELECTED] = col2;
|
||||
style2->fg[GTK_STATE_PRELIGHT] = col1;
|
||||
style2->bg[GTK_STATE_PRELIGHT] = col2;
|
||||
gdk_font_unref (style2->font);
|
||||
style2->font =
|
||||
gdk_font_load ("-*-courier-medium-*-*-*-*-300-*-*-*-*-*-*");
|
||||
}
|
||||
|
||||
gtk_ctree_node_set_cell_style (ctree, node, 1, style1);
|
||||
gtk_ctree_node_set_cell_style (ctree, node, 0, style2);
|
||||
|
||||
if (GTK_CTREE_ROW (node)->children)
|
||||
gtk_ctree_node_set_row_style (ctree, GTK_CTREE_ROW (node)->children,
|
||||
style2);
|
||||
|
||||
}
|
||||
|
||||
void unselect_all (GtkWidget *widget, GtkCTree *ctree)
|
||||
{
|
||||
gtk_ctree_unselect_recursive (ctree, NULL);
|
||||
@ -4204,11 +4351,6 @@ void remove_selection (GtkWidget *widget, GtkCTree *ctree)
|
||||
after_press (ctree, NULL);
|
||||
}
|
||||
|
||||
void sort_all (GtkWidget *widget, GtkCTree *ctree)
|
||||
{
|
||||
gtk_ctree_sort_recursive (ctree, NULL);
|
||||
}
|
||||
|
||||
struct _ExportStruct {
|
||||
gchar *tree;
|
||||
gchar *info;
|
||||
@ -4352,6 +4494,11 @@ void change_indent (GtkWidget *widget, GtkCTree *ctree)
|
||||
gtk_ctree_set_indent (ctree, GTK_ADJUSTMENT (widget)->value);
|
||||
}
|
||||
|
||||
void change_spacing (GtkWidget *widget, GtkCTree *ctree)
|
||||
{
|
||||
gtk_ctree_set_spacing (ctree, GTK_ADJUSTMENT (widget)->value);
|
||||
}
|
||||
|
||||
void change_row_height (GtkWidget *widget, GtkCList *clist)
|
||||
{
|
||||
gtk_clist_set_row_height (clist, GTK_ADJUSTMENT (widget)->value);
|
||||
@ -4364,24 +4511,20 @@ void toggle_reorderable (GtkWidget *widget, GtkCTree *ctree)
|
||||
|
||||
void set_background (GtkCTree *ctree, GtkCTreeNode *node, gpointer data)
|
||||
{
|
||||
GtkStyle *style = NULL;
|
||||
|
||||
if (!node)
|
||||
return;
|
||||
|
||||
if (ctree->line_style != GTK_CTREE_LINES_TABBED)
|
||||
{
|
||||
if (GTK_CTREE_ROW (node)->is_leaf)
|
||||
{
|
||||
if (GTK_CTREE_ROW (node)->parent)
|
||||
gtk_ctree_node_set_background
|
||||
(ctree, node,
|
||||
GTK_CTREE_ROW (GTK_CTREE_ROW (node)->parent)->row.data);
|
||||
if (!GTK_CTREE_ROW (node)->is_leaf)
|
||||
style = GTK_CTREE_ROW (node)->row.data;
|
||||
else if (GTK_CTREE_ROW (node)->parent)
|
||||
style = GTK_CTREE_ROW (GTK_CTREE_ROW (node)->parent)->row.data;
|
||||
}
|
||||
else
|
||||
gtk_ctree_node_set_background (ctree, node,
|
||||
GTK_CTREE_ROW (node)->row.data);
|
||||
}
|
||||
else
|
||||
gtk_ctree_node_set_background (ctree, node, NULL);
|
||||
|
||||
gtk_ctree_node_set_row_style (ctree, node, style);
|
||||
}
|
||||
|
||||
void ctree_toggle_line_style (GtkWidget *widget, GtkCTree *ctree)
|
||||
@ -4392,14 +4535,28 @@ void ctree_toggle_line_style (GtkWidget *widget, GtkCTree *ctree)
|
||||
return;
|
||||
|
||||
RADIOMENUTOGGLED ((GtkRadioMenuItem *)
|
||||
(((GtkOptionMenu *)omenu1)->menu_item),i);
|
||||
(((GtkOptionMenu *)omenu1)->menu_item), i);
|
||||
|
||||
if ((ctree->line_style == GTK_CTREE_LINES_TABBED &&
|
||||
((GtkCTreeLineStyle) (3-i)) != GTK_CTREE_LINES_TABBED) ||
|
||||
((GtkCTreeLineStyle) (3 - i)) != GTK_CTREE_LINES_TABBED) ||
|
||||
(ctree->line_style != GTK_CTREE_LINES_TABBED &&
|
||||
((GtkCTreeLineStyle) (3-i)) == GTK_CTREE_LINES_TABBED))
|
||||
((GtkCTreeLineStyle) (3 - i)) == GTK_CTREE_LINES_TABBED))
|
||||
gtk_ctree_pre_recursive (ctree, NULL, set_background, NULL);
|
||||
gtk_ctree_set_line_style (ctree, (GtkCTreeLineStyle) (3-i));
|
||||
gtk_ctree_set_line_style (ctree, 3 - i);
|
||||
line_style = 3 - i;
|
||||
}
|
||||
|
||||
void ctree_toggle_expander_style (GtkWidget *widget, GtkCTree *ctree)
|
||||
{
|
||||
gint i;
|
||||
|
||||
if (!GTK_WIDGET_MAPPED (widget))
|
||||
return;
|
||||
|
||||
RADIOMENUTOGGLED ((GtkRadioMenuItem *)
|
||||
(((GtkOptionMenu *)omenu2)->menu_item), i);
|
||||
|
||||
gtk_ctree_set_expander_style (ctree, (GtkCTreeExpanderStyle) (3 - i));
|
||||
}
|
||||
|
||||
void ctree_toggle_justify (GtkWidget *widget, GtkCTree *ctree)
|
||||
@ -4410,10 +4567,10 @@ void ctree_toggle_justify (GtkWidget *widget, GtkCTree *ctree)
|
||||
return;
|
||||
|
||||
RADIOMENUTOGGLED ((GtkRadioMenuItem *)
|
||||
(((GtkOptionMenu *)omenu2)->menu_item),i);
|
||||
(((GtkOptionMenu *)omenu3)->menu_item), i);
|
||||
|
||||
gtk_clist_set_column_justification (GTK_CLIST (ctree), ctree->tree_column,
|
||||
(GtkJustification) (1-i));
|
||||
(GtkJustification) (1 - i));
|
||||
}
|
||||
|
||||
void ctree_toggle_sel_mode (GtkWidget *widget, GtkCTree *ctree)
|
||||
@ -4424,9 +4581,9 @@ void ctree_toggle_sel_mode (GtkWidget *widget, GtkCTree *ctree)
|
||||
return;
|
||||
|
||||
RADIOMENUTOGGLED ((GtkRadioMenuItem *)
|
||||
(((GtkOptionMenu *)omenu3)->menu_item), i);
|
||||
(((GtkOptionMenu *)omenu4)->menu_item), i);
|
||||
|
||||
gtk_clist_set_selection_mode (GTK_CLIST (ctree), (GtkSelectionMode) (3-i));
|
||||
gtk_clist_set_selection_mode (GTK_CLIST (ctree), (GtkSelectionMode) (3 - i));
|
||||
after_press (ctree, NULL);
|
||||
}
|
||||
|
||||
@ -4452,8 +4609,9 @@ void build_recursive (GtkCTree *ctree, gint cur_depth, gint depth,
|
||||
pixmap3, mask3, NULL, NULL,
|
||||
TRUE, FALSE);
|
||||
|
||||
if (ctree->line_style == GTK_CTREE_LINES_TABBED)
|
||||
gtk_ctree_node_set_background (ctree, sibling, col_bg);
|
||||
if (parent && ctree->line_style == GTK_CTREE_LINES_TABBED)
|
||||
gtk_ctree_node_set_row_style (ctree, sibling,
|
||||
GTK_CTREE_ROW (parent)->row.style);
|
||||
}
|
||||
|
||||
if (cur_depth == depth)
|
||||
@ -4461,6 +4619,8 @@ void build_recursive (GtkCTree *ctree, gint cur_depth, gint depth,
|
||||
|
||||
for (i = num_books; i > 0; i--)
|
||||
{
|
||||
GtkStyle *style;
|
||||
|
||||
books++;
|
||||
sprintf (buf1, "Book %02d", (gint) rand() % 100);
|
||||
sprintf (buf2, "Item %d-%d", cur_depth, i);
|
||||
@ -4468,32 +4628,30 @@ void build_recursive (GtkCTree *ctree, gint cur_depth, gint depth,
|
||||
pixmap1, mask1, pixmap2, mask2,
|
||||
FALSE, FALSE);
|
||||
|
||||
col_bg = g_new (GdkColor, 1);
|
||||
|
||||
if (cur_depth % 3 == 0)
|
||||
style = gtk_style_new();
|
||||
switch (cur_depth % 3)
|
||||
{
|
||||
col_bg->red = 10000 * (cur_depth % 6);
|
||||
col_bg->green = 0;
|
||||
col_bg->blue = 65535 - ((i * 10000) % 65535);
|
||||
case 0:
|
||||
style->bg[GTK_STATE_PRELIGHT].red = 10000 * (cur_depth % 6);
|
||||
style->bg[GTK_STATE_PRELIGHT].green = 0;
|
||||
style->bg[GTK_STATE_PRELIGHT].blue = 65535 - ((i * 10000) % 65535);
|
||||
break;
|
||||
case 1:
|
||||
style->bg[GTK_STATE_PRELIGHT].red = 10000 * (cur_depth % 6);
|
||||
style->bg[GTK_STATE_PRELIGHT].green = 65535 - ((i * 10000) % 65535);
|
||||
style->bg[GTK_STATE_PRELIGHT].blue = 0;
|
||||
break;
|
||||
default:
|
||||
style->bg[GTK_STATE_PRELIGHT].red = 65535 - ((i * 10000) % 65535);
|
||||
style->bg[GTK_STATE_PRELIGHT].green = 0;
|
||||
style->bg[GTK_STATE_PRELIGHT].blue = 10000 * (cur_depth % 6);
|
||||
break;
|
||||
}
|
||||
else if (cur_depth % 3 == 1)
|
||||
{
|
||||
col_bg->red = 10000 * (cur_depth % 6);
|
||||
col_bg->green = 65535 - ((i * 10000) % 65535);
|
||||
col_bg->blue = 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
col_bg->red = 65535 - ((i * 10000) % 65535);
|
||||
col_bg->green = 0;
|
||||
col_bg->blue = 10000 * (cur_depth % 6);
|
||||
}
|
||||
|
||||
gdk_color_alloc (gtk_widget_get_colormap (GTK_WIDGET (ctree)), col_bg);
|
||||
gtk_ctree_node_set_row_data_full (ctree, sibling, col_bg, g_free);
|
||||
gtk_ctree_node_set_row_data_full (ctree, sibling, style,
|
||||
(GtkDestroyNotify) gtk_style_unref);
|
||||
|
||||
if (ctree->line_style == GTK_CTREE_LINES_TABBED)
|
||||
gtk_ctree_node_set_background (ctree, sibling, col_bg);
|
||||
gtk_ctree_node_set_row_style (ctree, sibling, style);
|
||||
|
||||
build_recursive (ctree, cur_depth + 1, depth, num_books, num_pages,
|
||||
sibling);
|
||||
@ -4506,6 +4664,7 @@ void rebuild_tree (GtkWidget *widget, GtkCTree *ctree)
|
||||
gchar label1[] = "Root";
|
||||
gchar label2[] = "";
|
||||
GtkCTreeNode *parent;
|
||||
GtkStyle *style;
|
||||
guint b, d, p, n;
|
||||
|
||||
text[0] = label1;
|
||||
@ -4532,14 +4691,15 @@ void rebuild_tree (GtkWidget *widget, GtkCTree *ctree)
|
||||
parent = gtk_ctree_insert_node (ctree, NULL, NULL, text, 5, pixmap1,
|
||||
mask1, pixmap2, mask2, FALSE, TRUE);
|
||||
|
||||
col_bg = g_new (GdkColor, 1);
|
||||
col_bg->red = 0;
|
||||
col_bg->green = 45000;
|
||||
col_bg->blue = 55000;
|
||||
gdk_color_alloc (gtk_widget_get_colormap (GTK_WIDGET (ctree)), col_bg);
|
||||
gtk_ctree_node_set_row_data_full (ctree, parent, col_bg, g_free);
|
||||
style = gtk_style_new ();
|
||||
style->bg[GTK_STATE_PRELIGHT].red = 0;
|
||||
style->bg[GTK_STATE_PRELIGHT].green = 45000;
|
||||
style->bg[GTK_STATE_PRELIGHT].blue = 55000;
|
||||
gtk_ctree_node_set_row_data_full (ctree, parent, style,
|
||||
(GtkDestroyNotify) gtk_style_unref);
|
||||
|
||||
if (ctree->line_style == GTK_CTREE_LINES_TABBED)
|
||||
gtk_ctree_node_set_background (ctree, parent, col_bg);
|
||||
gtk_ctree_node_set_row_style (ctree, parent, style);
|
||||
|
||||
build_recursive (ctree, 1, d, b, p, parent);
|
||||
gtk_clist_thaw (GTK_CLIST (ctree));
|
||||
@ -4572,6 +4732,8 @@ void create_ctree (void)
|
||||
GtkTooltips *tooltips;
|
||||
GtkCTree *ctree;
|
||||
GtkWidget *vbox;
|
||||
GtkWidget *bbox;
|
||||
GtkWidget *mbox;
|
||||
GtkWidget *hbox;
|
||||
GtkWidget *hbox2;
|
||||
GtkWidget *frame;
|
||||
@ -4587,19 +4749,27 @@ void create_ctree (void)
|
||||
|
||||
static OptionMenuItem items1[] =
|
||||
{
|
||||
{ "No lines", ctree_toggle_line_style },
|
||||
{ "Solid", ctree_toggle_line_style },
|
||||
{ "Dotted", ctree_toggle_line_style },
|
||||
{ "Tabbed", ctree_toggle_line_style },
|
||||
{ "No lines", ctree_toggle_line_style }
|
||||
{ "Tabbed", ctree_toggle_line_style }
|
||||
};
|
||||
|
||||
static OptionMenuItem items2[] =
|
||||
{
|
||||
{ "None", ctree_toggle_expander_style },
|
||||
{ "Square", ctree_toggle_expander_style },
|
||||
{ "Triangle", ctree_toggle_expander_style },
|
||||
{ "Circular", ctree_toggle_expander_style }
|
||||
};
|
||||
|
||||
static OptionMenuItem items3[] =
|
||||
{
|
||||
{ "Left", ctree_toggle_justify },
|
||||
{ "Right", ctree_toggle_justify }
|
||||
};
|
||||
|
||||
static OptionMenuItem items3[] =
|
||||
static OptionMenuItem items4[] =
|
||||
{
|
||||
{ "Single", ctree_toggle_sel_mode },
|
||||
{ "Browse", ctree_toggle_sel_mode },
|
||||
@ -4665,6 +4835,8 @@ void create_ctree (void)
|
||||
|
||||
ctree = GTK_CTREE (gtk_ctree_new_with_titles (2, 0, title));
|
||||
gtk_ctree_set_line_style (ctree, GTK_CTREE_LINES_DOTTED);
|
||||
line_style = GTK_CTREE_LINES_DOTTED;
|
||||
|
||||
gtk_ctree_set_reorderable (ctree, TRUE);
|
||||
gtk_signal_connect (GTK_OBJECT (ctree), "click_column",
|
||||
(GtkSignalFunc) ctree_click_column,
|
||||
@ -4700,9 +4872,53 @@ void create_ctree (void)
|
||||
gtk_signal_connect (GTK_OBJECT (button), "clicked",
|
||||
GTK_SIGNAL_FUNC (rebuild_tree), ctree);
|
||||
|
||||
bbox = gtk_hbox_new (FALSE, 5);
|
||||
gtk_container_border_width (GTK_CONTAINER (bbox), 5);
|
||||
gtk_box_pack_start (GTK_BOX (vbox), bbox, FALSE, TRUE, 0);
|
||||
|
||||
mbox = gtk_vbox_new (TRUE, 5);
|
||||
gtk_box_pack_start (GTK_BOX (bbox), mbox, FALSE, TRUE, 0);
|
||||
|
||||
label = gtk_label_new ("Row height :");
|
||||
gtk_box_pack_start (GTK_BOX (mbox), label, FALSE, FALSE, 0);
|
||||
|
||||
label = gtk_label_new ("Indent :");
|
||||
gtk_box_pack_start (GTK_BOX (mbox), label, FALSE, FALSE, 0);
|
||||
|
||||
label = gtk_label_new ("Spacing :");
|
||||
gtk_box_pack_start (GTK_BOX (mbox), label, FALSE, FALSE, 0);
|
||||
|
||||
mbox = gtk_vbox_new (TRUE, 5);
|
||||
gtk_box_pack_start (GTK_BOX (bbox), mbox, FALSE, TRUE, 0);
|
||||
|
||||
adj = (GtkAdjustment *) gtk_adjustment_new (20, 12, 100, 1, 10, 0);
|
||||
spinner = gtk_spin_button_new (adj, 0, 0);
|
||||
gtk_tooltips_set_tip (tooltips, spinner,
|
||||
"Row height of list items", NULL);
|
||||
gtk_signal_connect (GTK_OBJECT (adj), "value_changed",
|
||||
GTK_SIGNAL_FUNC (change_row_height), ctree);
|
||||
gtk_box_pack_start (GTK_BOX (mbox), spinner, FALSE, FALSE, 5);
|
||||
gtk_clist_set_row_height ( GTK_CLIST (ctree), adj->value);
|
||||
|
||||
adj = (GtkAdjustment *) gtk_adjustment_new (20, 0, 60, 1, 10, 0);
|
||||
spinner = gtk_spin_button_new (adj, 0, 0);
|
||||
gtk_tooltips_set_tip (tooltips, spinner, "Tree indentation.", NULL);
|
||||
gtk_signal_connect (GTK_OBJECT (adj), "value_changed",
|
||||
GTK_SIGNAL_FUNC (change_indent), ctree);
|
||||
gtk_box_pack_start (GTK_BOX (mbox), spinner, FALSE, FALSE, 5);
|
||||
|
||||
adj = (GtkAdjustment *) gtk_adjustment_new (5, 0, 60, 1, 10, 0);
|
||||
spinner = gtk_spin_button_new (adj, 0, 0);
|
||||
gtk_tooltips_set_tip (tooltips, spinner, "Tree spacing.", NULL);
|
||||
gtk_signal_connect (GTK_OBJECT (adj), "value_changed",
|
||||
GTK_SIGNAL_FUNC (change_spacing), ctree);
|
||||
gtk_box_pack_start (GTK_BOX (mbox), spinner, FALSE, FALSE, 5);
|
||||
|
||||
mbox = gtk_vbox_new (TRUE, 5);
|
||||
gtk_box_pack_start (GTK_BOX (bbox), mbox, FALSE, TRUE, 0);
|
||||
|
||||
hbox = gtk_hbox_new (FALSE, 5);
|
||||
gtk_container_border_width (GTK_CONTAINER (hbox), 5);
|
||||
gtk_box_pack_start (GTK_BOX (vbox), hbox, FALSE, TRUE, 0);
|
||||
gtk_box_pack_start (GTK_BOX (mbox), hbox, FALSE, FALSE, 0);
|
||||
|
||||
button = gtk_button_new_with_label ("Expand all");
|
||||
gtk_signal_connect (GTK_OBJECT (button), "clicked",
|
||||
@ -4714,9 +4930,9 @@ void create_ctree (void)
|
||||
GTK_SIGNAL_FUNC (collapse_all), ctree);
|
||||
gtk_box_pack_start (GTK_BOX (hbox), button, TRUE, TRUE, 0);
|
||||
|
||||
button = gtk_button_new_with_label ("Sort tree");
|
||||
button = gtk_button_new_with_label ("Change Style");
|
||||
gtk_signal_connect (GTK_OBJECT (button), "clicked",
|
||||
GTK_SIGNAL_FUNC (sort_all), ctree);
|
||||
GTK_SIGNAL_FUNC (change_style), ctree);
|
||||
gtk_box_pack_start (GTK_BOX (hbox), button, TRUE, TRUE, 0);
|
||||
|
||||
button = gtk_button_new_with_label ("Export tree");
|
||||
@ -4725,20 +4941,7 @@ void create_ctree (void)
|
||||
gtk_box_pack_start (GTK_BOX (hbox), button, TRUE, TRUE, 0);
|
||||
|
||||
hbox = gtk_hbox_new (FALSE, 5);
|
||||
gtk_container_border_width (GTK_CONTAINER (hbox), 5);
|
||||
gtk_box_pack_start (GTK_BOX (vbox), hbox, FALSE, TRUE, 0);
|
||||
|
||||
label = gtk_label_new ("Row height :");
|
||||
gtk_box_pack_start (GTK_BOX (hbox), label, FALSE, TRUE, 0);
|
||||
|
||||
adj = (GtkAdjustment *) gtk_adjustment_new (20, 12, 100, 1, 10, 0);
|
||||
spinner = gtk_spin_button_new (adj, 0, 0);
|
||||
gtk_tooltips_set_tip (tooltips, spinner,
|
||||
"Row height of list items", NULL);
|
||||
gtk_signal_connect (GTK_OBJECT (adj), "value_changed",
|
||||
GTK_SIGNAL_FUNC (change_row_height), ctree);
|
||||
gtk_box_pack_start (GTK_BOX (hbox), spinner, FALSE, TRUE, 5);
|
||||
gtk_clist_set_row_height ( GTK_CLIST (ctree), adj->value);
|
||||
gtk_box_pack_start (GTK_BOX (mbox), hbox, FALSE, FALSE, 0);
|
||||
|
||||
button = gtk_button_new_with_label ("Select all");
|
||||
gtk_signal_connect (GTK_OBJECT (button), "clicked",
|
||||
@ -4755,23 +4958,6 @@ void create_ctree (void)
|
||||
GTK_SIGNAL_FUNC (remove_selection), ctree);
|
||||
gtk_box_pack_start (GTK_BOX (hbox), button, TRUE, TRUE, 0);
|
||||
|
||||
hbox = gtk_hbox_new (TRUE, 5);
|
||||
gtk_container_border_width (GTK_CONTAINER (hbox), 5);
|
||||
gtk_box_pack_start (GTK_BOX (vbox), hbox, FALSE, TRUE, 0);
|
||||
|
||||
hbox2 = gtk_hbox_new (FALSE, 0);
|
||||
gtk_box_pack_start (GTK_BOX (hbox), hbox2, FALSE, TRUE, 0);
|
||||
|
||||
label = gtk_label_new ("Indent :");
|
||||
gtk_box_pack_start (GTK_BOX (hbox2), label, FALSE, TRUE, 0);
|
||||
|
||||
adj = (GtkAdjustment *) gtk_adjustment_new (20, 0, 60, 1, 10, 0);
|
||||
spinner = gtk_spin_button_new (adj, 0, 0);
|
||||
gtk_tooltips_set_tip (tooltips, spinner, "Tree indentation.", NULL);
|
||||
gtk_signal_connect (GTK_OBJECT (adj), "value_changed",
|
||||
GTK_SIGNAL_FUNC (change_indent), ctree);
|
||||
gtk_box_pack_start (GTK_BOX (hbox2), spinner, FALSE, TRUE, 5);
|
||||
|
||||
check = gtk_check_button_new_with_label ("Reorderable");
|
||||
gtk_tooltips_set_tip (tooltips, check,
|
||||
"Tree items can be reordered by dragging.", NULL);
|
||||
@ -4780,20 +4966,28 @@ void create_ctree (void)
|
||||
gtk_box_pack_start (GTK_BOX (hbox), check, FALSE, TRUE, 0);
|
||||
gtk_toggle_button_set_state (GTK_TOGGLE_BUTTON (check), TRUE);
|
||||
|
||||
omenu1 = build_option_menu (items1, 4, 1, ctree);
|
||||
hbox = gtk_hbox_new (TRUE, 5);
|
||||
gtk_box_pack_start (GTK_BOX (mbox), hbox, FALSE, FALSE, 0);
|
||||
|
||||
omenu1 = build_option_menu (items1, 4, 2, ctree);
|
||||
gtk_tooltips_set_tip (tooltips, omenu1, "The tree's line style.", NULL);
|
||||
gtk_box_pack_start (GTK_BOX (hbox), omenu1, FALSE, TRUE, 0);
|
||||
|
||||
omenu2 = build_option_menu (items2, 2, 0, ctree);
|
||||
gtk_tooltips_set_tip (tooltips, omenu2, "The tree's justification.",
|
||||
omenu2 = build_option_menu (items2, 4, 1, ctree);
|
||||
gtk_tooltips_set_tip (tooltips, omenu2, "The tree's expander style.",
|
||||
NULL);
|
||||
gtk_box_pack_start (GTK_BOX (hbox), omenu2, FALSE, TRUE, 0);
|
||||
|
||||
omenu3 = build_option_menu (items3, 4, 3, ctree);
|
||||
gtk_tooltips_set_tip (tooltips, omenu3, "The list's selection mode.",
|
||||
omenu3 = build_option_menu (items3, 2, 0, ctree);
|
||||
gtk_tooltips_set_tip (tooltips, omenu3, "The tree's justification.",
|
||||
NULL);
|
||||
gtk_box_pack_start (GTK_BOX (hbox), omenu3, FALSE, TRUE, 0);
|
||||
|
||||
omenu4 = build_option_menu (items4, 4, 3, ctree);
|
||||
gtk_tooltips_set_tip (tooltips, omenu4, "The list's selection mode.",
|
||||
NULL);
|
||||
gtk_box_pack_start (GTK_BOX (hbox), omenu4, FALSE, TRUE, 0);
|
||||
|
||||
gtk_widget_realize (window);
|
||||
|
||||
pixmap1 = gdk_pixmap_create_from_xpm_d (window->window, &mask1,
|
||||
|
||||
498
tests/testgtk.c
498
tests/testgtk.c
@ -3468,6 +3468,46 @@ static char * mini_page_xpm[] = {
|
||||
" oooooooooo ",
|
||||
" "};
|
||||
|
||||
static char * gtk_mini_xpm[] = {
|
||||
"15 20 17 1",
|
||||
" c None",
|
||||
". c #14121F",
|
||||
"+ c #278828",
|
||||
"@ c #9B3334",
|
||||
"# c #284C72",
|
||||
"$ c #24692A",
|
||||
"% c #69282E",
|
||||
"& c #37C539",
|
||||
"* c #1D2F4D",
|
||||
"= c #6D7076",
|
||||
"- c #7D8482",
|
||||
"; c #E24A49",
|
||||
"> c #515357",
|
||||
", c #9B9C9B",
|
||||
"' c #2FA232",
|
||||
") c #3CE23D",
|
||||
"! c #3B6CCB",
|
||||
" ",
|
||||
" ***> ",
|
||||
" >.*!!!* ",
|
||||
" ***....#*= ",
|
||||
" *!*.!!!**!!# ",
|
||||
" .!!#*!#*!!!!# ",
|
||||
" @%#!.##.*!!$& ",
|
||||
" @;%*!*.#!#')) ",
|
||||
" @;;@%!!*$&)'' ",
|
||||
" @%.%@%$'&)$+' ",
|
||||
" @;...@$'*'*)+ ",
|
||||
" @;%..@$+*.')$ ",
|
||||
" @;%%;;$+..$)# ",
|
||||
" @;%%;@$$$'.$# ",
|
||||
" %;@@;;$$+))&* ",
|
||||
" %;;;@+$&)&* ",
|
||||
" %;;@'))+> ",
|
||||
" %;@'&# ",
|
||||
" >%$$ ",
|
||||
" >= "};
|
||||
|
||||
#define TESTGTK_CLIST_COLUMNS 20
|
||||
static gint clist_rows = 0;
|
||||
static GtkWidget *clist_omenu;
|
||||
@ -3480,11 +3520,14 @@ add1000_clist (GtkWidget *widget, gpointer data)
|
||||
char *texts[TESTGTK_CLIST_COLUMNS];
|
||||
GdkBitmap *mask;
|
||||
GdkPixmap *pixmap;
|
||||
GtkCList *clist;
|
||||
|
||||
pixmap = gdk_pixmap_create_from_xpm_d (GTK_CLIST (data)->clist_window,
|
||||
clist = GTK_CLIST (data);
|
||||
|
||||
pixmap = gdk_pixmap_create_from_xpm_d (clist->clist_window,
|
||||
&mask,
|
||||
>K_WIDGET (data)->style->white,
|
||||
mini_page_xpm);
|
||||
gtk_mini_xpm);
|
||||
|
||||
for (i = 0; i < TESTGTK_CLIST_COLUMNS; i++)
|
||||
{
|
||||
@ -3499,9 +3542,9 @@ add1000_clist (GtkWidget *widget, gpointer data)
|
||||
gtk_clist_freeze (GTK_CLIST (data));
|
||||
for (i = 0; i < 1000; i++)
|
||||
{
|
||||
sprintf (text[0], "Row %d", rand() % 10000 /*clist_rows++*/);
|
||||
row = gtk_clist_append (GTK_CLIST (data), texts);
|
||||
gtk_clist_set_pixtext (GTK_CLIST (data), row, 3, "Hello World", 5, pixmap, mask);
|
||||
sprintf (text[0], "Row %d", rand() % 10000);
|
||||
row = gtk_clist_append (clist, texts);
|
||||
gtk_clist_set_pixtext (clist, row, 3, "gtk+", 5, pixmap, mask);
|
||||
}
|
||||
|
||||
gtk_clist_thaw (GTK_CLIST (data));
|
||||
@ -3692,10 +3735,48 @@ insert_row_clist (GtkWidget *widget, gpointer data)
|
||||
"This", "is", "a", "inserted", "row."
|
||||
};
|
||||
|
||||
static GtkStyle *style1 = NULL;
|
||||
static GtkStyle *style2 = NULL;
|
||||
static GtkStyle *style3 = NULL;
|
||||
gint row;
|
||||
|
||||
if (GTK_CLIST (data)->focus_row >= 0)
|
||||
gtk_clist_insert (GTK_CLIST (data), GTK_CLIST (data)->focus_row, text);
|
||||
row = gtk_clist_insert (GTK_CLIST (data), GTK_CLIST (data)->focus_row,
|
||||
text);
|
||||
else
|
||||
gtk_clist_insert (GTK_CLIST (data), 0, text);
|
||||
row = gtk_clist_prepend (GTK_CLIST (data), text);
|
||||
|
||||
if (!style1)
|
||||
{
|
||||
GdkColor col1;
|
||||
GdkColor col2;
|
||||
|
||||
col1.red = 0;
|
||||
col1.green = 56000;
|
||||
col1.blue = 0;
|
||||
col2.red = 32000;
|
||||
col2.green = 0;
|
||||
col2.blue = 56000;
|
||||
|
||||
style1 = gtk_style_copy (GTK_WIDGET (data)->style);
|
||||
style1->bg[GTK_STATE_PRELIGHT] = col1;
|
||||
style1->bg[GTK_STATE_SELECTED] = col2;
|
||||
|
||||
style2 = gtk_style_copy (GTK_WIDGET (data)->style);
|
||||
style2->fg[GTK_STATE_PRELIGHT] = col1;
|
||||
style2->fg[GTK_STATE_SELECTED] = col2;
|
||||
|
||||
style3 = gtk_style_copy (GTK_WIDGET (data)->style);
|
||||
style3->fg[GTK_STATE_PRELIGHT] = col1;
|
||||
style3->bg[GTK_STATE_PRELIGHT] = col2;
|
||||
gdk_font_unref (style3->font);
|
||||
style3->font =
|
||||
gdk_font_load ("-*-courier-medium-*-*-*-*-120-*-*-*-*-*-*");
|
||||
}
|
||||
|
||||
gtk_clist_set_cell_style (GTK_CLIST (data), row, 3, style1);
|
||||
gtk_clist_set_cell_style (GTK_CLIST (data), row, 4, style2);
|
||||
gtk_clist_set_cell_style (GTK_CLIST (data), row, 0, style3);
|
||||
|
||||
clist_rows++;
|
||||
}
|
||||
@ -3749,7 +3830,9 @@ clist_toggle_sel_mode (GtkWidget *widget, GtkCList *clist)
|
||||
static void
|
||||
clist_click_column (GtkCList *clist, gint column, gpointer data)
|
||||
{
|
||||
if (column == clist->sort_column)
|
||||
if (column == 5)
|
||||
gtk_clist_set_column_visibility (clist, column, FALSE);
|
||||
else if (column == clist->sort_column)
|
||||
{
|
||||
if (clist->sort_type == GTK_SORT_ASCENDING)
|
||||
clist->sort_type = GTK_SORT_DESCENDING;
|
||||
@ -3770,10 +3853,11 @@ create_clist (void)
|
||||
|
||||
static char *titles[] =
|
||||
{
|
||||
"Title 0", "Title 1", "Title 2", "Title 3", "Title 4",
|
||||
"Title 5", "Title 6", "Title 7", "Title 8", "Title 9",
|
||||
"Title 10", "Title 11", "Title 12", "Title 13", "Title 14",
|
||||
"Title 15", "Title 16", "Title 17", "Title 18", "Title 19"
|
||||
"Title 0", "Title 1", "not resizeable", "max width 120",
|
||||
"min width 40", "hide column", "Title 6", "Title 7",
|
||||
"Title 8", "Title 9", "Title 10", "Title 11", "Title 12",
|
||||
"Title 13", "Title 14", "Title 15", "Title 16", "Title 17",
|
||||
"Title 18", "Title 19"
|
||||
};
|
||||
|
||||
static OptionMenuItem items[] =
|
||||
@ -3796,14 +3880,17 @@ create_clist (void)
|
||||
GtkWidget *undo_button;
|
||||
GtkWidget *label;
|
||||
|
||||
GtkStyle *style;
|
||||
GdkColor col1;
|
||||
GdkColor col2;
|
||||
|
||||
if (!window)
|
||||
{
|
||||
clist_rows = 0;
|
||||
window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
|
||||
|
||||
gtk_signal_connect (GTK_OBJECT (window), "destroy",
|
||||
GTK_SIGNAL_FUNC(gtk_widget_destroyed),
|
||||
&window);
|
||||
GTK_SIGNAL_FUNC (gtk_widget_destroyed), &window);
|
||||
|
||||
gtk_window_set_title (GTK_WINDOW (window), "clist");
|
||||
gtk_container_border_width (GTK_CONTAINER (window), 0);
|
||||
@ -3821,41 +3908,32 @@ create_clist (void)
|
||||
/*clist = gtk_clist_new (TESTGTK_CLIST_COLUMNS);*/
|
||||
|
||||
gtk_signal_connect (GTK_OBJECT (clist), "click_column",
|
||||
(GtkSignalFunc) clist_click_column,
|
||||
NULL);
|
||||
(GtkSignalFunc) clist_click_column, NULL);
|
||||
|
||||
/* control buttons */
|
||||
button = gtk_button_new_with_label ("Add 1,000 Rows With Pixmaps");
|
||||
gtk_box_pack_start (GTK_BOX (box2), button, TRUE, TRUE, 0);
|
||||
|
||||
gtk_signal_connect (GTK_OBJECT (button),
|
||||
"clicked",
|
||||
(GtkSignalFunc) add1000_clist,
|
||||
(gpointer) clist);
|
||||
gtk_signal_connect (GTK_OBJECT (button), "clicked",
|
||||
(GtkSignalFunc) add1000_clist, (gpointer) clist);
|
||||
|
||||
button = gtk_button_new_with_label ("Add 10,000 Rows");
|
||||
gtk_box_pack_start (GTK_BOX (box2), button, TRUE, TRUE, 0);
|
||||
|
||||
gtk_signal_connect (GTK_OBJECT (button),
|
||||
"clicked",
|
||||
(GtkSignalFunc) add10000_clist,
|
||||
(gpointer) clist);
|
||||
gtk_signal_connect (GTK_OBJECT (button), "clicked",
|
||||
(GtkSignalFunc) add10000_clist, (gpointer) clist);
|
||||
|
||||
button = gtk_button_new_with_label ("Clear List");
|
||||
gtk_box_pack_start (GTK_BOX (box2), button, TRUE, TRUE, 0);
|
||||
|
||||
gtk_signal_connect (GTK_OBJECT (button),
|
||||
"clicked",
|
||||
(GtkSignalFunc) clear_clist,
|
||||
(gpointer) clist);
|
||||
gtk_signal_connect (GTK_OBJECT (button), "clicked",
|
||||
(GtkSignalFunc) clear_clist, (gpointer) clist);
|
||||
|
||||
button = gtk_button_new_with_label ("Remove Row");
|
||||
gtk_box_pack_start (GTK_BOX (box2), button, TRUE, TRUE, 0);
|
||||
|
||||
gtk_signal_connect (GTK_OBJECT (button),
|
||||
"clicked",
|
||||
(GtkSignalFunc) remove_row_clist,
|
||||
(gpointer) clist);
|
||||
gtk_signal_connect (GTK_OBJECT (button), "clicked",
|
||||
(GtkSignalFunc) remove_row_clist, (gpointer) clist);
|
||||
|
||||
/* second layer of buttons */
|
||||
box2 = gtk_hbox_new (FALSE, 10);
|
||||
@ -3865,34 +3943,26 @@ create_clist (void)
|
||||
button = gtk_button_new_with_label ("Insert Row");
|
||||
gtk_box_pack_start (GTK_BOX (box2), button, TRUE, TRUE, 0);
|
||||
|
||||
gtk_signal_connect (GTK_OBJECT (button),
|
||||
"clicked",
|
||||
(GtkSignalFunc) insert_row_clist,
|
||||
(gpointer) clist);
|
||||
gtk_signal_connect (GTK_OBJECT (button), "clicked",
|
||||
(GtkSignalFunc) insert_row_clist, (gpointer) clist);
|
||||
|
||||
button = gtk_button_new_with_label ("Show Title Buttons");
|
||||
gtk_box_pack_start (GTK_BOX (box2), button, TRUE, TRUE, 0);
|
||||
|
||||
gtk_signal_connect (GTK_OBJECT (button),
|
||||
"clicked",
|
||||
(GtkSignalFunc) show_titles_clist,
|
||||
(gpointer) clist);
|
||||
gtk_signal_connect (GTK_OBJECT (button), "clicked",
|
||||
(GtkSignalFunc) show_titles_clist, (gpointer) clist);
|
||||
|
||||
button = gtk_button_new_with_label ("Hide Title Buttons");
|
||||
gtk_box_pack_start (GTK_BOX (box2), button, TRUE, TRUE, 0);
|
||||
|
||||
gtk_signal_connect (GTK_OBJECT (button),
|
||||
"clicked",
|
||||
(GtkSignalFunc) hide_titles_clist,
|
||||
(gpointer) clist);
|
||||
gtk_signal_connect (GTK_OBJECT (button), "clicked",
|
||||
(GtkSignalFunc) hide_titles_clist, (gpointer) clist);
|
||||
|
||||
button = gtk_button_new_with_label ("Warning Test");
|
||||
gtk_box_pack_start (GTK_BOX (box2), button, TRUE, TRUE, 0);
|
||||
|
||||
gtk_signal_connect (GTK_OBJECT (button),
|
||||
"clicked",
|
||||
(GtkSignalFunc) clist_warning_test,
|
||||
(gpointer) clist);
|
||||
gtk_signal_connect (GTK_OBJECT (button), "clicked",
|
||||
(GtkSignalFunc) clist_warning_test,(gpointer) clist);
|
||||
|
||||
box2 = gtk_hbox_new (FALSE, 10);
|
||||
gtk_container_border_width (GTK_CONTAINER (box2), 10);
|
||||
@ -3900,10 +3970,8 @@ create_clist (void)
|
||||
|
||||
undo_button = gtk_button_new_with_label ("Undo last selection");
|
||||
gtk_box_pack_start (GTK_BOX (box2), undo_button, TRUE, TRUE, 0);
|
||||
gtk_signal_connect (GTK_OBJECT (undo_button),
|
||||
"clicked",
|
||||
(GtkSignalFunc) undo_selection,
|
||||
(gpointer) clist);
|
||||
gtk_signal_connect (GTK_OBJECT (undo_button), "clicked",
|
||||
(GtkSignalFunc) undo_selection, (gpointer) clist);
|
||||
|
||||
label = gtk_label_new ("Selection Mode :");
|
||||
gtk_box_pack_start (GTK_BOX (box2), label, FALSE, TRUE, 0);
|
||||
@ -3940,6 +4008,10 @@ create_clist (void)
|
||||
for (i = 1; i < TESTGTK_CLIST_COLUMNS; i++)
|
||||
gtk_clist_set_column_width (GTK_CLIST (clist), i, 80);
|
||||
|
||||
gtk_clist_set_column_resizeable (GTK_CLIST (clist), 2, FALSE);
|
||||
gtk_clist_set_column_max_width (GTK_CLIST (clist), 3, 120);
|
||||
gtk_clist_set_column_min_width (GTK_CLIST (clist), 4, 40);
|
||||
|
||||
gtk_clist_set_selection_mode (GTK_CLIST (clist), GTK_SELECTION_EXTENDED);
|
||||
gtk_clist_set_policy (GTK_CLIST (clist), GTK_POLICY_AUTOMATIC,
|
||||
GTK_POLICY_AUTOMATIC);
|
||||
@ -3958,10 +4030,35 @@ create_clist (void)
|
||||
sprintf (text[1], "Right");
|
||||
sprintf (text[2], "Center");
|
||||
|
||||
col1.red = 56000;
|
||||
col1.green = 0;
|
||||
col1.blue = 0;
|
||||
col2.red = 0;
|
||||
col2.green = 56000;
|
||||
col2.blue = 32000;
|
||||
|
||||
style = gtk_style_new ();
|
||||
style->fg[GTK_STATE_PRELIGHT] = col1;
|
||||
style->bg[GTK_STATE_PRELIGHT] = col2;
|
||||
|
||||
gdk_font_unref (style->font);
|
||||
style->font =
|
||||
gdk_font_load ("-adobe-helvetica-bold-r-*-*-*-140-*-*-*-*-*-*");
|
||||
|
||||
for (i = 0; i < 10; i++)
|
||||
{
|
||||
sprintf (text[0], "Row %d", clist_rows++);
|
||||
gtk_clist_append (GTK_CLIST (clist), texts);
|
||||
|
||||
switch (i % 4)
|
||||
{
|
||||
case 2:
|
||||
gtk_clist_set_row_style (GTK_CLIST (clist), i, style);
|
||||
break;
|
||||
default:
|
||||
gtk_clist_set_cell_style (GTK_CLIST (clist), i, i % 4, style);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
gtk_container_border_width (GTK_CONTAINER (clist), 5);
|
||||
@ -4014,10 +4111,11 @@ static GtkWidget *vis_label;
|
||||
static GtkWidget *omenu1;
|
||||
static GtkWidget *omenu2;
|
||||
static GtkWidget *omenu3;
|
||||
static GtkWidget *omenu4;
|
||||
static GtkWidget *spin1;
|
||||
static GtkWidget *spin2;
|
||||
static GtkWidget *spin3;
|
||||
static GdkColor *col_bg;
|
||||
static gint line_style;
|
||||
|
||||
void after_press (GtkCTree *ctree, gpointer data)
|
||||
{
|
||||
@ -4150,6 +4248,55 @@ void select_all (GtkWidget *widget, GtkCTree *ctree)
|
||||
after_press (ctree, NULL);
|
||||
}
|
||||
|
||||
void change_style (GtkWidget *widget, GtkCTree *ctree)
|
||||
{
|
||||
static GtkStyle *style1 = NULL;
|
||||
static GtkStyle *style2 = NULL;
|
||||
|
||||
GtkCTreeNode *node;
|
||||
GdkColor col1;
|
||||
GdkColor col2;
|
||||
|
||||
if (GTK_CLIST (ctree)->focus_row >= 0)
|
||||
node = GTK_CTREE_NODE
|
||||
(g_list_nth (GTK_CLIST (ctree)->row_list,GTK_CLIST (ctree)->focus_row));
|
||||
else
|
||||
node = GTK_CTREE_NODE (GTK_CLIST (ctree)->row_list);
|
||||
|
||||
if (!node)
|
||||
return;
|
||||
|
||||
if (!style1)
|
||||
{
|
||||
col1.red = 0;
|
||||
col1.green = 56000;
|
||||
col1.blue = 0;
|
||||
col2.red = 32000;
|
||||
col2.green = 0;
|
||||
col2.blue = 56000;
|
||||
|
||||
style1 = gtk_style_new ();
|
||||
style1->bg[GTK_STATE_PRELIGHT] = col1;
|
||||
style1->fg[GTK_STATE_SELECTED] = col2;
|
||||
|
||||
style2 = gtk_style_new ();
|
||||
style2->bg[GTK_STATE_SELECTED] = col2;
|
||||
style2->fg[GTK_STATE_PRELIGHT] = col1;
|
||||
style2->bg[GTK_STATE_PRELIGHT] = col2;
|
||||
gdk_font_unref (style2->font);
|
||||
style2->font =
|
||||
gdk_font_load ("-*-courier-medium-*-*-*-*-300-*-*-*-*-*-*");
|
||||
}
|
||||
|
||||
gtk_ctree_node_set_cell_style (ctree, node, 1, style1);
|
||||
gtk_ctree_node_set_cell_style (ctree, node, 0, style2);
|
||||
|
||||
if (GTK_CTREE_ROW (node)->children)
|
||||
gtk_ctree_node_set_row_style (ctree, GTK_CTREE_ROW (node)->children,
|
||||
style2);
|
||||
|
||||
}
|
||||
|
||||
void unselect_all (GtkWidget *widget, GtkCTree *ctree)
|
||||
{
|
||||
gtk_ctree_unselect_recursive (ctree, NULL);
|
||||
@ -4204,11 +4351,6 @@ void remove_selection (GtkWidget *widget, GtkCTree *ctree)
|
||||
after_press (ctree, NULL);
|
||||
}
|
||||
|
||||
void sort_all (GtkWidget *widget, GtkCTree *ctree)
|
||||
{
|
||||
gtk_ctree_sort_recursive (ctree, NULL);
|
||||
}
|
||||
|
||||
struct _ExportStruct {
|
||||
gchar *tree;
|
||||
gchar *info;
|
||||
@ -4352,6 +4494,11 @@ void change_indent (GtkWidget *widget, GtkCTree *ctree)
|
||||
gtk_ctree_set_indent (ctree, GTK_ADJUSTMENT (widget)->value);
|
||||
}
|
||||
|
||||
void change_spacing (GtkWidget *widget, GtkCTree *ctree)
|
||||
{
|
||||
gtk_ctree_set_spacing (ctree, GTK_ADJUSTMENT (widget)->value);
|
||||
}
|
||||
|
||||
void change_row_height (GtkWidget *widget, GtkCList *clist)
|
||||
{
|
||||
gtk_clist_set_row_height (clist, GTK_ADJUSTMENT (widget)->value);
|
||||
@ -4364,24 +4511,20 @@ void toggle_reorderable (GtkWidget *widget, GtkCTree *ctree)
|
||||
|
||||
void set_background (GtkCTree *ctree, GtkCTreeNode *node, gpointer data)
|
||||
{
|
||||
GtkStyle *style = NULL;
|
||||
|
||||
if (!node)
|
||||
return;
|
||||
|
||||
if (ctree->line_style != GTK_CTREE_LINES_TABBED)
|
||||
{
|
||||
if (GTK_CTREE_ROW (node)->is_leaf)
|
||||
{
|
||||
if (GTK_CTREE_ROW (node)->parent)
|
||||
gtk_ctree_node_set_background
|
||||
(ctree, node,
|
||||
GTK_CTREE_ROW (GTK_CTREE_ROW (node)->parent)->row.data);
|
||||
if (!GTK_CTREE_ROW (node)->is_leaf)
|
||||
style = GTK_CTREE_ROW (node)->row.data;
|
||||
else if (GTK_CTREE_ROW (node)->parent)
|
||||
style = GTK_CTREE_ROW (GTK_CTREE_ROW (node)->parent)->row.data;
|
||||
}
|
||||
else
|
||||
gtk_ctree_node_set_background (ctree, node,
|
||||
GTK_CTREE_ROW (node)->row.data);
|
||||
}
|
||||
else
|
||||
gtk_ctree_node_set_background (ctree, node, NULL);
|
||||
|
||||
gtk_ctree_node_set_row_style (ctree, node, style);
|
||||
}
|
||||
|
||||
void ctree_toggle_line_style (GtkWidget *widget, GtkCTree *ctree)
|
||||
@ -4392,14 +4535,28 @@ void ctree_toggle_line_style (GtkWidget *widget, GtkCTree *ctree)
|
||||
return;
|
||||
|
||||
RADIOMENUTOGGLED ((GtkRadioMenuItem *)
|
||||
(((GtkOptionMenu *)omenu1)->menu_item),i);
|
||||
(((GtkOptionMenu *)omenu1)->menu_item), i);
|
||||
|
||||
if ((ctree->line_style == GTK_CTREE_LINES_TABBED &&
|
||||
((GtkCTreeLineStyle) (3-i)) != GTK_CTREE_LINES_TABBED) ||
|
||||
((GtkCTreeLineStyle) (3 - i)) != GTK_CTREE_LINES_TABBED) ||
|
||||
(ctree->line_style != GTK_CTREE_LINES_TABBED &&
|
||||
((GtkCTreeLineStyle) (3-i)) == GTK_CTREE_LINES_TABBED))
|
||||
((GtkCTreeLineStyle) (3 - i)) == GTK_CTREE_LINES_TABBED))
|
||||
gtk_ctree_pre_recursive (ctree, NULL, set_background, NULL);
|
||||
gtk_ctree_set_line_style (ctree, (GtkCTreeLineStyle) (3-i));
|
||||
gtk_ctree_set_line_style (ctree, 3 - i);
|
||||
line_style = 3 - i;
|
||||
}
|
||||
|
||||
void ctree_toggle_expander_style (GtkWidget *widget, GtkCTree *ctree)
|
||||
{
|
||||
gint i;
|
||||
|
||||
if (!GTK_WIDGET_MAPPED (widget))
|
||||
return;
|
||||
|
||||
RADIOMENUTOGGLED ((GtkRadioMenuItem *)
|
||||
(((GtkOptionMenu *)omenu2)->menu_item), i);
|
||||
|
||||
gtk_ctree_set_expander_style (ctree, (GtkCTreeExpanderStyle) (3 - i));
|
||||
}
|
||||
|
||||
void ctree_toggle_justify (GtkWidget *widget, GtkCTree *ctree)
|
||||
@ -4410,10 +4567,10 @@ void ctree_toggle_justify (GtkWidget *widget, GtkCTree *ctree)
|
||||
return;
|
||||
|
||||
RADIOMENUTOGGLED ((GtkRadioMenuItem *)
|
||||
(((GtkOptionMenu *)omenu2)->menu_item),i);
|
||||
(((GtkOptionMenu *)omenu3)->menu_item), i);
|
||||
|
||||
gtk_clist_set_column_justification (GTK_CLIST (ctree), ctree->tree_column,
|
||||
(GtkJustification) (1-i));
|
||||
(GtkJustification) (1 - i));
|
||||
}
|
||||
|
||||
void ctree_toggle_sel_mode (GtkWidget *widget, GtkCTree *ctree)
|
||||
@ -4424,9 +4581,9 @@ void ctree_toggle_sel_mode (GtkWidget *widget, GtkCTree *ctree)
|
||||
return;
|
||||
|
||||
RADIOMENUTOGGLED ((GtkRadioMenuItem *)
|
||||
(((GtkOptionMenu *)omenu3)->menu_item), i);
|
||||
(((GtkOptionMenu *)omenu4)->menu_item), i);
|
||||
|
||||
gtk_clist_set_selection_mode (GTK_CLIST (ctree), (GtkSelectionMode) (3-i));
|
||||
gtk_clist_set_selection_mode (GTK_CLIST (ctree), (GtkSelectionMode) (3 - i));
|
||||
after_press (ctree, NULL);
|
||||
}
|
||||
|
||||
@ -4452,8 +4609,9 @@ void build_recursive (GtkCTree *ctree, gint cur_depth, gint depth,
|
||||
pixmap3, mask3, NULL, NULL,
|
||||
TRUE, FALSE);
|
||||
|
||||
if (ctree->line_style == GTK_CTREE_LINES_TABBED)
|
||||
gtk_ctree_node_set_background (ctree, sibling, col_bg);
|
||||
if (parent && ctree->line_style == GTK_CTREE_LINES_TABBED)
|
||||
gtk_ctree_node_set_row_style (ctree, sibling,
|
||||
GTK_CTREE_ROW (parent)->row.style);
|
||||
}
|
||||
|
||||
if (cur_depth == depth)
|
||||
@ -4461,6 +4619,8 @@ void build_recursive (GtkCTree *ctree, gint cur_depth, gint depth,
|
||||
|
||||
for (i = num_books; i > 0; i--)
|
||||
{
|
||||
GtkStyle *style;
|
||||
|
||||
books++;
|
||||
sprintf (buf1, "Book %02d", (gint) rand() % 100);
|
||||
sprintf (buf2, "Item %d-%d", cur_depth, i);
|
||||
@ -4468,32 +4628,30 @@ void build_recursive (GtkCTree *ctree, gint cur_depth, gint depth,
|
||||
pixmap1, mask1, pixmap2, mask2,
|
||||
FALSE, FALSE);
|
||||
|
||||
col_bg = g_new (GdkColor, 1);
|
||||
|
||||
if (cur_depth % 3 == 0)
|
||||
style = gtk_style_new();
|
||||
switch (cur_depth % 3)
|
||||
{
|
||||
col_bg->red = 10000 * (cur_depth % 6);
|
||||
col_bg->green = 0;
|
||||
col_bg->blue = 65535 - ((i * 10000) % 65535);
|
||||
case 0:
|
||||
style->bg[GTK_STATE_PRELIGHT].red = 10000 * (cur_depth % 6);
|
||||
style->bg[GTK_STATE_PRELIGHT].green = 0;
|
||||
style->bg[GTK_STATE_PRELIGHT].blue = 65535 - ((i * 10000) % 65535);
|
||||
break;
|
||||
case 1:
|
||||
style->bg[GTK_STATE_PRELIGHT].red = 10000 * (cur_depth % 6);
|
||||
style->bg[GTK_STATE_PRELIGHT].green = 65535 - ((i * 10000) % 65535);
|
||||
style->bg[GTK_STATE_PRELIGHT].blue = 0;
|
||||
break;
|
||||
default:
|
||||
style->bg[GTK_STATE_PRELIGHT].red = 65535 - ((i * 10000) % 65535);
|
||||
style->bg[GTK_STATE_PRELIGHT].green = 0;
|
||||
style->bg[GTK_STATE_PRELIGHT].blue = 10000 * (cur_depth % 6);
|
||||
break;
|
||||
}
|
||||
else if (cur_depth % 3 == 1)
|
||||
{
|
||||
col_bg->red = 10000 * (cur_depth % 6);
|
||||
col_bg->green = 65535 - ((i * 10000) % 65535);
|
||||
col_bg->blue = 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
col_bg->red = 65535 - ((i * 10000) % 65535);
|
||||
col_bg->green = 0;
|
||||
col_bg->blue = 10000 * (cur_depth % 6);
|
||||
}
|
||||
|
||||
gdk_color_alloc (gtk_widget_get_colormap (GTK_WIDGET (ctree)), col_bg);
|
||||
gtk_ctree_node_set_row_data_full (ctree, sibling, col_bg, g_free);
|
||||
gtk_ctree_node_set_row_data_full (ctree, sibling, style,
|
||||
(GtkDestroyNotify) gtk_style_unref);
|
||||
|
||||
if (ctree->line_style == GTK_CTREE_LINES_TABBED)
|
||||
gtk_ctree_node_set_background (ctree, sibling, col_bg);
|
||||
gtk_ctree_node_set_row_style (ctree, sibling, style);
|
||||
|
||||
build_recursive (ctree, cur_depth + 1, depth, num_books, num_pages,
|
||||
sibling);
|
||||
@ -4506,6 +4664,7 @@ void rebuild_tree (GtkWidget *widget, GtkCTree *ctree)
|
||||
gchar label1[] = "Root";
|
||||
gchar label2[] = "";
|
||||
GtkCTreeNode *parent;
|
||||
GtkStyle *style;
|
||||
guint b, d, p, n;
|
||||
|
||||
text[0] = label1;
|
||||
@ -4532,14 +4691,15 @@ void rebuild_tree (GtkWidget *widget, GtkCTree *ctree)
|
||||
parent = gtk_ctree_insert_node (ctree, NULL, NULL, text, 5, pixmap1,
|
||||
mask1, pixmap2, mask2, FALSE, TRUE);
|
||||
|
||||
col_bg = g_new (GdkColor, 1);
|
||||
col_bg->red = 0;
|
||||
col_bg->green = 45000;
|
||||
col_bg->blue = 55000;
|
||||
gdk_color_alloc (gtk_widget_get_colormap (GTK_WIDGET (ctree)), col_bg);
|
||||
gtk_ctree_node_set_row_data_full (ctree, parent, col_bg, g_free);
|
||||
style = gtk_style_new ();
|
||||
style->bg[GTK_STATE_PRELIGHT].red = 0;
|
||||
style->bg[GTK_STATE_PRELIGHT].green = 45000;
|
||||
style->bg[GTK_STATE_PRELIGHT].blue = 55000;
|
||||
gtk_ctree_node_set_row_data_full (ctree, parent, style,
|
||||
(GtkDestroyNotify) gtk_style_unref);
|
||||
|
||||
if (ctree->line_style == GTK_CTREE_LINES_TABBED)
|
||||
gtk_ctree_node_set_background (ctree, parent, col_bg);
|
||||
gtk_ctree_node_set_row_style (ctree, parent, style);
|
||||
|
||||
build_recursive (ctree, 1, d, b, p, parent);
|
||||
gtk_clist_thaw (GTK_CLIST (ctree));
|
||||
@ -4572,6 +4732,8 @@ void create_ctree (void)
|
||||
GtkTooltips *tooltips;
|
||||
GtkCTree *ctree;
|
||||
GtkWidget *vbox;
|
||||
GtkWidget *bbox;
|
||||
GtkWidget *mbox;
|
||||
GtkWidget *hbox;
|
||||
GtkWidget *hbox2;
|
||||
GtkWidget *frame;
|
||||
@ -4587,19 +4749,27 @@ void create_ctree (void)
|
||||
|
||||
static OptionMenuItem items1[] =
|
||||
{
|
||||
{ "No lines", ctree_toggle_line_style },
|
||||
{ "Solid", ctree_toggle_line_style },
|
||||
{ "Dotted", ctree_toggle_line_style },
|
||||
{ "Tabbed", ctree_toggle_line_style },
|
||||
{ "No lines", ctree_toggle_line_style }
|
||||
{ "Tabbed", ctree_toggle_line_style }
|
||||
};
|
||||
|
||||
static OptionMenuItem items2[] =
|
||||
{
|
||||
{ "None", ctree_toggle_expander_style },
|
||||
{ "Square", ctree_toggle_expander_style },
|
||||
{ "Triangle", ctree_toggle_expander_style },
|
||||
{ "Circular", ctree_toggle_expander_style }
|
||||
};
|
||||
|
||||
static OptionMenuItem items3[] =
|
||||
{
|
||||
{ "Left", ctree_toggle_justify },
|
||||
{ "Right", ctree_toggle_justify }
|
||||
};
|
||||
|
||||
static OptionMenuItem items3[] =
|
||||
static OptionMenuItem items4[] =
|
||||
{
|
||||
{ "Single", ctree_toggle_sel_mode },
|
||||
{ "Browse", ctree_toggle_sel_mode },
|
||||
@ -4665,6 +4835,8 @@ void create_ctree (void)
|
||||
|
||||
ctree = GTK_CTREE (gtk_ctree_new_with_titles (2, 0, title));
|
||||
gtk_ctree_set_line_style (ctree, GTK_CTREE_LINES_DOTTED);
|
||||
line_style = GTK_CTREE_LINES_DOTTED;
|
||||
|
||||
gtk_ctree_set_reorderable (ctree, TRUE);
|
||||
gtk_signal_connect (GTK_OBJECT (ctree), "click_column",
|
||||
(GtkSignalFunc) ctree_click_column,
|
||||
@ -4700,9 +4872,53 @@ void create_ctree (void)
|
||||
gtk_signal_connect (GTK_OBJECT (button), "clicked",
|
||||
GTK_SIGNAL_FUNC (rebuild_tree), ctree);
|
||||
|
||||
bbox = gtk_hbox_new (FALSE, 5);
|
||||
gtk_container_border_width (GTK_CONTAINER (bbox), 5);
|
||||
gtk_box_pack_start (GTK_BOX (vbox), bbox, FALSE, TRUE, 0);
|
||||
|
||||
mbox = gtk_vbox_new (TRUE, 5);
|
||||
gtk_box_pack_start (GTK_BOX (bbox), mbox, FALSE, TRUE, 0);
|
||||
|
||||
label = gtk_label_new ("Row height :");
|
||||
gtk_box_pack_start (GTK_BOX (mbox), label, FALSE, FALSE, 0);
|
||||
|
||||
label = gtk_label_new ("Indent :");
|
||||
gtk_box_pack_start (GTK_BOX (mbox), label, FALSE, FALSE, 0);
|
||||
|
||||
label = gtk_label_new ("Spacing :");
|
||||
gtk_box_pack_start (GTK_BOX (mbox), label, FALSE, FALSE, 0);
|
||||
|
||||
mbox = gtk_vbox_new (TRUE, 5);
|
||||
gtk_box_pack_start (GTK_BOX (bbox), mbox, FALSE, TRUE, 0);
|
||||
|
||||
adj = (GtkAdjustment *) gtk_adjustment_new (20, 12, 100, 1, 10, 0);
|
||||
spinner = gtk_spin_button_new (adj, 0, 0);
|
||||
gtk_tooltips_set_tip (tooltips, spinner,
|
||||
"Row height of list items", NULL);
|
||||
gtk_signal_connect (GTK_OBJECT (adj), "value_changed",
|
||||
GTK_SIGNAL_FUNC (change_row_height), ctree);
|
||||
gtk_box_pack_start (GTK_BOX (mbox), spinner, FALSE, FALSE, 5);
|
||||
gtk_clist_set_row_height ( GTK_CLIST (ctree), adj->value);
|
||||
|
||||
adj = (GtkAdjustment *) gtk_adjustment_new (20, 0, 60, 1, 10, 0);
|
||||
spinner = gtk_spin_button_new (adj, 0, 0);
|
||||
gtk_tooltips_set_tip (tooltips, spinner, "Tree indentation.", NULL);
|
||||
gtk_signal_connect (GTK_OBJECT (adj), "value_changed",
|
||||
GTK_SIGNAL_FUNC (change_indent), ctree);
|
||||
gtk_box_pack_start (GTK_BOX (mbox), spinner, FALSE, FALSE, 5);
|
||||
|
||||
adj = (GtkAdjustment *) gtk_adjustment_new (5, 0, 60, 1, 10, 0);
|
||||
spinner = gtk_spin_button_new (adj, 0, 0);
|
||||
gtk_tooltips_set_tip (tooltips, spinner, "Tree spacing.", NULL);
|
||||
gtk_signal_connect (GTK_OBJECT (adj), "value_changed",
|
||||
GTK_SIGNAL_FUNC (change_spacing), ctree);
|
||||
gtk_box_pack_start (GTK_BOX (mbox), spinner, FALSE, FALSE, 5);
|
||||
|
||||
mbox = gtk_vbox_new (TRUE, 5);
|
||||
gtk_box_pack_start (GTK_BOX (bbox), mbox, FALSE, TRUE, 0);
|
||||
|
||||
hbox = gtk_hbox_new (FALSE, 5);
|
||||
gtk_container_border_width (GTK_CONTAINER (hbox), 5);
|
||||
gtk_box_pack_start (GTK_BOX (vbox), hbox, FALSE, TRUE, 0);
|
||||
gtk_box_pack_start (GTK_BOX (mbox), hbox, FALSE, FALSE, 0);
|
||||
|
||||
button = gtk_button_new_with_label ("Expand all");
|
||||
gtk_signal_connect (GTK_OBJECT (button), "clicked",
|
||||
@ -4714,9 +4930,9 @@ void create_ctree (void)
|
||||
GTK_SIGNAL_FUNC (collapse_all), ctree);
|
||||
gtk_box_pack_start (GTK_BOX (hbox), button, TRUE, TRUE, 0);
|
||||
|
||||
button = gtk_button_new_with_label ("Sort tree");
|
||||
button = gtk_button_new_with_label ("Change Style");
|
||||
gtk_signal_connect (GTK_OBJECT (button), "clicked",
|
||||
GTK_SIGNAL_FUNC (sort_all), ctree);
|
||||
GTK_SIGNAL_FUNC (change_style), ctree);
|
||||
gtk_box_pack_start (GTK_BOX (hbox), button, TRUE, TRUE, 0);
|
||||
|
||||
button = gtk_button_new_with_label ("Export tree");
|
||||
@ -4725,20 +4941,7 @@ void create_ctree (void)
|
||||
gtk_box_pack_start (GTK_BOX (hbox), button, TRUE, TRUE, 0);
|
||||
|
||||
hbox = gtk_hbox_new (FALSE, 5);
|
||||
gtk_container_border_width (GTK_CONTAINER (hbox), 5);
|
||||
gtk_box_pack_start (GTK_BOX (vbox), hbox, FALSE, TRUE, 0);
|
||||
|
||||
label = gtk_label_new ("Row height :");
|
||||
gtk_box_pack_start (GTK_BOX (hbox), label, FALSE, TRUE, 0);
|
||||
|
||||
adj = (GtkAdjustment *) gtk_adjustment_new (20, 12, 100, 1, 10, 0);
|
||||
spinner = gtk_spin_button_new (adj, 0, 0);
|
||||
gtk_tooltips_set_tip (tooltips, spinner,
|
||||
"Row height of list items", NULL);
|
||||
gtk_signal_connect (GTK_OBJECT (adj), "value_changed",
|
||||
GTK_SIGNAL_FUNC (change_row_height), ctree);
|
||||
gtk_box_pack_start (GTK_BOX (hbox), spinner, FALSE, TRUE, 5);
|
||||
gtk_clist_set_row_height ( GTK_CLIST (ctree), adj->value);
|
||||
gtk_box_pack_start (GTK_BOX (mbox), hbox, FALSE, FALSE, 0);
|
||||
|
||||
button = gtk_button_new_with_label ("Select all");
|
||||
gtk_signal_connect (GTK_OBJECT (button), "clicked",
|
||||
@ -4755,23 +4958,6 @@ void create_ctree (void)
|
||||
GTK_SIGNAL_FUNC (remove_selection), ctree);
|
||||
gtk_box_pack_start (GTK_BOX (hbox), button, TRUE, TRUE, 0);
|
||||
|
||||
hbox = gtk_hbox_new (TRUE, 5);
|
||||
gtk_container_border_width (GTK_CONTAINER (hbox), 5);
|
||||
gtk_box_pack_start (GTK_BOX (vbox), hbox, FALSE, TRUE, 0);
|
||||
|
||||
hbox2 = gtk_hbox_new (FALSE, 0);
|
||||
gtk_box_pack_start (GTK_BOX (hbox), hbox2, FALSE, TRUE, 0);
|
||||
|
||||
label = gtk_label_new ("Indent :");
|
||||
gtk_box_pack_start (GTK_BOX (hbox2), label, FALSE, TRUE, 0);
|
||||
|
||||
adj = (GtkAdjustment *) gtk_adjustment_new (20, 0, 60, 1, 10, 0);
|
||||
spinner = gtk_spin_button_new (adj, 0, 0);
|
||||
gtk_tooltips_set_tip (tooltips, spinner, "Tree indentation.", NULL);
|
||||
gtk_signal_connect (GTK_OBJECT (adj), "value_changed",
|
||||
GTK_SIGNAL_FUNC (change_indent), ctree);
|
||||
gtk_box_pack_start (GTK_BOX (hbox2), spinner, FALSE, TRUE, 5);
|
||||
|
||||
check = gtk_check_button_new_with_label ("Reorderable");
|
||||
gtk_tooltips_set_tip (tooltips, check,
|
||||
"Tree items can be reordered by dragging.", NULL);
|
||||
@ -4780,20 +4966,28 @@ void create_ctree (void)
|
||||
gtk_box_pack_start (GTK_BOX (hbox), check, FALSE, TRUE, 0);
|
||||
gtk_toggle_button_set_state (GTK_TOGGLE_BUTTON (check), TRUE);
|
||||
|
||||
omenu1 = build_option_menu (items1, 4, 1, ctree);
|
||||
hbox = gtk_hbox_new (TRUE, 5);
|
||||
gtk_box_pack_start (GTK_BOX (mbox), hbox, FALSE, FALSE, 0);
|
||||
|
||||
omenu1 = build_option_menu (items1, 4, 2, ctree);
|
||||
gtk_tooltips_set_tip (tooltips, omenu1, "The tree's line style.", NULL);
|
||||
gtk_box_pack_start (GTK_BOX (hbox), omenu1, FALSE, TRUE, 0);
|
||||
|
||||
omenu2 = build_option_menu (items2, 2, 0, ctree);
|
||||
gtk_tooltips_set_tip (tooltips, omenu2, "The tree's justification.",
|
||||
omenu2 = build_option_menu (items2, 4, 1, ctree);
|
||||
gtk_tooltips_set_tip (tooltips, omenu2, "The tree's expander style.",
|
||||
NULL);
|
||||
gtk_box_pack_start (GTK_BOX (hbox), omenu2, FALSE, TRUE, 0);
|
||||
|
||||
omenu3 = build_option_menu (items3, 4, 3, ctree);
|
||||
gtk_tooltips_set_tip (tooltips, omenu3, "The list's selection mode.",
|
||||
omenu3 = build_option_menu (items3, 2, 0, ctree);
|
||||
gtk_tooltips_set_tip (tooltips, omenu3, "The tree's justification.",
|
||||
NULL);
|
||||
gtk_box_pack_start (GTK_BOX (hbox), omenu3, FALSE, TRUE, 0);
|
||||
|
||||
omenu4 = build_option_menu (items4, 4, 3, ctree);
|
||||
gtk_tooltips_set_tip (tooltips, omenu4, "The list's selection mode.",
|
||||
NULL);
|
||||
gtk_box_pack_start (GTK_BOX (hbox), omenu4, FALSE, TRUE, 0);
|
||||
|
||||
gtk_widget_realize (window);
|
||||
|
||||
pixmap1 = gdk_pixmap_create_from_xpm_d (window->window, &mask1,
|
||||
|
||||
Reference in New Issue
Block a user