]> Pileus Git - ~andy/gtk/blob - gtk/gtknotebook.h
stylecontext: Do invalidation on first resize container
[~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, 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 GType   gtk_notebook_get_type       (void) G_GNUC_CONST;
126 GtkWidget * gtk_notebook_new        (void);
127 gint gtk_notebook_append_page       (GtkNotebook *notebook,
128                                      GtkWidget   *child,
129                                      GtkWidget   *tab_label);
130 gint gtk_notebook_append_page_menu  (GtkNotebook *notebook,
131                                      GtkWidget   *child,
132                                      GtkWidget   *tab_label,
133                                      GtkWidget   *menu_label);
134 gint gtk_notebook_prepend_page      (GtkNotebook *notebook,
135                                      GtkWidget   *child,
136                                      GtkWidget   *tab_label);
137 gint gtk_notebook_prepend_page_menu (GtkNotebook *notebook,
138                                      GtkWidget   *child,
139                                      GtkWidget   *tab_label,
140                                      GtkWidget   *menu_label);
141 gint gtk_notebook_insert_page       (GtkNotebook *notebook,
142                                      GtkWidget   *child,
143                                      GtkWidget   *tab_label,
144                                      gint         position);
145 gint gtk_notebook_insert_page_menu  (GtkNotebook *notebook,
146                                      GtkWidget   *child,
147                                      GtkWidget   *tab_label,
148                                      GtkWidget   *menu_label,
149                                      gint         position);
150 void gtk_notebook_remove_page       (GtkNotebook *notebook,
151                                      gint         page_num);
152
153 /***********************************************************
154  *           Tabs drag and drop                            *
155  ***********************************************************/
156
157 void         gtk_notebook_set_group_name (GtkNotebook *notebook,
158                                           const gchar *group_name);
159 const gchar *gtk_notebook_get_group_name (GtkNotebook *notebook);
160
161
162
163 /***********************************************************
164  *            query, set current NotebookPage              *
165  ***********************************************************/
166
167 gint       gtk_notebook_get_current_page (GtkNotebook *notebook);
168 GtkWidget* gtk_notebook_get_nth_page     (GtkNotebook *notebook,
169                                           gint         page_num);
170 gint       gtk_notebook_get_n_pages      (GtkNotebook *notebook);
171 gint       gtk_notebook_page_num         (GtkNotebook *notebook,
172                                           GtkWidget   *child);
173 void       gtk_notebook_set_current_page (GtkNotebook *notebook,
174                                           gint         page_num);
175 void       gtk_notebook_next_page        (GtkNotebook *notebook);
176 void       gtk_notebook_prev_page        (GtkNotebook *notebook);
177
178 /***********************************************************
179  *            set Notebook, NotebookTab style              *
180  ***********************************************************/
181
182 void     gtk_notebook_set_show_border      (GtkNotebook     *notebook,
183                                             gboolean         show_border);
184 gboolean gtk_notebook_get_show_border      (GtkNotebook     *notebook);
185 void     gtk_notebook_set_show_tabs        (GtkNotebook     *notebook,
186                                             gboolean         show_tabs);
187 gboolean gtk_notebook_get_show_tabs        (GtkNotebook     *notebook);
188 void     gtk_notebook_set_tab_pos          (GtkNotebook     *notebook,
189                                             GtkPositionType  pos);
190 GtkPositionType gtk_notebook_get_tab_pos   (GtkNotebook     *notebook);
191 void     gtk_notebook_set_scrollable       (GtkNotebook     *notebook,
192                                             gboolean         scrollable);
193 gboolean gtk_notebook_get_scrollable       (GtkNotebook     *notebook);
194 guint16  gtk_notebook_get_tab_hborder      (GtkNotebook     *notebook);
195 guint16  gtk_notebook_get_tab_vborder      (GtkNotebook     *notebook);
196
197 /***********************************************************
198  *               enable/disable PopupMenu                  *
199  ***********************************************************/
200
201 void gtk_notebook_popup_enable  (GtkNotebook *notebook);
202 void gtk_notebook_popup_disable (GtkNotebook *notebook);
203
204 /***********************************************************
205  *             query/set NotebookPage Properties           *
206  ***********************************************************/
207
208 GtkWidget * gtk_notebook_get_tab_label    (GtkNotebook *notebook,
209                                            GtkWidget   *child);
210 void gtk_notebook_set_tab_label           (GtkNotebook *notebook,
211                                            GtkWidget   *child,
212                                            GtkWidget   *tab_label);
213 void          gtk_notebook_set_tab_label_text (GtkNotebook *notebook,
214                                                GtkWidget   *child,
215                                                const gchar *tab_text);
216 const gchar * gtk_notebook_get_tab_label_text (GtkNotebook *notebook,
217                                                GtkWidget   *child);
218 GtkWidget * gtk_notebook_get_menu_label   (GtkNotebook *notebook,
219                                            GtkWidget   *child);
220 void gtk_notebook_set_menu_label          (GtkNotebook *notebook,
221                                            GtkWidget   *child,
222                                            GtkWidget   *menu_label);
223 void          gtk_notebook_set_menu_label_text (GtkNotebook *notebook,
224                                                 GtkWidget   *child,
225                                                 const gchar *menu_text);
226 const gchar * gtk_notebook_get_menu_label_text (GtkNotebook *notebook,
227                                                         GtkWidget   *child);
228 void gtk_notebook_reorder_child           (GtkNotebook *notebook,
229                                            GtkWidget   *child,
230                                            gint         position);
231 gboolean gtk_notebook_get_tab_reorderable (GtkNotebook *notebook,
232                                            GtkWidget   *child);
233 void gtk_notebook_set_tab_reorderable     (GtkNotebook *notebook,
234                                            GtkWidget   *child,
235                                            gboolean     reorderable);
236 gboolean gtk_notebook_get_tab_detachable  (GtkNotebook *notebook,
237                                            GtkWidget   *child);
238 void gtk_notebook_set_tab_detachable      (GtkNotebook *notebook,
239                                            GtkWidget   *child,
240                                            gboolean     detachable);
241
242 GtkWidget* gtk_notebook_get_action_widget (GtkNotebook *notebook,
243                                            GtkPackType  pack_type);
244 void       gtk_notebook_set_action_widget (GtkNotebook *notebook,
245                                            GtkWidget   *widget,
246                                            GtkPackType  pack_type);
247
248 G_END_DECLS
249
250 #endif /* __GTK_NOTEBOOK_H__ */