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