]> Pileus Git - ~andy/gtk/blob - gtk/gtknotebook.h
Deprecated GtkNotebook tab packing
[~andy/gtk] / gtk / gtknotebook.h
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, write to the
17  * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
18  * Boston, MA 02111-1307, USA.
19  */
20
21 /*
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/.
26  */
27
28 #if defined(GTK_DISABLE_SINGLE_INCLUDES) && !defined (__GTK_H_INSIDE__) && !defined (GTK_COMPILATION)
29 #error "Only <gtk/gtk.h> can be included directly."
30 #endif
31
32 #ifndef __GTK_NOTEBOOK_H__
33 #define __GTK_NOTEBOOK_H__
34
35
36 #include <gtk/gtkcontainer.h>
37
38
39 G_BEGIN_DECLS
40
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))
47
48
49 typedef enum
50 {
51   GTK_NOTEBOOK_TAB_FIRST,
52   GTK_NOTEBOOK_TAB_LAST
53 } GtkNotebookTab;
54
55 typedef struct _GtkNotebook       GtkNotebook;
56 typedef struct _GtkNotebookClass  GtkNotebookClass;
57 typedef struct _GtkNotebookPage   GtkNotebookPage;
58
59 struct _GtkNotebook
60 {
61   GtkContainer container;
62   
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);
67   
68   GtkWidget *GSEAL (menu);
69   GdkWindow *GSEAL (event_window);
70   
71   guint32 GSEAL (timer);
72   
73   guint16 GSEAL (tab_hborder);
74   guint16 GSEAL (tab_vborder);
75   
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 */
88
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;
93 };
94
95 struct _GtkNotebookClass
96 {
97   GtkContainerClass parent_class;
98
99   void (* switch_page)       (GtkNotebook     *notebook,
100                               GtkNotebookPage *page,
101                               guint            page_num);
102
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,
109                                 gint               offset);
110   void (* move_focus_out)      (GtkNotebook       *notebook,
111                                 GtkDirectionType   direction);
112   gboolean (* reorder_tab)     (GtkNotebook       *notebook,
113                                 GtkDirectionType   direction,
114                                 gboolean           move_to_last);
115
116   /* More vfuncs */
117   gint (* insert_page)         (GtkNotebook       *notebook,
118                                 GtkWidget         *child,
119                                 GtkWidget         *tab_label,
120                                 GtkWidget         *menu_label,
121                                 gint               position);
122
123   GtkNotebook * (* create_window) (GtkNotebook       *notebook,
124                                    GtkWidget         *page,
125                                    gint               x,
126                                    gint               y);
127
128   void (*_gtk_reserved1) (void);
129 };
130
131 typedef GtkNotebook* (*GtkNotebookWindowCreationFunc) (GtkNotebook *source,
132                                                        GtkWidget   *page,
133                                                        gint         x,
134                                                        gint         y,
135                                                        gpointer     data);
136
137 /***********************************************************
138  *           Creation, insertion, deletion                 *
139  ***********************************************************/
140
141 GType   gtk_notebook_get_type       (void) G_GNUC_CONST;
142 GtkWidget * gtk_notebook_new        (void);
143 gint gtk_notebook_append_page       (GtkNotebook *notebook,
144                                      GtkWidget   *child,
145                                      GtkWidget   *tab_label);
146 gint gtk_notebook_append_page_menu  (GtkNotebook *notebook,
147                                      GtkWidget   *child,
148                                      GtkWidget   *tab_label,
149                                      GtkWidget   *menu_label);
150 gint gtk_notebook_prepend_page      (GtkNotebook *notebook,
151                                      GtkWidget   *child,
152                                      GtkWidget   *tab_label);
153 gint gtk_notebook_prepend_page_menu (GtkNotebook *notebook,
154                                      GtkWidget   *child,
155                                      GtkWidget   *tab_label,
156                                      GtkWidget   *menu_label);
157 gint gtk_notebook_insert_page       (GtkNotebook *notebook,
158                                      GtkWidget   *child,
159                                      GtkWidget   *tab_label,
160                                      gint         position);
161 gint gtk_notebook_insert_page_menu  (GtkNotebook *notebook,
162                                      GtkWidget   *child,
163                                      GtkWidget   *tab_label,
164                                      GtkWidget   *menu_label,
165                                      gint         position);
166 void gtk_notebook_remove_page       (GtkNotebook *notebook,
167                                      gint         page_num);
168
169 /***********************************************************
170  *           Tabs drag and drop                            *
171  ***********************************************************/
172
173 void gtk_notebook_set_window_creation_hook (GtkNotebookWindowCreationFunc  func,
174                                             gpointer                       data,
175                                             GDestroyNotify                 destroy);
176 #ifndef GTK_DISABLE_DEPRECATED
177 void gtk_notebook_set_group_id             (GtkNotebook *notebook,
178                                             gint         group_id);
179 gint gtk_notebook_get_group_id             (GtkNotebook *notebook);
180
181 #endif /* GTK_DISABLE_DEPRECATED */
182
183 void gtk_notebook_set_group                (GtkNotebook *notebook,
184                                             gpointer     group);
185 gpointer gtk_notebook_get_group            (GtkNotebook *notebook);
186
187
188
189 /***********************************************************
190  *            query, set current NotebookPage              *
191  ***********************************************************/
192
193 gint       gtk_notebook_get_current_page (GtkNotebook *notebook);
194 GtkWidget* gtk_notebook_get_nth_page     (GtkNotebook *notebook,
195                                           gint         page_num);
196 gint       gtk_notebook_get_n_pages      (GtkNotebook *notebook);
197 gint       gtk_notebook_page_num         (GtkNotebook *notebook,
198                                           GtkWidget   *child);
199 void       gtk_notebook_set_current_page (GtkNotebook *notebook,
200                                           gint         page_num);
201 void       gtk_notebook_next_page        (GtkNotebook *notebook);
202 void       gtk_notebook_prev_page        (GtkNotebook *notebook);
203
204 /***********************************************************
205  *            set Notebook, NotebookTab style              *
206  ***********************************************************/
207
208 void     gtk_notebook_set_show_border      (GtkNotebook     *notebook,
209                                             gboolean         show_border);
210 gboolean gtk_notebook_get_show_border      (GtkNotebook     *notebook);
211 void     gtk_notebook_set_show_tabs        (GtkNotebook     *notebook,
212                                             gboolean         show_tabs);
213 gboolean gtk_notebook_get_show_tabs        (GtkNotebook     *notebook);
214 void     gtk_notebook_set_tab_pos          (GtkNotebook     *notebook,
215                                             GtkPositionType  pos);
216 GtkPositionType gtk_notebook_get_tab_pos   (GtkNotebook     *notebook);
217
218 #ifndef GTK_DISABLE_DEPRECATED
219 void     gtk_notebook_set_homogeneous_tabs (GtkNotebook     *notebook,
220                                             gboolean         homogeneous);
221 void     gtk_notebook_set_tab_border       (GtkNotebook     *notebook,
222                                             guint            border_width);
223 void     gtk_notebook_set_tab_hborder      (GtkNotebook     *notebook,
224                                             guint            tab_hborder);
225 void     gtk_notebook_set_tab_vborder      (GtkNotebook     *notebook,
226                                             guint            tab_vborder);
227 #endif /* GTK_DISABLE_DEPRECATED */
228
229 void     gtk_notebook_set_scrollable       (GtkNotebook     *notebook,
230                                             gboolean         scrollable);
231 gboolean gtk_notebook_get_scrollable       (GtkNotebook     *notebook);
232
233 /***********************************************************
234  *               enable/disable PopupMenu                  *
235  ***********************************************************/
236
237 void gtk_notebook_popup_enable  (GtkNotebook *notebook);
238 void gtk_notebook_popup_disable (GtkNotebook *notebook);
239
240 /***********************************************************
241  *             query/set NotebookPage Properties           *
242  ***********************************************************/
243
244 GtkWidget * gtk_notebook_get_tab_label    (GtkNotebook *notebook,
245                                            GtkWidget   *child);
246 void gtk_notebook_set_tab_label           (GtkNotebook *notebook,
247                                            GtkWidget   *child,
248                                            GtkWidget   *tab_label);
249 void gtk_notebook_set_tab_label_text      (GtkNotebook *notebook,
250                                            GtkWidget   *child,
251                                            const gchar *tab_text);
252 G_CONST_RETURN gchar *gtk_notebook_get_tab_label_text (GtkNotebook *notebook,
253                                                        GtkWidget   *child);
254 GtkWidget * gtk_notebook_get_menu_label   (GtkNotebook *notebook,
255                                            GtkWidget   *child);
256 void gtk_notebook_set_menu_label          (GtkNotebook *notebook,
257                                            GtkWidget   *child,
258                                            GtkWidget   *menu_label);
259 void gtk_notebook_set_menu_label_text     (GtkNotebook *notebook,
260                                            GtkWidget   *child,
261                                            const gchar *menu_text);
262 G_CONST_RETURN gchar *gtk_notebook_get_menu_label_text (GtkNotebook *notebook,
263                                                         GtkWidget   *child);
264 #ifndef GTK_DISABLE_DEPRECATED
265 void gtk_notebook_query_tab_label_packing (GtkNotebook *notebook,
266                                            GtkWidget   *child,
267                                            gboolean    *expand,
268                                            gboolean    *fill,
269                                            GtkPackType *pack_type);
270 void gtk_notebook_set_tab_label_packing   (GtkNotebook *notebook,
271                                            GtkWidget   *child,
272                                            gboolean     expand,
273                                            gboolean     fill,
274                                            GtkPackType  pack_type);
275 #endif
276 void gtk_notebook_reorder_child           (GtkNotebook *notebook,
277                                            GtkWidget   *child,
278                                            gint         position);
279 gboolean gtk_notebook_get_tab_reorderable (GtkNotebook *notebook,
280                                            GtkWidget   *child);
281 void gtk_notebook_set_tab_reorderable     (GtkNotebook *notebook,
282                                            GtkWidget   *child,
283                                            gboolean     reorderable);
284 gboolean gtk_notebook_get_tab_detachable  (GtkNotebook *notebook,
285                                            GtkWidget   *child);
286 void gtk_notebook_set_tab_detachable      (GtkNotebook *notebook,
287                                            GtkWidget   *child,
288                                            gboolean     detachable);
289
290 #ifndef GTK_DISABLE_DEPRECATED
291 #define gtk_notebook_current_page               gtk_notebook_get_current_page
292 #define gtk_notebook_set_page                   gtk_notebook_set_current_page
293 #endif /* GTK_DISABLE_DEPRECATED */
294
295 G_END_DECLS
296
297 #endif /* __GTK_NOTEBOOK_H__ */