]> Pileus Git - ~andy/gtk/blob - gtk/gtknotebook.h
860c7c5b0c0fcf0f811000f35a368f00f340aa18
[~andy/gtk] / gtk / gtknotebook.h
1 /* GTK - The GIMP Toolkit
2  * Copyright (C) 1995-1997 Peter Mattis, Spencer Kimball and Josh MacDonald
3  *
4  * This library is free software; you can redistribute it and/or
5  * modify it under the terms of the GNU Lesser General Public
6  * License as published by the Free Software Foundation; either
7  * version 2 of the License, or (at your option) any later version.
8  *
9  * This library is distributed in the hope that it will be useful,
10  * but WITHOUT ANY WARRANTY; without even the implied warranty of
11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
12  * Lesser General Public License for more details.
13  *
14  * You should have received a copy of the GNU Lesser General Public
15  * License along with this library; if not, write to the
16  * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
17  * Boston, MA 02111-1307, USA.
18  */
19
20 /*
21  * Modified by the GTK+ Team and others 1997-2000.  See the AUTHORS
22  * file for a list of people on the GTK+ Team.  See the ChangeLog
23  * files for a list of changes.  These files are distributed with
24  * GTK+ at ftp://ftp.gtk.org/pub/gtk/. 
25  */
26
27 #ifndef __GTK_NOTEBOOK_H__
28 #define __GTK_NOTEBOOK_H__
29
30
31 #include <gdk/gdk.h>
32 #include <gtk/gtkcontainer.h>
33
34
35 #ifdef __cplusplus
36 extern "C" {
37 #endif /* __cplusplus */
38
39
40 #define GTK_TYPE_NOTEBOOK                  (gtk_notebook_get_type ())
41 #define GTK_NOTEBOOK(obj)                  (G_TYPE_CHECK_INSTANCE_CAST ((obj), GTK_TYPE_NOTEBOOK, GtkNotebook))
42 #define GTK_NOTEBOOK_CLASS(klass)          (G_TYPE_CHECK_CLASS_CAST ((klass), GTK_TYPE_NOTEBOOK, GtkNotebookClass))
43 #define GTK_IS_NOTEBOOK(obj)               (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GTK_TYPE_NOTEBOOK))
44 #define GTK_IS_NOTEBOOK_CLASS(klass)       (G_TYPE_CHECK_CLASS_TYPE ((klass), GTK_TYPE_NOTEBOOK))
45 #define GTK_NOTEBOOK_GET_CLASS(obj)        (G_TYPE_INSTANCE_GET_CLASS ((obj), GTK_TYPE_NOTEBOOK, GtkNotebookClass))
46
47
48 typedef enum
49 {
50   GTK_NOTEBOOK_TAB_FIRST,
51   GTK_NOTEBOOK_TAB_LAST
52 } GtkNotebookTab;
53
54 typedef struct _GtkNotebook       GtkNotebook;
55 typedef struct _GtkNotebookClass  GtkNotebookClass;
56 typedef struct _GtkNotebookPage   GtkNotebookPage;
57
58 struct _GtkNotebook
59 {
60   GtkContainer container;
61   
62   GtkNotebookPage *cur_page;
63   GList *children;
64   GList *first_tab;             /* The first tab visible (for scrolling notebooks) */
65   GList *focus_tab;
66   
67   GtkWidget *menu;
68   GdkWindow *event_window;
69   
70   guint32 timer;
71   
72   guint16 tab_hborder;
73   guint16 tab_vborder;
74   
75   guint show_tabs          : 1;
76   guint homogeneous        : 1;
77   guint show_border        : 1;
78   guint tab_pos            : 2;
79   guint scrollable         : 1;
80   guint in_child           : 3;
81   guint click_child        : 3;
82   guint button             : 2;
83   guint need_timer         : 1;
84   guint child_has_focus    : 1;
85   guint have_visible_child : 1;
86   guint focus_out          : 1; /* Flag used by ::move-focus-out implementation */
87
88   guint has_before_previous : 1;
89   guint has_before_next     : 1;
90   guint has_after_previous  : 1;
91   guint has_after_next      : 1;
92 };
93
94 struct _GtkNotebookClass
95 {
96   GtkContainerClass parent_class;
97   
98   void (* switch_page)       (GtkNotebook     *notebook,
99                               GtkNotebookPage *page,
100                               guint            page_num);
101
102   /* Action signals for keybindings */
103   gboolean (* select_page)     (GtkNotebook       *notebook,
104                                 gboolean           move_focus);
105   gboolean (* focus_tab)       (GtkNotebook       *notebook,
106                                 GtkNotebookTab     type);
107   void (* change_current_page) (GtkNotebook       *notebook,
108                                 gint               offset);
109   void (* move_focus_out)      (GtkNotebook       *notebook,
110                                 GtkDirectionType   direction);
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 };
118
119 /***********************************************************
120  *           Creation, insertion, deletion                 *
121  ***********************************************************/
122
123 GType   gtk_notebook_get_type       (void) G_GNUC_CONST;
124 GtkWidget * gtk_notebook_new        (void);
125 void gtk_notebook_append_page       (GtkNotebook *notebook,
126                                      GtkWidget   *child,
127                                      GtkWidget   *tab_label);
128 void gtk_notebook_append_page_menu  (GtkNotebook *notebook,
129                                      GtkWidget   *child,
130                                      GtkWidget   *tab_label,
131                                      GtkWidget   *menu_label);
132 void gtk_notebook_prepend_page      (GtkNotebook *notebook,
133                                      GtkWidget   *child,
134                                      GtkWidget   *tab_label);
135 void gtk_notebook_prepend_page_menu (GtkNotebook *notebook,
136                                      GtkWidget   *child,
137                                      GtkWidget   *tab_label,
138                                      GtkWidget   *menu_label);
139 void gtk_notebook_insert_page       (GtkNotebook *notebook,
140                                      GtkWidget   *child,
141                                      GtkWidget   *tab_label,
142                                      gint         position);
143 void gtk_notebook_insert_page_menu  (GtkNotebook *notebook,
144                                      GtkWidget   *child,
145                                      GtkWidget   *tab_label,
146                                      GtkWidget   *menu_label,
147                                      gint         position);
148 void gtk_notebook_remove_page       (GtkNotebook *notebook,
149                                      gint         page_num);
150
151 /***********************************************************
152  *            query, set current NoteebookPage             *
153  ***********************************************************/
154
155 gint       gtk_notebook_get_current_page (GtkNotebook *notebook);
156 GtkWidget* gtk_notebook_get_nth_page     (GtkNotebook *notebook,
157                                           gint         page_num);
158 gint       gtk_notebook_get_n_pages      (GtkNotebook *notebook);
159 gint       gtk_notebook_page_num         (GtkNotebook *notebook,
160                                           GtkWidget   *child);
161 void       gtk_notebook_set_current_page (GtkNotebook *notebook,
162                                           gint         page_num);
163 void       gtk_notebook_next_page        (GtkNotebook *notebook);
164 void       gtk_notebook_prev_page        (GtkNotebook *notebook);
165
166 /***********************************************************
167  *            set Notebook, NotebookTab style              *
168  ***********************************************************/
169
170 void     gtk_notebook_set_show_border      (GtkNotebook     *notebook,
171                                             gboolean         show_border);
172 gboolean gtk_notebook_get_show_border      (GtkNotebook     *notebook);
173 void     gtk_notebook_set_show_tabs        (GtkNotebook     *notebook,
174                                             gboolean         show_tabs);
175 gboolean gtk_notebook_get_show_tabs        (GtkNotebook     *notebook);
176 void     gtk_notebook_set_tab_pos          (GtkNotebook     *notebook,
177                                             GtkPositionType  pos);
178 GtkPositionType gtk_notebook_get_tab_pos   (GtkNotebook     *notebook);
179
180 #ifndef GTK_DISABLE_DEPRECATED
181 void     gtk_notebook_set_homogeneous_tabs (GtkNotebook     *notebook,
182                                             gboolean         homogeneous);
183 void     gtk_notebook_set_tab_border       (GtkNotebook     *notebook,
184                                             guint            border_width);
185 void     gtk_notebook_set_tab_hborder      (GtkNotebook     *notebook,
186                                             guint            tab_hborder);
187 void     gtk_notebook_set_tab_vborder      (GtkNotebook     *notebook,
188                                             guint            tab_vborder);
189 #endif /* GTK_DISABLE_DEPRECATED */
190
191 void     gtk_notebook_set_scrollable       (GtkNotebook     *notebook,
192                                             gboolean         scrollable);
193 gboolean gtk_notebook_get_scrollable       (GtkNotebook     *notebook);
194
195 /***********************************************************
196  *               enable/disable PopupMenu                  *
197  ***********************************************************/
198
199 void gtk_notebook_popup_enable  (GtkNotebook *notebook);
200 void gtk_notebook_popup_disable (GtkNotebook *notebook);
201
202 /***********************************************************
203  *             query/set NotebookPage Properties           *
204  ***********************************************************/
205
206 GtkWidget * gtk_notebook_get_tab_label    (GtkNotebook *notebook,
207                                            GtkWidget   *child);
208 void gtk_notebook_set_tab_label           (GtkNotebook *notebook,
209                                            GtkWidget   *child,
210                                            GtkWidget   *tab_label);
211 void gtk_notebook_set_tab_label_text      (GtkNotebook *notebook,
212                                            GtkWidget   *child,
213                                            const gchar *tab_text);
214 G_CONST_RETURN gchar *gtk_notebook_get_tab_label_text (GtkNotebook *notebook,
215                                                        GtkWidget   *child);
216 GtkWidget * gtk_notebook_get_menu_label   (GtkNotebook *notebook,
217                                            GtkWidget   *child);
218 void gtk_notebook_set_menu_label          (GtkNotebook *notebook,
219                                            GtkWidget   *child,
220                                            GtkWidget   *menu_label);
221 void gtk_notebook_set_menu_label_text     (GtkNotebook *notebook,
222                                            GtkWidget   *child,
223                                            const gchar *menu_text);
224 G_CONST_RETURN gchar *gtk_notebook_get_menu_label_text (GtkNotebook *notebook,
225                                                         GtkWidget   *child);
226 void gtk_notebook_query_tab_label_packing (GtkNotebook *notebook,
227                                            GtkWidget   *child,
228                                            gboolean    *expand,
229                                            gboolean    *fill,
230                                            GtkPackType *pack_type);
231 void gtk_notebook_set_tab_label_packing   (GtkNotebook *notebook,
232                                            GtkWidget   *child,
233                                            gboolean     expand,
234                                            gboolean     fill,
235                                            GtkPackType  pack_type);
236 void gtk_notebook_reorder_child           (GtkNotebook *notebook,
237                                            GtkWidget   *child,
238                                            gint         position);
239
240 #ifndef GTK_DISABLE_DEPRECATED
241 #define gtk_notebook_current_page               gtk_notebook_get_current_page
242 #define gtk_notebook_set_page                   gtk_notebook_set_current_page
243 #endif /* GTK_DISABLE_DEPRECATED */
244
245 #ifdef __cplusplus
246 }
247 #endif /* __cplusplus */
248
249
250 #endif /* __GTK_NOTEBOOK_H__ */