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 void (*_gtk_reserved1) (void);
120 void (*_gtk_reserved2) (void);
123 typedef GtkNotebook* (*GtkNotebookWindowCreationFunc) (GtkNotebook *source,
129 /***********************************************************
130 * Creation, insertion, deletion *
131 ***********************************************************/
133 GType gtk_notebook_get_type (void) G_GNUC_CONST;
134 GtkWidget * gtk_notebook_new (void);
135 gint gtk_notebook_append_page (GtkNotebook *notebook,
137 GtkWidget *tab_label);
138 gint gtk_notebook_append_page_menu (GtkNotebook *notebook,
140 GtkWidget *tab_label,
141 GtkWidget *menu_label);
142 gint gtk_notebook_prepend_page (GtkNotebook *notebook,
144 GtkWidget *tab_label);
145 gint gtk_notebook_prepend_page_menu (GtkNotebook *notebook,
147 GtkWidget *tab_label,
148 GtkWidget *menu_label);
149 gint gtk_notebook_insert_page (GtkNotebook *notebook,
151 GtkWidget *tab_label,
153 gint gtk_notebook_insert_page_menu (GtkNotebook *notebook,
155 GtkWidget *tab_label,
156 GtkWidget *menu_label,
158 void gtk_notebook_remove_page (GtkNotebook *notebook,
161 /***********************************************************
162 * Tabs drag and drop *
163 ***********************************************************/
165 void gtk_notebook_set_window_creation_hook (GtkNotebookWindowCreationFunc func,
167 GDestroyNotify destroy);
168 void gtk_notebook_set_group_id (GtkNotebook *notebook,
170 gint gtk_notebook_get_group_id (GtkNotebook *notebook);
172 /***********************************************************
173 * query, set current NoteebookPage *
174 ***********************************************************/
176 gint gtk_notebook_get_current_page (GtkNotebook *notebook);
177 GtkWidget* gtk_notebook_get_nth_page (GtkNotebook *notebook,
179 gint gtk_notebook_get_n_pages (GtkNotebook *notebook);
180 gint gtk_notebook_page_num (GtkNotebook *notebook,
182 void gtk_notebook_set_current_page (GtkNotebook *notebook,
184 void gtk_notebook_next_page (GtkNotebook *notebook);
185 void gtk_notebook_prev_page (GtkNotebook *notebook);
187 /***********************************************************
188 * set Notebook, NotebookTab style *
189 ***********************************************************/
191 void gtk_notebook_set_show_border (GtkNotebook *notebook,
192 gboolean show_border);
193 gboolean gtk_notebook_get_show_border (GtkNotebook *notebook);
194 void gtk_notebook_set_show_tabs (GtkNotebook *notebook,
196 gboolean gtk_notebook_get_show_tabs (GtkNotebook *notebook);
197 void gtk_notebook_set_tab_pos (GtkNotebook *notebook,
198 GtkPositionType pos);
199 GtkPositionType gtk_notebook_get_tab_pos (GtkNotebook *notebook);
201 #ifndef GTK_DISABLE_DEPRECATED
202 void gtk_notebook_set_homogeneous_tabs (GtkNotebook *notebook,
203 gboolean homogeneous);
204 void gtk_notebook_set_tab_border (GtkNotebook *notebook,
206 void gtk_notebook_set_tab_hborder (GtkNotebook *notebook,
208 void gtk_notebook_set_tab_vborder (GtkNotebook *notebook,
210 #endif /* GTK_DISABLE_DEPRECATED */
212 void gtk_notebook_set_scrollable (GtkNotebook *notebook,
213 gboolean scrollable);
214 gboolean gtk_notebook_get_scrollable (GtkNotebook *notebook);
216 /***********************************************************
217 * enable/disable PopupMenu *
218 ***********************************************************/
220 void gtk_notebook_popup_enable (GtkNotebook *notebook);
221 void gtk_notebook_popup_disable (GtkNotebook *notebook);
223 /***********************************************************
224 * query/set NotebookPage Properties *
225 ***********************************************************/
227 GtkWidget * gtk_notebook_get_tab_label (GtkNotebook *notebook,
229 void gtk_notebook_set_tab_label (GtkNotebook *notebook,
231 GtkWidget *tab_label);
232 void gtk_notebook_set_tab_label_text (GtkNotebook *notebook,
234 const gchar *tab_text);
235 G_CONST_RETURN gchar *gtk_notebook_get_tab_label_text (GtkNotebook *notebook,
237 GtkWidget * gtk_notebook_get_menu_label (GtkNotebook *notebook,
239 void gtk_notebook_set_menu_label (GtkNotebook *notebook,
241 GtkWidget *menu_label);
242 void gtk_notebook_set_menu_label_text (GtkNotebook *notebook,
244 const gchar *menu_text);
245 G_CONST_RETURN gchar *gtk_notebook_get_menu_label_text (GtkNotebook *notebook,
247 void gtk_notebook_query_tab_label_packing (GtkNotebook *notebook,
251 GtkPackType *pack_type);
252 void gtk_notebook_set_tab_label_packing (GtkNotebook *notebook,
256 GtkPackType pack_type);
257 void gtk_notebook_reorder_child (GtkNotebook *notebook,
260 gboolean gtk_notebook_get_tab_reorderable (GtkNotebook *notebook,
262 void gtk_notebook_set_tab_reorderable (GtkNotebook *notebook,
264 gboolean reorderable);
265 gboolean gtk_notebook_get_tab_detachable (GtkNotebook *notebook,
267 void gtk_notebook_set_tab_detachable (GtkNotebook *notebook,
269 gboolean detachable);
271 #ifndef GTK_DISABLE_DEPRECATED
272 #define gtk_notebook_current_page gtk_notebook_get_current_page
273 #define gtk_notebook_set_page gtk_notebook_set_current_page
274 #endif /* GTK_DISABLE_DEPRECATED */
278 #endif /* __GTK_NOTEBOOK_H__ */