]> Pileus Git - ~andy/gtk/blob - gtk/gtknotebook.h
Deprecate GtkNotebookPage as used in switch-page
[~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_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 #if !defined (GTK_DISABLE_DEPRECATED) || defined (GTK_COMPILATION)
58 typedef struct _GtkNotebookPage   GtkNotebookPage;
59 #endif
60
61 struct _GtkNotebook
62 {
63   GtkContainer container;
64   
65 #if !defined (GTK_DISABLE_DEPRECATED) || defined (GTK_COMPILATION)
66   GtkNotebookPage *GSEAL (cur_page);
67 #else
68   gpointer GSEAL (cur_page);
69 #endif
70   GList *GSEAL (children);
71   GList *GSEAL (first_tab);             /* The first tab visible (for scrolling notebooks) */
72   GList *GSEAL (focus_tab);
73   
74   GtkWidget *GSEAL (menu);
75   GdkWindow *GSEAL (event_window);
76   
77   guint32 GSEAL (timer);
78   
79   guint16 GSEAL (tab_hborder);
80   guint16 GSEAL (tab_vborder);
81   
82   guint GSEAL (show_tabs)          : 1;
83   guint GSEAL (homogeneous)        : 1;
84   guint GSEAL (show_border)        : 1;
85   guint GSEAL (tab_pos)            : 2;
86   guint GSEAL (scrollable)         : 1;
87   guint GSEAL (in_child)           : 3;
88   guint GSEAL (click_child)        : 3;
89   guint GSEAL (button)             : 2;
90   guint GSEAL (need_timer)         : 1;
91   guint GSEAL (child_has_focus)    : 1;
92   guint GSEAL (have_visible_child) : 1;
93   guint GSEAL (focus_out)          : 1; /* Flag used by ::move-focus-out implementation */
94
95   guint GSEAL (has_before_previous) : 1;
96   guint GSEAL (has_before_next)     : 1;
97   guint GSEAL (has_after_previous)  : 1;
98   guint GSEAL (has_after_next)      : 1;
99 };
100
101 struct _GtkNotebookClass
102 {
103   GtkContainerClass parent_class;
104
105   void (* switch_page)       (GtkNotebook     *notebook,
106 #if !defined (GTK_DISABLE_DEPRECATED) || defined (GTK_COMPILATION)
107                               GtkNotebookPage *page,
108 #else
109                               gpointer         page,
110 #endif
111                               guint            page_num);
112
113   /* Action signals for keybindings */
114   gboolean (* select_page)     (GtkNotebook       *notebook,
115                                 gboolean           move_focus);
116   gboolean (* focus_tab)       (GtkNotebook       *notebook,
117                                 GtkNotebookTab     type);
118   gboolean (* change_current_page) (GtkNotebook   *notebook,
119                                 gint               offset);
120   void (* move_focus_out)      (GtkNotebook       *notebook,
121                                 GtkDirectionType   direction);
122   gboolean (* reorder_tab)     (GtkNotebook       *notebook,
123                                 GtkDirectionType   direction,
124                                 gboolean           move_to_last);
125
126   /* More vfuncs */
127   gint (* insert_page)         (GtkNotebook       *notebook,
128                                 GtkWidget         *child,
129                                 GtkWidget         *tab_label,
130                                 GtkWidget         *menu_label,
131                                 gint               position);
132
133   GtkNotebook * (* create_window) (GtkNotebook       *notebook,
134                                    GtkWidget         *page,
135                                    gint               x,
136                                    gint               y);
137
138   void (*_gtk_reserved1) (void);
139 };
140
141 typedef GtkNotebook* (*GtkNotebookWindowCreationFunc) (GtkNotebook *source,
142                                                        GtkWidget   *page,
143                                                        gint         x,
144                                                        gint         y,
145                                                        gpointer     data);
146
147 /***********************************************************
148  *           Creation, insertion, deletion                 *
149  ***********************************************************/
150
151 GType   gtk_notebook_get_type       (void) G_GNUC_CONST;
152 GtkWidget * gtk_notebook_new        (void);
153 gint gtk_notebook_append_page       (GtkNotebook *notebook,
154                                      GtkWidget   *child,
155                                      GtkWidget   *tab_label);
156 gint gtk_notebook_append_page_menu  (GtkNotebook *notebook,
157                                      GtkWidget   *child,
158                                      GtkWidget   *tab_label,
159                                      GtkWidget   *menu_label);
160 gint gtk_notebook_prepend_page      (GtkNotebook *notebook,
161                                      GtkWidget   *child,
162                                      GtkWidget   *tab_label);
163 gint gtk_notebook_prepend_page_menu (GtkNotebook *notebook,
164                                      GtkWidget   *child,
165                                      GtkWidget   *tab_label,
166                                      GtkWidget   *menu_label);
167 gint gtk_notebook_insert_page       (GtkNotebook *notebook,
168                                      GtkWidget   *child,
169                                      GtkWidget   *tab_label,
170                                      gint         position);
171 gint gtk_notebook_insert_page_menu  (GtkNotebook *notebook,
172                                      GtkWidget   *child,
173                                      GtkWidget   *tab_label,
174                                      GtkWidget   *menu_label,
175                                      gint         position);
176 void gtk_notebook_remove_page       (GtkNotebook *notebook,
177                                      gint         page_num);
178
179 /***********************************************************
180  *           Tabs drag and drop                            *
181  ***********************************************************/
182
183 void gtk_notebook_set_window_creation_hook (GtkNotebookWindowCreationFunc  func,
184                                             gpointer                       data,
185                                             GDestroyNotify                 destroy);
186 void gtk_notebook_set_group                (GtkNotebook *notebook,
187                                             gpointer     group);
188 gpointer gtk_notebook_get_group            (GtkNotebook *notebook);
189
190
191
192 /***********************************************************
193  *            query, set current NotebookPage              *
194  ***********************************************************/
195
196 gint       gtk_notebook_get_current_page (GtkNotebook *notebook);
197 GtkWidget* gtk_notebook_get_nth_page     (GtkNotebook *notebook,
198                                           gint         page_num);
199 gint       gtk_notebook_get_n_pages      (GtkNotebook *notebook);
200 gint       gtk_notebook_page_num         (GtkNotebook *notebook,
201                                           GtkWidget   *child);
202 void       gtk_notebook_set_current_page (GtkNotebook *notebook,
203                                           gint         page_num);
204 void       gtk_notebook_next_page        (GtkNotebook *notebook);
205 void       gtk_notebook_prev_page        (GtkNotebook *notebook);
206
207 /***********************************************************
208  *            set Notebook, NotebookTab style              *
209  ***********************************************************/
210
211 void     gtk_notebook_set_show_border      (GtkNotebook     *notebook,
212                                             gboolean         show_border);
213 gboolean gtk_notebook_get_show_border      (GtkNotebook     *notebook);
214 void     gtk_notebook_set_show_tabs        (GtkNotebook     *notebook,
215                                             gboolean         show_tabs);
216 gboolean gtk_notebook_get_show_tabs        (GtkNotebook     *notebook);
217 void     gtk_notebook_set_tab_pos          (GtkNotebook     *notebook,
218                                             GtkPositionType  pos);
219 GtkPositionType gtk_notebook_get_tab_pos   (GtkNotebook     *notebook);
220 void     gtk_notebook_set_scrollable       (GtkNotebook     *notebook,
221                                             gboolean         scrollable);
222 gboolean gtk_notebook_get_scrollable       (GtkNotebook     *notebook);
223
224 /***********************************************************
225  *               enable/disable PopupMenu                  *
226  ***********************************************************/
227
228 void gtk_notebook_popup_enable  (GtkNotebook *notebook);
229 void gtk_notebook_popup_disable (GtkNotebook *notebook);
230
231 /***********************************************************
232  *             query/set NotebookPage Properties           *
233  ***********************************************************/
234
235 GtkWidget * gtk_notebook_get_tab_label    (GtkNotebook *notebook,
236                                            GtkWidget   *child);
237 void gtk_notebook_set_tab_label           (GtkNotebook *notebook,
238                                            GtkWidget   *child,
239                                            GtkWidget   *tab_label);
240 void gtk_notebook_set_tab_label_text      (GtkNotebook *notebook,
241                                            GtkWidget   *child,
242                                            const gchar *tab_text);
243 G_CONST_RETURN gchar *gtk_notebook_get_tab_label_text (GtkNotebook *notebook,
244                                                        GtkWidget   *child);
245 GtkWidget * gtk_notebook_get_menu_label   (GtkNotebook *notebook,
246                                            GtkWidget   *child);
247 void gtk_notebook_set_menu_label          (GtkNotebook *notebook,
248                                            GtkWidget   *child,
249                                            GtkWidget   *menu_label);
250 void gtk_notebook_set_menu_label_text     (GtkNotebook *notebook,
251                                            GtkWidget   *child,
252                                            const gchar *menu_text);
253 G_CONST_RETURN gchar *gtk_notebook_get_menu_label_text (GtkNotebook *notebook,
254                                                         GtkWidget   *child);
255 void gtk_notebook_reorder_child           (GtkNotebook *notebook,
256                                            GtkWidget   *child,
257                                            gint         position);
258 gboolean gtk_notebook_get_tab_reorderable (GtkNotebook *notebook,
259                                            GtkWidget   *child);
260 void gtk_notebook_set_tab_reorderable     (GtkNotebook *notebook,
261                                            GtkWidget   *child,
262                                            gboolean     reorderable);
263 gboolean gtk_notebook_get_tab_detachable  (GtkNotebook *notebook,
264                                            GtkWidget   *child);
265 void gtk_notebook_set_tab_detachable      (GtkNotebook *notebook,
266                                            GtkWidget   *child,
267                                            gboolean     detachable);
268
269 GtkWidget* gtk_notebook_get_action_widget (GtkNotebook *notebook,
270                                            GtkPackType  pack_type);
271 void       gtk_notebook_set_action_widget (GtkNotebook *notebook,
272                                            GtkWidget   *widget,
273                                            GtkPackType  pack_type);
274
275 G_END_DECLS
276
277 #endif /* __GTK_NOTEBOOK_H__ */