new flags : homogeneous; new guints : tab_hborder, tab_vborder; marked

Tue Nov 17 00:06:29 1998  Lars Hamann  <lars@gtk.org>

	* gtk/gtknotebook.h (struct _GtkNotebook): new flags : homogeneous;
	new guints : tab_hborder, tab_vborder; marked tab_border deprecated
	(struct _GtkNotebookPage): new flags : expand, fill, pack

	* gtk/gtknotebook.h/c
	(gtk_notebook_set_homogeneous_tabs): new function. set homogeneneous
 	tabs
	(gtk_notebook_set_tab_border): set tab_h/vborder to tab_border
	(gtk_notebook_set_tab_hborder): new function. set tab_hborder
	(gtk_notebook_set_tab_vborder): new function. set tab_vborder
	(gtk_notebook_query_tab_label): new function. get tab_label widget.
	(gtk_notebook_set_tab_label): new function. set tab_label widget.
	(gtk_notebook_set_tab_label_text): new function. set tab_label text.
	(gtk_notebook_query_menu_label): new function. get tab_label widget.
	(gtk_notebook_set_menu_label): new function. set tab_label widget.
	(gtk_notebook_set_menu_label_text): new function. set tab_label text.
	(gtk_notebook_set_tab_label_packing): new function. set tab_label
 	fill, expand, fill_type
	(gtk_notebook_query_tab_label_packing): new function. get tab_label
 	fill, expand, fill_type

	(gtk_notebook_real_page_position): return logic page number
	(gtk_notebook_search_page) search next/prev logic page
	(gtk_notebook_update_labels): set logic page number.
	(gtk_notebook_page_compare): renamed gtk_notebook_find_page
	(gtk_notebook_set/get_child_arg): new args CHILD_ARG_TAB_EXPAND,
 	CHILD_ARG_TAB_FILL, CHILD_ARG_TAB_PACK
 	(gtk_notebook_button_press) (gtk_notebook_key_press)
 	(gtk_notebook_focus) (gtk_notebook_pages_allocate)
	(gtk_notebook_calc_tabs) (gtk_notebook_switch_focus_tab)
 	use gtk_notebook_search_page
	(gtk_notebook_page_allocate): fixed allocation bug
	(gtk_notebook_set/get_arg): new args TAB_HBORDER, TAB_VBORDER.
	(gtk_notebook_init): unset GTK_NO_WINDOW flag
	(gtk_notebook_size_request): check whether page->child is visible.
 	changes due to tab h/vborder, homogeneous tabs
	(gtk_notebook_paint): don't draw invisible tabs
	(gtk_notebook_switch_page): calculate page_num if it's less than 0
 	(gtk_notebook_append_*) (gtk_notebook_prepend_*)
 	(gtk_notebook_insert_page): removed sanity checks

	* gtk/testgtk.c (create_notebook): extended Notebook sample a bit.
This commit is contained in:
Lars Hamann 1998-11-16 23:40:50 +00:00 committed by Lars Hamann
parent 7e44eced8c
commit e94a7b1a7a
11 changed files with 3657 additions and 2409 deletions

View File

@ -1,3 +1,48 @@
Tue Nov 17 00:06:29 1998 Lars Hamann <lars@gtk.org>
* gtk/gtknotebook.h (struct _GtkNotebook): new flags : homogeneous;
new guints : tab_hborder, tab_vborder; marked tab_border deprecated
(struct _GtkNotebookPage): new flags : expand, fill, pack
* gtk/gtknotebook.h/c
(gtk_notebook_set_homogeneous_tabs): new function. set homogeneneous
tabs
(gtk_notebook_set_tab_border): set tab_h/vborder to tab_border
(gtk_notebook_set_tab_hborder): new function. set tab_hborder
(gtk_notebook_set_tab_vborder): new function. set tab_vborder
(gtk_notebook_query_tab_label): new function. get tab_label widget.
(gtk_notebook_set_tab_label): new function. set tab_label widget.
(gtk_notebook_set_tab_label_text): new function. set tab_label text.
(gtk_notebook_query_menu_label): new function. get tab_label widget.
(gtk_notebook_set_menu_label): new function. set tab_label widget.
(gtk_notebook_set_menu_label_text): new function. set tab_label text.
(gtk_notebook_set_tab_label_packing): new function. set tab_label
fill, expand, fill_type
(gtk_notebook_query_tab_label_packing): new function. get tab_label
fill, expand, fill_type
(gtk_notebook_real_page_position): return logic page number
(gtk_notebook_search_page) search next/prev logic page
(gtk_notebook_update_labels): set logic page number.
(gtk_notebook_page_compare): renamed gtk_notebook_find_page
(gtk_notebook_set/get_child_arg): new args CHILD_ARG_TAB_EXPAND,
CHILD_ARG_TAB_FILL, CHILD_ARG_TAB_PACK
(gtk_notebook_button_press) (gtk_notebook_key_press)
(gtk_notebook_focus) (gtk_notebook_pages_allocate)
(gtk_notebook_calc_tabs) (gtk_notebook_switch_focus_tab)
use gtk_notebook_search_page
(gtk_notebook_page_allocate): fixed allocation bug
(gtk_notebook_set/get_arg): new args TAB_HBORDER, TAB_VBORDER.
(gtk_notebook_init): unset GTK_NO_WINDOW flag
(gtk_notebook_size_request): check whether page->child is visible.
changes due to tab h/vborder, homogeneous tabs
(gtk_notebook_paint): don't draw invisible tabs
(gtk_notebook_switch_page): calculate page_num if it's less than 0
(gtk_notebook_append_*) (gtk_notebook_prepend_*)
(gtk_notebook_insert_page): removed sanity checks
* gtk/testgtk.c (create_notebook): extended Notebook sample a bit.
Mon Nov 16 15:10:33 1998 Owen Taylor <otaylor@redhat.com> Mon Nov 16 15:10:33 1998 Owen Taylor <otaylor@redhat.com>
* gtk/gtktext.c: Optimizations for moving point n * gtk/gtktext.c: Optimizations for moving point n

View File

@ -1,3 +1,48 @@
Tue Nov 17 00:06:29 1998 Lars Hamann <lars@gtk.org>
* gtk/gtknotebook.h (struct _GtkNotebook): new flags : homogeneous;
new guints : tab_hborder, tab_vborder; marked tab_border deprecated
(struct _GtkNotebookPage): new flags : expand, fill, pack
* gtk/gtknotebook.h/c
(gtk_notebook_set_homogeneous_tabs): new function. set homogeneneous
tabs
(gtk_notebook_set_tab_border): set tab_h/vborder to tab_border
(gtk_notebook_set_tab_hborder): new function. set tab_hborder
(gtk_notebook_set_tab_vborder): new function. set tab_vborder
(gtk_notebook_query_tab_label): new function. get tab_label widget.
(gtk_notebook_set_tab_label): new function. set tab_label widget.
(gtk_notebook_set_tab_label_text): new function. set tab_label text.
(gtk_notebook_query_menu_label): new function. get tab_label widget.
(gtk_notebook_set_menu_label): new function. set tab_label widget.
(gtk_notebook_set_menu_label_text): new function. set tab_label text.
(gtk_notebook_set_tab_label_packing): new function. set tab_label
fill, expand, fill_type
(gtk_notebook_query_tab_label_packing): new function. get tab_label
fill, expand, fill_type
(gtk_notebook_real_page_position): return logic page number
(gtk_notebook_search_page) search next/prev logic page
(gtk_notebook_update_labels): set logic page number.
(gtk_notebook_page_compare): renamed gtk_notebook_find_page
(gtk_notebook_set/get_child_arg): new args CHILD_ARG_TAB_EXPAND,
CHILD_ARG_TAB_FILL, CHILD_ARG_TAB_PACK
(gtk_notebook_button_press) (gtk_notebook_key_press)
(gtk_notebook_focus) (gtk_notebook_pages_allocate)
(gtk_notebook_calc_tabs) (gtk_notebook_switch_focus_tab)
use gtk_notebook_search_page
(gtk_notebook_page_allocate): fixed allocation bug
(gtk_notebook_set/get_arg): new args TAB_HBORDER, TAB_VBORDER.
(gtk_notebook_init): unset GTK_NO_WINDOW flag
(gtk_notebook_size_request): check whether page->child is visible.
changes due to tab h/vborder, homogeneous tabs
(gtk_notebook_paint): don't draw invisible tabs
(gtk_notebook_switch_page): calculate page_num if it's less than 0
(gtk_notebook_append_*) (gtk_notebook_prepend_*)
(gtk_notebook_insert_page): removed sanity checks
* gtk/testgtk.c (create_notebook): extended Notebook sample a bit.
Mon Nov 16 15:10:33 1998 Owen Taylor <otaylor@redhat.com> Mon Nov 16 15:10:33 1998 Owen Taylor <otaylor@redhat.com>
* gtk/gtktext.c: Optimizations for moving point n * gtk/gtktext.c: Optimizations for moving point n

View File

