]> Pileus Git - ~andy/gtk/blob - gtk/gtknotebook.h
Added notice to look in AUTHORS and ChangeLog files for a list of changes.
[~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 Library 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  * Library General Public License for more details.
13  *
14  * You should have received a copy of the GNU Library 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-1999.  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
46 #define GTK_NOTEBOOK_PAGE(_glist_)         ((GtkNotebookPage *)((GList *)(_glist_))->data)
47
48
49 typedef struct _GtkNotebook       GtkNotebook;
50 typedef struct _GtkNotebookClass  GtkNotebookClass;
51 typedef struct _GtkNotebookPage   GtkNotebookPage;
52
53 struct _GtkNotebook
54 {
55   GtkContainer container;
56   
57   GtkNotebookPage *cur_page;
58   GList *children;
59   GList *first_tab;
60   GList *focus_tab;
61   
62   GtkWidget *menu;
63   GdkWindow *panel;
64   
65   guint32 timer;
66   
67   guint16 tab_hborder;
68   guint16 tab_vborder;
69   
70   guint show_tabs          : 1;
71   guint homogeneous        : 1;
72   guint show_border        : 1;
73   guint tab_pos            : 2;
74   guint scrollable         : 1;
75   guint in_child           : 2;
76   guint click_child        : 2;
77   guint button             : 2;
78   guint need_timer         : 1;
79   guint child_has_focus    : 1;
80   guint have_visible_child : 1;
81 };
82
83 struct _GtkNotebookClass
84 {
85   GtkContainerClass parent_class;
86   
87   void (* switch_page)       (GtkNotebook     *notebook,
88                               GtkNotebookPage *page,
89                               guint            page_num);
90 };
91
92 struct _GtkNotebookPage
93 {
94   GtkWidget *child;
95   GtkWidget *tab_label;
96   GtkWidget *menu_label;
97
98   guint default_menu : 1;
99   guint default_tab  : 1;
100   guint expand       : 1;
101   guint fill         : 1;
102   guint pack         : 1;
103
104   GtkRequisition requisition;
105   GtkAllocation allocation;
106 };
107
108 /***********************************************************
109  *           Creation, insertion, deletion                 *
110  ***********************************************************/
111
112 GtkType gtk_notebook_get_type       (void);
113 GtkWidget * gtk_notebook_new        (void);
114 void gtk_notebook_append_page       (GtkNotebook *notebook,
115                                      GtkWidget   *child,
116                                      GtkWidget   *tab_label);
117 void gtk_notebook_append_page_menu  (GtkNotebook *notebook,
118                                      GtkWidget   *child,
119                                      GtkWidget   *tab_label,
120                                      GtkWidget   *menu_label);
121 void gtk_notebook_prepend_page      (GtkNotebook *notebook,
122                                      GtkWidget   *child,
123                                      GtkWidget   *tab_label);
124 void gtk_notebook_prepend_page_menu (GtkNotebook *notebook,
125                                      GtkWidget   *child,
126                                      GtkWidget   *tab_label,
127                                      GtkWidget   *menu_label);
128 void gtk_notebook_insert_page       (GtkNotebook *notebook,
129                                      GtkWidget   *child,
130                                      GtkWidget   *tab_label,
131                                      gint         position);
132 void gtk_notebook_insert_page_menu  (GtkNotebook *notebook,
133                                      GtkWidget   *child,
134                                      GtkWidget   *tab_label,
135                                      GtkWidget   *menu_label,
136                                      gint         position);
137 void gtk_notebook_remove_page       (GtkNotebook *notebook,
138                                      gint         page_num);
139
140 /***********************************************************
141  *            query, set current NoteebookPage             *
142  ***********************************************************/
143
144 gint gtk_notebook_get_current_page   (GtkNotebook *notebook);
145 GtkWidget* gtk_notebook_get_nth_page (GtkNotebook *notebook,
146                                       gint         page_num);
147 gint gtk_notebook_page_num         (GtkNotebook *notebook,
148                                     GtkWidget   *child);
149 void gtk_notebook_set_page         (GtkNotebook *notebook,
150                                     gint         page_num);
151 void gtk_notebook_next_page        (GtkNotebook *notebook);
152 void gtk_notebook_prev_page        (GtkNotebook *notebook);
153
154 /***********************************************************
155  *            set Notebook, NotebookTab style              *
156  ***********************************************************/
157
158 void gtk_notebook_set_show_border      (GtkNotebook     *notebook,
159                                         gboolean         show_border);
160 void gtk_notebook_set_show_tabs        (GtkNotebook     *notebook,
161                                         gboolean         show_tabs);
162 void gtk_notebook_set_tab_pos          (GtkNotebook     *notebook,
163                                         GtkPositionType  pos);
164 void gtk_notebook_set_homogeneous_tabs (GtkNotebook     *notebook,
165                                         gboolean         homogeneous);
166 void gtk_notebook_set_tab_border       (GtkNotebook     *notebook,
167                                         guint            border_width);
168 void gtk_notebook_set_tab_hborder      (GtkNotebook     *notebook,
169                                         guint            tab_hborder);
170 void gtk_notebook_set_tab_vborder      (GtkNotebook     *notebook,
171                                         guint            tab_vborder);
172 void gtk_notebook_set_scrollable       (GtkNotebook     *notebook,
173                                         gboolean         scrollable);
174
175 /***********************************************************
176  *               enable/disable PopupMenu                  *
177  ***********************************************************/
178
179 void gtk_notebook_popup_enable  (GtkNotebook *notebook);
180 void gtk_notebook_popup_disable (GtkNotebook *notebook);
181
182 /***********************************************************
183  *             query/set NotebookPage Properties           *
184  ***********************************************************/
185
186 GtkWidget * gtk_notebook_get_tab_label    (GtkNotebook *notebook,
187                                            GtkWidget   *child);
188 void gtk_notebook_set_tab_label           (GtkNotebook *notebook,
189                                            GtkWidget   *child,
190                                            GtkWidget   *tab_label);
191 void gtk_notebook_set_tab_label_text      (GtkNotebook *notebook,
192                                            GtkWidget   *child,
193                                            const gchar *tab_text);
194 GtkWidget * gtk_notebook_get_menu_label   (GtkNotebook *notebook,
195                                            GtkWidget   *child);
196 void gtk_notebook_set_menu_label          (GtkNotebook *notebook,
197                                            GtkWidget   *child,
198                                            GtkWidget   *menu_label);
199 void gtk_notebook_set_menu_label_text     (GtkNotebook *notebook,
200                                            GtkWidget   *child,
201                                            const gchar *menu_text);
202 void gtk_notebook_query_tab_label_packing (GtkNotebook *notebook,
203                                            GtkWidget   *child,
204                                            gboolean    *expand,
205                                            gboolean    *fill,
206                                            GtkPackType *pack_type);
207 void gtk_notebook_set_tab_label_packing   (GtkNotebook *notebook,
208                                            GtkWidget   *child,
209                                            gboolean     expand,
210                                            gboolean     fill,
211                                            GtkPackType  pack_type);
212 void gtk_notebook_reorder_child           (GtkNotebook *notebook,
213                                            GtkWidget   *child,
214                                            gint         position);
215
216 #ifdef __cplusplus
217 }
218 #endif /* __cplusplus */
219
220
221 #endif /* __GTK_NOTEBOOK_H__ */