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