]> Pileus Git - ~andy/gtk/blob - gtk/gtknotebook.h
applied patch from Andreas Persenius <ndap@swipnet.se> that updates the
[~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)                  (GTK_CHECK_CAST ((obj), GTK_TYPE_NOTEBOOK, GtkNotebook))
42 #define GTK_NOTEBOOK_CLASS(klass)          (GTK_CHECK_CLASS_CAST ((klass), GTK_TYPE_NOTEBOOK, GtkNotebookClass))
43 #define GTK_IS_NOTEBOOK(obj)               (GTK_CHECK_TYPE ((obj), GTK_TYPE_NOTEBOOK))
44 #define GTK_IS_NOTEBOOK_CLASS(klass)       (GTK_CHECK_CLASS_TYPE ((klass), GTK_TYPE_NOTEBOOK))
45 #define GTK_NOTEBOOK_GET_CLASS(obj)        (GTK_CHECK_GET_CLASS ((obj), GTK_TYPE_NOTEBOOK, GtkNotebookClass))
46
47
48 #define GTK_NOTEBOOK_PAGE(_glist_)         ((GtkNotebookPage *)((GList *)(_glist_))->data)
49
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;
62   GList *focus_tab;
63   
64   GtkWidget *menu;
65   GdkWindow *panel;
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           : 2;
78   guint click_child        : 2;
79   guint button             : 2;
80   guint need_timer         : 1;
81   guint child_has_focus    : 1;
82   guint have_visible_child : 1;
83 };
84
85 struct _GtkNotebookClass
86 {
87   GtkContainerClass parent_class;
88   
89   void (* switch_page)       (GtkNotebook     *notebook,
90                               GtkNotebookPage *page,
91                               guint            page_num);
92 };
93
94 struct _GtkNotebookPage
95 {
96   GtkWidget *child;
97   GtkWidget *tab_label;
98   GtkWidget *menu_label;
99
100   guint default_menu : 1;
101   guint default_tab  : 1;
102   guint expand       : 1;
103   guint fill         : 1;
104   guint pack         : 1;
105
106   GtkRequisition requisition;
107   GtkAllocation allocation;
108 };
109
110 /***********************************************************
111  *           Creation, insertion, deletion                 *
112  ***********************************************************/
113
114 GtkType gtk_notebook_get_type       (void);
115 GtkWidget * gtk_notebook_new        (void);
116 void gtk_notebook_append_page       (GtkNotebook *notebook,
117                                      GtkWidget   *child,
118                                      GtkWidget   *tab_label);
119 void gtk_notebook_append_page_menu  (GtkNotebook *notebook,
120                                      GtkWidget   *child,
121                                      GtkWidget   *tab_label,
122                                      GtkWidget   *menu_label);
123 void gtk_notebook_prepend_page      (GtkNotebook *notebook,
124                                      GtkWidget   *child,
125                                      GtkWidget   *tab_label);
126 void gtk_notebook_prepend_page_menu (GtkNotebook *notebook,
127                                      GtkWidget   *child,
128                                      GtkWidget   *tab_label,
129                                      GtkWidget   *menu_label);
130 void gtk_notebook_insert_page       (GtkNotebook *notebook,
131                                      GtkWidget   *child,
132                                      GtkWidget   *tab_label,
133                                      gint         position);
134 void gtk_notebook_insert_page_menu  (GtkNotebook *notebook,
135                                      GtkWidget   *child,
136                                      GtkWidget   *tab_label,
137                                      GtkWidget   *menu_label,
138                                      gint         position);
139 void gtk_notebook_remove_page       (GtkNotebook *notebook,
140                                      gint         page_num);
141
142 /***********************************************************
143  *            query, set current NoteebookPage             *
144  ***********************************************************/
145
146 gint gtk_notebook_get_current_page   (GtkNotebook *notebook);
147 GtkWidget* gtk_notebook_get_nth_page (GtkNotebook *notebook,
148                                       gint         page_num);
149 gint gtk_notebook_page_num         (GtkNotebook *notebook,
150                                     GtkWidget   *child);
151 void gtk_notebook_set_page         (GtkNotebook *notebook,
152                                     gint         page_num);
153 void gtk_notebook_next_page        (GtkNotebook *notebook);
154 void gtk_notebook_prev_page        (GtkNotebook *notebook);
155
156 /***********************************************************
157  *            set Notebook, NotebookTab style              *
158  ***********************************************************/
159
160 void gtk_notebook_set_show_border      (GtkNotebook     *notebook,
161                                         gboolean         show_border);
162 void gtk_notebook_set_show_tabs        (GtkNotebook     *notebook,
163                                         gboolean         show_tabs);
164 void gtk_notebook_set_tab_pos          (GtkNotebook     *notebook,
165                                         GtkPositionType  pos);
166 void gtk_notebook_set_homogeneous_tabs (GtkNotebook     *notebook,
167                                         gboolean         homogeneous);
168 void gtk_notebook_set_tab_border       (GtkNotebook     *notebook,
169                                         guint            border_width);
170 void gtk_notebook_set_tab_hborder      (GtkNotebook     *notebook,
171                                         guint            tab_hborder);
172 void gtk_notebook_set_tab_vborder      (GtkNotebook     *notebook,
173                                         guint            tab_vborder);
174 void gtk_notebook_set_scrollable       (GtkNotebook     *notebook,
175                                         gboolean         scrollable);
176
177 /***********************************************************
178  *               enable/disable PopupMenu                  *
179  ***********************************************************/
180
181 void gtk_notebook_popup_enable  (GtkNotebook *notebook);
182 void gtk_notebook_popup_disable (GtkNotebook *notebook);
183
184 /***********************************************************
185  *             query/set NotebookPage Properties           *
186  ***********************************************************/
187
188 GtkWidget * gtk_notebook_get_tab_label    (GtkNotebook *notebook,
189                                            GtkWidget   *child);
190 void gtk_notebook_set_tab_label           (GtkNotebook *notebook,
191                                            GtkWidget   *child,
192                                            GtkWidget   *tab_label);
193 void gtk_notebook_set_tab_label_text      (GtkNotebook *notebook,
194                                            GtkWidget   *child,
195                                            const gchar *tab_text);
196 GtkWidget * gtk_notebook_get_menu_label   (GtkNotebook *notebook,
197                                            GtkWidget   *child);
198 void gtk_notebook_set_menu_label          (GtkNotebook *notebook,
199                                            GtkWidget   *child,
200                                            GtkWidget   *menu_label);
201 void gtk_notebook_set_menu_label_text     (GtkNotebook *notebook,
202                                            GtkWidget   *child,
203                                            const gchar *menu_text);
204 void gtk_notebook_query_tab_label_packing (GtkNotebook *notebook,
205                                            GtkWidget   *child,
206                                            gboolean    *expand,
207                                            gboolean    *fill,
208                                            GtkPackType *pack_type);
209 void gtk_notebook_set_tab_label_packing   (GtkNotebook *notebook,
210                                            GtkWidget   *child,
211                                            gboolean     expand,
212                                            gboolean     fill,
213                                            GtkPackType  pack_type);
214 void gtk_notebook_reorder_child           (GtkNotebook *notebook,
215                                            GtkWidget   *child,
216                                            gint         position);
217
218 #ifdef __cplusplus
219 }
220 #endif /* __cplusplus */
221
222
223 #endif /* __GTK_NOTEBOOK_H__ */