@ -1,3 +1,48 @@
Tue Nov 17 00:06:29 1998 Lars Hamann <lars@gtk.org>
* gtk/gtknotebook.h (struct _GtkNotebook): new flags : homogeneous;
new guints : tab_hborder, tab_vborder; marked tab_border deprecated
(struct _GtkNotebookPage): new flags : expand, fill, pack
* gtk/gtknotebook.h/c
(gtk_notebook_set_homogeneous_tabs): new function. set homogeneneous
tabs
(gtk_notebook_set_tab_border): set tab_h/vborder to tab_border
(gtk_notebook_set_tab_hborder): new function. set tab_hborder
(gtk_notebook_set_tab_vborder): new function. set tab_vborder
(gtk_notebook_query_tab_label): new function. get tab_label widget.
(gtk_notebook_set_tab_label): new function. set tab_label widget.
(gtk_notebook_set_tab_label_text): new function. set tab_label text.
(gtk_notebook_query_menu_label): new function. get tab_label widget.
(gtk_notebook_set_menu_label): new function. set tab_label widget.
(gtk_notebook_set_menu_label_text): new function. set tab_label text.
(gtk_notebook_set_tab_label_packing): new function. set tab_label
fill, expand, fill_type
(gtk_notebook_query_tab_label_packing): new function. get tab_label
fill, expand, fill_type
(gtk_notebook_real_page_position): return logic page number
(gtk_notebook_search_page) search next/prev logic page
(gtk_notebook_update_labels): set logic page number.
(gtk_notebook_page_compare): renamed gtk_notebook_find_page
(gtk_notebook_set/get_child_arg): new args CHILD_ARG_TAB_EXPAND,
CHILD_ARG_TAB_FILL, CHILD_ARG_TAB_PACK
(gtk_notebook_button_press) (gtk_notebook_key_press)
(gtk_notebook_focus) (gtk_notebook_pages_allocate)
(gtk_notebook_calc_tabs) (gtk_notebook_switch_focus_tab)
use gtk_notebook_search_page
(gtk_notebook_page_allocate): fixed allocation bug
(gtk_notebook_set/get_arg): new args TAB_HBORDER, TAB_VBORDER.
(gtk_notebook_init): unset GTK_NO_WINDOW flag
(gtk_notebook_size_request): check whether page->child is visible.
changes due to tab h/vborder, homogeneous tabs
(gtk_notebook_paint): don't draw invisible tabs
(gtk_notebook_switch_page): calculate page_num if it's less than 0
(gtk_notebook_append_*) (gtk_notebook_prepend_*)
(gtk_notebook_insert_page): removed sanity checks
* gtk/testgtk.c (create_notebook): extended Notebook sample a bit.
Mon Nov 16 15:10:33 1998 Owen Taylor <otaylor@redhat.com> Mon Nov 16 15:10:33 1998 Owen Taylor <otaylor@redhat.com>
* gtk/gtktext.c: Optimizations for moving point n * gtk/gtktext.c: Optimizations for moving point n

View File

@ -1,3 +1,48 @@
Tue Nov 17 00:06:29 1998 Lars Hamann <lars@gtk.org>
* gtk/gtknotebook.h (struct _GtkNotebook): new flags : homogeneous;
new guints : tab_hborder, tab_vborder; marked tab_border deprecated
(struct _GtkNotebookPage): new flags : expand, fill, pack
* gtk/gtknotebook.h/c
(gtk_notebook_set_homogeneous_tabs): new function. set homogeneneous
tabs
(gtk_notebook_set_tab_border): set tab_h/vborder to tab_border
(gtk_notebook_set_tab_hborder): new function. set tab_hborder
(gtk_notebook_set_tab_vborder): new function. set tab_vborder
(gtk_notebook_query_tab_label): new function. get tab_label widget.
(gtk_notebook_set_tab_label): new function. set tab_label widget.
(gtk_notebook_set_tab_label_text): new function. set tab_label text.
(gtk_notebook_query_menu_label): new function. get tab_label widget.
(gtk_notebook_set_menu_label): new function. set tab_label widget.
(gtk_notebook_set_menu_label_text): new function. set tab_label text.
(gtk_notebook_set_tab_label_packing): new function. set tab_label
fill, expand, fill_type
(gtk_notebook_query_tab_label_packing): new function. get tab_label
fill, expand, fill_type
(gtk_notebook_real_page_position): return logic page number
(gtk_notebook_search_page) search next/prev logic page
(gtk_notebook_update_labels): set logic page number.
(gtk_notebook_page_compare): renamed gtk_notebook_find_page
(gtk_notebook_set/get_child_arg): new args CHILD_ARG_TAB_EXPAND,
CHILD_ARG_TAB_FILL, CHILD_ARG_TAB_PACK
(gtk_notebook_button_press) (gtk_notebook_key_press)
(gtk_notebook_focus) (gtk_notebook_pages_allocate)
(gtk_notebook_calc_tabs) (gtk_notebook_switch_focus_tab)
use gtk_notebook_search_page
(gtk_notebook_page_allocate): fixed allocation bug
(gtk_notebook_set/get_arg): new args TAB_HBORDER, TAB_VBORDER.
(gtk_notebook_init): unset GTK_NO_WINDOW flag
(gtk_notebook_size_request): check whether page->child is visible.
changes due to tab h/vborder, homogeneous tabs
(gtk_notebook_paint): don't draw invisible tabs
(gtk_notebook_switch_page): calculate page_num if it's less than 0
(gtk_notebook_append_*) (gtk_notebook_prepend_*)
(gtk_notebook_insert_page): removed sanity checks
* gtk/testgtk.c (create_notebook): extended Notebook sample a bit.
Mon Nov 16 15:10:33 1998 Owen Taylor <otaylor@redhat.com> Mon Nov 16 15:10:33 1998 Owen Taylor <otaylor@redhat.com>
* gtk/gtktext.c: Optimizations for moving point n * gtk/gtktext.c: Optimizations for moving point n

View File

@ -1,3 +1,48 @@
Tue Nov 17 00:06:29 1998 Lars Hamann <lars@gtk.org>
* gtk/gtknotebook.h (struct _GtkNotebook): new flags : homogeneous;
new guints : tab_hborder, tab_vborder; marked tab_border deprecated
(struct _GtkNotebookPage): new flags : expand, fill, pack
* gtk/gtknotebook.h/c
(gtk_notebook_set_homogeneous_tabs): new function. set homogeneneous
tabs
(gtk_notebook_set_tab_border): set tab_h/vborder to tab_border
(gtk_notebook_set_tab_hborder): new function. set tab_hborder
(gtk_notebook_set_tab_vborder): new function. set tab_vborder
(gtk_notebook_query_tab_label): new function. get tab_label widget.
(gtk_notebook_set_tab_label): new function. set tab_label widget.
(gtk_notebook_set_tab_label_text): new function. set tab_label text.
(gtk_notebook_query_menu_label): new function. get tab_label widget.
(gtk_notebook_set_menu_label): new function. set tab_label widget.
(gtk_notebook_set_menu_label_text): new function. set tab_label text.
(gtk_notebook_set_tab_label_packing): new function. set tab_label
fill, expand, fill_type
(gtk_notebook_query_tab_label_packing): new function. get tab_label
fill, expand, fill_type
(gtk_notebook_real_page_position): return logic page number
(gtk_notebook_search_page) search next/prev logic page
(gtk_notebook_update_labels): set logic page number.
(gtk_notebook_page_compare): renamed gtk_notebook_find_page
(gtk_notebook_set/get_child_arg): new args CHILD_ARG_TAB_EXPAND,
CHILD_ARG_TAB_FILL, CHILD_ARG_TAB_PACK
(gtk_notebook_button_press) (gtk_notebook_key_press)
(gtk_notebook_focus) (gtk_notebook_pages_allocate)
(gtk_notebook_calc_tabs) (gtk_notebook_switch_focus_tab)
use gtk_notebook_search_page
(gtk_notebook_page_allocate): fixed allocation bug
(gtk_notebook_set/get_arg): new args TAB_HBORDER, TAB_VBORDER.
(gtk_notebook_init): unset GTK_NO_WINDOW flag
(gtk_notebook_size_request): check whether page->child is visible.
changes due to tab h/vborder, homogeneous tabs
(gtk_notebook_paint): don't draw invisible tabs
(gtk_notebook_switch_page): calculate page_num if it's less than 0
(gtk_notebook_append_*) (gtk_notebook_prepend_*)
(gtk_notebook_insert_page): removed sanity checks
* gtk/testgtk.c (create_notebook): extended Notebook sample a bit.
Mon Nov 16 15:10:33 1998 Owen Taylor <otaylor@redhat.com> Mon Nov 16 15:10:33 1998 Owen Taylor <otaylor@redhat.com>
* gtk/gtktext.c: Optimizations for moving point n * gtk/gtktext.c: Optimizations for moving point n

View File

