diff options
author | Tim Janik <timj@gtk.org> | 1998-07-19 19:09:27 +0000 |
---|---|---|
committer | Tim Janik <timj@src.gnome.org> | 1998-07-19 19:09:27 +0000 |
commit | c1c8caa28cbc1a0b7a8f07296189d915c11b6dfc (patch) | |
tree | 4eb0433121445a22ddaab898a18ccc349a6006c5 /gtk | |
parent | b43c45571d92dc4786cf8c04b1938aa1609e19ce (diff) | |
download | gtk+-c1c8caa28cbc1a0b7a8f07296189d915c11b6dfc.tar.gz |
export gtk_binary_age and gtk_interface_age.
Sat Jul 18 22:59:04 1998 Tim Janik <timj@gtk.org>
* gtk/gtkmain.h:
* gtk/gtkmain.c: export gtk_binary_age and gtk_interface_age.
* gtk/gtktypeutils.h:
* gtk/gtkitemfactory.h: remove "void" from prototypes again.
Sat Jul 18 00:54:01 1998 Lars Hamann <lars@gtk.org>
* gtk/gtknotebook.c (gtk_notebook_set_child_arg): added support for
CHILD_ARG_MENU_LABEL, CHILD_ARG_TAB_LABEL
(gtk_notebook_get_child_arg): added support for CHILD_ARG_MENU_LABEL,
CHILD_ARG_POSITION
(gtk_notebook_reorder_child): new funktion to change position of a
notebook page
(gtk_notebook_draw_arrow): draw left/right arrow with
GTK_SHADOW_ETCHED_IN if focus_tab is first/last tab.
* gtk/gtkstyle.c (gtk_default_draw_arrow):
added GTK_SHADOW_ETCHED_IN/OUT
Diffstat (limited to 'gtk')
-rw-r--r-- | gtk/gtkfeatures.h.in | 2 | ||||
-rw-r--r-- | gtk/gtkitemfactory.h | 2 | ||||
-rw-r--r-- | gtk/gtkmain.c | 2 | ||||
-rw-r--r-- | gtk/gtkmain.h | 4 | ||||
-rw-r--r-- | gtk/gtknotebook.c | 271 | ||||
-rw-r--r-- | gtk/gtknotebook.h | 3 | ||||
-rw-r--r-- | gtk/gtkstyle.c | 285 | ||||
-rw-r--r-- | gtk/gtktypeutils.h | 2 | ||||
-rw-r--r-- | gtk/testgtk.c | 4 |
9 files changed, 451 insertions, 124 deletions
diff --git a/gtk/gtkfeatures.h.in b/gtk/gtkfeatures.h.in index dccb97f612..cb68804b45 100644 --- a/gtk/gtkfeatures.h.in +++ b/gtk/gtkfeatures.h.in @@ -31,6 +31,8 @@ extern "C" { #define GTK_MAJOR_VERSION (@GTK_MAJOR_VERSION@) #define GTK_MINOR_VERSION (@GTK_MINOR_VERSION@) #define GTK_MICRO_VERSION (@GTK_MICRO_VERSION@) +#define GTK_BINARY_AGE (@GTK_BINARY_AGE@) +#define GTK_INTERFACE_AGE (@GTK_INTERFACE_AGE@) /* new gtk_container_set_focus_[hv]adjustment() */ diff --git a/gtk/gtkitemfactory.h b/gtk/gtkitemfactory.h index 620f5e0f07..01597fb004 100644 --- a/gtk/gtkitemfactory.h +++ b/gtk/gtkitemfactory.h @@ -36,7 +36,7 @@ extern "C" { typedef void (*GtkPrintFunc) (gpointer func_data, gchar *str); -typedef void (*GtkItemFactoryCallback) (void); +typedef void (*GtkItemFactoryCallback) (); typedef void (*GtkItemFactoryCallback1) (gpointer callback_data, guint callback_action, GtkWidget *widget); diff --git a/gtk/gtkmain.c b/gtk/gtkmain.c index 5f07d5e5a3..e41a793516 100644 --- a/gtk/gtkmain.c +++ b/gtk/gtkmain.c @@ -137,6 +137,8 @@ static gint gtk_timeout_compare (gconstpointer a, const guint gtk_major_version = GTK_MAJOR_VERSION; const guint gtk_minor_version = GTK_MINOR_VERSION; const guint gtk_micro_version = GTK_MICRO_VERSION; +const guint gtk_binary_age = GTK_BINARY_AGE; +const guint gtk_interface_age = GTK_INTERFACE_AGE; static gboolean iteration_done = FALSE; static guint main_level = 0; diff --git a/gtk/gtkmain.h b/gtk/gtkmain.h index d74d9bba8d..abbf5f4284 100644 --- a/gtk/gtkmain.h +++ b/gtk/gtkmain.h @@ -26,6 +26,7 @@ #ifdef __cplusplus extern "C" { +#pragma } #endif /* __cplusplus */ #define GTK_PRIORITY_HIGH -20 @@ -42,6 +43,9 @@ typedef gint (*GtkKeySnoopFunc) (GtkWidget *grab_widget, extern const guint gtk_major_version; extern const guint gtk_minor_version; extern const guint gtk_micro_version; +extern const guint gtk_binary_age; +extern const guint gtk_interface_age; + /* Initialization, exit, mainloop and miscellaneous routines */ diff --git a/gtk/gtknotebook.c b/gtk/gtknotebook.c index 4d076c4e60..d5ae15904a 100644 --- a/gtk/gtknotebook.c +++ b/gtk/gtknotebook.c @@ -174,6 +174,8 @@ static void gtk_notebook_menu_item_create (GtkNotebook *notebook, GtkNotebookPage *page, gint position); static GtkType gtk_notebook_child_type (GtkContainer *container); +static gint gtk_notebook_find_page (gconstpointer a, + gconstpointer b); static GtkContainerClass *parent_class = NULL; @@ -225,10 +227,8 @@ gtk_notebook_class_init (GtkNotebookClass *class) gtk_object_add_arg_type ("GtkNotebook::enable_popup", GTK_TYPE_BOOL, GTK_ARG_READWRITE, ARG_ENABLE_POPUP); gtk_container_add_child_arg_type ("GtkNotebook::tab_label", GTK_TYPE_STRING, GTK_ARG_READWRITE, CHILD_ARG_TAB_LABEL); - /* - * gtk_container_add_child_arg_type ("GtkNotebook::menu_label", GTK_TYPE_STRING, GTK_ARG_READWRITE, CHILD_ARG_MENU_LABEL); - * gtk_container_add_child_arg_type ("GtkNotebook::position", GTK_TYPE_INT, GTK_ARG_READWRITE, CHILD_ARG_POSITION); - */ + gtk_container_add_child_arg_type ("GtkNotebook::menu_label", GTK_TYPE_STRING, GTK_ARG_READWRITE, CHILD_ARG_MENU_LABEL); + gtk_container_add_child_arg_type ("GtkNotebook::position", GTK_TYPE_INT, GTK_ARG_READWRITE, CHILD_ARG_POSITION); notebook_signals[SWITCH_PAGE] = gtk_signal_new ("switch_page", @@ -362,24 +362,23 @@ gtk_notebook_set_child_arg (GtkContainer *container, GtkNotebook *notebook; GtkNotebookPage *page = NULL; GList *list; + gint position; notebook = GTK_NOTEBOOK (container); - for (list = notebook->children; list; list = list->next) - { - page = list->data; - if (page->child == child) - break; - } - if (!list) - return; - switch (arg_id) { case CHILD_ARG_TAB_LABEL: /* a NULL pointer indicates a default_tab setting, otherwise * we need to set the associated label */ + + if (!(list = g_list_find_custom (notebook->children, child, + gtk_notebook_find_page))) + return; + + page = list->data; + if (GTK_VALUE_STRING (*arg)) { page->default_tab = FALSE; @@ -388,7 +387,12 @@ gtk_notebook_set_child_arg (GtkContainer *container, page->tab_label = gtk_label_new (GTK_VALUE_STRING (*arg)); gtk_widget_set_parent (page->tab_label, GTK_WIDGET (notebook)); if (notebook->show_tabs) - gtk_widget_show (page->tab_label); + { + gtk_widget_show (page->tab_label); + gtk_notebook_pages_allocate + (notebook, &(GTK_WIDGET (notebook)->allocation)); + gtk_notebook_expose_tabs (notebook); + } } else { @@ -405,12 +409,49 @@ gtk_notebook_set_child_arg (GtkContainer *container, page->tab_label = gtk_label_new (string); gtk_widget_set_parent (page->tab_label, GTK_WIDGET (notebook)); gtk_widget_show (page->tab_label); + gtk_notebook_pages_allocate + (notebook, &(GTK_WIDGET (notebook)->allocation)); + gtk_notebook_expose_tabs (notebook); } } break; case CHILD_ARG_MENU_LABEL: + + for (position = 0, list = notebook->children; list; + list = list->next, position++) + { + page = list->data; + if (page->child == child) + break; + } + + if (page->menu_label) + { + if (notebook->menu) + { + gtk_container_remove (GTK_CONTAINER (notebook->menu), + page->menu_label->parent); + gtk_widget_queue_resize (notebook->menu); + } + if (!page->default_menu) + gtk_widget_unref (page->menu_label); + } + if (GTK_VALUE_STRING (*arg)) + { + page->menu_label = gtk_label_new (GTK_VALUE_STRING (*arg)); + gtk_widget_ref (page->menu_label); + gtk_object_sink (GTK_OBJECT(page->menu_label)); + page->default_menu = FALSE; + } + else + page->default_menu = TRUE; + + if (notebook->menu) + gtk_notebook_menu_item_create (notebook, page, position); + break; case CHILD_ARG_POSITION: + gtk_notebook_reorder_child (notebook, child, GTK_VALUE_INT (*arg)); break; default: break; @@ -429,18 +470,15 @@ gtk_notebook_get_child_arg (GtkContainer *container, notebook = GTK_NOTEBOOK (container); - for (list = notebook->children; list; list = list->next) - { - page = list->data; - if (page->child == child) - break; - } - if (!list) + if (!(list = g_list_find_custom (notebook->children, child, + gtk_notebook_find_page))) { arg->type = GTK_TYPE_INVALID; return; } + page = list->data; + switch (arg_id) { case CHILD_ARG_TAB_LABEL: @@ -455,8 +493,18 @@ gtk_notebook_get_child_arg (GtkContainer *container, } break; case CHILD_ARG_MENU_LABEL: + if (page->default_menu) + GTK_VALUE_STRING (*arg) = NULL; + else + { + if (page->menu_label && GTK_IS_LABEL (page->menu_label)) + GTK_VALUE_STRING (*arg) = g_strdup (GTK_LABEL (page->menu_label)->label); + else + GTK_VALUE_STRING (*arg) = NULL; + } break; case CHILD_ARG_POSITION: + GTK_VALUE_INT (*arg) = g_list_position (notebook->children, list); break; default: arg->type = GTK_TYPE_INVALID; @@ -646,7 +694,7 @@ gtk_notebook_insert_page_menu (GtkNotebook *notebook, if (!notebook->cur_page) { gtk_notebook_switch_page (notebook, page, 0); - notebook->focus_tab = NULL; + gtk_notebook_switch_focus_tab (notebook, NULL); } if (GTK_WIDGET_VISIBLE (notebook)) @@ -694,8 +742,8 @@ gtk_notebook_remove_page (GtkNotebook *notebook, { list = g_list_last (notebook->children); if (list) - gtk_notebook_real_remove (notebook, list, - g_list_index (notebook->children, list->data)); + gtk_notebook_real_remove + (notebook, list, g_list_index (notebook->children, list->data)); } } @@ -776,7 +824,7 @@ gtk_notebook_real_remove (GtkNotebook *notebook, if (list == notebook->first_tab) notebook->first_tab = next_list; if (list == notebook->focus_tab) - notebook->focus_tab = next_list; + gtk_notebook_switch_focus_tab (notebook, next_list); page = list->data; @@ -845,7 +893,7 @@ gtk_notebook_current_page (GtkNotebook *notebook) void gtk_notebook_set_page (GtkNotebook *notebook, - gint page_num) + gint page_num) { GList *list; @@ -946,6 +994,81 @@ gtk_notebook_prev_page (GtkNotebook *notebook) gtk_notebook_switch_page (notebook, page, num); } +void +gtk_notebook_reorder_child (GtkNotebook *notebook, + GtkWidget *child, + gint position) +{ + GList *list; + GtkNotebookPage *page; + gint old_pos; + + g_return_if_fail (notebook != NULL); + g_return_if_fail (GTK_IS_NOTEBOOK (notebook)); + g_return_if_fail (child != NULL); + g_return_if_fail (GTK_IS_WIDGET (child)); + + for (old_pos = 0, list = notebook->children; list; + list = list->next, old_pos++) + { + page = list->data; + if (page->child == child) + break; + } + + if (!list || old_pos == position) + return; + + notebook->children = g_list_remove_link (notebook->children, list); + + if (position <= 0 || !notebook->children) + { + list->next = notebook->children; + if (list->next) + list->next->prev = list; + notebook->children = list; + } + else + { + GList *work; + + if ((work = g_list_nth (notebook->children, position))) + { + list->prev = work->prev; + if (list->prev) + list->prev->next = list; + list->next = work; + work->prev = list; + } + else + { + work = g_list_last (notebook->children); + work->next = list; + list->prev = work; + } + } + + if (notebook->menu) + { + GtkWidget *menu_item; + + menu_item = page->menu_label->parent; + gtk_container_remove (GTK_CONTAINER (menu_item), page->menu_label); + gtk_container_remove (GTK_CONTAINER (notebook->menu), menu_item); + gtk_notebook_menu_item_create (notebook, page, position); + gtk_widget_queue_resize (notebook->menu); + } + + gtk_notebook_update_labels (notebook, notebook->children, 1); + + if (notebook->show_tabs) + { + gtk_notebook_pages_allocate (notebook, + &(GTK_WIDGET (notebook)->allocation)); + gtk_notebook_expose_tabs (notebook); + } +} + static void gtk_notebook_foreach (GtkContainer *container, GtkCallback callback, @@ -1836,12 +1959,12 @@ gtk_notebook_button_press (GtkWidget *widget, notebook->child_has_focus = FALSE; old_page = (GtkNotebookPage *) (notebook->focus_tab->data); - notebook->focus_tab = children; + gtk_notebook_switch_focus_tab (notebook, children); gtk_notebook_focus_changed (notebook, old_page); } else { - notebook->focus_tab = children; + gtk_notebook_switch_focus_tab (notebook, children); gtk_notebook_switch_page (notebook, page, num); gtk_widget_grab_focus (widget); } @@ -2062,6 +2185,12 @@ gtk_notebook_draw_arrow (GtkNotebook *notebook, guint arrow) if (arrow == GTK_ARROW_LEFT) { + if (notebook->focus_tab && !notebook->focus_tab->prev) + { + shadow_type = GTK_SHADOW_ETCHED_IN; + state_type = GTK_STATE_NORMAL; + } + if (notebook->tab_pos == GTK_POS_LEFT || notebook->tab_pos == GTK_POS_RIGHT) arrow = GTK_ARROW_UP; @@ -2071,6 +2200,12 @@ gtk_notebook_draw_arrow (GtkNotebook *notebook, guint arrow) } else { + if (notebook->focus_tab && !notebook->focus_tab->next) + { + shadow_type = GTK_SHADOW_ETCHED_IN; + state_type = GTK_STATE_NORMAL; + } + if (notebook->tab_pos == GTK_POS_LEFT || notebook->tab_pos == GTK_POS_RIGHT) arrow = GTK_ARROW_DOWN; @@ -2380,7 +2515,7 @@ gtk_notebook_set_focus_child (GtkContainer *container, { page = children->data; if (page->child == child || page->tab_label == child) - notebook->focus_tab = children; + gtk_notebook_switch_focus_tab (notebook, children); children = children->next; } } @@ -3021,10 +3156,10 @@ gtk_notebook_focus (GtkContainer *container, case GTK_DIR_RIGHT: case GTK_DIR_DOWN: if (!notebook->focus_tab) - notebook->focus_tab = notebook->children; + gtk_notebook_switch_focus_tab (notebook, notebook->children); else - notebook->focus_tab = notebook->focus_tab->next; - + gtk_notebook_switch_focus_tab (notebook, notebook->focus_tab->next); + if (!notebook->focus_tab) { gtk_notebook_focus_changed (notebook, old_page); @@ -3034,13 +3169,15 @@ gtk_notebook_focus (GtkContainer *container, page = notebook->focus_tab->data; return_val = TRUE; break; + case GTK_DIR_TAB_BACKWARD: case GTK_DIR_LEFT: case GTK_DIR_UP: if (!notebook->focus_tab) - notebook->focus_tab = g_list_last (notebook->children); + gtk_notebook_switch_focus_tab + (notebook, g_list_last (notebook->children)); else - notebook->focus_tab = notebook->focus_tab->prev; + gtk_notebook_switch_focus_tab (notebook, notebook->focus_tab->prev); if (!notebook->focus_tab) { @@ -3117,28 +3254,61 @@ static void gtk_notebook_switch_focus_tab (GtkNotebook *notebook, GList *new_child) { + GList *old_tab; GtkNotebookPage *old_page = NULL; GtkNotebookPage *page; g_return_if_fail (notebook != NULL); g_return_if_fail (GTK_IS_NOTEBOOK (notebook)); - if (notebook->focus_tab != new_child) - { - if (notebook->focus_tab) - old_page = notebook->focus_tab->data; + if (notebook->focus_tab == new_child) + return; + + old_tab = notebook->focus_tab; + notebook->focus_tab = new_child; - notebook->focus_tab = new_child; - page = notebook->focus_tab->data; - if (GTK_WIDGET_MAPPED (page->tab_label)) - gtk_notebook_focus_changed (notebook, old_page); + if (notebook->scrollable) + { + if ((new_child == NULL) != (old_tab == NULL)) + { + gdk_window_clear (notebook->panel); + gtk_notebook_draw_arrow (notebook, GTK_ARROW_LEFT); + gtk_notebook_draw_arrow (notebook, GTK_ARROW_RIGHT); + + } else { - gtk_notebook_pages_allocate (notebook, - &(GTK_WIDGET (notebook)->allocation)); - gtk_notebook_expose_tabs (notebook); + if ((old_tab->prev == NULL) != (new_child->prev == NULL)) + { + gdk_window_clear_area (notebook->panel, 0, 0, + ARROW_SIZE, ARROW_SIZE); + gtk_notebook_draw_arrow (notebook, GTK_ARROW_LEFT); + } + if ((old_tab->next == NULL) != (new_child->next == NULL)) + { + gdk_window_clear_area (notebook->panel, + ARROW_SIZE + ARROW_SPACING, 0, + ARROW_SIZE, ARROW_SIZE); + gtk_notebook_draw_arrow (notebook, GTK_ARROW_RIGHT); + } } } + + if (!notebook->focus_tab) + return; + + if (old_tab) + old_page = old_tab->data; + + page = notebook->focus_tab->data; + if (GTK_WIDGET_MAPPED (page->tab_label)) + gtk_notebook_focus_changed (notebook, old_page); + else + { + gtk_notebook_pages_allocate (notebook, + &(GTK_WIDGET (notebook)->allocation)); + gtk_notebook_expose_tabs (notebook); + } } static gint @@ -3256,14 +3426,14 @@ gtk_notebook_menu_item_create (GtkNotebook *notebook, page->menu_label = gtk_label_new (""); gtk_misc_set_alignment (GTK_MISC (page->menu_label), 0.0, 0.5); } + gtk_widget_show (page->menu_label); menu_item = gtk_menu_item_new (); gtk_widget_freeze_accelerators (menu_item); gtk_container_add (GTK_CONTAINER (menu_item), page->menu_label); gtk_menu_insert (GTK_MENU (notebook->menu), menu_item, position); gtk_signal_connect (GTK_OBJECT (menu_item), "activate", - GTK_SIGNAL_FUNC (gtk_notebook_menu_switch_page), - page); + GTK_SIGNAL_FUNC (gtk_notebook_menu_switch_page), page); gtk_widget_show (menu_item); } @@ -3330,3 +3500,10 @@ gtk_notebook_menu_detacher (GtkWidget *widget, notebook->menu = NULL; } + +static gint +gtk_notebook_find_page (gconstpointer a, + gconstpointer b) +{ + return (((GtkNotebookPage *) a)->child != b); +} diff --git a/gtk/gtknotebook.h b/gtk/gtknotebook.h index 183b7ee505..2efb2a227d 100644 --- a/gtk/gtknotebook.h +++ b/gtk/gtknotebook.h @@ -121,6 +121,9 @@ void gtk_notebook_set_page (GtkNotebook *notebook, gint page_num); void gtk_notebook_next_page (GtkNotebook *notebook); void gtk_notebook_prev_page (GtkNotebook *notebook); +void gtk_notebook_reorder_child (GtkNotebook *notebook, + GtkWidget *child, + gint position); void gtk_notebook_set_tab_pos (GtkNotebook *notebook, GtkPositionType pos); void gtk_notebook_set_show_tabs (GtkNotebook *notebook, diff --git a/gtk/gtkstyle.c b/gtk/gtkstyle.c index 020d323708..98fe667589 100644 --- a/gtk/gtkstyle.c +++ b/gtk/gtkstyle.c @@ -1273,7 +1273,6 @@ gtk_default_draw_polygon (GtkStyle *style, } } - static void gtk_default_draw_arrow (GtkStyle *style, GdkWindow *window, @@ -1311,6 +1310,18 @@ gtk_default_draw_arrow (GtkStyle *style, gc3 = style->black_gc; gc4 = style->bg_gc[state_type]; break; + case GTK_SHADOW_ETCHED_IN: + gc1 = style->light_gc[state_type]; + gc2 = style->dark_gc[state_type]; + gc3 = NULL; + gc4 = NULL; + break; + case GTK_SHADOW_ETCHED_OUT: + gc1 = style->dark_gc[state_type]; + gc2 = style->light_gc[state_type]; + gc3 = NULL; + gc4 = NULL; + break; default: return; } @@ -1340,27 +1351,60 @@ gtk_default_draw_arrow (GtkStyle *style, gdk_draw_polygon (window, style->bg_gc[state_type], TRUE, points, 3); } - gdk_draw_line (window, gc1, - x + 1, y + height - 2, - x + width - 2, y + height - 2); - gdk_draw_line (window, gc3, - x + 0, y + height - 1, - x + width - 1, y + height - 1); + switch (shadow_type) + { + case GTK_SHADOW_IN: + case GTK_SHADOW_OUT: + + gdk_draw_line (window, gc1, + x + 1, y + height - 2, + x + width - 2, y + height - 2); + gdk_draw_line (window, gc3, + x + 0, y + height - 1, + x + width - 1, y + height - 1); + + gdk_draw_line (window, gc1, + x + width - 2, y + height - 1, + x + half_width, y + 1); + gdk_draw_line (window, gc3, + x + width - 1, y + height - 1, + x + half_width, y); + + gdk_draw_line (window, gc4, + x + half_width, y + 1, + x + 1, y + height - 1); + gdk_draw_line (window, gc2, + x + half_width, y, + x, y + height - 1); + break; - gdk_draw_line (window, gc1, - x + width - 2, y + height - 1, - x + half_width, y + 1); - gdk_draw_line (window, gc3, - x + width - 1, y + height - 1, - x + half_width, y); + case GTK_SHADOW_ETCHED_IN: + case GTK_SHADOW_ETCHED_OUT: + gdk_draw_line (window, gc1, + x + half_width, y + 1, + x + 1, y + height - 1); + gdk_draw_line (window, gc1, + x + 1, y + height - 1, + x + width - 1, y + height - 1); + gdk_draw_line (window, gc1, + x + width - 1, y + height - 1, + x + half_width + 1, y + 1); + + points[0].x = x + half_width; + points[0].y = y; + points[1].x = x; + points[1].y = y + height - 2; + points[2].x = x + width - 2; + points[2].y = y + height - 2; - gdk_draw_line (window, gc4, - x + half_width, y + 1, - x + 1, y + height - 1); - gdk_draw_line (window, gc2, - x + half_width, y, - x, y + height - 1); + gdk_draw_polygon (window, gc2, FALSE, points, 3); + break; + + default: + break; + } break; + case GTK_ARROW_DOWN: if (fill) { @@ -1373,27 +1417,57 @@ gtk_default_draw_arrow (GtkStyle *style, gdk_draw_polygon (window, style->bg_gc[state_type], TRUE, points, 3); } + switch (shadow_type) + { + case GTK_SHADOW_IN: + case GTK_SHADOW_OUT: + gdk_draw_line (window, gc4, + x + width - 2, + y + 1, x + 1, y + 1); + gdk_draw_line (window, gc2, + x + width - 1, y, + x, y); + + gdk_draw_line (window, gc4, + x + 1, y, + x + half_width, y + height - 2); + gdk_draw_line (window, gc2, + x, y, + x + half_width, y + height - 1); - gdk_draw_line (window, gc4, - x + width - 2, - y + 1, x + 1, y + 1); - gdk_draw_line (window, gc2, - x + width - 1, y, - x, y); + gdk_draw_line (window, gc1, + x + half_width, y + height - 2, + x + width - 2, y); + gdk_draw_line (window, gc3, + x + half_width, y + height - 1, + x + width - 1, y); + break; - gdk_draw_line (window, gc4, - x + 1, y, - x + half_width, y + height - 2); - gdk_draw_line (window, gc2, - x, y, - x + half_width, y + height - 1); + case GTK_SHADOW_ETCHED_IN: + case GTK_SHADOW_ETCHED_OUT: + gdk_draw_line (window, gc1, + x + width - 1, y + 1, + x + 1, y + 1); + gdk_draw_line (window, gc1, + x + 1, y + 1, + x + half_width + 1, y + height - 1); + gdk_draw_line (window, gc1, + x + half_width + 1, y + height - 2, + x + width - 1, y); + + points[0].x = x + width - 2; + points[0].y = y; + points[1].x = x; + points[1].y = y; + points[2].x = x + half_width; + points[2].y = y + height - 2; - gdk_draw_line (window, gc1, - x + half_width, y + height - 2, - x + width - 2, y); - gdk_draw_line (window, gc3, - x + half_width, y + height - 1, - x + width - 1, y); + gdk_draw_polygon (window, gc2, FALSE, points, 3); + break; + + default: + break; + } break; case GTK_ARROW_LEFT: if (fill) @@ -1408,26 +1482,57 @@ gtk_default_draw_arrow (GtkStyle *style, gdk_draw_polygon (window, style->bg_gc[state_type], TRUE, points, 3); } - gdk_draw_line (window, gc1, - x + 1, y + half_height, - x + width - 1, y + height - 1); - gdk_draw_line (window, gc3, - x, y + half_height, - x + width - 1, y + height - 1); + switch (shadow_type) + { + case GTK_SHADOW_IN: + case GTK_SHADOW_OUT: + gdk_draw_line (window, gc1, + x + 1, y + half_height, + x + width - 1, y + height - 1); + gdk_draw_line (window, gc3, + x, y + half_height, + x + width - 1, y + height - 1); - gdk_draw_line (window, gc1, - x + width - 2, y + height - 1, - x + width - 2, y + 1); - gdk_draw_line (window, gc3, - x + width - 1, y + height - 1, - x + width - 1, y); - - gdk_draw_line (window, gc4, - x + width - 1, y + 1, - x + 1, y + half_height); - gdk_draw_line (window, gc2, - x + width - 1, y, - x, y + half_height); + gdk_draw_line (window, gc1, + x + width - 2, y + height - 1, + x + width - 2, y + 1); + gdk_draw_line (window, gc3, + x + width - 1, y + height - 1, + x + width - 1, y); + + gdk_draw_line (window, gc4, + x + width - 1, y + 1, + x + 1, y + half_height); + gdk_draw_line (window, gc2, + x + width - 1, y, + x, y + half_height); + break; + + case GTK_SHADOW_ETCHED_IN: + case GTK_SHADOW_ETCHED_OUT: + gdk_draw_line (window, gc1, + x + width - 1, y + 1, + x + 1, y + half_height); + gdk_draw_line (window, gc1, + x + 1, y + half_height + 1, + x + width - 1, y + height - 1); + gdk_draw_line (window, gc1, + x + width - 1, y + height - 1, + x + width - 1, y + 1); + + points[0].x = x + width - 2; + points[0].y = y; + points[1].x = x; + points[1].y = y + half_height; + points[2].x = x + width - 2; + points[2].y = y + height - 2; + + gdk_draw_polygon (window, gc2, FALSE, points, 3); + break; + + default: + break; + } break; case GTK_ARROW_RIGHT: if (fill) @@ -1442,31 +1547,61 @@ gtk_default_draw_arrow (GtkStyle *style, gdk_draw_polygon (window, style->bg_gc[state_type], TRUE, points, 3); } - gdk_draw_line (window, gc4, - x + width - 1, y + half_height, - x + 1, y + 1); - gdk_draw_line (window, gc2, - x + width - 1, y + half_height, - x, y); + switch (shadow_type) + { + case GTK_SHADOW_IN: + case GTK_SHADOW_OUT: + gdk_draw_line (window, gc4, + x + width - 1, y + half_height, + x + 1, y + 1); + gdk_draw_line (window, gc2, + x + width - 1, y + half_height, + x, y); - gdk_draw_line (window, gc4, - x + 1, y + 1, - x + 1, y + height - 2); - gdk_draw_line (window, gc2, - x, y, - x, y + height - 1); + gdk_draw_line (window, gc4, + x + 1, y + 1, + x + 1, y + height - 2); + gdk_draw_line (window, gc2, + x, y, + x, y + height - 1); - gdk_draw_line (window, gc1, - x + 1, y + height - 2, - x + width - 1, y + half_height); - gdk_draw_line (window, gc3, - x, y + height - 1, - x + width - 1, y + half_height); + gdk_draw_line (window, gc1, + x + 1, y + height - 2, + x + width - 1, y + half_height); + gdk_draw_line (window, gc3, + x, y + height - 1, + x + width - 1, y + half_height); + break; + + case GTK_SHADOW_ETCHED_IN: + case GTK_SHADOW_ETCHED_OUT: + gdk_draw_line (window, gc1, + x + width - 1, y + half_height + 1, + x + 1, y + 1); + gdk_draw_line (window, gc1, + x + 1, y + 1, + x + 1, y + height - 1); + gdk_draw_line (window, gc1, + x + 1, y + height - 1, + x + width - 1, y + half_height + 1); + + points[0].x = x + width - 2; + points[0].y = y + half_height; + points[1].x = x; + points[1].y = y; + points[2].x = x; + points[2].y = y + height - 1; + + gdk_draw_polygon (window, gc2, FALSE, points, 3); + break; + + default: + break; + } break; } } - static void gtk_default_draw_diamond (GtkStyle *style, GdkWindow *window, diff --git a/gtk/gtktypeutils.h b/gtk/gtktypeutils.h index 57c1d092f6..af66787b2f 100644 --- a/gtk/gtktypeutils.h +++ b/gtk/gtktypeutils.h @@ -100,7 +100,7 @@ typedef struct _GtkEnumValue GtkFlagValue; typedef void (*GtkClassInitFunc) (gpointer klass); typedef void (*GtkObjectInitFunc) (gpointer object); -typedef void (*GtkSignalFunc) (void); +typedef void (*GtkSignalFunc) (); typedef gint (*GtkFunction) (gpointer data); typedef void (*GtkDestroyNotify) (gpointer data); typedef void (*GtkCallbackMarshal) (GtkObject *object, diff --git a/gtk/testgtk.c b/gtk/testgtk.c index 5bd02f3d27..a9805e260d 100644 --- a/gtk/testgtk.c +++ b/gtk/testgtk.c @@ -7445,6 +7445,10 @@ create_main_window (void) gtk_widget_show (window); } +#ifdef HAVE_LIBGLE +#include <gle/gle.h> +#endif /* !HAVE_LIBGLE */ + int main (int argc, char *argv[]) { |