1 /* -*- Mode: C; c-file-style: "gnu"; tab-width: 8 -*- */
2 /* GTK - The GIMP Toolkit
3 * Copyright (C) 1995-1997 Peter Mattis, Spencer Kimball and Josh MacDonald
5 * This library is free software; you can redistribute it and/or
6 * modify it under the terms of the GNU Lesser General Public
7 * License as published by the Free Software Foundation; either
8 * version 2 of the License, or (at your option) any later version.
10 * This library is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 * Lesser General Public License for more details.
15 * You should have received a copy of the GNU Lesser General Public
16 * License along with this library; if not, write to the
17 * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
18 * Boston, MA 02111-1307, USA.
22 * Modified by the GTK+ Team and others 1997-2000. See the AUTHORS
23 * file for a list of people on the GTK+ Team. See the ChangeLog
24 * files for a list of changes. These files are distributed with
25 * GTK+ at ftp://ftp.gtk.org/pub/gtk/.
28 #if !defined (__GTK_H_INSIDE__) && !defined (GTK_COMPILATION)
29 #error "Only <gtk/gtk.h> can be included directly."
32 #ifndef __GTK_NOTEBOOK_H__
33 #define __GTK_NOTEBOOK_H__
36 #include <gtk/gtkcontainer.h>
41 #define GTK_TYPE_NOTEBOOK (gtk_notebook_get_type ())
42 #define GTK_NOTEBOOK(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GTK_TYPE_NOTEBOOK, GtkNotebook))
43 #define GTK_NOTEBOOK_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GTK_TYPE_NOTEBOOK, GtkNotebookClass))
44 #define GTK_IS_NOTEBOOK(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GTK_TYPE_NOTEBOOK))
45 #define GTK_IS_NOTEBOOK_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GTK_TYPE_NOTEBOOK))
46 #define GTK_NOTEBOOK_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GTK_TYPE_NOTEBOOK, GtkNotebookClass))
51 GTK_NOTEBOOK_TAB_FIRST,
55 typedef struct _GtkNotebook GtkNotebook;
56 typedef struct _GtkNotebookClass GtkNotebookClass;
57 typedef struct _GtkNotebookPage GtkNotebookPage;
61 GtkContainer container;
63 GtkNotebookPage *GSEAL (cur_page);
64 GList *GSEAL (children);
65 GList *GSEAL (first_tab); /* The first tab visible (for scrolling notebooks) */
66 GList *GSEAL (focus_tab);
68 GtkWidget *GSEAL (menu);
69 GdkWindow *GSEAL (event_window);
71 guint32 GSEAL (timer);
73 guint16 GSEAL (tab_hborder);
74 guint16 GSEAL (tab_vborder);
76 guint GSEAL (show_tabs) : 1;
77 guint GSEAL (homogeneous) : 1;
78 guint GSEAL (show_border) : 1;
79 guint GSEAL (tab_pos) : 2;
80 guint GSEAL (scrollable) : 1;
81 guint GSEAL (in_child) : 3;
82 guint GSEAL (click_child) : 3;
83 guint GSEAL (button) : 2;
84 guint GSEAL (need_timer) : 1;
85 guint GSEAL (child_has_focus) : 1;
86 guint GSEAL (have_visible_child) : 1;
87 guint GSEAL (focus_out) : 1; /* Flag used by ::move-focus-out implementation */
89 guint GSEAL (has_before_previous) : 1;
90 guint GSEAL (has_before_next) : 1;
91 guint GSEAL (has_after_previous) : 1;
92 guint GSEAL (has_after_next) : 1;
95 struct _GtkNotebookClass
97 GtkContainerClass parent_class;
99 void (* switch_page) (GtkNotebook *notebook,
100 GtkNotebookPage *page,
103 /* Action signals for keybindings */
104 gboolean (* select_page) (GtkNotebook *notebook,
105 gboolean move_focus);
106 gboolean (* focus_tab) (GtkNotebook *notebook,
107 GtkNotebookTab type);
108 gboolean (* change_current_page) (GtkNotebook *notebook,
110 void (* move_focus_out) (GtkNotebook *notebook,
111 GtkDirectionType direction);
112 gboolean (* reorder_tab) (GtkNotebook *notebook,
113 GtkDirectionType direction,
114 gboolean move_to_last);
117 gint (* insert_page) (GtkNotebook *notebook,
119 GtkWidget *tab_label,
120 GtkWidget *menu_label,
123 GtkNotebook * (* create_window) (GtkNotebook *notebook,
128 void (*_gtk_reserved1) (void);
131 typedef GtkNotebook* (*GtkNotebookWindowCreationFunc) (GtkNotebook *source,
137 /***********************************************************
138 * Creation, insertion, deletion *
139 ***********************************************************/
141 GType gtk_notebook_get_type (void) G_GNUC_CONST;
142 GtkWidget * gtk_notebook_new (void);
143 gint gtk_notebook_append_page (GtkNotebook *notebook,
145 GtkWidget *tab_label);
146 gint gtk_notebook_append_page_menu (GtkNotebook *notebook,
148 GtkWidget *tab_label,
149 GtkWidget *menu_label);
150 gint gtk_notebook_prepend_page (GtkNotebook *notebook,
152 GtkWidget *tab_label);
153 gint gtk_notebook_prepend_page_menu (GtkNotebook *notebook,
155 GtkWidget *tab_label,
156 GtkWidget *menu_label);
157 gint gtk_notebook_insert_page (GtkNotebook *notebook,
159 GtkWidget *tab_label,
161 gint gtk_notebook_insert_page_menu (GtkNotebook *notebook,
163 GtkWidget *tab_label,
164 GtkWidget *menu_label,
166 void gtk_notebook_remove_page (GtkNotebook *notebook,
169 /***********************************************************
170 * Tabs drag and drop *
171 ***********************************************************/
173 void gtk_notebook_set_window_creation_hook (GtkNotebookWindowCreationFunc func,
175 GDestroyNotify destroy);
176 void gtk_notebook_set_group (GtkNotebook *notebook,
178 gpointer gtk_notebook_get_group (GtkNotebook *notebook);
182 /***********************************************************
183 * query, set current NotebookPage *
184 ***********************************************************/
186 gint gtk_notebook_get_current_page (GtkNotebook *notebook);
187 GtkWidget* gtk_notebook_get_nth_page (GtkNotebook *notebook,
189 gint gtk_notebook_get_n_pages (GtkNotebook *notebook);
190 gint gtk_notebook_page_num (GtkNotebook *notebook,
192 void gtk_notebook_set_current_page (GtkNotebook *notebook,
194 void gtk_notebook_next_page (GtkNotebook *notebook);
195 void gtk_notebook_prev_page (GtkNotebook *notebook);
197 /***********************************************************
198 * set Notebook, NotebookTab style *
199 ***********************************************************/
201 void gtk_notebook_set_show_border (GtkNotebook *notebook,
202 gboolean show_border);
203 gboolean gtk_notebook_get_show_border (GtkNotebook *notebook);
204 void gtk_notebook_set_show_tabs (GtkNotebook *notebook,
206 gboolean gtk_notebook_get_show_tabs (GtkNotebook *notebook);
207 void gtk_notebook_set_tab_pos (GtkNotebook *notebook,
208 GtkPositionType pos);
209 GtkPositionType gtk_notebook_get_tab_pos (GtkNotebook *notebook);
210 void gtk_notebook_set_scrollable (GtkNotebook *notebook,
211 gboolean scrollable);
212 gboolean gtk_notebook_get_scrollable (GtkNotebook *notebook);
214 /***********************************************************
215 * enable/disable PopupMenu *
216 ***********************************************************/
218 void gtk_notebook_popup_enable (GtkNotebook *notebook);
219 void gtk_notebook_popup_disable (GtkNotebook *notebook);
221 /***********************************************************
222 * query/set NotebookPage Properties *
223 ***********************************************************/
225 GtkWidget * gtk_notebook_get_tab_label (GtkNotebook *notebook,
227 void gtk_notebook_set_tab_label (GtkNotebook *notebook,
229 GtkWidget *tab_label);
230 void gtk_notebook_set_tab_label_text (GtkNotebook *notebook,
232 const gchar *tab_text);
233 G_CONST_RETURN gchar *gtk_notebook_get_tab_label_text (GtkNotebook *notebook,
235 GtkWidget * gtk_notebook_get_menu_label (GtkNotebook *notebook,
237 void gtk_notebook_set_menu_label (GtkNotebook *notebook,
239 GtkWidget *menu_label);
240 void gtk_notebook_set_menu_label_text (GtkNotebook *notebook,
242 const gchar *menu_text);
243 G_CONST_RETURN gchar *gtk_notebook_get_menu_label_text (GtkNotebook *notebook,
245 void gtk_notebook_reorder_child (GtkNotebook *notebook,
248 gboolean gtk_notebook_get_tab_reorderable (GtkNotebook *notebook,
250 void gtk_notebook_set_tab_reorderable (GtkNotebook *notebook,
252 gboolean reorderable);
253 gboolean gtk_notebook_get_tab_detachable (GtkNotebook *notebook,
255 void gtk_notebook_set_tab_detachable (GtkNotebook *notebook,
257 gboolean detachable);
259 GtkWidget* gtk_notebook_get_action_widget (GtkNotebook *notebook,
260 GtkPackType pack_type);
261 void gtk_notebook_set_action_widget (GtkNotebook *notebook,
263 GtkPackType pack_type);
267 #endif /* __GTK_NOTEBOOK_H__ */