@ -1,3 +1,48 @@
Tue Nov 17 00:06:29 1998 Lars Hamann <lars@gtk.org>
* gtk/gtknotebook.h (struct _GtkNotebook): new flags : homogeneous;
new guints : tab_hborder, tab_vborder; marked tab_border deprecated
(struct _GtkNotebookPage): new flags : expand, fill, pack
* gtk/gtknotebook.h/c
(gtk_notebook_set_homogeneous_tabs): new function. set homogeneneous
tabs
(gtk_notebook_set_tab_border): set tab_h/vborder to tab_border
(gtk_notebook_set_tab_hborder): new function. set tab_hborder
(gtk_notebook_set_tab_vborder): new function. set tab_vborder
(gtk_notebook_query_tab_label): new function. get tab_label widget.
(gtk_notebook_set_tab_label): new function. set tab_label widget.
(gtk_notebook_set_tab_label_text): new function. set tab_label text.
(gtk_notebook_query_menu_label): new function. get tab_label widget.
(gtk_notebook_set_menu_label): new function. set tab_label widget.
(gtk_notebook_set_menu_label_text): new function. set tab_label text.
(gtk_notebook_set_tab_label_packing): new function. set tab_label
fill, expand, fill_type
(gtk_notebook_query_tab_label_packing): new function. get tab_label
fill, expand, fill_type
(gtk_notebook_real_page_position): return logic page number
(gtk_notebook_search_page) search next/prev logic page
(gtk_notebook_update_labels): set logic page number.
(gtk_notebook_page_compare): renamed gtk_notebook_find_page
(gtk_notebook_set/get_child_arg): new args CHILD_ARG_TAB_EXPAND,
CHILD_ARG_TAB_FILL, CHILD_ARG_TAB_PACK
(gtk_notebook_button_press) (gtk_notebook_key_press)
(gtk_notebook_focus) (gtk_notebook_pages_allocate)
(gtk_notebook_calc_tabs) (gtk_notebook_switch_focus_tab)
use gtk_notebook_search_page
(gtk_notebook_page_allocate): fixed allocation bug
(gtk_notebook_set/get_arg): new args TAB_HBORDER, TAB_VBORDER.
(gtk_notebook_init): unset GTK_NO_WINDOW flag
(gtk_notebook_size_request): check whether page->child is visible.
changes due to tab h/vborder, homogeneous tabs
(gtk_notebook_paint): don't draw invisible tabs
(gtk_notebook_switch_page): calculate page_num if it's less than 0
(gtk_notebook_append_*) (gtk_notebook_prepend_*)
(gtk_notebook_insert_page): removed sanity checks
* gtk/testgtk.c (create_notebook): extended Notebook sample a bit.
Mon Nov 16 15:10:33 1998 Owen Taylor <otaylor@redhat.com> Mon Nov 16 15:10:33 1998 Owen Taylor <otaylor@redhat.com>
* gtk/gtktext.c: Optimizations for moving point n * gtk/gtktext.c: Optimizations for moving point n

View File

@ -1,3 +1,48 @@
Tue Nov 17 00:06:29 1998 Lars Hamann <lars@gtk.org>
* gtk/gtknotebook.h (struct _GtkNotebook): new flags : homogeneous;
new guints : tab_hborder, tab_vborder; marked tab_border deprecated
(struct _GtkNotebookPage): new flags : expand, fill, pack
* gtk/gtknotebook.h/c
(gtk_notebook_set_homogeneous_tabs): new function. set homogeneneous
tabs
(gtk_notebook_set_tab_border): set tab_h/vborder to tab_border
(gtk_notebook_set_tab_hborder): new function. set tab_hborder
(gtk_notebook_set_tab_vborder): new function. set tab_vborder
(gtk_notebook_query_tab_label): new function. get tab_label widget.
(gtk_notebook_set_tab_label): new function. set tab_label widget.
(gtk_notebook_set_tab_label_text): new function. set tab_label text.
(gtk_notebook_query_menu_label): new function. get tab_label widget.
(gtk_notebook_set_menu_label): new function. set tab_label widget.
(gtk_notebook_set_menu_label_text): new function. set tab_label text.
(gtk_notebook_set_tab_label_packing): new function. set tab_label
fill, expand, fill_type
(gtk_notebook_query_tab_label_packing): new function. get tab_label
fill, expand, fill_type
(gtk_notebook_real_page_position): return logic page number
(gtk_notebook_search_page) search next/prev logic page
(gtk_notebook_update_labels): set logic page number.
(gtk_notebook_page_compare): renamed gtk_notebook_find_page
(gtk_notebook_set/get_child_arg): new args CHILD_ARG_TAB_EXPAND,
CHILD_ARG_TAB_FILL, CHILD_ARG_TAB_PACK
(gtk_notebook_button_press) (gtk_notebook_key_press)
(gtk_notebook_focus) (gtk_notebook_pages_allocate)
(gtk_notebook_calc_tabs) (gtk_notebook_switch_focus_tab)
use gtk_notebook_search_page
(gtk_notebook_page_allocate): fixed allocation bug
(gtk_notebook_set/get_arg): new args TAB_HBORDER, TAB_VBORDER.
(gtk_notebook_init): unset GTK_NO_WINDOW flag
(gtk_notebook_size_request): check whether page->child is visible.
changes due to tab h/vborder, homogeneous tabs
(gtk_notebook_paint): don't draw invisible tabs
(gtk_notebook_switch_page): calculate page_num if it's less than 0
(gtk_notebook_append_*) (gtk_notebook_prepend_*)
(gtk_notebook_insert_page): removed sanity checks
* gtk/testgtk.c (create_notebook): extended Notebook sample a bit.
Mon Nov 16 15:10:33 1998 Owen Taylor <otaylor@redhat.com> Mon Nov 16 15:10:33 1998 Owen Taylor <otaylor@redhat.com>
* gtk/gtktext.c: Optimizations for moving point n * gtk/gtktext.c: Optimizations for moving point n

File diff suppressed because it is too large Load Diff

View File

