]> Pileus Git - ~andy/gtk/blob - gtk/gtknotebook.h
new class method/signal row_move. new public function. emit a row_move
[~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 #ifndef __GTK_NOTEBOOK_H__
20 #define __GTK_NOTEBOOK_H__
21
22
23 #include <gdk/gdk.h>
24 #include <gtk/gtkcontainer.h>
25
26
27 #ifdef __cplusplus
28 extern "C" {
29 #endif /* __cplusplus */
30
31
32 #define GTK_TYPE_NOTEBOOK                  (gtk_notebook_get_type ())
33 #define GTK_NOTEBOOK(obj)                  (GTK_CHECK_CAST ((obj), GTK_TYPE_NOTEBOOK, GtkNotebook))
34 #define GTK_NOTEBOOK_CLASS(klass)          (GTK_CHECK_CLASS_CAST ((klass), GTK_TYPE_NOTEBOOK, GtkNotebookClass))
35 #define GTK_IS_NOTEBOOK(obj)               (GTK_CHECK_TYPE ((obj), GTK_TYPE_NOTEBOOK))
36 #define GTK_IS_NOTEBOOK_CLASS(klass)       (GTK_CHECK_CLASS_TYPE ((klass), GTK_TYPE_NOTEBOOK))
37
38 #define GTK_NOTEBOOK_PAGE(_glist_)         ((GtkNotebookPage *)((GList *)(_glist_))->data)
39
40
41 typedef struct _GtkNotebook       GtkNotebook;
42 typedef struct _GtkNotebookClass  GtkNotebookClass;
43 typedef struct _GtkNotebookPage   GtkNotebookPage;
44
45 struct _GtkNotebook
46 {
47   GtkContainer container;
48   
49   GtkNotebookPage *cur_page;
50   GList *children;
51   GList *first_tab;
52   GList *focus_tab;
53   
54   GtkWidget *menu;
55   GdkWindow *panel;
56   
57   guint32 timer;
58   
59   guint16 tab_hborder;
60   guint16 tab_vborder;
61   
62   guint show_tabs       : 1;
63   guint homogeneous     : 1;
64   guint show_border     : 1;
65   guint tab_pos         : 2;
66   guint scrollable      : 1;
67   guint in_child        : 2;
68   guint click_child     : 2;
69   guint button          : 2;
70   guint need_timer      : 1;
71   guint child_has_focus : 1;
72 };
73
74 struct _GtkNotebookClass
75 {
76   GtkContainerClass parent_class;
77   
78   void (* switch_page)       (GtkNotebook     *notebook,
79                               GtkNotebookPage *page,
80                               guint            page_num);
81 };
82
83 struct _GtkNotebookPage
84 {
85   GtkWidget *child;
86   GtkWidget *tab_label;
87   GtkWidget *menu_label;
88
89   guint default_menu : 1;
90   guint default_tab  : 1;
91   guint expand       : 1;
92   guint fill         : 1;
93   guint pack         : 1;
94
95   GtkRequisition requisition;
96   GtkAllocation allocation;
97 };
98
99 /***********************************************************
100  *           Creation, insertion, deletion                 *
101  ***********************************************************/
102
103 GtkType gtk_notebook_get_type       (void);
104 GtkWidget * gtk_notebook_new        (void);
105 void gtk_notebook_append_page       (GtkNotebook *notebook,
106                                      GtkWidget   *child,
107                                      GtkWidget   *tab_label);
108 void gtk_notebook_append_page_menu  (GtkNotebook *notebook,
109                                      GtkWidget   *child,
110                                      GtkWidget   *tab_label,
111                                      GtkWidget   *menu_label);
112 void gtk_notebook_prepend_page      (GtkNotebook *notebook,
113                                      GtkWidget   *child,
114                                      GtkWidget   *tab_label);
115 void gtk_notebook_prepend_page_menu (GtkNotebook *notebook,
116                                      GtkWidget   *child,
117                                      GtkWidget   *tab_label,
118                                      GtkWidget   *menu_label);
119 void gtk_notebook_insert_page       (GtkNotebook *notebook,
120                                      GtkWidget   *child,
121                                      GtkWidget   *tab_label,
122                                      gint         position);
123 void gtk_notebook_insert_page_menu  (GtkNotebook *notebook,
124                                      GtkWidget   *child,
125                                      GtkWidget   *tab_label,
126                                      GtkWidget   *menu_label,
127                                      gint         position);
128 void gtk_notebook_remove_page       (GtkNotebook *notebook,
129                                      gint         page_num);
130
131 /***********************************************************
132  *            query, set current NoteebookPage             *
133  ***********************************************************/
134
135 gint gtk_notebook_get_current_page (GtkNotebook *notebook);
136 GtkWidget * gtk_notebook_nth_page  (GtkNotebook *notebook,
137                                     gint         page_num);
138 gint gtk_notebook_page_num         (GtkNotebook *notebook,
139                                     GtkWidget   *child);
140 void gtk_notebook_set_page         (GtkNotebook *notebook,
141                                     gint         page_num);
142 void gtk_notebook_next_page        (GtkNotebook *notebook);
143 void gtk_notebook_prev_page        (GtkNotebook *notebook);
144
145 /***********************************************************
146  *            set Notebook, NotebookTab style              *
147  ***********************************************************/
148
149 void gtk_notebook_set_show_border      (GtkNotebook     *notebook,
150                                         gboolean         show_border);
151 void gtk_notebook_set_show_tabs        (GtkNotebook     *notebook,
152                                         gboolean         show_tabs);
153 void gtk_notebook_set_tab_pos          (GtkNotebook     *notebook,
154                                         GtkPositionType  pos);
155 void gtk_notebook_set_homogeneous_tabs (GtkNotebook     *notebook,
156                                         gboolean         homogeneous);
157 void gtk_notebook_set_tab_border       (GtkNotebook     *notebook,
158                                         guint            border_width);
159 void gtk_notebook_set_tab_hborder      (GtkNotebook     *notebook,
160                                         guint            tab_hborder);
161 void gtk_notebook_set_tab_vborder      (GtkNotebook     *notebook,
162                                         guint            tab_vborder);
163 void gtk_notebook_set_scrollable       (GtkNotebook     *notebook,
164                                         gboolean         scrollable);
165
166 /***********************************************************
167  *               enable/disable PopupMenu                  *
168  ***********************************************************/
169
170 void gtk_notebook_popup_enable  (GtkNotebook *notebook);
171 void gtk_notebook_popup_disable (GtkNotebook *notebook);
172
173 /***********************************************************
174  *             query/set NotebookPage Properties           *
175  ***********************************************************/
176
177 GtkWidget * gtk_notebook_get_tab_label    (GtkNotebook *notebook,
178                                            GtkWidget   *child);
179 void gtk_notebook_set_tab_label           (GtkNotebook *notebook,
180                                            GtkWidget   *child,
181                                            GtkWidget   *tab_label);
182 void gtk_notebook_set_tab_label_text      (GtkNotebook *notebook,
183                                            GtkWidget   *child,
184                                            const gchar *tab_text);
185 GtkWidget * gtk_notebook_get_menu_label   (GtkNotebook *notebook,
186                                            GtkWidget   *child);
187 void gtk_notebook_set_menu_label          (GtkNotebook *notebook,
188                                            GtkWidget   *child,
189                                            GtkWidget   *menu_label);
190 void gtk_notebook_set_menu_label_text     (GtkNotebook *notebook,
191                                            GtkWidget   *child,
192                                            const gchar *menu_text);
193 void gtk_notebook_query_tab_label_packing (GtkNotebook *notebook,
194                                            GtkWidget   *child,
195                                            gboolean    *expand,
196                                            gboolean    *fill,
197                                            GtkPackType *pack_type);
198 void gtk_notebook_set_tab_label_packing   (GtkNotebook *notebook,
199                                            GtkWidget   *child,
200                                            gboolean     expand,
201                                            gboolean     fill,
202                                            GtkPackType  pack_type);
203 void gtk_notebook_reorder_child           (GtkNotebook *notebook,
204                                            GtkWidget   *child,
205                                            gint         position);
206
207 #ifdef __cplusplus
208 }
209 #endif /* __cplusplus */
210
211
212 #endif /* __GTK_NOTEBOOK_H__ */