[14481] | 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_WIDGET_H__ |
---|
| 28 | #define __GTK_WIDGET_H__ |
---|
| 29 | |
---|
| 30 | #include <gdk/gdk.h> |
---|
| 31 | #include <gtk/gtkaccelgroup.h> |
---|
| 32 | #include <gtk/gtkobject.h> |
---|
| 33 | #include <gtk/gtkadjustment.h> |
---|
| 34 | #include <gtk/gtkstyle.h> |
---|
| 35 | |
---|
| 36 | |
---|
| 37 | #ifdef __cplusplus |
---|
| 38 | extern "C" { |
---|
| 39 | #endif /* __cplusplus */ |
---|
| 40 | |
---|
| 41 | |
---|
| 42 | /* The flags that are used by GtkWidget on top of the |
---|
| 43 | * flags field of GtkObject. |
---|
| 44 | */ |
---|
| 45 | typedef enum |
---|
| 46 | { |
---|
| 47 | GTK_TOPLEVEL = 1 << 4, |
---|
| 48 | GTK_NO_WINDOW = 1 << 5, |
---|
| 49 | GTK_REALIZED = 1 << 6, |
---|
| 50 | GTK_MAPPED = 1 << 7, |
---|
| 51 | GTK_VISIBLE = 1 << 8, |
---|
| 52 | GTK_SENSITIVE = 1 << 9, |
---|
| 53 | GTK_PARENT_SENSITIVE = 1 << 10, |
---|
| 54 | GTK_CAN_FOCUS = 1 << 11, |
---|
| 55 | GTK_HAS_FOCUS = 1 << 12, |
---|
[15780] | 56 | |
---|
| 57 | /* widget is allowed to receive the default via gtk_widget_grab_default |
---|
| 58 | * and will reserve space to draw the default if possible */ |
---|
[14481] | 59 | GTK_CAN_DEFAULT = 1 << 13, |
---|
[15780] | 60 | |
---|
| 61 | /* the widget currently is receiving the default action and should be drawn |
---|
| 62 | * appropriately if possible */ |
---|
[14481] | 63 | GTK_HAS_DEFAULT = 1 << 14, |
---|
[15780] | 64 | |
---|
[14481] | 65 | GTK_HAS_GRAB = 1 << 15, |
---|
| 66 | GTK_RC_STYLE = 1 << 16, |
---|
| 67 | GTK_COMPOSITE_CHILD = 1 << 17, |
---|
| 68 | GTK_NO_REPARENT = 1 << 18, |
---|
| 69 | GTK_APP_PAINTABLE = 1 << 19, |
---|
[15780] | 70 | |
---|
| 71 | /* the widget when focused will receive the default action and have |
---|
| 72 | * HAS_DEFAULT set even if there is a different widget set as default */ |
---|
[14481] | 73 | GTK_RECEIVES_DEFAULT = 1 << 20 |
---|
| 74 | } GtkWidgetFlags; |
---|
| 75 | |
---|
| 76 | /* Macro for casting a pointer to a GtkWidget or GtkWidgetClass pointer. |
---|
| 77 | * Macros for testing whether `widget' or `klass' are of type GTK_TYPE_WIDGET. |
---|
| 78 | */ |
---|
| 79 | #define GTK_TYPE_WIDGET (gtk_widget_get_type ()) |
---|
| 80 | #define GTK_WIDGET(widget) (GTK_CHECK_CAST ((widget), GTK_TYPE_WIDGET, GtkWidget)) |
---|
| 81 | #define GTK_WIDGET_CLASS(klass) (GTK_CHECK_CLASS_CAST ((klass), GTK_TYPE_WIDGET, GtkWidgetClass)) |
---|
| 82 | #define GTK_IS_WIDGET(widget) (GTK_CHECK_TYPE ((widget), GTK_TYPE_WIDGET)) |
---|
| 83 | #define GTK_IS_WIDGET_CLASS(klass) (GTK_CHECK_CLASS_TYPE ((klass), GTK_TYPE_WIDGET)) |
---|
| 84 | |
---|
| 85 | /* Macros for extracting various fields from GtkWidget and GtkWidgetClass. |
---|
| 86 | */ |
---|
| 87 | #define GTK_WIDGET_TYPE(wid) (GTK_OBJECT_TYPE (wid)) |
---|
| 88 | #define GTK_WIDGET_STATE(wid) (GTK_WIDGET (wid)->state) |
---|
| 89 | #define GTK_WIDGET_SAVED_STATE(wid) (GTK_WIDGET (wid)->saved_state) |
---|
| 90 | |
---|
| 91 | /* Macros for extracting the widget flags from GtkWidget. |
---|
| 92 | */ |
---|
| 93 | #define GTK_WIDGET_FLAGS(wid) (GTK_OBJECT_FLAGS (wid)) |
---|
| 94 | #define GTK_WIDGET_TOPLEVEL(wid) ((GTK_WIDGET_FLAGS (wid) & GTK_TOPLEVEL) != 0) |
---|
| 95 | #define GTK_WIDGET_NO_WINDOW(wid) ((GTK_WIDGET_FLAGS (wid) & GTK_NO_WINDOW) != 0) |
---|
| 96 | #define GTK_WIDGET_REALIZED(wid) ((GTK_WIDGET_FLAGS (wid) & GTK_REALIZED) != 0) |
---|
| 97 | #define GTK_WIDGET_MAPPED(wid) ((GTK_WIDGET_FLAGS (wid) & GTK_MAPPED) != 0) |
---|
| 98 | #define GTK_WIDGET_VISIBLE(wid) ((GTK_WIDGET_FLAGS (wid) & GTK_VISIBLE) != 0) |
---|
| 99 | #define GTK_WIDGET_DRAWABLE(wid) (GTK_WIDGET_VISIBLE (wid) && GTK_WIDGET_MAPPED (wid)) |
---|
| 100 | #define GTK_WIDGET_SENSITIVE(wid) ((GTK_WIDGET_FLAGS (wid) & GTK_SENSITIVE) != 0) |
---|
| 101 | #define GTK_WIDGET_PARENT_SENSITIVE(wid) ((GTK_WIDGET_FLAGS (wid) & GTK_PARENT_SENSITIVE) != 0) |
---|
| 102 | #define GTK_WIDGET_IS_SENSITIVE(wid) (GTK_WIDGET_SENSITIVE (wid) && \ |
---|
| 103 | GTK_WIDGET_PARENT_SENSITIVE (wid)) |
---|
| 104 | #define GTK_WIDGET_CAN_FOCUS(wid) ((GTK_WIDGET_FLAGS (wid) & GTK_CAN_FOCUS) != 0) |
---|
| 105 | #define GTK_WIDGET_HAS_FOCUS(wid) ((GTK_WIDGET_FLAGS (wid) & GTK_HAS_FOCUS) != 0) |
---|
| 106 | #define GTK_WIDGET_CAN_DEFAULT(wid) ((GTK_WIDGET_FLAGS (wid) & GTK_CAN_DEFAULT) != 0) |
---|
| 107 | #define GTK_WIDGET_HAS_DEFAULT(wid) ((GTK_WIDGET_FLAGS (wid) & GTK_HAS_DEFAULT) != 0) |
---|
| 108 | #define GTK_WIDGET_HAS_GRAB(wid) ((GTK_WIDGET_FLAGS (wid) & GTK_HAS_GRAB) != 0) |
---|
| 109 | #define GTK_WIDGET_RC_STYLE(wid) ((GTK_WIDGET_FLAGS (wid) & GTK_RC_STYLE) != 0) |
---|
| 110 | #define GTK_WIDGET_COMPOSITE_CHILD(wid) ((GTK_WIDGET_FLAGS (wid) & GTK_COMPOSITE_CHILD) != 0) |
---|
| 111 | #define GTK_WIDGET_APP_PAINTABLE(wid) ((GTK_WIDGET_FLAGS (wid) & GTK_APP_PAINTABLE) != 0) |
---|
| 112 | #define GTK_WIDGET_RECEIVES_DEFAULT(wid) ((GTK_WIDGET_FLAGS (wid) & GTK_RECEIVES_DEFAULT) != 0) |
---|
| 113 | |
---|
| 114 | /* Macros for setting and clearing widget flags. |
---|
| 115 | */ |
---|
| 116 | #define GTK_WIDGET_SET_FLAGS(wid,flag) G_STMT_START{ (GTK_WIDGET_FLAGS (wid) |= (flag)); }G_STMT_END |
---|
| 117 | #define GTK_WIDGET_UNSET_FLAGS(wid,flag) G_STMT_START{ (GTK_WIDGET_FLAGS (wid) &= ~(flag)); }G_STMT_END |
---|
| 118 | |
---|
| 119 | |
---|
| 120 | |
---|
| 121 | typedef struct _GtkRequisition GtkRequisition; |
---|
| 122 | typedef struct _GtkAllocation GtkAllocation; |
---|
| 123 | typedef struct _GtkSelectionData GtkSelectionData; |
---|
| 124 | typedef struct _GtkWidgetClass GtkWidgetClass; |
---|
| 125 | typedef struct _GtkWidgetAuxInfo GtkWidgetAuxInfo; |
---|
| 126 | typedef struct _GtkWidgetShapeInfo GtkWidgetShapeInfo; |
---|
| 127 | |
---|
| 128 | typedef void (*GtkCallback) (GtkWidget *widget, |
---|
| 129 | gpointer data); |
---|
| 130 | |
---|
| 131 | /* A requisition is a desired amount of space which a |
---|
| 132 | * widget may request. |
---|
| 133 | */ |
---|
| 134 | struct _GtkRequisition |
---|
| 135 | { |
---|
| 136 | gint16 width; |
---|
| 137 | gint16 height; |
---|
| 138 | }; |
---|
| 139 | |
---|
| 140 | /* An allocation is a size and position. Where a widget |
---|
| 141 | * can ask for a desired size, it is actually given |
---|
| 142 | * this amount of space at the specified position. |
---|
| 143 | */ |
---|
| 144 | struct _GtkAllocation |
---|
| 145 | { |
---|
| 146 | gint16 x; |
---|
| 147 | gint16 y; |
---|
| 148 | guint16 width; |
---|
| 149 | guint16 height; |
---|
| 150 | }; |
---|
| 151 | |
---|
| 152 | /* The contents of a selection are returned in a GtkSelectionData |
---|
| 153 | structure. selection/target identify the request. |
---|
| 154 | type specifies the type of the return; if length < 0, and |
---|
| 155 | the data should be ignored. This structure has object semantics - |
---|
| 156 | no fields should be modified directly, they should not be created |
---|
| 157 | directly, and pointers to them should not be stored beyond the duration of |
---|
| 158 | a callback. (If the last is changed, we'll need to add reference |
---|
| 159 | counting.) The time field gives the timestamp at which the data was sent. */ |
---|
| 160 | |
---|
| 161 | struct _GtkSelectionData |
---|
| 162 | { |
---|
| 163 | GdkAtom selection; |
---|
| 164 | GdkAtom target; |
---|
| 165 | GdkAtom type; |
---|
| 166 | gint format; |
---|
| 167 | guchar *data; |
---|
| 168 | gint length; |
---|
| 169 | }; |
---|
| 170 | |
---|
| 171 | /* The widget is the base of the tree for displayable objects. |
---|
| 172 | * (A displayable object is one which takes up some amount |
---|
| 173 | * of screen real estate). It provides a common base and interface |
---|
| 174 | * which actual widgets must adhere to. |
---|
| 175 | */ |
---|
| 176 | struct _GtkWidget |
---|
| 177 | { |
---|
| 178 | /* The object structure needs to be the first |
---|
| 179 | * element in the widget structure in order for |
---|
| 180 | * the object mechanism to work correctly. This |
---|
| 181 | * allows a GtkWidget pointer to be cast to a |
---|
| 182 | * GtkObject pointer. |
---|
| 183 | */ |
---|
| 184 | GtkObject object; |
---|
| 185 | |
---|
| 186 | /* 16 bits of internally used private flags. |
---|
| 187 | * this will be packed into the same 4 byte alignment frame that |
---|
| 188 | * state and saved_state go. we therefore don't waste any new |
---|
| 189 | * space on this. |
---|
| 190 | */ |
---|
| 191 | guint16 private_flags; |
---|
| 192 | |
---|
| 193 | /* The state of the widget. There are actually only |
---|
| 194 | * 5 widget states (defined in "gtkenums.h"). |
---|
| 195 | */ |
---|
| 196 | guint8 state; |
---|
| 197 | |
---|
| 198 | /* The saved state of the widget. When a widgets state |
---|
| 199 | * is changed to GTK_STATE_INSENSITIVE via |
---|
| 200 | * "gtk_widget_set_state" or "gtk_widget_set_sensitive" |
---|
| 201 | * the old state is kept around in this field. The state |
---|
| 202 | * will be restored once the widget gets sensitive again. |
---|
| 203 | */ |
---|
| 204 | guint8 saved_state; |
---|
| 205 | |
---|
| 206 | /* The widgets name. If the widget does not have a name |
---|
| 207 | * (the name is NULL), then its name (as returned by |
---|
| 208 | * "gtk_widget_get_name") is its classes name. |
---|
| 209 | * Among other things, the widget name is used to determine |
---|
| 210 | * the style to use for a widget. |
---|
| 211 | */ |
---|
| 212 | gchar *name; |
---|
| 213 | |
---|
| 214 | /* The style for the widget. The style contains the |
---|
| 215 | * colors the widget should be drawn in for each state |
---|
| 216 | * along with graphics contexts used to draw with and |
---|
| 217 | * the font to use for text. |
---|
| 218 | */ |
---|
| 219 | GtkStyle *style; |
---|
| 220 | |
---|
| 221 | /* The widgets desired size. |
---|
| 222 | */ |
---|
| 223 | GtkRequisition requisition; |
---|
| 224 | |
---|
| 225 | /* The widgets allocated size. |
---|
| 226 | */ |
---|
| 227 | GtkAllocation allocation; |
---|
| 228 | |
---|
| 229 | /* The widgets window or its parent window if it does |
---|
| 230 | * not have a window. (Which will be indicated by the |
---|
| 231 | * GTK_NO_WINDOW flag being set). |
---|
| 232 | */ |
---|
| 233 | GdkWindow *window; |
---|
| 234 | |
---|
| 235 | /* The widgets parent. |
---|
| 236 | */ |
---|
| 237 | GtkWidget *parent; |
---|
| 238 | }; |
---|
| 239 | |
---|
| 240 | struct _GtkWidgetClass |
---|
| 241 | { |
---|
| 242 | /* The object class structure needs to be the first |
---|
| 243 | * element in the widget class structure in order for |
---|
| 244 | * the class mechanism to work correctly. This allows a |
---|
| 245 | * GtkWidgetClass pointer to be cast to a GtkObjectClass |
---|
| 246 | * pointer. |
---|
| 247 | */ |
---|
| 248 | GtkObjectClass parent_class; |
---|
| 249 | |
---|
| 250 | /* The signal to emit when a widget of this class is activated, |
---|
| 251 | * gtk_widget_activate() handles the emission. |
---|
| 252 | * Implementation of this signal is optional. |
---|
| 253 | */ |
---|
| 254 | guint activate_signal; |
---|
| 255 | |
---|
| 256 | /* This signal is emitted when a widget of this class is added |
---|
| 257 | * to a scrolling aware parent, gtk_widget_set_scroll_adjustments() |
---|
| 258 | * handles the emission. |
---|
| 259 | * Implementation of this signal is optional. |
---|
| 260 | */ |
---|
| 261 | guint set_scroll_adjustments_signal; |
---|
| 262 | |
---|
| 263 | /* basics */ |
---|
| 264 | void (* show) (GtkWidget *widget); |
---|
| 265 | void (* show_all) (GtkWidget *widget); |
---|
| 266 | void (* hide) (GtkWidget *widget); |
---|
| 267 | void (* hide_all) (GtkWidget *widget); |
---|
| 268 | void (* map) (GtkWidget *widget); |
---|
| 269 | void (* unmap) (GtkWidget *widget); |
---|
| 270 | void (* realize) (GtkWidget *widget); |
---|
| 271 | void (* unrealize) (GtkWidget *widget); |
---|
| 272 | void (* draw) (GtkWidget *widget, |
---|
| 273 | GdkRectangle *area); |
---|
| 274 | void (* draw_focus) (GtkWidget *widget); |
---|
| 275 | void (* draw_default) (GtkWidget *widget); |
---|
| 276 | void (* size_request) (GtkWidget *widget, |
---|
| 277 | GtkRequisition *requisition); |
---|
| 278 | void (* size_allocate) (GtkWidget *widget, |
---|
| 279 | GtkAllocation *allocation); |
---|
| 280 | void (* state_changed) (GtkWidget *widget, |
---|
| 281 | GtkStateType previous_state); |
---|
| 282 | void (* parent_set) (GtkWidget *widget, |
---|
| 283 | GtkWidget *previous_parent); |
---|
| 284 | void (* style_set) (GtkWidget *widget, |
---|
| 285 | GtkStyle *previous_style); |
---|
| 286 | |
---|
| 287 | /* accelerators */ |
---|
| 288 | gint (* add_accelerator) (GtkWidget *widget, |
---|
| 289 | guint accel_signal_id, |
---|
| 290 | GtkAccelGroup *accel_group, |
---|
| 291 | guint accel_key, |
---|
| 292 | GdkModifierType accel_mods, |
---|
| 293 | GtkAccelFlags accel_flags); |
---|
| 294 | void (* remove_accelerator) (GtkWidget *widget, |
---|
| 295 | GtkAccelGroup *accel_group, |
---|
| 296 | guint accel_key, |
---|
| 297 | GdkModifierType accel_mods); |
---|
| 298 | |
---|
| 299 | /* explicit focus */ |
---|
| 300 | void (* grab_focus) (GtkWidget *widget); |
---|
| 301 | |
---|
| 302 | /* events */ |
---|
| 303 | gint (* event) (GtkWidget *widget, |
---|
| 304 | GdkEvent *event); |
---|
| 305 | gint (* button_press_event) (GtkWidget *widget, |
---|
| 306 | GdkEventButton *event); |
---|
| 307 | gint (* button_release_event) (GtkWidget *widget, |
---|
| 308 | GdkEventButton *event); |
---|
| 309 | gint (* motion_notify_event) (GtkWidget *widget, |
---|
| 310 | GdkEventMotion *event); |
---|
| 311 | gint (* delete_event) (GtkWidget *widget, |
---|
| 312 | GdkEventAny *event); |
---|
| 313 | gint (* destroy_event) (GtkWidget *widget, |
---|
| 314 | GdkEventAny *event); |
---|
| 315 | gint (* expose_event) (GtkWidget *widget, |
---|
| 316 | GdkEventExpose *event); |
---|
| 317 | gint (* key_press_event) (GtkWidget *widget, |
---|
| 318 | GdkEventKey *event); |
---|
| 319 | gint (* key_release_event) (GtkWidget *widget, |
---|
| 320 | GdkEventKey *event); |
---|
| 321 | gint (* enter_notify_event) (GtkWidget *widget, |
---|
| 322 | GdkEventCrossing *event); |
---|
| 323 | gint (* leave_notify_event) (GtkWidget *widget, |
---|
| 324 | GdkEventCrossing *event); |
---|
| 325 | gint (* configure_event) (GtkWidget *widget, |
---|
| 326 | GdkEventConfigure *event); |
---|
| 327 | gint (* focus_in_event) (GtkWidget *widget, |
---|
| 328 | GdkEventFocus *event); |
---|
| 329 | gint (* focus_out_event) (GtkWidget *widget, |
---|
| 330 | GdkEventFocus *event); |
---|
| 331 | gint (* map_event) (GtkWidget *widget, |
---|
| 332 | GdkEventAny *event); |
---|
| 333 | gint (* unmap_event) (GtkWidget *widget, |
---|
| 334 | GdkEventAny *event); |
---|
| 335 | gint (* property_notify_event) (GtkWidget *widget, |
---|
| 336 | GdkEventProperty *event); |
---|
| 337 | gint (* selection_clear_event) (GtkWidget *widget, |
---|
| 338 | GdkEventSelection *event); |
---|
| 339 | gint (* selection_request_event) (GtkWidget *widget, |
---|
| 340 | GdkEventSelection *event); |
---|
| 341 | gint (* selection_notify_event) (GtkWidget *widget, |
---|
| 342 | GdkEventSelection *event); |
---|
| 343 | gint (* proximity_in_event) (GtkWidget *widget, |
---|
| 344 | GdkEventProximity *event); |
---|
| 345 | gint (* proximity_out_event) (GtkWidget *widget, |
---|
| 346 | GdkEventProximity *event); |
---|
| 347 | gint (* visibility_notify_event) (GtkWidget *widget, |
---|
| 348 | GdkEventVisibility *event); |
---|
| 349 | gint (* client_event) (GtkWidget *widget, |
---|
| 350 | GdkEventClient *event); |
---|
| 351 | gint (* no_expose_event) (GtkWidget *widget, |
---|
| 352 | GdkEventAny *event); |
---|
| 353 | |
---|
| 354 | /* selection */ |
---|
| 355 | void (* selection_get) (GtkWidget *widget, |
---|
| 356 | GtkSelectionData *selection_data, |
---|
| 357 | guint info, |
---|
| 358 | guint time); |
---|
| 359 | void (* selection_received) (GtkWidget *widget, |
---|
| 360 | GtkSelectionData *selection_data, |
---|
| 361 | guint time); |
---|
| 362 | |
---|
| 363 | /* Source side drag signals */ |
---|
| 364 | void (* drag_begin) (GtkWidget *widget, |
---|
| 365 | GdkDragContext *context); |
---|
| 366 | void (* drag_end) (GtkWidget *widget, |
---|
| 367 | GdkDragContext *context); |
---|
| 368 | void (* drag_data_get) (GtkWidget *widget, |
---|
| 369 | GdkDragContext *context, |
---|
| 370 | GtkSelectionData *selection_data, |
---|
| 371 | guint info, |
---|
| 372 | guint time); |
---|
| 373 | void (* drag_data_delete) (GtkWidget *widget, |
---|
| 374 | GdkDragContext *context); |
---|
| 375 | |
---|
| 376 | /* Target side drag signals */ |
---|
| 377 | void (* drag_leave) (GtkWidget *widget, |
---|
| 378 | GdkDragContext *context, |
---|
| 379 | guint time); |
---|
| 380 | gboolean (* drag_motion) (GtkWidget *widget, |
---|
| 381 | GdkDragContext *context, |
---|
| 382 | gint x, |
---|
| 383 | gint y, |
---|
| 384 | guint time); |
---|
| 385 | gboolean (* drag_drop) (GtkWidget *widget, |
---|
| 386 | GdkDragContext *context, |
---|
| 387 | gint x, |
---|
| 388 | gint y, |
---|
| 389 | guint time); |
---|
| 390 | void (* drag_data_received) (GtkWidget *widget, |
---|
| 391 | GdkDragContext *context, |
---|
| 392 | gint x, |
---|
| 393 | gint y, |
---|
| 394 | GtkSelectionData *selection_data, |
---|
| 395 | guint info, |
---|
| 396 | guint time); |
---|
| 397 | |
---|
| 398 | /* action signals */ |
---|
| 399 | void (* debug_msg) (GtkWidget *widget, |
---|
| 400 | const gchar *string); |
---|
| 401 | |
---|
| 402 | /* Padding for future expandsion */ |
---|
| 403 | GtkFunction pad1; |
---|
| 404 | GtkFunction pad2; |
---|
| 405 | GtkFunction pad3; |
---|
| 406 | GtkFunction pad4; |
---|
| 407 | }; |
---|
| 408 | |
---|
| 409 | struct _GtkWidgetAuxInfo |
---|
| 410 | { |
---|
| 411 | gint16 x; |
---|
| 412 | gint16 y; |
---|
| 413 | gint16 width; |
---|
| 414 | gint16 height; |
---|
| 415 | }; |
---|
| 416 | |
---|
| 417 | struct _GtkWidgetShapeInfo |
---|
| 418 | { |
---|
| 419 | gint16 offset_x; |
---|
| 420 | gint16 offset_y; |
---|
| 421 | GdkBitmap *shape_mask; |
---|
| 422 | }; |
---|
| 423 | |
---|
| 424 | |
---|
| 425 | GtkType gtk_widget_get_type (void); |
---|
| 426 | GtkWidget* gtk_widget_new (GtkType type, |
---|
| 427 | const gchar *first_arg_name, |
---|
| 428 | ...); |
---|
| 429 | GtkWidget* gtk_widget_newv (GtkType type, |
---|
| 430 | guint nargs, |
---|
| 431 | GtkArg *args); |
---|
| 432 | void gtk_widget_ref (GtkWidget *widget); |
---|
| 433 | void gtk_widget_unref (GtkWidget *widget); |
---|
| 434 | void gtk_widget_destroy (GtkWidget *widget); |
---|
| 435 | void gtk_widget_destroyed (GtkWidget *widget, |
---|
| 436 | GtkWidget **widget_pointer); |
---|
| 437 | void gtk_widget_get (GtkWidget *widget, |
---|
| 438 | GtkArg *arg); |
---|
| 439 | void gtk_widget_getv (GtkWidget *widget, |
---|
| 440 | guint nargs, |
---|
| 441 | GtkArg *args); |
---|
| 442 | void gtk_widget_set (GtkWidget *widget, |
---|
| 443 | const gchar *first_arg_name, |
---|
| 444 | ...); |
---|
| 445 | void gtk_widget_setv (GtkWidget *widget, |
---|
| 446 | guint nargs, |
---|
| 447 | GtkArg *args); |
---|
| 448 | void gtk_widget_unparent (GtkWidget *widget); |
---|
| 449 | void gtk_widget_show (GtkWidget *widget); |
---|
| 450 | void gtk_widget_show_now (GtkWidget *widget); |
---|
| 451 | void gtk_widget_hide (GtkWidget *widget); |
---|
| 452 | void gtk_widget_show_all (GtkWidget *widget); |
---|
| 453 | void gtk_widget_hide_all (GtkWidget *widget); |
---|
| 454 | void gtk_widget_map (GtkWidget *widget); |
---|
| 455 | void gtk_widget_unmap (GtkWidget *widget); |
---|
| 456 | void gtk_widget_realize (GtkWidget *widget); |
---|
| 457 | void gtk_widget_unrealize (GtkWidget *widget); |
---|
| 458 | |
---|
| 459 | /* Queuing draws */ |
---|
| 460 | void gtk_widget_queue_draw (GtkWidget *widget); |
---|
| 461 | void gtk_widget_queue_draw_area (GtkWidget *widget, |
---|
| 462 | gint x, |
---|
| 463 | gint y, |
---|
| 464 | gint width, |
---|
| 465 | gint height); |
---|
| 466 | void gtk_widget_queue_clear (GtkWidget *widget); |
---|
| 467 | void gtk_widget_queue_clear_area (GtkWidget *widget, |
---|
| 468 | gint x, |
---|
| 469 | gint y, |
---|
| 470 | gint width, |
---|
| 471 | gint height); |
---|
| 472 | |
---|
| 473 | |
---|
| 474 | void gtk_widget_queue_resize (GtkWidget *widget); |
---|
| 475 | void gtk_widget_draw (GtkWidget *widget, |
---|
| 476 | GdkRectangle *area); |
---|
| 477 | void gtk_widget_draw_focus (GtkWidget *widget); |
---|
| 478 | void gtk_widget_draw_default (GtkWidget *widget); |
---|
| 479 | void gtk_widget_size_request (GtkWidget *widget, |
---|
| 480 | GtkRequisition *requisition); |
---|
| 481 | void gtk_widget_size_allocate (GtkWidget *widget, |
---|
| 482 | GtkAllocation *allocation); |
---|
| 483 | void gtk_widget_get_child_requisition (GtkWidget *widget, |
---|
| 484 | GtkRequisition *requisition); |
---|
| 485 | void gtk_widget_add_accelerator (GtkWidget *widget, |
---|
| 486 | const gchar *accel_signal, |
---|
| 487 | GtkAccelGroup *accel_group, |
---|
| 488 | guint accel_key, |
---|
| 489 | guint accel_mods, |
---|
| 490 | GtkAccelFlags accel_flags); |
---|
| 491 | void gtk_widget_remove_accelerator (GtkWidget *widget, |
---|
| 492 | GtkAccelGroup *accel_group, |
---|
| 493 | guint accel_key, |
---|
| 494 | guint accel_mods); |
---|
| 495 | void gtk_widget_remove_accelerators (GtkWidget *widget, |
---|
| 496 | const gchar *accel_signal, |
---|
| 497 | gboolean visible_only); |
---|
| 498 | guint gtk_widget_accelerator_signal (GtkWidget *widget, |
---|
| 499 | GtkAccelGroup *accel_group, |
---|
| 500 | guint accel_key, |
---|
| 501 | guint accel_mods); |
---|
| 502 | void gtk_widget_lock_accelerators (GtkWidget *widget); |
---|
| 503 | void gtk_widget_unlock_accelerators (GtkWidget *widget); |
---|
| 504 | gboolean gtk_widget_accelerators_locked (GtkWidget *widget); |
---|
| 505 | gint gtk_widget_event (GtkWidget *widget, |
---|
| 506 | GdkEvent *event); |
---|
| 507 | |
---|
| 508 | gboolean gtk_widget_activate (GtkWidget *widget); |
---|
| 509 | gboolean gtk_widget_set_scroll_adjustments (GtkWidget *widget, |
---|
| 510 | GtkAdjustment *hadjustment, |
---|
| 511 | GtkAdjustment *vadjustment); |
---|
| 512 | |
---|
| 513 | void gtk_widget_reparent (GtkWidget *widget, |
---|
| 514 | GtkWidget *new_parent); |
---|
| 515 | void gtk_widget_popup (GtkWidget *widget, |
---|
| 516 | gint x, |
---|
| 517 | gint y); |
---|
| 518 | gint gtk_widget_intersect (GtkWidget *widget, |
---|
| 519 | GdkRectangle *area, |
---|
| 520 | GdkRectangle *intersection); |
---|
| 521 | |
---|
| 522 | void gtk_widget_grab_focus (GtkWidget *widget); |
---|
| 523 | void gtk_widget_grab_default (GtkWidget *widget); |
---|
| 524 | |
---|
| 525 | void gtk_widget_set_name (GtkWidget *widget, |
---|
| 526 | const gchar *name); |
---|
| 527 | gchar* gtk_widget_get_name (GtkWidget *widget); |
---|
| 528 | void gtk_widget_set_state (GtkWidget *widget, |
---|
| 529 | GtkStateType state); |
---|
| 530 | void gtk_widget_set_sensitive (GtkWidget *widget, |
---|
| 531 | gboolean sensitive); |
---|
| 532 | void gtk_widget_set_app_paintable (GtkWidget *widget, |
---|
| 533 | gboolean app_paintable); |
---|
| 534 | void gtk_widget_set_parent (GtkWidget *widget, |
---|
| 535 | GtkWidget *parent); |
---|
| 536 | void gtk_widget_set_parent_window (GtkWidget *widget, |
---|
| 537 | GdkWindow *parent_window); |
---|
| 538 | GdkWindow *gtk_widget_get_parent_window (GtkWidget *widget); |
---|
| 539 | void gtk_widget_set_uposition (GtkWidget *widget, |
---|
| 540 | gint x, |
---|
| 541 | gint y); |
---|
| 542 | void gtk_widget_set_usize (GtkWidget *widget, |
---|
| 543 | gint width, |
---|
| 544 | gint height); |
---|
| 545 | void gtk_widget_set_events (GtkWidget *widget, |
---|
| 546 | gint events); |
---|
| 547 | void gtk_widget_add_events (GtkWidget *widget, |
---|
| 548 | gint events); |
---|
| 549 | void gtk_widget_set_extension_events (GtkWidget *widget, |
---|
| 550 | GdkExtensionMode mode); |
---|
| 551 | |
---|
| 552 | GdkExtensionMode gtk_widget_get_extension_events (GtkWidget *widget); |
---|
| 553 | GtkWidget* gtk_widget_get_toplevel (GtkWidget *widget); |
---|
| 554 | GtkWidget* gtk_widget_get_ancestor (GtkWidget *widget, |
---|
| 555 | GtkType widget_type); |
---|
| 556 | GdkColormap* gtk_widget_get_colormap (GtkWidget *widget); |
---|
| 557 | GdkVisual* gtk_widget_get_visual (GtkWidget *widget); |
---|
| 558 | |
---|
| 559 | /* The following functions must not be called on an already |
---|
| 560 | * realized widget. Because it is possible that somebody |
---|
| 561 | * can call get_colormap() or get_visual() and save the |
---|
| 562 | * result, these functions are probably only safe to |
---|
| 563 | * call in a widget's init() function. |
---|
| 564 | */ |
---|
| 565 | void gtk_widget_set_colormap (GtkWidget *widget, |
---|
| 566 | GdkColormap *colormap); |
---|
| 567 | void gtk_widget_set_visual (GtkWidget *widget, |
---|
| 568 | GdkVisual *visual); |
---|
| 569 | |
---|
| 570 | |
---|
| 571 | gint gtk_widget_get_events (GtkWidget *widget); |
---|
| 572 | void gtk_widget_get_pointer (GtkWidget *widget, |
---|
| 573 | gint *x, |
---|
| 574 | gint *y); |
---|
| 575 | |
---|
[15780] | 576 | gboolean gtk_widget_is_ancestor (GtkWidget *widget, |
---|
[14481] | 577 | GtkWidget *ancestor); |
---|
| 578 | |
---|
| 579 | /* Hide widget and return TRUE. |
---|
| 580 | */ |
---|
| 581 | gint gtk_widget_hide_on_delete (GtkWidget *widget); |
---|
| 582 | |
---|
| 583 | /* Widget styles. |
---|
| 584 | */ |
---|
| 585 | void gtk_widget_set_style (GtkWidget *widget, |
---|
| 586 | GtkStyle *style); |
---|
| 587 | void gtk_widget_set_rc_style (GtkWidget *widget); |
---|
| 588 | void gtk_widget_ensure_style (GtkWidget *widget); |
---|
| 589 | GtkStyle* gtk_widget_get_style (GtkWidget *widget); |
---|
| 590 | void gtk_widget_restore_default_style (GtkWidget *widget); |
---|
| 591 | |
---|
| 592 | void gtk_widget_modify_style (GtkWidget *widget, |
---|
| 593 | GtkRcStyle *style); |
---|
| 594 | |
---|
| 595 | /* handle composite names for GTK_COMPOSITE_CHILD widgets, |
---|
| 596 | * the returned name is newly allocated. |
---|
| 597 | */ |
---|
| 598 | void gtk_widget_set_composite_name (GtkWidget *widget, |
---|
| 599 | const gchar *name); |
---|
| 600 | gchar* gtk_widget_get_composite_name (GtkWidget *widget); |
---|
| 601 | |
---|
| 602 | /* Descend recursively and set rc-style on all widgets without user styles */ |
---|
| 603 | void gtk_widget_reset_rc_styles (GtkWidget *widget); |
---|
| 604 | |
---|
| 605 | /* Push/pop pairs, to change default values upon a widget's creation. |
---|
| 606 | * This will override the values that got set by the |
---|
| 607 | * gtk_widget_set_default_* () functions. |
---|
| 608 | */ |
---|
| 609 | void gtk_widget_push_style (GtkStyle *style); |
---|
| 610 | void gtk_widget_push_colormap (GdkColormap *cmap); |
---|
| 611 | void gtk_widget_push_visual (GdkVisual *visual); |
---|
| 612 | void gtk_widget_push_composite_child (void); |
---|
| 613 | void gtk_widget_pop_composite_child (void); |
---|
| 614 | void gtk_widget_pop_style (void); |
---|
| 615 | void gtk_widget_pop_colormap (void); |
---|
| 616 | void gtk_widget_pop_visual (void); |
---|
| 617 | |
---|
| 618 | /* Set certain default values to be used at widget creation time. |
---|
| 619 | */ |
---|
| 620 | void gtk_widget_set_default_style (GtkStyle *style); |
---|
| 621 | void gtk_widget_set_default_colormap (GdkColormap *colormap); |
---|
| 622 | void gtk_widget_set_default_visual (GdkVisual *visual); |
---|
| 623 | GtkStyle* gtk_widget_get_default_style (void); |
---|
| 624 | GdkColormap* gtk_widget_get_default_colormap (void); |
---|
| 625 | GdkVisual* gtk_widget_get_default_visual (void); |
---|
| 626 | |
---|
| 627 | /* Counterpart to gdk_window_shape_combine_mask. |
---|
| 628 | */ |
---|
| 629 | void gtk_widget_shape_combine_mask (GtkWidget *widget, |
---|
| 630 | GdkBitmap *shape_mask, |
---|
| 631 | gint offset_x, |
---|
| 632 | gint offset_y); |
---|
| 633 | |
---|
| 634 | /* internal function */ |
---|
| 635 | void gtk_widget_reset_shapes (GtkWidget *widget); |
---|
| 636 | |
---|
| 637 | /* Compute a widget's path in the form "GtkWindow.MyLabel", and |
---|
| 638 | * return newly alocated strings. |
---|
| 639 | */ |
---|
| 640 | void gtk_widget_path (GtkWidget *widget, |
---|
| 641 | guint *path_length, |
---|
| 642 | gchar **path, |
---|
| 643 | gchar **path_reversed); |
---|
| 644 | void gtk_widget_class_path (GtkWidget *widget, |
---|
| 645 | guint *path_length, |
---|
| 646 | gchar **path, |
---|
| 647 | gchar **path_reversed); |
---|
| 648 | |
---|
| 649 | #if defined (GTK_TRACE_OBJECTS) && defined (__GNUC__) |
---|
| 650 | # define gtk_widget_ref gtk_object_ref |
---|
| 651 | # define gtk_widget_unref gtk_object_unref |
---|
| 652 | #endif /* GTK_TRACE_OBJECTS && __GNUC__ */ |
---|
| 653 | |
---|
| 654 | |
---|
| 655 | |
---|
| 656 | #ifdef __cplusplus |
---|
| 657 | } |
---|
| 658 | #endif /* __cplusplus */ |
---|
| 659 | |
---|
| 660 | |
---|
| 661 | #endif /* __GTK_WIDGET_H__ */ |
---|