@ -35,6 +35,8 @@ extern "C" {
#define GTK_IS_NOTEBOOK(obj) (GTK_CHECK_TYPE ((obj), GTK_TYPE_NOTEBOOK)) #define GTK_IS_NOTEBOOK(obj) (GTK_CHECK_TYPE ((obj), GTK_TYPE_NOTEBOOK))
#define GTK_IS_NOTEBOOK_CLASS(klass) (GTK_CHECK_CLASS_TYPE ((klass), GTK_TYPE_NOTEBOOK)) #define GTK_IS_NOTEBOOK_CLASS(klass) (GTK_CHECK_CLASS_TYPE ((klass), GTK_TYPE_NOTEBOOK))
#define GTK_NOTEBOOK_PAGE(_glist_) ((GtkNotebookPage *)((GList *)(_glist_))->data)
typedef struct _GtkNotebook GtkNotebook; typedef struct _GtkNotebook GtkNotebook;
typedef struct _GtkNotebookClass GtkNotebookClass; typedef struct _GtkNotebookClass GtkNotebookClass;
@ -54,16 +56,21 @@ struct _GtkNotebook
guint32 timer; guint32 timer;
guint16 tab_border; guint16 tab_border; /* deprecated field,
* use tab_hborder, tab_vborder instead
*/
guint16 tab_hborder;
guint16 tab_vborder;
guint show_tabs : 1; guint show_tabs : 1;
guint show_border : 1; guint homogeneous : 1;
guint tab_pos : 2; guint show_border : 1;
guint scrollable : 1; guint tab_pos : 2;
guint in_child : 2; guint scrollable : 1;
guint click_child : 2; guint in_child : 2;
guint button : 2; guint click_child : 2;
guint need_timer : 1; guint button : 2;
guint need_timer : 1;
guint child_has_focus : 1; guint child_has_focus : 1;
}; };
@ -81,62 +88,122 @@ struct _GtkNotebookPage
GtkWidget *child; GtkWidget *child;
GtkWidget *tab_label; GtkWidget *tab_label;
GtkWidget *menu_label; GtkWidget *menu_label;
guint default_menu : 1; guint default_menu : 1;
guint default_tab : 1; guint default_tab : 1;
guint expand : 1;
guint fill : 1;
guint pack : 1;
GtkRequisition requisition; GtkRequisition requisition;
GtkAllocation allocation; GtkAllocation allocation;
}; };
/***********************************************************
* Creation, insertion, deletion *
***********************************************************/
GtkType gtk_notebook_get_type (void); GtkType gtk_notebook_get_type (void);
GtkWidget* gtk_notebook_new (void); GtkWidget * gtk_notebook_new (void);
void gtk_notebook_append_page (GtkNotebook *notebook, void gtk_notebook_append_page (GtkNotebook *notebook,
GtkWidget *child, GtkWidget *child,
GtkWidget *tab_label); GtkWidget *tab_label);
void gtk_notebook_append_page_menu (GtkNotebook *notebook, void gtk_notebook_append_page_menu (GtkNotebook *notebook,
GtkWidget *child, GtkWidget *child,
GtkWidget *tab_label, GtkWidget *tab_label,
GtkWidget *menu_label); GtkWidget *menu_label);
void gtk_notebook_prepend_page (GtkNotebook *notebook, void gtk_notebook_prepend_page (GtkNotebook *notebook,
GtkWidget *child, GtkWidget *child,
GtkWidget *tab_label); GtkWidget *tab_label);
void gtk_notebook_prepend_page_menu (GtkNotebook *notebook, void gtk_notebook_prepend_page_menu (GtkNotebook *notebook,
GtkWidget *child, GtkWidget *child,
GtkWidget *tab_label, GtkWidget *tab_label,
GtkWidget *menu_label); GtkWidget *menu_label);
void gtk_notebook_insert_page (GtkNotebook *notebook, void gtk_notebook_insert_page (GtkNotebook *notebook,
GtkWidget *child, GtkWidget *child,
GtkWidget *tab_label, GtkWidget *tab_label,
gint position); gint position);
void gtk_notebook_insert_page_menu (GtkNotebook *notebook, void gtk_notebook_insert_page_menu (GtkNotebook *notebook,
GtkWidget *child, GtkWidget *child,
GtkWidget *tab_label, GtkWidget *tab_label,
GtkWidget *menu_label, GtkWidget *menu_label,
gint position); gint position);
void gtk_notebook_remove_page (GtkNotebook *notebook, void gtk_notebook_remove_page (GtkNotebook *notebook,
gint page_num); gint page_num);
gint gtk_notebook_current_page (GtkNotebook *notebook);
gint gtk_notebook_page_num (GtkNotebook *notebook, /***********************************************************
GtkWidget *child); * query, set current NoteebookPage *
void gtk_notebook_set_page (GtkNotebook *notebook, ***********************************************************/
gint page_num);
void gtk_notebook_next_page (GtkNotebook *notebook); gint gtk_notebook_current_page (GtkNotebook *notebook);
void gtk_notebook_prev_page (GtkNotebook *notebook); gint gtk_notebook_page_num (GtkNotebook *notebook,
void gtk_notebook_reorder_child (GtkNotebook *notebook, GtkWidget *child);
GtkWidget *child, void gtk_notebook_set_page (GtkNotebook *notebook,
gint position); gint page_num);
void gtk_notebook_set_tab_pos (GtkNotebook *notebook, void gtk_notebook_next_page (GtkNotebook *notebook);
GtkPositionType pos); void gtk_notebook_prev_page (GtkNotebook *notebook);
void gtk_notebook_set_show_tabs (GtkNotebook *notebook,
gboolean show_tabs); /***********************************************************
void gtk_notebook_set_show_border (GtkNotebook *notebook, * set Notebook, NotebookTab style *
gint show_border); ***********************************************************/
void gtk_notebook_set_scrollable (GtkNotebook *notebook,
gint scrollable); void gtk_notebook_set_show_border (GtkNotebook *notebook,
void gtk_notebook_set_tab_border (GtkNotebook *notebook, gboolean show_border);
guint border_width); void gtk_notebook_set_show_tabs (GtkNotebook *notebook,
void gtk_notebook_popup_enable (GtkNotebook *notebook); gboolean show_tabs);
void gtk_notebook_popup_disable (GtkNotebook *notebook); void gtk_notebook_set_tab_pos (GtkNotebook *notebook,
GtkPositionType pos);
void gtk_notebook_set_homogeneous_tabs (GtkNotebook *notebook,
gboolean homogeneous);
void gtk_notebook_set_tab_border (GtkNotebook *notebook,
guint border_width);
void gtk_notebook_set_tab_hborder (GtkNotebook *notebook,
guint tab_hborder);
void gtk_notebook_set_tab_vborder (GtkNotebook *notebook,
guint tab_vborder);
void gtk_notebook_set_scrollable (GtkNotebook *notebook,
gboolean scrollable);
/***********************************************************
* enable/disable PopupMenu *
***********************************************************/
void gtk_notebook_popup_enable (GtkNotebook *notebook);
void gtk_notebook_popup_disable (GtkNotebook *notebook);
/***********************************************************
* query/set NotebookPage Properties *
***********************************************************/
GtkWidget * gtk_notebook_query_tab_label (GtkNotebook *notebook,
GtkWidget *child);
void gtk_notebook_set_tab_label (GtkNotebook *notebook,
GtkWidget *child,
GtkWidget *tab_label);
void gtk_notebook_set_tab_label_text (GtkNotebook *notebook,
GtkWidget *child,
gchar *tab_text);
GtkWidget * gtk_notebook_query_menu_label (GtkNotebook *notebook,
GtkWidget *child);
void gtk_notebook_set_menu_label (GtkNotebook *notebook,
GtkWidget *child,
GtkWidget *menu_label);
void gtk_notebook_set_menu_label_text (GtkNotebook *notebook,
GtkWidget *child,
gchar *menu_text);
void gtk_notebook_query_tab_label_packing (GtkNotebook *notebook,
GtkWidget *child,
gboolean *expand,
gboolean *fill,
GtkPackType *pack_type);
void gtk_notebook_set_tab_label_packing (GtkNotebook *notebook,
GtkWidget *child,
gboolean expand,
gboolean fill,
GtkPackType pack_type);
void gtk_notebook_reorder_child (GtkNotebook *notebook,
GtkWidget *child,
gint position);
#ifdef __cplusplus #ifdef __cplusplus
} }

View File

