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 #ifndef __GTK_NOTEBOOK_H__
29 #define __GTK_NOTEBOOK_H__
33 #include <gtk/gtkcontainer.h>
37 #define GTK_TYPE_NOTEBOOK (gtk_notebook_get_type ())
38 #define GTK_NOTEBOOK(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GTK_TYPE_NOTEBOOK, GtkNotebook))
39 #define GTK_NOTEBOOK_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GTK_TYPE_NOTEBOOK, GtkNotebookClass))
40 #define GTK_IS_NOTEBOOK(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GTK_TYPE_NOTEBOOK))
41 #define GTK_IS_NOTEBOOK_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GTK_TYPE_NOTEBOOK))
42 #define GTK_NOTEBOOK_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GTK_TYPE_NOTEBOOK, GtkNotebookClass))
47 GTK_NOTEBOOK_TAB_FIRST,
51 typedef struct _GtkNotebook GtkNotebook;
52 typedef struct _GtkNotebookClass GtkNotebookClass;
53 typedef struct _GtkNotebookPage GtkNotebookPage;
57 GtkContainer container;
59 GtkNotebookPage *cur_page;
61 GList *first_tab; /* The first tab visible (for scrolling notebooks) */
65 GdkWindow *event_window;
73 guint homogeneous : 1;
74 guint show_border : 1;
78 guint click_child : 3;
81 guint child_has_focus : 1;
82 guint have_visible_child : 1;
83 guint focus_out : 1; /* Flag used by ::move-focus-out implementation */
85 guint has_before_previous : 1;
86 guint has_before_next : 1;
87 guint has_after_previous : 1;
88 guint has_after_next : 1;
91 struct _GtkNotebookClass
93 GtkContainerClass parent_class;
95 void (* switch_page) (GtkNotebook *notebook,
96 GtkNotebookPage *page,
99 /* Action signals for keybindings */
100 gboolean (* select_page) (GtkNotebook *notebook,
101 gboolean move_focus);
102 gboolean (* focus_tab) (GtkNotebook *notebook,
103 GtkNotebookTab type);
104 gboolean (* change_current_page) (GtkNotebook *notebook,
106 void (* move_focus_out) (GtkNotebook *notebook,
107 GtkDirectionType direction);
108 gboolean (* reorder_tab) (GtkNotebook *notebook,
109 GtkDirectionType direction,
110 gboolean move_to_last);
113 gint (* insert_page) (GtkNotebook *notebook,
115 GtkWidget *tab_label,
116 GtkWidget *menu_label,
119 GtkNotebook * (* create_window) (GtkNotebook *notebook,
124 void (*_gtk_reserved1) (void);
127 typedef GtkNotebook* (*GtkNotebookWindowCreationFunc) (GtkNotebook *source,
133 /***********************************************************
134 * Creation, insertion, deletion *
135 ***********************************************************/
137 GType gtk_notebook_get_type (void) G_GNUC_CONST;
138 GtkWidget * gtk_notebook_new (void);
139 gint gtk_notebook_append_page (GtkNotebook *notebook,
141 GtkWidget *tab_label);
142 gint gtk_notebook_append_page_menu (GtkNotebook *notebook,
144 GtkWidget *tab_label,
145 GtkWidget *menu_label);
146 gint gtk_notebook_prepend_page (GtkNotebook *notebook,
148 GtkWidget *tab_label);
149 gint gtk_notebook_prepend_page_menu (GtkNotebook *notebook,
151 GtkWidget *tab_label,
152 GtkWidget *menu_label);
153 gint gtk_notebook_insert_page (GtkNotebook *notebook,
155 GtkWidget *tab_label,
157 gint gtk_notebook_insert_page_menu (GtkNotebook *notebook,
159 GtkWidget *tab_label,
160 GtkWidget *menu_label,
162 void gtk_notebook_remove_page (GtkNotebook *notebook,
165 /***********************************************************
166 * Tabs drag and drop *
167 ***********************************************************/
169 void gtk_notebook_set_window_creation_hook (GtkNotebookWindowCreationFunc func,
171 GDestroyNotify destroy);
172 #ifndef GTK_DISABLE_DEPRECATED
173 void gtk_notebook_set_group_id (GtkNotebook *notebook,
175 gint gtk_notebook_get_group_id (GtkNotebook *notebook);
177 #endif /* GTK_DISABLE_DEPRECATED */
179 void gtk_notebook_set_group (GtkNotebook *notebook,
181 gpointer gtk_notebook_get_group (GtkNotebook *notebook);
185 /***********************************************************
186 * query, set current NotebookPage *
187 ***********************************************************/
189 gint gtk_notebook_get_current_page (GtkNotebook *notebook);
190 GtkWidget* gtk_notebook_get_nth_page (GtkNotebook *notebook,
192 gint gtk_notebook_get_n_pages (GtkNotebook *notebook);
193 gint gtk_notebook_page_num (GtkNotebook *notebook,
195 void gtk_notebook_set_current_page (GtkNotebook *notebook,
197 void gtk_notebook_next_page (GtkNotebook *notebook);
198 void gtk_notebook_prev_page (GtkNotebook *notebook);
200 /***********************************************************
201 * set Notebook, NotebookTab style *
202 ***********************************************************/
204 void gtk_notebook_set_show_border (GtkNotebook *notebook,
205 gboolean show_border);
206 gboolean gtk_notebook_get_show_border (GtkNotebook *notebook);
207 void gtk_notebook_set_show_tabs (GtkNotebook *notebook,
209 gboolean gtk_notebook_get_show_tabs (GtkNotebook *notebook);
210 void gtk_notebook_set_tab_pos (GtkNotebook *notebook,
211 GtkPositionType pos);
212 GtkPositionType gtk_notebook_get_tab_pos (GtkNotebook *notebook);
214 #ifndef GTK_DISABLE_DEPRECATED
215 void gtk_notebook_set_homogeneous_tabs (GtkNotebook *notebook,
216 gboolean homogeneous);
217 void gtk_notebook_set_tab_border (GtkNotebook *notebook,
219 void gtk_notebook_set_tab_hborder (GtkNotebook *notebook,
221 void gtk_notebook_set_tab_vborder (GtkNotebook *notebook,
223 #endif /* GTK_DISABLE_DEPRECATED */
225 void gtk_notebook_set_scrollable (GtkNotebook *notebook,
226 gboolean scrollable);
227 gboolean gtk_notebook_get_scrollable (GtkNotebook *notebook);
229 /***********************************************************
230 * enable/disable PopupMenu *
231 ***********************************************************/
233 void gtk_notebook_popup_enable (GtkNotebook *notebook);
234 void gtk_notebook_popup_disable (GtkNotebook *notebook);
236 /***********************************************************
237 * query/set NotebookPage Properties *
238 ***********************************************************/
240 GtkWidget * gtk_notebook_get_tab_label (GtkNotebook *notebook,
242 void gtk_notebook_set_tab_label (GtkNotebook *notebook,
244 GtkWidget *tab_label);
245 void gtk_notebook_set_tab_label_text (GtkNotebook *notebook,
247 const gchar *tab_text);
248 G_CONST_RETURN gchar *gtk_notebook_get_tab_label_text (GtkNotebook *notebook,
250 GtkWidget * gtk_notebook_get_menu_label (GtkNotebook *notebook,
252 void gtk_notebook_set_menu_label (GtkNotebook *notebook,
254 GtkWidget *menu_label);
255 void gtk_notebook_set_menu_label_text (GtkNotebook *notebook,
257 const gchar *menu_text);
258 G_CONST_RETURN gchar *gtk_notebook_get_menu_label_text (GtkNotebook *notebook,
260 void gtk_notebook_query_tab_label_packing (GtkNotebook *notebook,
264 GtkPackType *pack_type);
265 void gtk_notebook_set_tab_label_packing (GtkNotebook *notebook,
269 GtkPackType pack_type);
270 void gtk_notebook_reorder_child (GtkNotebook *notebook,
273 gboolean gtk_notebook_get_tab_reorderable (GtkNotebook *notebook,
275 void gtk_notebook_set_tab_reorderable (GtkNotebook *notebook,
277 gboolean reorderable);
278 gboolean gtk_notebook_get_tab_detachable (GtkNotebook *notebook,
280 void gtk_notebook_set_tab_detachable (GtkNotebook *notebook,
282 gboolean detachable);
284 #ifndef GTK_DISABLE_DEPRECATED
285 #define gtk_notebook_current_page gtk_notebook_get_current_page
286 #define gtk_notebook_set_page gtk_notebook_set_current_page
287 #endif /* GTK_DISABLE_DEPRECATED */
291 #endif /* __GTK_NOTEBOOK_H__ */