diff options
author | Lars Hamann <lars@gtk.org> | 1999-01-21 02:13:13 +0000 |
---|---|---|
committer | Lars Hamann <lars@src.gnome.org> | 1999-01-21 02:13:13 +0000 |
commit | 1a58d9b3cfc2da2338de37e05990e8456ef08e2d (patch) | |
tree | ac74b9e8a114bb939cb246de435d0e203bb9aadd /gtk | |
parent | 21993dcb10451adc462fa1b42e3e46f392371c95 (diff) | |
download | gtk+-1a58d9b3cfc2da2338de37e05990e8456ef08e2d.tar.gz |
few cleanups. (gtk_notebook_key_press): call select page function for
Thu Jan 21 02:47:36 1999 Lars Hamann <lars@gtk.org>
* gtk/gtknotebook.c (gtk_notebook_focus): few cleanups.
(gtk_notebook_key_press): call select page function for
GDK_DOWN key in case of tab_pos == TOP. Changed other
positions accordingly.
Diffstat (limited to 'gtk')
-rw-r--r-- | gtk/gtknotebook.c | 76 |
1 files changed, 59 insertions, 17 deletions
diff --git a/gtk/gtknotebook.c b/gtk/gtknotebook.c index 75d96dd7aa..b2a5a387b9 100644 --- a/gtk/gtknotebook.c +++ b/gtk/gtknotebook.c @@ -1249,16 +1249,56 @@ gtk_notebook_key_press (GtkWidget *widget, switch (event->keyval) { case GDK_Up: - direction = GTK_DIR_UP; + switch (notebook->tab_pos) + { + case GTK_POS_BOTTOM: + gtk_notebook_page_select (GTK_NOTEBOOK (widget)); + return TRUE; + case GTK_POS_TOP: + return FALSE; + default: + direction = GTK_DIR_UP; + break; + } break; case GDK_Left: - direction = GTK_DIR_LEFT; + switch (notebook->tab_pos) + { + case GTK_POS_RIGHT: + gtk_notebook_page_select (GTK_NOTEBOOK (widget)); + return TRUE; + case GTK_POS_LEFT: + return FALSE; + default: + direction = GTK_DIR_LEFT; + break; + } break; case GDK_Down: - direction = GTK_DIR_DOWN; + switch (notebook->tab_pos) + { + case GTK_POS_TOP: + gtk_notebook_page_select (GTK_NOTEBOOK (widget)); + return TRUE; + case GTK_POS_BOTTOM: + return FALSE; + default: + direction = GTK_DIR_DOWN; + break; + } break; case GDK_Right: - direction = GTK_DIR_RIGHT; + switch (notebook->tab_pos) + { + case GTK_POS_LEFT: + gtk_notebook_page_select (GTK_NOTEBOOK (widget)); + return TRUE; + case GTK_POS_RIGHT: + return FALSE; + default: + direction = GTK_DIR_RIGHT; + break; + } break; case GDK_Tab: case GDK_ISO_Left_Tab: @@ -1534,7 +1574,6 @@ gtk_notebook_focus (GtkContainer *container, GtkDirectionType direction) { GtkNotebook *notebook; - GtkWidget *focus_child; GtkNotebookPage *page = NULL; GtkNotebookPage *old_page = NULL; @@ -1543,13 +1582,12 @@ gtk_notebook_focus (GtkContainer *container, notebook = GTK_NOTEBOOK (container); - if (!GTK_WIDGET_DRAWABLE (notebook) || !GTK_WIDGET_IS_SENSITIVE (container) || - !notebook->children || !notebook->cur_page) + if (!GTK_WIDGET_DRAWABLE (notebook) || + !GTK_WIDGET_IS_SENSITIVE (container) || + !notebook->children || + !notebook->cur_page) return FALSE; - focus_child = container->focus_child; - gtk_container_set_focus_child (container, NULL); - if (!notebook->show_tabs) { if (GTK_WIDGET_DRAWABLE (notebook->cur_page->child) && @@ -1563,7 +1601,7 @@ gtk_notebook_focus (GtkContainer *container, } else if (GTK_WIDGET_CAN_FOCUS (notebook->cur_page->child)) { - if (!focus_child) + if (!container->focus_child) { gtk_widget_grab_focus (notebook->cur_page->child); return TRUE; @@ -1576,24 +1614,28 @@ gtk_notebook_focus (GtkContainer *container, if (notebook->focus_tab) old_page = notebook->focus_tab->data; - if (focus_child && old_page && focus_child == old_page->child && - notebook->child_has_focus) + if (container->focus_child && old_page && + container->focus_child == old_page->child && notebook->child_has_focus) { - if (GTK_WIDGET_DRAWABLE (old_page->child)) + if (GTK_WIDGET_DRAWABLE (container->focus_child)) { - if (GTK_IS_CONTAINER (old_page->child) && - !GTK_WIDGET_HAS_FOCUS (old_page->child)) + if (GTK_IS_CONTAINER (container->focus_child) && + !GTK_WIDGET_HAS_FOCUS (container->focus_child)) { - if (gtk_container_focus (GTK_CONTAINER (old_page->child), + if (gtk_container_focus (GTK_CONTAINER (container->focus_child), direction)) return TRUE; } gtk_widget_grab_focus (GTK_WIDGET(notebook)); return TRUE; } + notebook->focus_tab = NULL; return FALSE; } + if (!GTK_WIDGET_HAS_FOCUS (container)) + notebook->focus_tab = NULL; + switch (direction) { case GTK_DIR_TAB_FORWARD: |