]> Pileus Git - ~andy/gtk/blob - gtk/gtknotebook.h
gtk: Use const instead G_CONST_RETURN
[~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 _GtkNotebookPrivate       GtkNotebookPrivate;
57 typedef struct _GtkNotebookClass         GtkNotebookClass;
58
59 struct _GtkNotebook
60 {
61   /*< private >*/
62   GtkContainer container;
63
64   GtkNotebookPrivate *priv;
65 };
66
67 struct _GtkNotebookClass
68 {
69   GtkContainerClass parent_class;
70
71   void (* switch_page)       (GtkNotebook     *notebook,
72                               GtkWidget       *page,
73                               guint            page_num);
74
75   /* Action signals for keybindings */
76   gboolean (* select_page)     (GtkNotebook       *notebook,
77                                 gboolean           move_focus);
78   gboolean (* focus_tab)       (GtkNotebook       *notebook,
79                                 GtkNotebookTab     type);
80   gboolean (* change_current_page) (GtkNotebook   *notebook,
81                                 gint               offset);
82   void (* move_focus_out)      (GtkNotebook       *notebook,
83                                 GtkDirectionType   direction);
84   gboolean (* reorder_tab)     (GtkNotebook       *notebook,
85                                 GtkDirectionType   direction,
86                                 gboolean           move_to_last);
87
88   /* More vfuncs */
89   gint (* insert_page)         (GtkNotebook       *notebook,
90                                 GtkWidget         *child,
91                                 GtkWidget         *tab_label,
92                                 GtkWidget         *menu_label,
93                                 gint               position);
94
95   GtkNotebook * (* create_window) (GtkNotebook       *notebook,
96                                    GtkWidget         *page,
97                                    gint               x,
98                                    gint               y);
99
100   void (* page_reordered)      (GtkNotebook     *notebook,
101                                 GtkWidget       *child,
102                                 guint            page_num);
103
104   void (* page_removed)        (GtkNotebook     *notebook,
105                                 GtkWidget       *child,
106                                 guint            page_num);
107
108   void (* page_added)          (GtkNotebook     *notebook,
109                                 GtkWidget       *child,
110                                 guint            page_num);
111
112   /* Padding for future expansion */
113   void (*_gtk_reserved1) (void);
114   void (*_gtk_reserved2) (void);
115   void (*_gtk_reserved3) (void);
116   void (*_gtk_reserved4) (void);
117   void (*_gtk_reserved5) (void);
118   void (*_gtk_reserved6) (void);
119   void (*_gtk_reserved7) (void);
120   void (*_gtk_reserved8) (void);
121 };
122
123 /***********************************************************
124  *           Creation, insertion, deletion                 *
125  ***********************************************************/
126
127 GType   gtk_notebook_get_type       (void) G_GNUC_CONST;
128 GtkWidget * gtk_notebook_new        (void);
129 gint gtk_notebook_append_page       (GtkNotebook *notebook,
130                                      GtkWidget   *child,
131                                      GtkWidget   *tab_label);
132 gint gtk_notebook_append_page_menu  (GtkNotebook *notebook,
133                                      GtkWidget   *child,
134                                      GtkWidget   *tab_label,
135                                      GtkWidget   *menu_label);
136 gint gtk_notebook_prepend_page      (GtkNotebook *notebook,
137                                      GtkWidget   *child,
138                                      GtkWidget   *tab_label);
139 gint gtk_notebook_prepend_page_menu (GtkNotebook *notebook,
140                                      GtkWidget   *child,
141                                      GtkWidget   *tab_label,
142                                      GtkWidget   *menu_label);
143 gint gtk_notebook_insert_page       (GtkNotebook *notebook,
144                                      GtkWidget   *child,
145                                      GtkWidget   *tab_label,
146                                      gint         position);
147 gint gtk_notebook_insert_page_menu  (GtkNotebook *notebook,
148                                      GtkWidget   *child,
149                                      GtkWidget   *tab_label,
150                                      GtkWidget   *menu_label,
151                                      gint         position);
152 void gtk_notebook_remove_page       (GtkNotebook *notebook,
153                                      gint         page_num);
154
155 /***********************************************************
156  *           Tabs drag and drop                            *
157  ***********************************************************/
158
159 void         gtk_notebook_set_group_name (GtkNotebook *notebook,
160                                           const gchar *group_name);
161 const gchar *gtk_notebook_get_group_name (GtkNotebook *notebook);
162
163
164
165 /***********************************************************
166  *            query, set current NotebookPage              *
167  ***********************************************************/
168
169 gint       gtk_notebook_get_current_page (GtkNotebook *notebook);
170 GtkWidget* gtk_notebook_get_nth_page     (GtkNotebook *notebook,
171                                           gint         page_num);
172 gint       gtk_notebook_get_n_pages      (GtkNotebook *notebook);
173 gint       gtk_notebook_page_num         (GtkNotebook *notebook,
174                                           GtkWidget   *child);
175 void       gtk_notebook_set_current_page (GtkNotebook *notebook,
176                                           gint         page_num);
177 void       gtk_notebook_next_page        (GtkNotebook *notebook);
178 void       gtk_notebook_prev_page        (GtkNotebook *notebook);
179
180 /***********************************************************
181  *            set Notebook, NotebookTab style              *
182  ***********************************************************/
183
184 void     gtk_notebook_set_show_border      (GtkNotebook     *notebook,
185                                             gboolean         show_border);
186 gboolean gtk_notebook_get_show_border      (GtkNotebook     *notebook);
187 void     gtk_notebook_set_show_tabs        (GtkNotebook     *notebook,
188                                             gboolean         show_tabs);
189 gboolean gtk_notebook_get_show_tabs        (GtkNotebook     *notebook);
190 void     gtk_notebook_set_tab_pos          (GtkNotebook     *notebook,
191                                             GtkPositionType  pos);
192 GtkPositionType gtk_notebook_get_tab_pos   (GtkNotebook     *notebook);
193 void     gtk_notebook_set_scrollable       (GtkNotebook     *notebook,
194                                             gboolean         scrollable);
195 gboolean gtk_notebook_get_scrollable       (GtkNotebook     *notebook);
196 guint16  gtk_notebook_get_tab_hborder      (GtkNotebook     *notebook);
197 guint16  gtk_notebook_get_tab_vborder      (GtkNotebook     *notebook);
198
199 /***********************************************************
200  *               enable/disable PopupMenu                  *
201  ***********************************************************/
202
203 void gtk_notebook_popup_enable  (GtkNotebook *notebook);
204 void gtk_notebook_popup_disable (GtkNotebook *notebook);
205
206 /***********************************************************
207  *             query/set NotebookPage Properties           *
208  ***********************************************************/
209
210 GtkWidget * gtk_notebook_get_tab_label    (GtkNotebook *notebook,
211                                            GtkWidget   *child);
212 void gtk_notebook_set_tab_label           (GtkNotebook *notebook,
213                                            GtkWidget   *child,
214                                            GtkWidget   *tab_label);
215 void          gtk_notebook_set_tab_label_text (GtkNotebook *notebook,
216                                                GtkWidget   *child,
217                                                const gchar *tab_text);
218 const gchar * gtk_notebook_get_tab_label_text (GtkNotebook *notebook,
219                                                GtkWidget   *child);
220 GtkWidget * gtk_notebook_get_menu_label   (GtkNotebook *notebook,
221                                            GtkWidget   *child);
222 void gtk_notebook_set_menu_label          (GtkNotebook *notebook,
223                                            GtkWidget   *child,
224                                            GtkWidget   *menu_label);
225 void          gtk_notebook_set_menu_label_text (GtkNotebook *notebook,
226                                                 GtkWidget   *child,
227                                                 const gchar *menu_text);
228 const gchar * gtk_notebook_get_menu_label_text (GtkNotebook *notebook,
229                                                         GtkWidget   *child);
230 void gtk_notebook_reorder_child           (GtkNotebook *notebook,
231                                            GtkWidget   *child,
232                                            gint         position);
233 gboolean gtk_notebook_get_tab_reorderable (GtkNotebook *notebook,
234                                            GtkWidget   *child);
235 void gtk_notebook_set_tab_reorderable     (GtkNotebook *notebook,
236                                            GtkWidget   *child,
237                                            gboolean     reorderable);
238 gboolean gtk_notebook_get_tab_detachable  (GtkNotebook *notebook,
239                                            GtkWidget   *child);
240 void gtk_notebook_set_tab_detachable      (GtkNotebook *notebook,
241                                            GtkWidget   *child,
242                                            gboolean     detachable);
243
244 GtkWidget* gtk_notebook_get_action_widget (GtkNotebook *notebook,
245                                            GtkPackType  pack_type);
246 void       gtk_notebook_set_action_widget (GtkNotebook *notebook,
247                                            GtkWidget   *widget,
248                                            GtkPackType  pack_type);
249
250 G_END_DECLS
251
252 #endif /* __GTK_NOTEBOOK_H__ */