@ -5698,6 +5698,7 @@ GdkPixmap *book_open;
GdkPixmap *book_closed; GdkPixmap *book_closed;
GdkBitmap *book_open_mask; GdkBitmap *book_open_mask;
GdkBitmap *book_closed_mask; GdkBitmap *book_closed_mask;
GtkWidget *sample_notebook;
static void static void
page_switch (GtkWidget *widget, GtkNotebookPage *page, gint page_num) page_switch (GtkWidget *widget, GtkNotebookPage *page, gint page_num)
@ -5709,33 +5710,71 @@ page_switch (GtkWidget *widget, GtkNotebookPage *page, gint page_num)
if (page == oldpage) if (page == oldpage)
return; return;
pixwid = ((GtkBoxChild*)
pixwid = ((GtkBoxChild*)(GTK_BOX (page->tab_label)->children->data))->widget; (GTK_BOX (page->tab_label)->children->data))->widget;
gtk_pixmap_set (GTK_PIXMAP (pixwid), book_open, book_open_mask); gtk_pixmap_set (GTK_PIXMAP (pixwid), book_open, book_open_mask);
pixwid = ((GtkBoxChild*) (GTK_BOX (page->menu_label)->children->data))->widget; pixwid = ((GtkBoxChild*)
(GTK_BOX (page->menu_label)->children->data))->widget;
gtk_pixmap_set (GTK_PIXMAP (pixwid), book_open, book_open_mask); gtk_pixmap_set (GTK_PIXMAP (pixwid), book_open, book_open_mask);
if (oldpage) if (oldpage)
{ {
pixwid = ((GtkBoxChild*) (GTK_BOX pixwid = ((GtkBoxChild*)
(oldpage->tab_label)->children->data))->widget; (GTK_BOX (oldpage->tab_label)->children->data))->widget;
gtk_pixmap_set (GTK_PIXMAP (pixwid), book_closed, book_closed_mask); gtk_pixmap_set (GTK_PIXMAP (pixwid), book_closed, book_closed_mask);
pixwid = ((GtkBoxChild*) (GTK_BOX (oldpage->menu_label)->children->data))->widget; pixwid = ((GtkBoxChild*)
(GTK_BOX (oldpage->menu_label)->children->data))->widget;
gtk_pixmap_set (GTK_PIXMAP (pixwid), book_closed, book_closed_mask); gtk_pixmap_set (GTK_PIXMAP (pixwid), book_closed, book_closed_mask);
} }
} }
static void
tab_fill (GtkToggleButton *button, GtkWidget *child)
{
gboolean expand;
GtkPackType pack_type;
gtk_notebook_query_tab_label_packing (GTK_NOTEBOOK (sample_notebook), child,
&expand, NULL, &pack_type);
gtk_notebook_set_tab_label_packing (GTK_NOTEBOOK (sample_notebook), child,
expand, button->active, pack_type);
}
static void
tab_expand (GtkToggleButton *button, GtkWidget *child)
{
gboolean fill;
GtkPackType pack_type;
gtk_notebook_query_tab_label_packing (GTK_NOTEBOOK (sample_notebook), child,
NULL, &fill, &pack_type);
gtk_notebook_set_tab_label_packing (GTK_NOTEBOOK (sample_notebook), child,
button->active, fill, pack_type);
}
static void
tab_pack (GtkToggleButton *button, GtkWidget *child)
{
gboolean expand;
gboolean fill;
gtk_notebook_query_tab_label_packing (GTK_NOTEBOOK (sample_notebook), child,
&expand, &fill, NULL);
gtk_notebook_set_tab_label_packing (GTK_NOTEBOOK (sample_notebook), child,
expand, fill, button->active);
}
static void static void
create_pages (GtkNotebook *notebook, gint start, gint end) create_pages (GtkNotebook *notebook, gint start, gint end)
{ {
GtkWidget *child = NULL; GtkWidget *child = NULL;
GtkWidget *button;
GtkWidget *label; GtkWidget *label;
GtkWidget *entry;
GtkWidget *box;
GtkWidget *hbox; GtkWidget *hbox;
GtkWidget *vbox;
GtkWidget *label_box; GtkWidget *label_box;
GtkWidget *menu_box; GtkWidget *menu_box;
GtkWidget *button;
GtkWidget *pixwid; GtkWidget *pixwid;
gint i; gint i;
char buffer[32]; char buffer[32];
@ -5743,47 +5782,38 @@ create_pages (GtkNotebook *notebook, gint start, gint end)
for (i = start; i <= end; i++) for (i = start; i <= end; i++)
{ {
sprintf (buffer, "Page %d", i); sprintf (buffer, "Page %d", i);
switch (i % 4)
{
case 3:
child = gtk_button_new_with_label (buffer);
gtk_container_border_width (GTK_CONTAINER(child), 10);
break;
case 2:
child = gtk_label_new (buffer);
break;
case 1:
child = gtk_frame_new (buffer);
gtk_container_border_width (GTK_CONTAINER (child), 10);
box = gtk_vbox_new (TRUE,0);
gtk_container_border_width (GTK_CONTAINER (box), 10);
gtk_container_add (GTK_CONTAINER (child), box);
label = gtk_label_new (buffer); child = gtk_frame_new (buffer);
gtk_box_pack_start (GTK_BOX(box), label, TRUE, TRUE, 5); gtk_container_border_width (GTK_CONTAINER (child), 10);
entry = gtk_entry_new (); vbox = gtk_vbox_new (TRUE,0);
gtk_box_pack_start (GTK_BOX(box), entry, TRUE, TRUE, 5); gtk_container_border_width (GTK_CONTAINER (vbox), 10);
gtk_container_add (GTK_CONTAINER (child), vbox);
hbox = gtk_hbox_new (TRUE,0);
gtk_box_pack_start (GTK_BOX(box), hbox, TRUE, TRUE, 5);
button = gtk_button_new_with_label ("Ok"); hbox = gtk_hbox_new (TRUE,0);
gtk_box_pack_start (GTK_BOX(hbox), button, TRUE, TRUE, 5); gtk_box_pack_start (GTK_BOX (vbox), hbox, FALSE, TRUE, 5);
button = gtk_button_new_with_label ("Cancel"); button = gtk_check_button_new_with_label ("Fill Tab");
gtk_box_pack_start (GTK_BOX(hbox), button, TRUE, TRUE, 5); gtk_box_pack_start (GTK_BOX (hbox), button, TRUE, TRUE, 5);
break; gtk_toggle_button_set_state (GTK_TOGGLE_BUTTON (button), TRUE);
case 0: gtk_signal_connect (GTK_OBJECT (button), "toggled",
child = gtk_frame_new (buffer); GTK_SIGNAL_FUNC (tab_fill), child);
gtk_container_border_width (GTK_CONTAINER (child), 10);
label = gtk_label_new (buffer); button = gtk_check_button_new_with_label ("Expand Tab");
gtk_container_add (GTK_CONTAINER (child), label); gtk_box_pack_start (GTK_BOX (hbox), button, TRUE, TRUE, 5);
break; gtk_signal_connect (GTK_OBJECT (button), "toggled",
} GTK_SIGNAL_FUNC (tab_expand), child);
button = gtk_check_button_new_with_label ("Pack end");
gtk_box_pack_start (GTK_BOX (hbox), button, TRUE, TRUE, 5);
gtk_signal_connect (GTK_OBJECT (button), "toggled",
GTK_SIGNAL_FUNC (tab_pack), child);
button = gtk_button_new_with_label ("Hide Page");
gtk_box_pack_end (GTK_BOX (vbox), button, FALSE, FALSE, 5);
gtk_signal_connect_object (GTK_OBJECT (button), "clicked",
GTK_SIGNAL_FUNC (gtk_widget_hide),
GTK_OBJECT (child));
gtk_widget_show_all (child); gtk_widget_show_all (child);
@ -5794,7 +5824,7 @@ create_pages (GtkNotebook *notebook, gint start, gint end)
label = gtk_label_new (buffer); label = gtk_label_new (buffer);
gtk_box_pack_start (GTK_BOX (label_box), label, FALSE, TRUE, 0); gtk_box_pack_start (GTK_BOX (label_box), label, FALSE, TRUE, 0);
gtk_widget_show_all (label_box); gtk_widget_show_all (label_box);
menu_box = gtk_hbox_new (FALSE, 0); menu_box = gtk_hbox_new (FALSE, 0);
pixwid = gtk_pixmap_new (book_closed, book_closed_mask); pixwid = gtk_pixmap_new (book_closed, book_closed_mask);
gtk_box_pack_start (GTK_BOX (menu_box), pixwid, FALSE, TRUE, 0); gtk_box_pack_start (GTK_BOX (menu_box), pixwid, FALSE, TRUE, 0);
@ -5802,7 +5832,6 @@ create_pages (GtkNotebook *notebook, gint start, gint end)
label = gtk_label_new (buffer); label = gtk_label_new (buffer);
gtk_box_pack_start (GTK_BOX (menu_box), label, FALSE, TRUE, 0); gtk_box_pack_start (GTK_BOX (menu_box), label, FALSE, TRUE, 0);
gtk_widget_show_all (menu_box); gtk_widget_show_all (menu_box);
gtk_notebook_append_page_menu (notebook, child, label_box, menu_box); gtk_notebook_append_page_menu (notebook, child, label_box, menu_box);
} }
} }
@ -5814,9 +5843,17 @@ rotate_notebook (GtkButton *button,
gtk_notebook_set_tab_pos (notebook, (notebook->tab_pos + 1) % 4); gtk_notebook_set_tab_pos (notebook, (notebook->tab_pos + 1) % 4);
} }
static void
show_all_pages (GtkButton *button,
GtkNotebook *notebook)
{
gtk_container_foreach (GTK_CONTAINER (notebook),
(GtkCallback) gtk_widget_show, NULL);
}
static void static void
standard_notebook (GtkButton *button, standard_notebook (GtkButton *button,
GtkNotebook *notebook) GtkNotebook *notebook)
{ {
gint i; gint i;
@ -5829,7 +5866,7 @@ standard_notebook (GtkButton *button,
static void static void
notabs_notebook (GtkButton *button, notabs_notebook (GtkButton *button,
GtkNotebook *notebook) GtkNotebook *notebook)
{ {
gint i; gint i;
@ -5841,7 +5878,7 @@ notabs_notebook (GtkButton *button,
static void static void
scrollable_notebook (GtkButton *button, scrollable_notebook (GtkButton *button,
GtkNotebook *notebook) GtkNotebook *notebook)
{ {
gtk_notebook_set_show_tabs (notebook, TRUE); gtk_notebook_set_show_tabs (notebook, TRUE);
gtk_notebook_set_scrollable (notebook, TRUE); gtk_notebook_set_scrollable (notebook, TRUE);
@ -5859,6 +5896,13 @@ notebook_popup (GtkToggleButton *button,
gtk_notebook_popup_disable (notebook); gtk_notebook_popup_disable (notebook);
} }
static void
notebook_homogeneous (GtkToggleButton *button,
GtkNotebook *notebook)
{
gtk_notebook_set_homogeneous_tabs (notebook, button->active);
}
static void static void
create_notebook (void) create_notebook (void)
{ {
@ -5867,9 +5911,9 @@ create_notebook (void)
GtkWidget *box2; GtkWidget *box2;
GtkWidget *button; GtkWidget *button;
GtkWidget *separator; GtkWidget *separator;
GtkWidget *notebook;
GtkWidget *omenu; GtkWidget *omenu;
GdkColor *transparent = NULL; GdkColor *transparent = NULL;
GtkWidget *label;
static OptionMenuItem items[] = static OptionMenuItem items[] =
{ {
@ -5892,72 +5936,91 @@ create_notebook (void)
box1 = gtk_vbox_new (FALSE, 0); box1 = gtk_vbox_new (FALSE, 0);
gtk_container_add (GTK_CONTAINER (window), box1); gtk_container_add (GTK_CONTAINER (window), box1);
notebook = gtk_notebook_new (); sample_notebook = gtk_notebook_new ();
gtk_signal_connect (GTK_OBJECT (notebook), "switch_page", gtk_signal_connect (GTK_OBJECT (sample_notebook), "switch_page",
GTK_SIGNAL_FUNC (page_switch), NULL); GTK_SIGNAL_FUNC (page_switch), NULL);
gtk_notebook_set_tab_pos (GTK_NOTEBOOK (notebook), GTK_POS_TOP); gtk_notebook_set_tab_pos (GTK_NOTEBOOK (sample_notebook), GTK_POS_TOP);
gtk_box_pack_start (GTK_BOX (box1), notebook, TRUE, TRUE, 0); gtk_box_pack_start (GTK_BOX (box1), sample_notebook, TRUE, TRUE, 0);
gtk_container_border_width (GTK_CONTAINER (notebook), 10); gtk_container_border_width (GTK_CONTAINER (sample_notebook), 10);
gtk_widget_realize (notebook); gtk_widget_realize (sample_notebook);
book_open = gdk_pixmap_create_from_xpm_d (notebook->window, book_open = gdk_pixmap_create_from_xpm_d (sample_notebook->window,
&book_open_mask, &book_open_mask,
transparent, transparent,
book_open_xpm); book_open_xpm);
book_closed = gdk_pixmap_create_from_xpm_d (notebook->window, book_closed = gdk_pixmap_create_from_xpm_d (sample_notebook->window,
&book_closed_mask, &book_closed_mask,
transparent, transparent,
book_closed_xpm); book_closed_xpm);
create_pages (GTK_NOTEBOOK (notebook), 1, 5); create_pages (GTK_NOTEBOOK (sample_notebook), 1, 5);
separator = gtk_hseparator_new (); separator = gtk_hseparator_new ();
gtk_box_pack_start (GTK_BOX (box1), separator, FALSE, TRUE, 10); gtk_box_pack_start (GTK_BOX (box1), separator, FALSE, TRUE, 10);
box2 = gtk_hbox_new (TRUE, 5); box2 = gtk_hbox_new (FALSE, 5);
gtk_container_border_width (GTK_CONTAINER (box2), 10);
gtk_box_pack_start (GTK_BOX (box1), box2, FALSE, TRUE, 0); gtk_box_pack_start (GTK_BOX (box1), box2, FALSE, TRUE, 0);
omenu = build_option_menu (items, 3, 0, notebook);
gtk_box_pack_start (GTK_BOX (box2), omenu, FALSE, FALSE, 0);
button = gtk_check_button_new_with_label ("enable popup menu"); button = gtk_check_button_new_with_label ("popup menu");
gtk_box_pack_start (GTK_BOX (box2), button, FALSE, FALSE, 0); gtk_box_pack_start (GTK_BOX (box2), button, TRUE, FALSE, 0);
gtk_signal_connect (GTK_OBJECT(button), "clicked", gtk_signal_connect (GTK_OBJECT(button), "clicked",
GTK_SIGNAL_FUNC (notebook_popup), GTK_SIGNAL_FUNC (notebook_popup),
GTK_OBJECT (notebook)); GTK_OBJECT (sample_notebook));
button = gtk_check_button_new_with_label ("homogeneous tabs");
gtk_box_pack_start (GTK_BOX (box2), button, TRUE, FALSE, 0);
gtk_signal_connect (GTK_OBJECT(button), "clicked",
GTK_SIGNAL_FUNC (notebook_homogeneous),
GTK_OBJECT (sample_notebook));
box2 = gtk_hbox_new (FALSE, 5);
gtk_container_border_width (GTK_CONTAINER (box2), 10);
gtk_box_pack_start (GTK_BOX (box1), box2, FALSE, TRUE, 0);
label = gtk_label_new ("Notebook Style :");
gtk_box_pack_start (GTK_BOX (box2), label, FALSE, TRUE, 0);
omenu = build_option_menu (items, 3, 0, sample_notebook);
gtk_box_pack_start (GTK_BOX (box2), omenu, FALSE, TRUE, 0);
button = gtk_button_new_with_label ("Show all Pages");
gtk_box_pack_start (GTK_BOX (box2), button, FALSE, TRUE, 0);
gtk_signal_connect (GTK_OBJECT (button), "clicked",
GTK_SIGNAL_FUNC (show_all_pages), sample_notebook);
box2 = gtk_hbox_new (TRUE, 10); box2 = gtk_hbox_new (TRUE, 10);
gtk_container_border_width (GTK_CONTAINER (box2), 10); gtk_container_border_width (GTK_CONTAINER (box2), 10);
gtk_box_pack_start (GTK_BOX (box1), box2, FALSE, TRUE, 0); gtk_box_pack_start (GTK_BOX (box1), box2, FALSE, TRUE, 0);
button = gtk_button_new_with_label ("close");
gtk_signal_connect_object (GTK_OBJECT (button), "clicked",
GTK_SIGNAL_FUNC (gtk_widget_destroy),
GTK_OBJECT (window));
gtk_box_pack_start (GTK_BOX (box2), button, TRUE, TRUE, 0);
GTK_WIDGET_SET_FLAGS (button, GTK_CAN_DEFAULT);
gtk_widget_grab_default (button);
button = gtk_button_new_with_label ("next");
gtk_signal_connect_object (GTK_OBJECT (button), "clicked",
GTK_SIGNAL_FUNC (gtk_notebook_next_page),
GTK_OBJECT (notebook));
gtk_box_pack_start (GTK_BOX (box2), button, TRUE, TRUE, 0);
GTK_WIDGET_SET_FLAGS (button, GTK_CAN_DEFAULT);
button = gtk_button_new_with_label ("prev"); button = gtk_button_new_with_label ("prev");
gtk_signal_connect_object (GTK_OBJECT (button), "clicked", gtk_signal_connect_object (GTK_OBJECT (button), "clicked",
GTK_SIGNAL_FUNC (gtk_notebook_prev_page), GTK_SIGNAL_FUNC (gtk_notebook_prev_page),
GTK_OBJECT (notebook)); GTK_OBJECT (sample_notebook));
gtk_box_pack_start (GTK_BOX (box2), button, TRUE, TRUE, 0);
button = gtk_button_new_with_label ("next");
gtk_signal_connect_object (GTK_OBJECT (button), "clicked",
GTK_SIGNAL_FUNC (gtk_notebook_next_page),
GTK_OBJECT (sample_notebook));
gtk_box_pack_start (GTK_BOX (box2), button, TRUE, TRUE, 0); gtk_box_pack_start (GTK_BOX (box2), button, TRUE, TRUE, 0);
GTK_WIDGET_SET_FLAGS (button, GTK_CAN_DEFAULT);
button = gtk_button_new_with_label ("rotate"); button = gtk_button_new_with_label ("rotate");
gtk_signal_connect (GTK_OBJECT (button), "clicked", gtk_signal_connect (GTK_OBJECT (button), "clicked",
GTK_SIGNAL_FUNC (rotate_notebook), GTK_SIGNAL_FUNC (rotate_notebook), sample_notebook);
notebook);
gtk_box_pack_start (GTK_BOX (box2), button, TRUE, TRUE, 0); gtk_box_pack_start (GTK_BOX (box2), button, TRUE, TRUE, 0);
separator = gtk_hseparator_new ();
gtk_box_pack_start (GTK_BOX (box1), separator, FALSE, TRUE, 5);
button = gtk_button_new_with_label ("close");
gtk_container_border_width (GTK_CONTAINER (button), 5);
gtk_signal_connect_object (GTK_OBJECT (button), "clicked",
GTK_SIGNAL_FUNC (gtk_widget_destroy),
GTK_OBJECT (window));
gtk_box_pack_start (GTK_BOX (box1), button, FALSE, FALSE, 0);
GTK_WIDGET_SET_FLAGS (button, GTK_CAN_DEFAULT); GTK_WIDGET_SET_FLAGS (button, GTK_CAN_DEFAULT);
gtk_widget_grab_default (button);
} }
if (!GTK_WIDGET_VISIBLE (window)) if (!GTK_WIDGET_VISIBLE (window))

View File

@ -5698,6 +5698,7 @@ GdkPixmap *book_open;
GdkPixmap *book_closed; GdkPixmap *book_closed;
GdkBitmap *book_open_mask; GdkBitmap *book_open_mask;
GdkBitmap *book_closed_mask; GdkBitmap *book_closed_mask;
GtkWidget *sample_notebook;
static void static void
page_switch (GtkWidget *widget, GtkNotebookPage *page, gint page_num) page_switch (GtkWidget *widget, GtkNotebookPage *page, gint page_num)
@ -5709,33 +5710,71 @@ page_switch (GtkWidget *widget, GtkNotebookPage *page, gint page_num)
if (page == oldpage) if (page == oldpage)
return; return;
pixwid = ((GtkBoxChild*)
pixwid = ((GtkBoxChild*)(GTK_BOX (page->tab_label)->children->data))->widget; (GTK_BOX (page->tab_label)->children->data))->widget;
gtk_pixmap_set (GTK_PIXMAP (pixwid), book_open, book_open_mask); gtk_pixmap_set (GTK_PIXMAP (pixwid), book_open, book_open_mask);
pixwid = ((GtkBoxChild*) (GTK_BOX (page->menu_label)->children->data))->widget; pixwid = ((GtkBoxChild*)
(GTK_BOX (page->menu_label)->children->data))->widget;
gtk_pixmap_set (GTK_PIXMAP (pixwid), book_open, book_open_mask); gtk_pixmap_set (GTK_PIXMAP (pixwid), book_open, book_open_mask);
if (oldpage) if (oldpage)
{ {
pixwid = ((GtkBoxChild*) (GTK_BOX pixwid = ((GtkBoxChild*)
(oldpage->tab_label)->children->data))->widget; (GTK_BOX (oldpage->tab_label)->children->data))->widget;
gtk_pixmap_set (GTK_PIXMAP (pixwid), book_closed, book_closed_mask); gtk_pixmap_set (GTK_PIXMAP (pixwid), book_closed, book_closed_mask);
pixwid = ((GtkBoxChild*) (GTK_BOX (oldpage->menu_label)->children->data))->widget; pixwid = ((GtkBoxChild*)
(GTK_BOX (oldpage->menu_label)->children->data))->widget;
gtk_pixmap_set (GTK_PIXMAP (pixwid), book_closed, book_closed_mask); gtk_pixmap_set (GTK_PIXMAP (pixwid), book_closed, book_closed_mask);
} }
} }
static void
tab_fill (GtkToggleButton *button, GtkWidget *child)
{
gboolean expand;
GtkPackType pack_type;
gtk_notebook_query_tab_label_packing (GTK_NOTEBOOK (sample_notebook), child,
&expand, NULL, &pack_type);
gtk_notebook_set_tab_label_packing (GTK_NOTEBOOK (sample_notebook), child,
expand, button->active, pack_type);
}
static void
tab_expand (GtkToggleButton *button, GtkWidget *child)
{
gboolean fill;
GtkPackType pack_type;
gtk_notebook_query_tab_label_packing (GTK_NOTEBOOK (sample_notebook), child,
NULL, &fill, &pack_type);
gtk_notebook_set_tab_label_packing (GTK_NOTEBOOK (sample_notebook), child,
button->active, fill, pack_type);
}
static void
tab_pack (GtkToggleButton *button, GtkWidget *child)
{
gboolean expand;
gboolean fill;
gtk_notebook_query_tab_label_packing (GTK_NOTEBOOK (sample_notebook), child,
&expand, &fill, NULL);
gtk_notebook_set_tab_label_packing (GTK_NOTEBOOK (sample_notebook), child,
expand, fill, button->active);
}
static void static void
create_pages (GtkNotebook *notebook, gint start, gint end) create_pages (GtkNotebook *notebook, gint start, gint end)
{ {
GtkWidget *child = NULL; GtkWidget *child = NULL;
GtkWidget *button;
GtkWidget *label; GtkWidget *label;
GtkWidget *entry;
GtkWidget *box;
GtkWidget *hbox; GtkWidget *hbox;
GtkWidget *vbox;
GtkWidget *label_box; GtkWidget *label_box;
GtkWidget *menu_box; GtkWidget *menu_box;
GtkWidget *button;
GtkWidget *pixwid; GtkWidget *pixwid;
gint i; gint i;
char buffer[32]; char buffer[32];
@ -5743,47 +5782,38 @@ create_pages (GtkNotebook *notebook, gint start, gint end)
for (i = start; i <= end; i++) for (i = start; i <= end; i++)
{ {
sprintf (buffer, "Page %d", i); sprintf (buffer, "Page %d", i);
switch (i % 4)
{
case 3:
child = gtk_button_new_with_label (buffer);
gtk_container_border_width (GTK_CONTAINER(child), 10);
break;
case 2:
child = gtk_label_new (buffer);
break;
case 1:
child = gtk_frame_new (buffer);
gtk_container_border_width (GTK_CONTAINER (child), 10);
box = gtk_vbox_new (TRUE,0);
gtk_container_border_width (GTK_CONTAINER (box), 10);
gtk_container_add (GTK_CONTAINER (child), box);
label = gtk_label_new (buffer); child = gtk_frame_new (buffer);
gtk_box_pack_start (GTK_BOX(box), label, TRUE, TRUE, 5); gtk_container_border_width (GTK_CONTAINER (child), 10);
entry = gtk_entry_new (); vbox = gtk_vbox_new (TRUE,0);
gtk_box_pack_start (GTK_BOX(box), entry, TRUE, TRUE, 5); gtk_container_border_width (GTK_CONTAINER (vbox), 10);
gtk_container_add (GTK_CONTAINER (child), vbox);
hbox = gtk_hbox_new (TRUE,0);
gtk_box_pack_start (GTK_BOX(box), hbox, TRUE, TRUE, 5);
button = gtk_button_new_with_label ("Ok"); hbox = gtk_hbox_new (TRUE,0);
gtk_box_pack_start (GTK_BOX(hbox), button, TRUE, TRUE, 5); gtk_box_pack_start (GTK_BOX (vbox), hbox, FALSE, TRUE, 5);
button = gtk_button_new_with_label ("Cancel"); button = gtk_check_button_new_with_label ("Fill Tab");
gtk_box_pack_start (GTK_BOX(hbox), button, TRUE, TRUE, 5); gtk_box_pack_start (GTK_BOX (hbox), button, TRUE, TRUE, 5);
break; gtk_toggle_button_set_state (GTK_TOGGLE_BUTTON (button), TRUE);
case 0: gtk_signal_connect (GTK_OBJECT (button), "toggled",
child = gtk_frame_new (buffer); GTK_SIGNAL_FUNC (tab_fill), child);
gtk_container_border_width (GTK_CONTAINER (child), 10);
label = gtk_label_new (buffer); button = gtk_check_button_new_with_label ("Expand Tab");
gtk_container_add (GTK_CONTAINER (child), label); gtk_box_pack_start (GTK_BOX (hbox), button, TRUE, TRUE, 5);
break; gtk_signal_connect (GTK_OBJECT (button), "toggled",
} GTK_SIGNAL_FUNC (tab_expand), child);
button = gtk_check_button_new_with_label ("Pack end");
gtk_box_pack_start (GTK_BOX (hbox), button, TRUE, TRUE, 5);
gtk_signal_connect (GTK_OBJECT (button), "toggled",
GTK_SIGNAL_FUNC (tab_pack), child);
button = gtk_button_new_with_label ("Hide Page");
gtk_box_pack_end (GTK_BOX (vbox), button, FALSE, FALSE, 5);
gtk_signal_connect_object (GTK_OBJECT (button), "clicked",
GTK_SIGNAL_FUNC (gtk_widget_hide),
GTK_OBJECT (child));
gtk_widget_show_all (child); gtk_widget_show_all (child);
@ -5794,7 +5824,7 @@ create_pages (GtkNotebook *notebook, gint start, gint end)
label = gtk_label_new (buffer); label = gtk_label_new (buffer);
gtk_box_pack_start (GTK_BOX (label_box), label, FALSE, TRUE, 0); gtk_box_pack_start (GTK_BOX (label_box), label, FALSE, TRUE, 0);
gtk_widget_show_all (label_box); gtk_widget_show_all (label_box);
menu_box = gtk_hbox_new (FALSE, 0); menu_box = gtk_hbox_new (FALSE, 0);
pixwid = gtk_pixmap_new (book_closed, book_closed_mask); pixwid = gtk_pixmap_new (book_closed, book_closed_mask);
gtk_box_pack_start (GTK_BOX (menu_box), pixwid, FALSE, TRUE, 0); gtk_box_pack_start (GTK_BOX (menu_box), pixwid, FALSE, TRUE, 0);
@ -5802,7 +5832,6 @@ create_pages (GtkNotebook *notebook, gint start, gint end)
label = gtk_label_new (buffer); label = gtk_label_new (buffer);
gtk_box_pack_start (GTK_BOX (menu_box), label, FALSE, TRUE, 0); gtk_box_pack_start (GTK_BOX (menu_box), label, FALSE, TRUE, 0);
gtk_widget_show_all (menu_box); gtk_widget_show_all (menu_box);
gtk_notebook_append_page_menu (notebook, child, label_box, menu_box); gtk_notebook_append_page_menu (notebook, child, label_box, menu_box);
} }
} }
@ -5814,9 +5843,17 @@ rotate_notebook (GtkButton *button,
gtk_notebook_set_tab_pos (notebook, (notebook->tab_pos + 1) % 4); gtk_notebook_set_tab_pos (notebook, (notebook->tab_pos + 1) % 4);
} }
static void
show_all_pages (GtkButton *button,
GtkNotebook *notebook)
{
gtk_container_foreach (GTK_CONTAINER (notebook),
(GtkCallback) gtk_widget_show, NULL);
}
static void static void
standard_notebook (GtkButton *button, standard_notebook (GtkButton *button,
GtkNotebook *notebook) GtkNotebook *notebook)
{ {
gint i; gint i;
@ -5829,7 +5866,7 @@ standard_notebook (GtkButton *button,
static void static void
notabs_notebook (GtkButton *button, notabs_notebook (GtkButton *button,
GtkNotebook *notebook) GtkNotebook *notebook)
{ {
gint i; gint i;
@ -5841,7 +5878,7 @@ notabs_notebook (GtkButton *button,
static void static void
scrollable_notebook (GtkButton *button, scrollable_notebook (GtkButton *button,
GtkNotebook *notebook) GtkNotebook *notebook)
{ {
gtk_notebook_set_show_tabs (notebook, TRUE); gtk_notebook_set_show_tabs (notebook, TRUE);
gtk_notebook_set_scrollable (notebook, TRUE); gtk_notebook_set_scrollable (notebook, TRUE);
@ -5859,6 +5896,13 @@ notebook_popup (GtkToggleButton *button,
gtk_notebook_popup_disable (notebook); gtk_notebook_popup_disable (notebook);
} }
static void
notebook_homogeneous (GtkToggleButton *button,
GtkNotebook *notebook)
{
gtk_notebook_set_homogeneous_tabs (notebook, button->active);
}
static void static void
create_notebook (void) create_notebook (void)
{ {
@ -5867,9 +5911,9 @@ create_notebook (void)
GtkWidget *box2; GtkWidget *box2;
GtkWidget *button; GtkWidget *button;
GtkWidget *separator; GtkWidget *separator;
GtkWidget *notebook;
GtkWidget *omenu; GtkWidget *omenu;
GdkColor *transparent = NULL; GdkColor *transparent = NULL;
GtkWidget *label;
static OptionMenuItem items[] = static OptionMenuItem items[] =
{ {
@ -5892,72 +5936,91 @@ create_notebook (void)
box1 = gtk_vbox_new (FALSE, 0); box1 = gtk_vbox_new (FALSE, 0);
gtk_container_add (GTK_CONTAINER (window), box1); gtk_container_add (GTK_CONTAINER (window), box1);
notebook = gtk_notebook_new (); sample_notebook = gtk_notebook_new ();
gtk_signal_connect (GTK_OBJECT (notebook), "switch_page", gtk_signal_connect (GTK_OBJECT (sample_notebook), "switch_page",
GTK_SIGNAL_FUNC (page_switch), NULL); GTK_SIGNAL_FUNC (page_switch), NULL);
gtk_notebook_set_tab_pos (GTK_NOTEBOOK (notebook), GTK_POS_TOP); gtk_notebook_set_tab_pos (GTK_NOTEBOOK (sample_notebook), GTK_POS_TOP);
gtk_box_pack_start (GTK_BOX (box1), notebook, TRUE, TRUE, 0); gtk_box_pack_start (GTK_BOX (box1), sample_notebook, TRUE, TRUE, 0);
gtk_container_border_width (GTK_CONTAINER (notebook), 10); gtk_container_border_width (GTK_CONTAINER (sample_notebook), 10);
gtk_widget_realize (notebook); gtk_widget_realize (sample_notebook);
book_open = gdk_pixmap_create_from_xpm_d (notebook->window, book_open = gdk_pixmap_create_from_xpm_d (sample_notebook->window,
&book_open_mask, &book_open_mask,
transparent, transparent,
book_open_xpm); book_open_xpm);
book_closed = gdk_pixmap_create_from_xpm_d (notebook->window, book_closed = gdk_pixmap_create_from_xpm_d (sample_notebook->window,
&book_closed_mask, &book_closed_mask,
transparent, transparent,
book_closed_xpm); book_closed_xpm);
create_pages (GTK_NOTEBOOK (notebook), 1, 5); create_pages (GTK_NOTEBOOK (sample_notebook), 1, 5);
separator = gtk_hseparator_new (); separator = gtk_hseparator_new ();
gtk_box_pack_start (GTK_BOX (box1), separator, FALSE, TRUE, 10); gtk_box_pack_start (GTK_BOX (box1), separator, FALSE, TRUE, 10);
box2 = gtk_hbox_new (TRUE, 5); box2 = gtk_hbox_new (FALSE, 5);
gtk_container_border_width (GTK_CONTAINER (box2), 10);
gtk_box_pack_start (GTK_BOX (box1), box2, FALSE, TRUE, 0); gtk_box_pack_start (GTK_BOX (box1), box2, FALSE, TRUE, 0);
omenu = build_option_menu (items, 3, 0, notebook);
gtk_box_pack_start (GTK_BOX (box2), omenu, FALSE, FALSE, 0);
button = gtk_check_button_new_with_label ("enable popup menu"); button = gtk_check_button_new_with_label ("popup menu");
gtk_box_pack_start (GTK_BOX (box2), button, FALSE, FALSE, 0); gtk_box_pack_start (GTK_BOX (box2), button, TRUE, FALSE, 0);
gtk_signal_connect (GTK_OBJECT(button), "clicked", gtk_signal_connect (GTK_OBJECT(button), "clicked",
GTK_SIGNAL_FUNC (notebook_popup), GTK_SIGNAL_FUNC (notebook_popup),
GTK_OBJECT (notebook)); GTK_OBJECT (sample_notebook));
button = gtk_check_button_new_with_label ("homogeneous tabs");
gtk_box_pack_start (GTK_BOX (box2), button, TRUE, FALSE, 0);
gtk_signal_connect (GTK_OBJECT(button), "clicked",
GTK_SIGNAL_FUNC (notebook_homogeneous),
GTK_OBJECT (sample_notebook));
box2 = gtk_hbox_new (FALSE, 5);
gtk_container_border_width (GTK_CONTAINER (box2), 10);
gtk_box_pack_start (GTK_BOX (box1), box2, FALSE, TRUE, 0);
label = gtk_label_new ("Notebook Style :");
gtk_box_pack_start (GTK_BOX (box2), label, FALSE, TRUE, 0);
omenu = build_option_menu (items, 3, 0, sample_notebook);
gtk_box_pack_start (GTK_BOX (box2), omenu, FALSE, TRUE, 0);
button = gtk_button_new_with_label ("Show all Pages");
gtk_box_pack_start (GTK_BOX (box2), button, FALSE, TRUE, 0);
gtk_signal_connect (GTK_OBJECT (button), "clicked",
GTK_SIGNAL_FUNC (show_all_pages), sample_notebook);
box2 = gtk_hbox_new (TRUE, 10); box2 = gtk_hbox_new (TRUE, 10);
gtk_container_border_width (GTK_CONTAINER (box2), 10); gtk_container_border_width (GTK_CONTAINER (box2), 10);
gtk_box_pack_start (GTK_BOX (box1), box2, FALSE, TRUE, 0); gtk_box_pack_start (GTK_BOX (box1), box2, FALSE, TRUE, 0);
button = gtk_button_new_with_label ("close");
gtk_signal_connect_object (GTK_OBJECT (button), "clicked",
GTK_SIGNAL_FUNC (gtk_widget_destroy),
GTK_OBJECT (window));
gtk_box_pack_start (GTK_BOX (box2), button, TRUE, TRUE, 0);
GTK_WIDGET_SET_FLAGS (button, GTK_CAN_DEFAULT);
gtk_widget_grab_default (button);
button = gtk_button_new_with_label ("next");
gtk_signal_connect_object (GTK_OBJECT (button), "clicked",
GTK_SIGNAL_FUNC (gtk_notebook_next_page),
GTK_OBJECT (notebook));
gtk_box_pack_start (GTK_BOX (box2), button, TRUE, TRUE, 0);
GTK_WIDGET_SET_FLAGS (button, GTK_CAN_DEFAULT);
button = gtk_button_new_with_label ("prev"); button = gtk_button_new_with_label ("prev");
gtk_signal_connect_object (GTK_OBJECT (button), "clicked", gtk_signal_connect_object (GTK_OBJECT (button), "clicked",
GTK_SIGNAL_FUNC (gtk_notebook_prev_page), GTK_SIGNAL_FUNC (gtk_notebook_prev_page),
GTK_OBJECT (notebook)); GTK_OBJECT (sample_notebook));
gtk_box_pack_start (GTK_BOX (box2), button, TRUE, TRUE, 0);
button = gtk_button_new_with_label ("next");
gtk_signal_connect_object (GTK_OBJECT (button), "clicked",
GTK_SIGNAL_FUNC (gtk_notebook_next_page),
GTK_OBJECT (sample_notebook));
gtk_box_pack_start (GTK_BOX (box2), button, TRUE, TRUE, 0); gtk_box_pack_start (GTK_BOX (box2), button, TRUE, TRUE, 0);
GTK_WIDGET_SET_FLAGS (button, GTK_CAN_DEFAULT);
button = gtk_button_new_with_label ("rotate"); button = gtk_button_new_with_label ("rotate");
gtk_signal_connect (GTK_OBJECT (button), "clicked", gtk_signal_connect (GTK_OBJECT (button), "clicked",
GTK_SIGNAL_FUNC (rotate_notebook), GTK_SIGNAL_FUNC (rotate_notebook), sample_notebook);
notebook);
gtk_box_pack_start (GTK_BOX (box2), button, TRUE, TRUE, 0); gtk_box_pack_start (GTK_BOX (box2), button, TRUE, TRUE, 0);
separator = gtk_hseparator_new ();
gtk_box_pack_start (GTK_BOX (box1), separator, FALSE, TRUE, 5);
button = gtk_button_new_with_label ("close");
gtk_container_border_width (GTK_CONTAINER (button), 5);
gtk_signal_connect_object (GTK_OBJECT (button), "clicked",
GTK_SIGNAL_FUNC (gtk_widget_destroy),
GTK_OBJECT (window));
gtk_box_pack_start (GTK_BOX (box1), button, FALSE, FALSE, 0);
GTK_WIDGET_SET_FLAGS (button, GTK_CAN_DEFAULT); GTK_WIDGET_SET_FLAGS (button, GTK_CAN_DEFAULT);
gtk_widget_grab_default (button);
} }
if (!GTK_WIDGET_VISIBLE (window)) if (!GTK_WIDGET_VISIBLE (window))