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
4  *
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.
9  *
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.
14  *
15  * You should have received a copy of the GNU Lesser General Public
16  * License along with this library. If not, see <http://www.gnu.org/licenses/>.
17  */
18 
19 /*
20  * Modified by the GTK+ Team and others 1997-2000.  See the AUTHORS
21  * file for a list of people on the GTK+ Team.  See the ChangeLog
22  * files for a list of changes.  These files are distributed with
23  * GTK+ at ftp://ftp.gtk.org/pub/gtk/.
24  */
25 
26 #ifndef __GTK_NOTEBOOK_H__
27 #define __GTK_NOTEBOOK_H__
28 
29 
30 #if !defined (__GTK_H_INSIDE__) && !defined (GTK_COMPILATION)
31 #error "Only <gtk/gtk.h> can be included directly."
32 #endif
33 
34 #include <gtk/gtkcontainer.h>
35 
36 
37 G_BEGIN_DECLS
38 
39 #define GTK_TYPE_NOTEBOOK                  (gtk_notebook_get_type ())
40 #define GTK_NOTEBOOK(obj)                  (G_TYPE_CHECK_INSTANCE_CAST ((obj), GTK_TYPE_NOTEBOOK, GtkNotebook))
41 #define GTK_NOTEBOOK_CLASS(klass)          (G_TYPE_CHECK_CLASS_CAST ((klass), GTK_TYPE_NOTEBOOK, GtkNotebookClass))
42 #define GTK_IS_NOTEBOOK(obj)               (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GTK_TYPE_NOTEBOOK))
43 #define GTK_IS_NOTEBOOK_CLASS(klass)       (G_TYPE_CHECK_CLASS_TYPE ((klass), GTK_TYPE_NOTEBOOK))
44 #define GTK_NOTEBOOK_GET_CLASS(obj)        (G_TYPE_INSTANCE_GET_CLASS ((obj), GTK_TYPE_NOTEBOOK, GtkNotebookClass))
45 
46 
47 typedef enum
48 {
49   GTK_NOTEBOOK_TAB_FIRST,
50   GTK_NOTEBOOK_TAB_LAST
51 } GtkNotebookTab;
52 
53 typedef struct _GtkNotebook              GtkNotebook;
54 typedef struct _GtkNotebookPrivate       GtkNotebookPrivate;
55 typedef struct _GtkNotebookClass         GtkNotebookClass;
56 
57 struct _GtkNotebook
58 {
59   /*< private >*/
60   GtkContainer container;
61 
62   GtkNotebookPrivate *priv;
63 };
64 
65 struct _GtkNotebookClass
66 {
67   GtkContainerClass parent_class;
68 
69   void (* switch_page)       (GtkNotebook     *notebook,
70                               GtkWidget       *page,
71 			      guint            page_num);
72 
73   /* Action signals for keybindings */
74   gboolean (* select_page)     (GtkNotebook       *notebook,
75                                 gboolean           move_focus);
76   gboolean (* focus_tab)       (GtkNotebook       *notebook,
77                                 GtkNotebookTab     type);
78   gboolean (* change_current_page) (GtkNotebook   *notebook,
79                                 gint               offset);
80   void (* move_focus_out)      (GtkNotebook       *notebook,
81 				GtkDirectionType   direction);
82   gboolean (* reorder_tab)     (GtkNotebook       *notebook,
83 				GtkDirectionType   direction,
84 				gboolean           move_to_last);
85 
86   /* More vfuncs */
87   gint (* insert_page)         (GtkNotebook       *notebook,
88 			        GtkWidget         *child,
89 				GtkWidget         *tab_label,
90 				GtkWidget         *menu_label,
91 				gint               position);
92 
93   GtkNotebook * (* create_window) (GtkNotebook       *notebook,
94                                    GtkWidget         *page,
95                                    gint               x,
96                                    gint               y);
97 
98   void (* page_reordered)      (GtkNotebook     *notebook,
99                                 GtkWidget       *child,
100                                 guint            page_num);
101 
102   void (* page_removed)        (GtkNotebook     *notebook,
103                                 GtkWidget       *child,
104                                 guint            page_num);
105 
106   void (* page_added)          (GtkNotebook     *notebook,
107                                 GtkWidget       *child,
108                                 guint            page_num);
109 
110   /* Padding for future expansion */
111   void (*_gtk_reserved1) (void);
112   void (*_gtk_reserved2) (void);
113   void (*_gtk_reserved3) (void);
114   void (*_gtk_reserved4) (void);
115   void (*_gtk_reserved5) (void);
116   void (*_gtk_reserved6) (void);
117   void (*_gtk_reserved7) (void);
118   void (*_gtk_reserved8) (void);
119 };
120 
121 /***********************************************************
122  *           Creation, insertion, deletion                 *
123  ***********************************************************/
124 
125 GDK_AVAILABLE_IN_ALL
126 GType   gtk_notebook_get_type       (void) G_GNUC_CONST;
127 GDK_AVAILABLE_IN_ALL
128 GtkWidget * gtk_notebook_new        (void);
129 GDK_AVAILABLE_IN_ALL
130 gint gtk_notebook_append_page       (GtkNotebook *notebook,
131 				     GtkWidget   *child,
132 				     GtkWidget   *tab_label);
133 GDK_AVAILABLE_IN_ALL
134 gint gtk_notebook_append_page_menu  (GtkNotebook *notebook,
135 				     GtkWidget   *child,
136 				     GtkWidget   *tab_label,
137 				     GtkWidget   *menu_label);
138 GDK_AVAILABLE_IN_ALL
139 gint gtk_notebook_prepend_page      (GtkNotebook *notebook,
140 				     GtkWidget   *child,
141 				     GtkWidget   *tab_label);
142 GDK_AVAILABLE_IN_ALL
143 gint gtk_notebook_prepend_page_menu (GtkNotebook *notebook,
144 				     GtkWidget   *child,
145 				     GtkWidget   *tab_label,
146 				     GtkWidget   *menu_label);
147 GDK_AVAILABLE_IN_ALL
148 gint gtk_notebook_insert_page       (GtkNotebook *notebook,
149 				     GtkWidget   *child,
150 				     GtkWidget   *tab_label,
151 				     gint         position);
152 GDK_AVAILABLE_IN_ALL
153 gint gtk_notebook_insert_page_menu  (GtkNotebook *notebook,
154 				     GtkWidget   *child,
155 				     GtkWidget   *tab_label,
156 				     GtkWidget   *menu_label,
157 				     gint         position);
158 GDK_AVAILABLE_IN_ALL
159 void gtk_notebook_remove_page       (GtkNotebook *notebook,
160 				     gint         page_num);
161 
162 /***********************************************************
163  *           Tabs drag and drop                            *
164  ***********************************************************/
165 
166 GDK_AVAILABLE_IN_ALL
167 void         gtk_notebook_set_group_name (GtkNotebook *notebook,
168                                           const gchar *group_name);
169 GDK_AVAILABLE_IN_ALL
170 const gchar *gtk_notebook_get_group_name (GtkNotebook *notebook);
171 
172 
173 
174 /***********************************************************
175  *            query, set current NotebookPage              *
176  ***********************************************************/
177 
178 GDK_AVAILABLE_IN_ALL
179 gint       gtk_notebook_get_current_page (GtkNotebook *notebook);
180 GDK_AVAILABLE_IN_ALL
181 GtkWidget* gtk_notebook_get_nth_page     (GtkNotebook *notebook,
182 					  gint         page_num);
183 GDK_AVAILABLE_IN_ALL
184 gint       gtk_notebook_get_n_pages      (GtkNotebook *notebook);
185 GDK_AVAILABLE_IN_ALL
186 gint       gtk_notebook_page_num         (GtkNotebook *notebook,
187 					  GtkWidget   *child);
188 GDK_AVAILABLE_IN_ALL
189 void       gtk_notebook_set_current_page (GtkNotebook *notebook,
190 					  gint         page_num);
191 GDK_AVAILABLE_IN_ALL
192 void       gtk_notebook_next_page        (GtkNotebook *notebook);
193 GDK_AVAILABLE_IN_ALL
194 void       gtk_notebook_prev_page        (GtkNotebook *notebook);
195 
196 /***********************************************************
197  *            set Notebook, NotebookTab style              *
198  ***********************************************************/
199 
200 GDK_AVAILABLE_IN_ALL
201 void     gtk_notebook_set_show_border      (GtkNotebook     *notebook,
202 					    gboolean         show_border);
203 GDK_AVAILABLE_IN_ALL
204 gboolean gtk_notebook_get_show_border      (GtkNotebook     *notebook);
205 GDK_AVAILABLE_IN_ALL
206 void     gtk_notebook_set_show_tabs        (GtkNotebook     *notebook,
207 					    gboolean         show_tabs);
208 GDK_AVAILABLE_IN_ALL
209 gboolean gtk_notebook_get_show_tabs        (GtkNotebook     *notebook);
210 GDK_AVAILABLE_IN_ALL
211 void     gtk_notebook_set_tab_pos          (GtkNotebook     *notebook,
212 				            GtkPositionType  pos);
213 GDK_AVAILABLE_IN_ALL
214 GtkPositionType gtk_notebook_get_tab_pos   (GtkNotebook     *notebook);
215 GDK_AVAILABLE_IN_ALL
216 void     gtk_notebook_set_scrollable       (GtkNotebook     *notebook,
217 					    gboolean         scrollable);
218 GDK_AVAILABLE_IN_ALL
219 gboolean gtk_notebook_get_scrollable       (GtkNotebook     *notebook);
220 GDK_DEPRECATED_IN_3_4
221 guint16  gtk_notebook_get_tab_hborder      (GtkNotebook     *notebook);
222 GDK_DEPRECATED_IN_3_4
223 guint16  gtk_notebook_get_tab_vborder      (GtkNotebook     *notebook);
224 
225 /***********************************************************
226  *               enable/disable PopupMenu                  *
227  ***********************************************************/
228 
229 GDK_AVAILABLE_IN_ALL
230 void gtk_notebook_popup_enable  (GtkNotebook *notebook);
231 GDK_AVAILABLE_IN_ALL
232 void gtk_notebook_popup_disable (GtkNotebook *notebook);
233 
234 /***********************************************************
235  *             query/set NotebookPage Properties           *
236  ***********************************************************/
237 
238 GDK_AVAILABLE_IN_ALL
239 GtkWidget * gtk_notebook_get_tab_label    (GtkNotebook *notebook,
240 					   GtkWidget   *child);
241 GDK_AVAILABLE_IN_ALL
242 void gtk_notebook_set_tab_label           (GtkNotebook *notebook,
243 					   GtkWidget   *child,
244 					   GtkWidget   *tab_label);
245 GDK_AVAILABLE_IN_ALL
246 void          gtk_notebook_set_tab_label_text (GtkNotebook *notebook,
247                                                GtkWidget   *child,
248                                                const gchar *tab_text);
249 GDK_AVAILABLE_IN_ALL
250 const gchar * gtk_notebook_get_tab_label_text (GtkNotebook *notebook,
251                                                GtkWidget   *child);
252 GDK_AVAILABLE_IN_ALL
253 GtkWidget * gtk_notebook_get_menu_label   (GtkNotebook *notebook,
254 					   GtkWidget   *child);
255 GDK_AVAILABLE_IN_ALL
256 void gtk_notebook_set_menu_label          (GtkNotebook *notebook,
257 					   GtkWidget   *child,
258 					   GtkWidget   *menu_label);
259 GDK_AVAILABLE_IN_ALL
260 void          gtk_notebook_set_menu_label_text (GtkNotebook *notebook,
261                                                 GtkWidget   *child,
262                                                 const gchar *menu_text);
263 GDK_AVAILABLE_IN_ALL
264 const gchar * gtk_notebook_get_menu_label_text (GtkNotebook *notebook,
265 							GtkWidget   *child);
266 GDK_AVAILABLE_IN_ALL
267 void gtk_notebook_reorder_child           (GtkNotebook *notebook,
268 					   GtkWidget   *child,
269 					   gint         position);
270 GDK_AVAILABLE_IN_ALL
271 gboolean gtk_notebook_get_tab_reorderable (GtkNotebook *notebook,
272 					   GtkWidget   *child);
273 GDK_AVAILABLE_IN_ALL
274 void gtk_notebook_set_tab_reorderable     (GtkNotebook *notebook,
275 					   GtkWidget   *child,
276 					   gboolean     reorderable);
277 GDK_AVAILABLE_IN_ALL
278 gboolean gtk_notebook_get_tab_detachable  (GtkNotebook *notebook,
279 					   GtkWidget   *child);
280 GDK_AVAILABLE_IN_ALL
281 void gtk_notebook_set_tab_detachable      (GtkNotebook *notebook,
282 					   GtkWidget   *child,
283 					   gboolean     detachable);
284 GDK_AVAILABLE_IN_3_16
285 void gtk_notebook_detach_tab              (GtkNotebook *notebook,
286                                            GtkWidget   *child);
287 
288 GDK_AVAILABLE_IN_ALL
289 GtkWidget* gtk_notebook_get_action_widget (GtkNotebook *notebook,
290                                            GtkPackType  pack_type);
291 GDK_AVAILABLE_IN_ALL
292 void       gtk_notebook_set_action_widget (GtkNotebook *notebook,
293                                            GtkWidget   *widget,
294                                            GtkPackType  pack_type);
295 
296 G_END_DECLS
297 
298 #endif /* __GTK_NOTEBOOK_H__ */
299