1 /*
2 * Copyright (c) 2003-2006, 2009, 2010, 2012 by the gtk2-perl team (see the
3 * file AUTHORS)
4 *
5 * Licensed under the LGPL, see LICENSE file for more information.
6 *
7 * $Id$
8 */
9 #include "gtk2perl.h"
10
11 static void
_INSTALL_OVERRIDES(const char * package)12 _INSTALL_OVERRIDES (const char * package)
13 {
14 GType gtype;
15 guint signal_id;
16
17 gtype = gperl_object_type_from_package (package);
18 if (!gtype)
19 croak ("package '%s' is not registered with Gtk2-Perl",
20 package);
21 if (! g_type_is_a (gtype, GTK_TYPE_WIDGET))
22 croak ("%s(%s) is not a GtkWidget",
23 package, g_type_name (gtype));
24
25 /*
26 * GtkWidgets may implement "native scrolling". Such widgets can
27 * be told to use scroll adjustments with the method
28 * gtk_widget_set_scroll_adjustments(), which emits the signal whose
29 * id is stored in GtkWidgetClass::set_scroll_adjustments_signal.
30 * Since we have limited support for class-init, we'll add the
31 * somewhat sensible restriction that the signal named
32 * "set-scroll-adjustments" is for that purpose.
33 */
34 signal_id = g_signal_lookup ("set-scroll-adjustments", gtype);
35 if (signal_id) {
36 GSignalQuery query;
37
38 /* verify that the signal is valid for this purpose. */
39 g_signal_query (signal_id, &query);
40
41 /* Note: we are interested iff the signal is defined by the
42 * exact type we're initializing. Do NOT do this for inherited
43 * signals. */
44 if (query.itype == gtype) {
45 if (query.return_type == G_TYPE_NONE &&
46 query.n_params == 2 &&
47 g_type_is_a (query.param_types[0], GTK_TYPE_ADJUSTMENT) &&
48 g_type_is_a (query.param_types[1], GTK_TYPE_ADJUSTMENT)) {
49 GtkWidgetClass * class;
50
51 class = g_type_class_peek (gtype);
52 g_assert (class);
53
54 class->set_scroll_adjustments_signal = signal_id;
55 } else {
56 warn ("Signal %s on %s is an invalid set-scroll-"
57 "adjustments signal. A set-scroll-adjustments "
58 "signal must have no return type and take "
59 "exactly two Gtk2::Adjustment parameters. "
60 "Ignoring", query.signal_name, package);
61 }
62 }
63 }
64 }
65
66 MODULE = Gtk2::Widget PACKAGE = Gtk2::Requisition
67
68 gint
69 width (requisition, newval=NULL)
70 GtkRequisition * requisition
71 SV * newval
72 ALIAS:
73 height = 1
74 CODE:
75 switch (ix) {
76 case 0:
77 RETVAL = requisition->width;
78 if (newval) requisition->width = SvIV (newval);
79 break;
80 case 1:
81 RETVAL = requisition->height;
82 if (newval) requisition->height = SvIV (newval);
83 break;
84 default:
85 RETVAL = 0;
86 g_assert_not_reached ();
87 }
88 OUTPUT:
89 RETVAL
90
91 GtkRequisition_copy *
92 new (class, width=0, height=0)
93 gint width
94 gint height
95 PREINIT:
96 GtkRequisition req;
97 CODE:
98 req.width = width;
99 req.height = height;
100 RETVAL = &req;
101 OUTPUT:
102 RETVAL
103
104
105 MODULE = Gtk2::Widget PACKAGE = Gtk2::Widget PREFIX = gtk_widget_
106
107 =for position post_interfaces
108
109 =head1 CONSTANTS
110
111 C<EVENT_STOP> and C<EVENT_PROPAGATE> are designed for the return from
112 widget event signal handlers and similar, being true to stop or false
113 to propagate. The names can help you avoid confusion over which way
114 is true and which is false. (You can also remember the return as
115 meaning "handled", which is the jargon in a few other signal handler
116 types.)
117
118 Gtk2::EVENT_STOP # true
119 Gtk2::EVENT_PROPAGATE # false
120
121 =cut
122
123 =for apidoc __hide__
124 =cut
125 void
126 _INSTALL_OVERRIDES (const char * package)
127
128
129 ## access to important struct members:
130
131 ## must allow ornull for people who call ->window before the widget
132 ## is realized. the ref/unref stunt is necessary to make sure RETVAL doesn't
133 ## get mangled.
134 GdkWindow_ornull *
135 window (widget, new=NULL)
136 GtkWidget * widget
137 GdkWindow_ornull * new
138 CODE:
139 RETVAL = widget->window;
140 if (RETVAL)
141 g_object_ref (widget->window);
142
143 if (items == 2 && new != widget->window) {
144 if (widget->window)
145 g_object_unref (widget->window);
146 if (new)
147 g_object_ref (new);
148 widget->window = new;
149 }
150 OUTPUT:
151 RETVAL
152 CLEANUP:
153 if (RETVAL) g_object_unref (RETVAL);
154
155 =for apidoc
156 Return the currently desired width and height of $widget. Basically
157 this is the result from the last C<size_request> call on $widget, and
158 therefore may not be up-to-date if $widget has asked for a resize but
159 its container parent has not yet called C<size_request>.
160
161 The returned requisition object points into $widget and can only be
162 used as long as $widget exists.
163 =cut
164 GtkRequisition *
165 requisition (widget)
166 GtkWidget * widget
167 CODE:
168 RETVAL = &(widget->requisition);
169 OUTPUT:
170 RETVAL
171
172 =for apidoc
173 Return the current allocated size and position of $widget within its
174 parent widget. The allocated size is not necessarily the same as the
175 requested size.
176
177 The returned rect object points into $widget and can only be used as
178 long as $widget exists.
179 =cut
180 GdkRectangle *
181 allocation (widget)
182 GtkWidget * widget
183 CODE:
184 RETVAL = &(widget->allocation);
185 OUTPUT:
186 RETVAL
187
188 #GtkStyle* gtk_widget_get_style (GtkWidget *widget);
189 GtkStyle*
190 style (widget)
191 GtkWidget * widget
192 ALIAS:
193 Gtk2::Widget::get_style = 1
194 CODE:
195 PERL_UNUSED_VAR (ix);
196 RETVAL = gtk_widget_get_style(widget);
197 OUTPUT:
198 RETVAL
199
200 ## and now, the exported API from the header
201
202 ##define GTK_WIDGET_TYPE(wid) (GTK_OBJECT_TYPE (wid))
203 ##define GTK_WIDGET_STATE(wid) (GTK_WIDGET (wid)->state)
204 ##define GTK_WIDGET_SAVED_STATE(wid) (GTK_WIDGET (wid)->saved_state)
205 GtkStateType
206 state (widget)
207 GtkWidget * widget
208 ALIAS:
209 Gtk2::Widget::saved_state = 1
210 CODE:
211 switch (ix) {
212 case 0: RETVAL = GTK_WIDGET_STATE (widget); break;
213 case 1: RETVAL = GTK_WIDGET_SAVED_STATE (widget); break;
214 default: RETVAL = 0; g_assert_not_reached ();
215 }
216 OUTPUT:
217 RETVAL
218
219 ##define GTK_WIDGET_FLAGS(wid) (GTK_OBJECT_FLAGS (wid))
220
221 =for apidoc Gtk2::Widget::toplevel
222 =for signature $widget->toplevel ($value)
223 =for signature boolean = $widget->toplevel
224 =for arg ... (__hide__)
225 =cut
226
227 =for apidoc Gtk2::Widget::no_window
228 =for signature $widget->no_window ($boolean)
229 =for signature boolean = $widget->no_window
230 =for arg ... (__hide__)
231 =cut
232
233 =for apidoc Gtk2::Widget::realized
234 =for signature $widget->realized ($boolean)
235 =for signature boolean = $widget->realized
236 =for arg ... (__hide__)
237 =cut
238
239 =for apidoc Gtk2::Widget::mapped
240 =for signature $widget->mapped ($boolean)
241 =for signature boolean = $widget->mapped
242 =for arg ... (__hide__)
243 =cut
244
245 =for apidoc Gtk2::Widget::visible
246 =for signature $widget->visible ($boolean)
247 =for signature boolean = $widget->visible
248 =for arg ... (__hide__)
249 =cut
250
251 =for apidoc Gtk2::Widget::drawable
252 =for signature $widget->drawable ($boolean)
253 =for signature boolean = $widget->drawable
254 =for arg ... (__hide__)
255 =cut
256
257 =for apidoc Gtk2::Widget::sensitive
258 =for signature $widget->sensitive ($boolean)
259 =for signature boolean = $widget->sensitive
260 =for arg ... (__hide__)
261 =cut
262
263 =for apidoc Gtk2::Widget::parent_sensitive
264 =for signature $widget->parent_sensitive ($boolean)
265 =for signature boolean = $widget->parent_sensitive
266 =for arg ... (__hide__)
267 =cut
268
269 =for apidoc Gtk2::Widget::is_sensitive
270 =for signature $widget->is_sensitive ($boolean)
271 =for signature boolean = $widget->is_sensitive
272 =for arg ... (__hide__)
273 =cut
274
275 =for apidoc Gtk2::Widget::can_focus
276 =for signature $widget->can_focus ($boolean)
277 =for signature boolean = $widget->can_focus
278 =for arg ... (__hide__)
279 =cut
280
281 =for apidoc Gtk2::Widget::has_focus
282 =for signature $widget->has_focus ($boolean)
283 =for signature boolean = $widget->has_focus
284 =for arg ... (__hide__)
285 =cut
286
287 =for apidoc Gtk2::Widget::has_grab
288 =for signature $widget->has_grab ($boolean)
289 =for signature boolean = $widget->has_grab
290 =for arg ... (__hide__)
291 =cut
292
293 =for apidoc Gtk2::Widget::rc_style
294 =for signature $widget->rc_style ($boolean)
295 =for signature boolean = $widget->rc_style
296 =for arg ... (__hide__)
297 =cut
298
299 =for apidoc Gtk2::Widget::composite_child
300 =for signature $widget->composite_child ($boolean)
301 =for signature boolean = $widget->composite_child
302 =for arg ... (__hide__)
303 =cut
304
305 =for apidoc Gtk2::Widget::app_paintable
306 =for signature $widget->app_paintable ($boolean)
307 =for signature boolean = $widget->app_paintable
308 =for arg ... (__hide__)
309 =cut
310
311 =for apidoc Gtk2::Widget::receives_default
312 =for signature $widget->receives_default ($boolean)
313 =for signature boolean = $widget->receives_default
314 =for arg ... (__hide__)
315 =cut
316
317 =for apidoc Gtk2::Widget::double_buffered
318 =for signature $widget->double_buffered ($boolean)
319 =for signature boolean = $widget->double_buffered
320 =for arg ... (__hide__)
321 =cut
322
323 =for apidoc Gtk2::Widget::can_default
324 =for signature $widget->can_default ($boolean)
325 =for signature boolean = $widget->can_default
326 =for arg ... (__hide__)
327 =cut
328
329 =for apidoc Gtk2::Widget::has_default
330 =for signature $widget->has_default ($boolean)
331 =for signature boolean = $widget->has_default
332 =for arg ... (__hide__)
333 =cut
334
335 gboolean
336 toplevel (widget, ...)
337 GtkWidget * widget
338 ALIAS:
339 Gtk2::Widget::no_window = 1
340 Gtk2::Widget::realized = 2
341 Gtk2::Widget::mapped = 3
342 Gtk2::Widget::visible = 4
343 Gtk2::Widget::drawable = 5
344 Gtk2::Widget::sensitive = 6
345 Gtk2::Widget::parent_sensitive = 7
346 Gtk2::Widget::is_sensitive = 8
347 Gtk2::Widget::can_focus = 9
348 Gtk2::Widget::has_focus = 10
349 Gtk2::Widget::has_grab = 11
350 Gtk2::Widget::rc_style = 12
351 Gtk2::Widget::composite_child = 13
352 Gtk2::Widget::app_paintable = 14
353 Gtk2::Widget::receives_default = 15
354 Gtk2::Widget::double_buffered = 16
355 Gtk2::Widget::can_default = 17
356 Gtk2::Widget::has_default = 18
357 PREINIT:
358 gboolean value = FALSE;
359 GtkWidgetFlags flag = 0;
360 CODE:
361 if (items > 2) {
362 croak ("Usage: boolean = $widget->%s\n"
363 " $widget->%s (newvalue)\n"
364 " too many arguments",
365 GvNAME (CvGV (cv)), GvNAME (CvGV (cv)));
366 }
367
368 if ( items == 1 ) {
369 switch (ix) {
370 case 0: RETVAL = GTK_WIDGET_TOPLEVEL (widget); break;
371 case 1: RETVAL = GTK_WIDGET_NO_WINDOW (widget); break;
372 case 2: RETVAL = GTK_WIDGET_REALIZED (widget); break;
373 case 3: RETVAL = GTK_WIDGET_MAPPED (widget); break;
374 case 4: RETVAL = GTK_WIDGET_VISIBLE (widget); break;
375 case 5: RETVAL = GTK_WIDGET_DRAWABLE (widget); break;
376 case 6: RETVAL = GTK_WIDGET_SENSITIVE (widget); break;
377 case 7: RETVAL = GTK_WIDGET_PARENT_SENSITIVE (widget); break;
378 case 8: RETVAL = GTK_WIDGET_IS_SENSITIVE (widget); break;
379 case 9: RETVAL = GTK_WIDGET_CAN_FOCUS (widget); break;
380 case 10: RETVAL = GTK_WIDGET_HAS_FOCUS (widget); break;
381 case 11: RETVAL = GTK_WIDGET_HAS_GRAB (widget); break;
382 case 12: RETVAL = GTK_WIDGET_RC_STYLE (widget); break;
383 case 13: RETVAL = GTK_WIDGET_COMPOSITE_CHILD (widget); break;
384 case 14: RETVAL = GTK_WIDGET_APP_PAINTABLE (widget); break;
385 case 15: RETVAL = GTK_WIDGET_RECEIVES_DEFAULT (widget); break;
386 case 16: RETVAL = GTK_WIDGET_DOUBLE_BUFFERED (widget); break;
387 case 17: RETVAL = GTK_WIDGET_CAN_DEFAULT (widget); break;
388 case 18: RETVAL = GTK_WIDGET_HAS_DEFAULT (widget); break;
389 default:
390 RETVAL = FALSE;
391 g_assert_not_reached ();
392 }
393 } else {
394 value = (gboolean) SvIV(ST(1));
395 switch (ix) {
396 case 0: flag = GTK_TOPLEVEL ; break;
397 case 1: flag = GTK_NO_WINDOW ; break;
398 case 2: flag = GTK_REALIZED ; break;
399 case 3: flag = GTK_MAPPED ; break;
400 case 4: flag = GTK_VISIBLE ; break;
401 case 5: croak ("widget flag drawable is read only"); break;
402 case 6: flag = GTK_SENSITIVE ; break;
403 case 7: flag = GTK_PARENT_SENSITIVE ; break;
404 case 8: croak ("widget flag is_sensitive is read only"); break;
405 case 9: flag = GTK_CAN_FOCUS ; break;
406 case 10: flag = GTK_HAS_FOCUS ; break;
407 case 11: flag = GTK_HAS_GRAB ; break;
408 case 12: flag = GTK_RC_STYLE ; break;
409 case 13: flag = GTK_COMPOSITE_CHILD ; break;
410 case 14: flag = GTK_APP_PAINTABLE ; break;
411 case 15: flag = GTK_RECEIVES_DEFAULT ; break;
412 case 16: flag = GTK_DOUBLE_BUFFERED ; break;
413 case 17: flag = GTK_CAN_DEFAULT ; break;
414 case 18: flag = GTK_HAS_DEFAULT ; break;
415 default:
416 flag = FALSE;
417 g_assert_not_reached ();
418 }
419 if ( value ) {
420 GTK_WIDGET_SET_FLAGS(widget, flag);
421 } else {
422 GTK_WIDGET_UNSET_FLAGS(widget, flag);
423 }
424 RETVAL=value;
425 }
426
427 OUTPUT:
428 RETVAL
429
430 GtkWidgetFlags
431 flags (GtkWidget * widget)
432 ALIAS:
433 get_flags = 1
434 CODE:
435 PERL_UNUSED_VAR (ix);
436 RETVAL = GTK_WIDGET_FLAGS (widget);
437 OUTPUT:
438 RETVAL
439
440 #
441 #/* Macros for setting and clearing widget flags.
442 # */
443 ##define GTK_WIDGET_SET_FLAGS(wid,flag) G_STMT_START{ (GTK_WIDGET_FLAGS (wid) |= (flag)); }G_STMT_END
444 ##define GTK_WIDGET_UNSET_FLAGS(wid,flag) G_STMT_START{ (GTK_WIDGET_FLAGS (wid) &= ~(flag)); }G_STMT_END
445
446 void
447 set_flags (widget, flags)
448 GtkWidget * widget
449 GtkWidgetFlags flags
450 CODE:
451 GTK_WIDGET_SET_FLAGS (widget, flags);
452
453 void
454 unset_flags (widget, flags)
455 GtkWidget * widget
456 GtkWidgetFlags flags
457 CODE:
458 GTK_WIDGET_UNSET_FLAGS (widget, flags);
459
460 #/* A requisition is a desired amount of space which a
461 # * widget may request.
462 # */
463 #struct _GtkRequisition
464 #{
465 # gint width;
466 # gint height;
467 #};
468 #
469 #
470 #struct _GtkWidgetShapeInfo
471 #{
472 # gint16 offset_x;
473 # gint16 offset_y;
474 # GdkBitmap *shape_mask;
475 #};
476 #
477 #GtkWidget* gtk_widget_new (GtkType type,
478 # const gchar *first_property_name,
479 # ...);
480
481 ## should use g_object_ref and g_object_unref instead, so we do
482 #GtkWidget* gtk_widget_ref (GtkWidget *widget);
483 #void gtk_widget_unref (GtkWidget *widget);
484
485
486 #void gtk_widget_destroyed (GtkWidget *widget,
487 # GtkWidget **widget_pointer);
488
489 ##
490 ## by consolidating all of the various xsubs with the signature
491 ## void $widget->method(void)
492 ## into one aliased xsub, i managed to cut a couple of kilobytes from the
493 ## resultant stripped i686 object file.
494 ##
495 void
496 destroy (GtkWidget * widget)
497 ALIAS:
498 unparent = 1
499 show = 2
500 show_now = 3
501 hide = 4
502 show_all = 5
503 hide_all = 6
504 map = 7
505 unmap = 8
506 realize = 9
507 unrealize = 10
508 grab_focus = 11
509 grab_default = 12
510 reset_shapes = 13
511 queue_draw = 14
512 queue_resize = 15
513 freeze_child_notify = 16
514 thaw_child_notify = 17
515 CODE:
516 switch (ix) {
517 case 0: gtk_widget_destroy (widget); break;
518 case 1: gtk_widget_unparent (widget); break;
519 case 2: gtk_widget_show (widget); break;
520 case 3: gtk_widget_show_now (widget); break;
521 case 4: gtk_widget_hide (widget); break;
522 case 5: gtk_widget_show_all (widget); break;
523 case 6: gtk_widget_hide_all (widget); break;
524 case 7: gtk_widget_map (widget); break;
525 case 8: gtk_widget_unmap (widget); break;
526 case 9: gtk_widget_realize (widget); break;
527 case 10: gtk_widget_unrealize (widget); break;
528 case 11: gtk_widget_grab_focus (widget); break;
529 case 12: gtk_widget_grab_default (widget); break;
530 case 13: gtk_widget_reset_shapes (widget); break;
531 case 14: gtk_widget_queue_draw (widget); break;
532 case 15: gtk_widget_queue_resize (widget); break;
533 case 16: gtk_widget_freeze_child_notify (widget); break;
534 case 17: gtk_widget_thaw_child_notify (widget); break;
535 default:
536 g_assert_not_reached ();
537 }
538
539 void
540 gtk_widget_queue_draw_area (widget, x, y, width, height)
541 GtkWidget * widget
542 gint x
543 gint y
544 gint width
545 gint height
546
547
548 =for apidoc
549 This function is typically used when implementing a GtkContainer subclass.
550 Obtains the preferred size of a widget. The container uses this information to
551 arrange its child widgets and decide what size allocations to give them with
552 size_allocate ().
553
554 You can also call this function from an application, with some caveats. Most
555 notably, getting a size request requires the widget to be associated with a
556 screen, because font information may be needed. Multihead-aware applications
557 should keep this in mind.
558
559 Also remember that the size request is not necessarily the size a widget will
560 actually be allocated.
561
562 See also L<get_child_requisition ()|/"requisition = $widget-E<gt>B<get_child_requisition>">
563 =cut
564 GtkRequisition_copy *
565 gtk_widget_size_request (widget)
566 GtkWidget * widget
567 PREINIT:
568 GtkRequisition req;
569 CODE:
570 gtk_widget_size_request (widget, &req);
571 RETVAL = &req;
572 OUTPUT:
573 RETVAL
574
575
576 ##void gtk_widget_size_allocate (GtkWidget * widget, GtkAllocation * allocation);
577 void
578 gtk_widget_size_allocate (widget, allocation)
579 GtkWidget * widget
580 GdkRectangle * allocation
581
582 ## function is only useful for widget implementations
583 ##void gtk_widget_get_child_requisition (GtkWidget *widget, GtkRequisition *requisition);
584 =for apidoc
585 This function is only for use in widget implementations. Obtains
586 C<< $widget->requisition >>, unless someone has forced a particular geometry
587 on the widget (e.g., with C<set_usize()>, in which case it returns that
588 geometry instead of the widget's requisition.
589
590 This function differs from
591 L<size_request()|/"requisition = $widget-E<gt>B<size_request>">
592 in that it retrieves the last size request value from
593 C<< $widget->requisition >>,
594 while C<size_request()> actually calls the C<size_request> virtual method
595 (that is, emits the "size-request" signal) on the I<$widget> to compute
596 the size request and fill in C<< $widget->requisition >>, and only then
597 returns C<< $widget->requisition >>.
598
599 Because this function does not call the C<size_request> method, it can only
600 be used when you know that C<< $widget->requisition >> is up-to-date. In
601 general, only container implementations have this information; applications
602 should use C<size_request ()>.
603 =cut
604 GtkRequisition_copy*
605 gtk_widget_get_child_requisition (GtkWidget * widget)
606 PREINIT:
607 GtkRequisition req;
608 CODE:
609 gtk_widget_get_child_requisition (widget, &req);
610 RETVAL = &req;
611 OUTPUT:
612 RETVAL
613
614 void
615 gtk_widget_add_accelerator (widget, accel_signal, accel_group, accel_key, accel_mods, flags)
616 GtkWidget * widget
617 const gchar * accel_signal
618 GtkAccelGroup * accel_group
619 guint accel_key
620 GdkModifierType accel_mods
621 GtkAccelFlags flags
622
623 gboolean
624 gtk_widget_remove_accelerator (widget, accel_group, accel_key, accel_mods)
625 GtkWidget * widget
626 GtkAccelGroup * accel_group
627 guint accel_key
628 GdkModifierType accel_mods
629
630 void
631 gtk_widget_set_accel_path (widget, accel_path, accel_group)
632 GtkWidget * widget
633 const gchar_ornull * accel_path
634 GtkAccelGroup_ornull * accel_group
635
636 #GList* gtk_widget_list_accel_closures (GtkWidget *widget);
637
638 gboolean
639 gtk_widget_mnemonic_activate (widget, group_cycling)
640 GtkWidget * widget
641 gboolean group_cycling
642
643 # gtk docs say rarely used, suggest other ways
644 =for apidoc
645 This rarely-used function emits an event signal on I<$widget>. Don't use
646 this to synthesize events; use C<< Gtk2->main_do_event >> instead. Don't
647 synthesize expose events; use C<< $gdkwindow->invalidate_rect >> instead.
648 Basically, the main use for this in gtk2-perl will be to pass motion
649 notify events to rulers from other widgets.
650 =cut
651 gboolean gtk_widget_event (GtkWidget * widget, GdkEvent *event);
652
653 # gtk docs say rarely used, suggest other ways
654 #gint gtk_widget_send_expose (GtkWidget *widget,
655 # GdkEvent *event);
656
657 =for apidoc
658 This function works by emitting an action signal nominated by the various
659 widget subclasses. The signal is normally called C<activate>, but it
660 doesn't have to be.
661
662 Currently if you make a widget subclass in Perl there's no way to
663 nominate a signal to be emitted by C<< $widget->activate >>. A signal
664 merely named C<activate> is not automatically hooked up.
665 =cut
666 gboolean
667 gtk_widget_activate (widget)
668 GtkWidget * widget
669
670 =for apidoc
671 This function works by emitting a setter signal nominated by the
672 various widget types which have "native" scrolling. The signal is
673 normally called C<set-scroll-adjustments>, but it doesn't have to be.
674
675 If you make a widget subclass in Perl and create a signal in it called
676 C<set-scroll-adjustments> taking two Gtk2::Adjustment parameters then
677 the subclassing automatically hooks that up to be emitted by
678 C<< $widget->set_scroll_adjustments >>. (Your "class closure" default
679 handler code should then store the adjustment objects somewhere.)
680 =cut
681 gboolean
682 gtk_widget_set_scroll_adjustments (widget, hadjustment, vadjustment)
683 GtkWidget * widget
684 GtkAdjustment_ornull * hadjustment
685 GtkAdjustment_ornull * vadjustment
686
687 void
688 gtk_widget_reparent (widget, new_parent)
689 GtkWidget * widget
690 GtkWidget * new_parent
691
692 =for apidoc
693 Returns undef if I<$widget> and I<$area> do not intersect.
694 =cut
695 GdkRectangle_copy *
696 gtk_widget_intersect (widget, area)
697 GtkWidget * widget
698 GdkRectangle * area
699 PREINIT:
700 GdkRectangle intersection;
701 CODE:
702 if (!gtk_widget_intersect (widget, area, &intersection))
703 XSRETURN_UNDEF;
704 RETVAL = &intersection;
705 OUTPUT:
706 RETVAL
707
708 GdkRegion * gtk_widget_region_intersect (GtkWidget * widget, GdkRegion * region)
709
710 void gtk_widget_child_notify (GtkWidget *widget, const gchar *child_property);
711
712 gboolean gtk_widget_is_focus (GtkWidget *widget);
713
714 void
715 gtk_widget_set_name (widget, name)
716 GtkWidget *widget
717 const gchar *name
718
719 const gchar*
720 gtk_widget_get_name (widget)
721 GtkWidget *widget
722
723 # gtk doc says only used for widget implementations
724 void
725 gtk_widget_set_state (GtkWidget * widget, GtkStateType state);
726
727 void
728 gtk_widget_set_sensitive (widget, sensitive)
729 GtkWidget * widget
730 gboolean sensitive
731
732 void gtk_widget_set_app_paintable (GtkWidget *widget, gboolean app_paintable);
733
734 void gtk_widget_set_double_buffered (GtkWidget *widget, gboolean double_buffered);
735
736 void gtk_widget_set_redraw_on_allocate (GtkWidget *widget, gboolean redraw_on_allocate);
737
738 void
739 gtk_widget_set_parent (GtkWidget *widget, GtkWidget *parent);
740
741 void
742 gtk_widget_set_parent_window (GtkWidget *widget, GdkWindow *parent_window);
743
744 void
745 gtk_widget_set_child_visible (GtkWidget *widget, gboolean is_visible);
746
747 gboolean
748 gtk_widget_get_child_visible (GtkWidget *widget);
749
750
751 ## must allow NULL on return, in case somebody calls this on
752 ## an unparented widget
753
754 GtkWidget_ornull *
755 gtk_widget_get_parent (widget)
756 GtkWidget * widget
757 ALIAS:
758 Gtk2::Widget::parent = 1
759 CLEANUP:
760 PERL_UNUSED_VAR (ix);
761
762 GdkWindow *gtk_widget_get_parent_window (GtkWidget *widget);
763
764 gboolean gtk_widget_child_focus (GtkWidget *widget, GtkDirectionType direction);
765
766 void
767 gtk_widget_set_size_request (widget, width=-1, height=-1)
768 GtkWidget * widget
769 gint width
770 gint height
771
772 =for apidoc
773 =for signature (width, height) = $widget->get_size_request
774
775 Gets the size request that was explicitly set for the widget using
776 C<set_size_request()>. A value of -1 for I<width> or I<height> indicates
777 that the dimension has not been explicitly set and the natural requisition
778 of the widget will be used instead.
779 See L<set_size_request()|/"$widget-E<gt>B<set_size_request> ($width=-1, $height=-1)">.
780 To get the size a widget will actually use, call
781 L<size_request()|/"requisition = $widget-E<gt>B<size_request>"> instead of
782 this function.
783 =cut
784 void
785 gtk_widget_get_size_request (widget)
786 GtkWidget * widget
787 PREINIT:
788 gint width, height;
789 PPCODE:
790 gtk_widget_get_size_request (widget, &width, &height);
791 XPUSHs (sv_2mortal (newSViv (width)));
792 XPUSHs (sv_2mortal (newSViv (height)));
793
794 void
795 gtk_widget_set_events (widget, events)
796 GtkWidget *widget
797 GdkEventMask events
798 ### gint events
799
800 void
801 gtk_widget_add_events (widget, events)
802 GtkWidget *widget
803 GdkEventMask events
804
805 void
806 gtk_widget_set_extension_events (widget, mode)
807 GtkWidget *widget
808 GdkExtensionMode mode
809
810 GdkExtensionMode
811 gtk_widget_get_extension_events (widget)
812 GtkWidget *widget
813
814 GtkWidget *
815 gtk_widget_get_toplevel (widget)
816 GtkWidget * widget
817
818 # useful for grabbing the box which contains you
819 #GtkWidget* gtk_widget_get_ancestor (GtkWidget *widget, GtkType widget_type);
820 GtkWidget_ornull*
821 gtk_widget_get_ancestor (widget, ancestor_package)
822 GtkWidget *widget
823 const char * ancestor_package
824 PREINIT:
825 GtkType widget_type;
826 CODE:
827 widget_type = gperl_object_type_from_package (ancestor_package);
828 if (!widget_type)
829 croak ("package %s is not registered to a GType",
830 ancestor_package);
831 RETVAL = gtk_widget_get_ancestor (widget, widget_type);
832 OUTPUT:
833 RETVAL
834
835 GdkColormap*
836 gtk_widget_get_colormap (widget)
837 GtkWidget * widget
838
839 GdkVisual * gtk_widget_get_visual (GtkWidget * widget);
840
841 GtkSettings * gtk_widget_get_settings (GtkWidget * widget);
842
843 #/* Accessibility support */
844 AtkObject * gtk_widget_get_accessible (GtkWidget * widget);
845
846 #/* The following functions must not be called on an already
847 # * realized widget. Because it is possible that somebody
848 # * can call get_colormap() or get_visual() and save the
849 # * result, these functions are probably only safe to
850 # * call in a widget's init() function.
851 # */
852 void gtk_widget_set_colormap (GtkWidget * widget, GdkColormap * colormap);
853
854 #gint gtk_widget_get_events (GtkWidget *widget);
855 GdkEventMask
856 gtk_widget_get_events (widget)
857 GtkWidget *widget
858
859 #void gtk_widget_get_pointer (GtkWidget *widget, gint *x, gint *y);
860 void
861 gtk_widget_get_pointer (GtkWidget *widget, OUTLIST gint x, OUTLIST gint y);
862
863 gboolean gtk_widget_is_ancestor (GtkWidget *widget, GtkWidget *ancestor);
864
865 #gboolean gtk_widget_translate_coordinates (GtkWidget *src_widget, GtkWidget *dest_widget, gint src_x, gint src_y, gint *dest_x, gint *dest_y);
866 =for apidoc
867 =for signature (dst_x, dst_y) = $src_widget->translate_coordinates ($dest_widget, $src_x, $src_y)
868 Returns an empty list if either widget is not realized or if they do not share
869 a common ancestor.
870 =cut
871 void
872 gtk_widget_translate_coordinates (GtkWidget *src_widget, GtkWidget *dest_widget, gint src_x, gint src_y)
873 PREINIT:
874 gint dest_x, dest_y;
875 PPCODE:
876 if (!gtk_widget_translate_coordinates (src_widget, dest_widget,
877 src_x, src_y, &dest_x, &dest_y))
878 XSRETURN_EMPTY;
879 EXTEND (SP, 2);
880 PUSHs (sv_2mortal (newSViv (dest_x)));
881 PUSHs (sv_2mortal (newSViv (dest_y)));
882
883 =for apidoc __function__
884
885 This is a helper function intended to be used as the callback for the
886 C<delete-event> signal:
887
888 $wiget->signal_connect (
889 delete_event => \&Gtk2::Widget::hide_on_delete);
890
891 =for arg ... other arguments ignored (event etc)
892 =cut
893 gboolean gtk_widget_hide_on_delete (GtkWidget *widget, ...);
894
895 #/* Widget styles.
896 # */
897
898 void gtk_widget_set_style (GtkWidget *widget, GtkStyle_ornull *style);
899
900 void gtk_widget_ensure_style (GtkWidget *widget);
901
902 void gtk_widget_modify_style (GtkWidget *widget, GtkRcStyle *style);
903
904 GtkRcStyle * gtk_widget_get_modifier_style (GtkWidget * widget);
905
906 void gtk_widget_modify_fg (GtkWidget * widget, GtkStateType state, GdkColor_ornull * color);
907
908 void gtk_widget_modify_bg (GtkWidget * widget, GtkStateType state, GdkColor_ornull * color);
909
910 void gtk_widget_modify_text (GtkWidget * widget, GtkStateType state, GdkColor_ornull * color);
911
912 void gtk_widget_modify_base (GtkWidget * widget, GtkStateType state, GdkColor_ornull * color);
913
914 void gtk_widget_modify_font (GtkWidget *widget, PangoFontDescription_ornull *font_desc)
915
916
917 #PangoContext *gtk_widget_create_pango_context (GtkWidget *widget);
918 PangoContext_noinc *
919 gtk_widget_create_pango_context (GtkWidget *widget)
920
921 #PangoContext *gtk_widget_get_pango_context (GtkWidget *widget);
922 PangoContext *
923 gtk_widget_get_pango_context (GtkWidget *widget)
924
925 PangoLayout_noinc *
926 gtk_widget_create_pango_layout (widget, text=NULL)
927 GtkWidget * widget
928 const gchar_ornull *text
929
930 ### may return NULL if stockid isn't known.... but then, it will
931 ### croak on converting unknown stock ids, too.
932 GdkPixbuf_noinc *
933 gtk_widget_render_icon (widget, stock_id, size, detail=NULL)
934 GtkWidget * widget
935 const gchar * stock_id
936 GtkIconSize size
937 const gchar * detail
938
939 #/* handle composite names for GTK_COMPOSITE_CHILD widgets,
940 # * the returned name is newly allocated.
941 # */
942
943 void gtk_widget_set_composite_name (GtkWidget *widget, const gchar *name)
944
945 gchar_ornull* gtk_widget_get_composite_name (GtkWidget *widget)
946
947 #/* Descend recursively and set rc-style on all widgets without user styles */
948 void gtk_widget_reset_rc_styles (GtkWidget *widget)
949
950 =for apidoc
951 =for signature Gtk2::Widget->push_colormap (cmap)
952 =for signature $widget->push_colormap (cmap)
953 =cut
954 void gtk_widget_push_colormap (class_or_widget, GdkColormap *cmap)
955 C_ARGS: cmap
956
957 =for apidoc
958 =for signature Gtk2::Widget->pop_colormap (cmap)
959 =for signature $widget->pop_colormap (cmap)
960 =cut
961 void gtk_widget_pop_colormap (class_or_widget)
962 C_ARGS: /* void */
963
964 =for apidoc
965 =for signature Gtk2::Widget->push_composite_child
966 =for signature $widget->push_composite_child
967 =cut
968 void gtk_widget_push_composite_child (class_or_widget=NULL)
969 C_ARGS: /* void */
970
971 =for apidoc
972 =for signature Gtk2::Widget->pop_composite_child
973 =for signature $widget->pop_composite_child
974 =cut
975 void gtk_widget_pop_composite_child (class_or_widget=NULL)
976 C_ARGS: /* void */
977
978 # bunch of FIXMEs: widget class style properties
979 #
980 #void gtk_widget_class_install_style_property (GtkWidgetClass *klass,
981 # GParamSpec *pspec);
982 #void gtk_widget_class_install_style_property_parser (GtkWidgetClass *klass,
983 # GParamSpec *pspec,
984 # GtkRcPropertyParser parser);
985
986 ### gtk_widget_class_find_style_property isn't available until 2.2.0, so we
987 ### can't implement gtk_widget_style_get and friends until 2.2.0, because
988 ### we have to be able to query the property's pspec to know what type of
989 ### GValue to send it.
990
991 #if GTK_CHECK_VERSION(2,2,0)
992
993 #void gtk_widget_style_get_property (GtkWidget *widget, const gchar *property_name, GValue *value);
994 #void gtk_widget_style_get_valist (GtkWidget *widget, const gchar *first_property_name, va_list var_args);
995 #void gtk_widget_style_get (GtkWidget *widget, const gchar *first_property_name, ...);
996
997 =for apidoc style_get_property
998 =for arg first_property_name (string)
999 =for arg ... 0 or more additional property names
1000 An alias for style_get.
1001 =cut
1002 =for apidoc
1003 =for arg first_property_name (string)
1004 =for arg ... 0 or more additional property names
1005 Returns the values of the requested style properties.
1006 =cut
1007 void
1008 style_get (GtkWidget * widget, first_property_name, ...)
1009 ALIAS:
1010 style_get_property = 1
1011 PREINIT:
1012 int i;
1013 PPCODE:
1014 PERL_UNUSED_VAR (ix);
1015 EXTEND (SP, items - 1);
1016 for (i = 1 ; i < items ; i++) {
1017 GValue value = {0, };
1018 gchar * name = SvGChar (ST (i));
1019 GParamSpec * pspec;
1020 pspec = gtk_widget_class_find_style_property
1021 (GTK_WIDGET_GET_CLASS (widget), name);
1022 if (pspec) {
1023 g_value_init (&value, G_PARAM_SPEC_VALUE_TYPE (pspec));
1024 gtk_widget_style_get_property (widget, name, &value);
1025 PUSHs (sv_2mortal (gperl_sv_from_value (&value)));
1026 g_value_unset (&value);
1027 } else {
1028 warn ("Invalid property `%s' used", name);
1029 }
1030 }
1031
1032 #endif
1033
1034
1035 #/* Set certain default values to be used at widget creation time.
1036 # */
1037
1038 =for apidoc
1039 =for signature Gtk2::Widget->set_default_colormap ($colormap)
1040 =for signature $widget->set_default_colormap ($colormap)
1041 =cut
1042 void gtk_widget_set_default_colormap (class_or_widget, GdkColormap *colormap);
1043 C_ARGS: colormap
1044
1045 =for apidoc
1046 =for signature style = Gtk2::Widget->get_default_style
1047 =for signature style = $widget->get_default_style
1048 =cut
1049 GtkStyle*
1050 gtk_widget_get_default_style (class_or_widget)
1051 C_ARGS: /* void */
1052
1053 =for apidoc
1054 =for signature colormap = Gtk2::Widget->get_default_colormap
1055 =for signature colormap = $widget->get_default_colormap
1056 =cut
1057 GdkColormap* gtk_widget_get_default_colormap (class_or_widget)
1058 C_ARGS: /* void */
1059
1060 =for apidoc
1061 =for signature visual = Gtk2::Widget->get_default_visual
1062 =for signature visual = $widget->get_default_visual
1063 =cut
1064 GdkVisual* gtk_widget_get_default_visual (class_or_widget)
1065 C_ARGS: /* void */
1066
1067 #
1068 #/* Functions for setting directionality for widgets
1069 # */
1070
1071 void
1072 gtk_widget_set_direction (GtkWidget *widget, GtkTextDirection dir);
1073
1074 GtkTextDirection
1075 gtk_widget_get_direction (GtkWidget *widget);
1076
1077 void
1078 gtk_widget_set_default_direction (class, dir);
1079 GtkTextDirection dir
1080 C_ARGS:
1081 dir
1082
1083 GtkTextDirection
1084 gtk_widget_get_default_direction (class);
1085 C_ARGS:
1086 /* void */
1087
1088 #/* Counterpart to gdk_window_shape_combine_mask.
1089 # */
1090 void gtk_widget_shape_combine_mask (GtkWidget *widget, GdkBitmap_ornull *shape_mask, gint offset_x, gint offset_y);
1091
1092
1093
1094
1095 # void gtk_widget_path (GtkWidget *widget, guint *path_length, gchar **path, gchar **path_reversed);
1096 # void gtk_widget_class_path (GtkWidget *widget, guint *path_length, gchar **path, gchar **path_reversed);
1097 ## both changed to ($path, $path_reversed) = $widget->(path|class_path);
1098 ## returns the path_reversed straight from C, no matter how nonsensical...
1099 =for apidoc Gtk2::Widget::path
1100 =for signature (path, path_reversed) = $widget->path
1101 =cut
1102
1103 =for apidoc class_path
1104 =for signature (path, path_reversed) = $widget->class_path
1105 =cut
1106
1107 void
1108 gtk_widget_path (GtkWidget *widget)
1109 ALIAS:
1110 class_path = 1
1111 PREINIT:
1112 gchar *path = NULL, *path_reversed = NULL;
1113 PPCODE:
1114 if (ix == 1)
1115 gtk_widget_class_path (widget, NULL, &path, &path_reversed);
1116 else
1117 gtk_widget_path (widget, NULL, &path, &path_reversed);
1118 EXTEND (SP, 2);
1119 PUSHs (sv_2mortal (newSVGChar (path)));
1120 PUSHs (sv_2mortal (newSVGChar (path_reversed)));
1121 g_free (path);
1122 g_free (path_reversed);
1123
1124
1125 # boxed support, bindings not needed
1126 #GtkRequisition *gtk_requisition_copy (const GtkRequisition *requisition);
1127 #void gtk_requisition_free (GtkRequisition *requisition);
1128
1129 # private, will not be bound
1130 #GdkColormap* _gtk_widget_peek_colormap (void);
1131
1132
1133
1134
1135 #if GTK_CHECK_VERSION(2,2,0)
1136
1137 # GtkWidgetClass not in typemap, should use type_from_package and
1138 # then look up the class
1139 ##GParamSpec* gtk_widget_class_find_style_property (GtkWidgetClass *klass, const gchar *property_name)
1140 #GParamSpec *
1141 #gtk_widget_class_find_style_property (klass, property_name)
1142 # GtkWidgetClass * klass
1143 # const gchar * property_name
1144 #
1145 # GtkWidgetClass not in typemap
1146 ##GParamSpec** gtk_widget_class_list_style_properties (GtkWidgetClass *klass, guint *n_properties)
1147 #GParamSpec **
1148 #gtk_widget_class_list_style_properties (klass, n_properties)
1149 # GtkWidgetClass * klass
1150 # guint * n_properties
1151
1152 =for apidoc Gtk2::Widget::list_style_properties
1153 =for signature list = $widget_or_class_name->list_style_properties
1154 =for arg ... (__hide__)
1155 Return a list of C<Glib::ParamSpec> objects which are the style
1156 properties available on C<$widget_or_class_name>. See L<Glib::Object>
1157 C<list_properties> for the fields in a ParamSpec.
1158 =cut
1159 =for apidoc Gtk2::Widget::find_style_property
1160 =for signature pspec or undef = $widget_or_class_name->find_style_property ($name)
1161 =for arg name (string)
1162 =for arg ... (__hide__)
1163 Return a C<Glib::ParamSpec> for style property C<$name> on widget
1164 C<$widget_or_class_name>. If there's no property C<$name> then return
1165 C<undef>. See L<Glib::Object> C<list_properties> for the fields in a
1166 ParamSpec.
1167 =cut
1168 void
1169 find_style_property (widget_or_class_name, ...)
1170 SV * widget_or_class_name
1171 ALIAS:
1172 Gtk2::Widget::list_style_properties = 1
1173 PREINIT:
1174 GType type;
1175 gchar *name = NULL;
1176 GtkWidgetClass *widget_class;
1177 PPCODE:
1178 /* ENHANCE-ME: share this SV to GType lookup code with
1179 Glib::Object::find_property and Gtk2::Container::find_child_property
1180 and probably other places. Might pass GTK_TYPE_WIDGET to say it
1181 should be a widget. */
1182 if (gperl_sv_is_defined (widget_or_class_name) &&
1183 SvROK (widget_or_class_name)) {
1184 GtkWidget * widget = SvGtkWidget (widget_or_class_name);
1185 if (!widget)
1186 croak ("wha? NULL widget in list_style_properties");
1187 type = G_OBJECT_TYPE (widget);
1188 } else {
1189 type = gperl_object_type_from_package
1190 (SvPV_nolen (widget_or_class_name));
1191 if (!type)
1192 croak ("package %s is not registered with GPerl",
1193 SvPV_nolen (widget_or_class_name));
1194 }
1195
1196 switch (ix) {
1197 case 0:
1198 if (items != 2)
1199 croak ("Usage: Gtk2::Widget::find_style_property (class, name)");
1200 name = SvGChar (ST (1));
1201 break;
1202 default: /* ix==1 */
1203 if (items != 1)
1204 croak ("Usage: Gtk2::Widget::list_style_properties (class)");
1205 break;
1206 }
1207 if (! g_type_is_a (type, GTK_TYPE_WIDGET))
1208 croak ("Not a Gtk2::Widget");
1209
1210 /* classes registered by perl are kept alive by the bindings.
1211 * those coming straight from C are not. if we had an actual
1212 * widget, the class will be alive, but if we just had a
1213 * package, the class may not exist yet. thus, we'll have to
1214 * do an honest ref here, rather than a peek.
1215 */
1216 widget_class = g_type_class_ref (type);
1217
1218 if (ix == 0) {
1219 GParamSpec *pspec
1220 = gtk_widget_class_find_style_property
1221 (widget_class, name);
1222 XPUSHs (pspec
1223 ? sv_2mortal (newSVGParamSpec (pspec))
1224 : &PL_sv_undef);
1225 }
1226 else if (ix == 1) {
1227 GParamSpec **props;
1228 guint n_props, i;
1229 props = gtk_widget_class_list_style_properties
1230 (widget_class, &n_props);
1231 if (n_props) {
1232 EXTEND (SP, n_props);
1233 for (i = 0; i < n_props; i++)
1234 PUSHs (sv_2mortal (newSVGParamSpec (props[i])));
1235 }
1236 g_free (props); /* must free even when n_props==0 */
1237 }
1238
1239 g_type_class_unref (widget_class);
1240
1241
1242 #GtkClipboard* gtk_widget_get_clipboard (GtkWidget *widget, GdkAtom selection)
1243 GtkClipboard *
1244 gtk_widget_get_clipboard (widget, selection=GDK_SELECTION_CLIPBOARD)
1245 GtkWidget * widget
1246 GdkAtom selection
1247
1248
1249 GdkDisplay * gtk_widget_get_display (GtkWidget * widget)
1250
1251 GdkWindow * gtk_widget_get_root_window (GtkWidget * widget)
1252
1253 GdkScreen * gtk_widget_get_screen (GtkWidget * widget)
1254
1255 gboolean gtk_widget_has_screen (GtkWidget * widget);
1256
1257 #endif
1258
1259
1260 #if GTK_CHECK_VERSION(2,4,0)
1261
1262 void gtk_widget_set_no_show_all (GtkWidget *widget, gboolean no_show_all);
1263
1264 gboolean gtk_widget_get_no_show_all (GtkWidget *widget);
1265
1266 void gtk_widget_queue_resize_no_redraw (GtkWidget *widget);
1267
1268 gboolean
1269 gtk_widget_can_activate_accel (widget, signal_id)
1270 GtkWidget *widget
1271 guint signal_id
1272
1273 void
1274 gtk_widget_list_mnemonic_labels (widget)
1275 GtkWidget *widget
1276 PREINIT:
1277 GList *i, *list = NULL;
1278 PPCODE:
1279 list = gtk_widget_list_mnemonic_labels (widget);
1280 for (i = list; i != NULL; i = i->next)
1281 XPUSHs (sv_2mortal (newSVGtkWidget (i->data)));
1282 g_list_free (list);
1283
1284 void gtk_widget_add_mnemonic_label (GtkWidget *widget, GtkWidget *label);
1285
1286 void gtk_widget_remove_mnemonic_label (GtkWidget *widget, GtkWidget *label);
1287
1288 #endif
1289
1290 #if GTK_CHECK_VERSION(2, 10, 0)
1291
1292 void gtk_widget_input_shape_combine_mask (GtkWidget *widget, GdkBitmap_ornull *shape_mask, gint offset_x, gint offset_y);
1293
1294 gboolean gtk_widget_is_composited (GtkWidget *widget);
1295
1296 #endif /* 2.10 */
1297
1298 #if GTK_CHECK_VERSION(2, 12, 0)
1299
1300 gboolean gtk_widget_keynav_failed (GtkWidget *widget, GtkDirectionType direction);
1301
1302 void gtk_widget_error_bell (GtkWidget *widget);
1303
1304 void gtk_widget_set_tooltip_window (GtkWidget *widget, GtkWindow_ornull *custom_window);
1305
1306 GtkWindow_ornull *gtk_widget_get_tooltip_window (GtkWidget *widget);
1307
1308 void gtk_widget_trigger_tooltip_query (GtkWidget *widget);
1309
1310 void gtk_widget_set_tooltip_text (GtkWidget *widget, const gchar_ornull *text);
1311
1312 gchar_own * gtk_widget_get_tooltip_text (GtkWidget *widget);
1313
1314 void gtk_widget_set_tooltip_markup (GtkWidget *widget, const gchar_ornull *markup);
1315
1316 gchar_own * gtk_widget_get_tooltip_markup (GtkWidget *widget);
1317
1318 void gtk_widget_modify_cursor (GtkWidget *widget, const GdkColor_ornull *primary, const GdkColor_ornull *secondary);
1319
1320 void gtk_widget_set_has_tooltip (GtkWidget *widget, gboolean has_tooltip);
1321
1322 gboolean gtk_widget_get_has_tooltip (GtkWidget *widget);
1323
1324 #endif
1325
1326 #if GTK_CHECK_VERSION (2, 14, 0)
1327
1328 GdkPixmap_noinc_ornull * gtk_widget_get_snapshot (GtkWidget *widget, GdkRectangle_ornull *clip_rect=NULL);
1329
1330 GdkWindow_ornull * gtk_widget_get_window (GtkWidget *widget);
1331
1332 #endif /* 2.14 */
1333
1334 #if GTK_CHECK_VERSION (2, 18, 0)
1335
1336 void gtk_widget_set_allocation (GtkWidget *widget, const GdkRectangle *allocation);
1337
1338 GdkRectangle_copy * gtk_widget_get_allocation (GtkWidget *widget)
1339 PREINIT:
1340 GdkRectangle allocation;
1341 CODE:
1342 gtk_widget_get_allocation (widget, &allocation);
1343 RETVAL = &allocation;
1344 OUTPUT:
1345 RETVAL
1346
1347 gboolean gtk_widget_get_app_paintable (GtkWidget *widget);
1348
1349 gboolean gtk_widget_get_can_default (GtkWidget *widget);
1350
1351 void gtk_widget_set_can_default (GtkWidget *widget, gboolean can_default);
1352
1353 gboolean gtk_widget_get_can_focus (GtkWidget *widget);
1354
1355 void gtk_widget_set_can_focus (GtkWidget *widget, gboolean can_focus);
1356
1357 gboolean gtk_widget_get_double_buffered (GtkWidget *widget);
1358
1359 void gtk_widget_set_has_window (GtkWidget *widget, gboolean has_window);
1360
1361 gboolean gtk_widget_get_has_window (GtkWidget *widget);
1362
1363 void gtk_widget_set_receives_default (GtkWidget *widget, gboolean receives_default);
1364
1365 gboolean gtk_widget_get_receives_default (GtkWidget *widget);
1366
1367 gboolean gtk_widget_get_sensitive (GtkWidget *widget);
1368
1369 GtkStateType gtk_widget_get_state (GtkWidget *widget);
1370
1371 gboolean gtk_widget_get_visible (GtkWidget *widget);
1372
1373 void gtk_widget_set_visible (GtkWidget *widget, gboolean visible);
1374
1375 # These conflict with our custom accessors and don't provide new
1376 # functionality. So just skip them for now.
1377 #gboolean gtk_widget_has_default (GtkWidget *widget);
1378 #gboolean gtk_widget_has_focus (GtkWidget *widget);
1379 #gboolean gtk_widget_has_grab (GtkWidget *widget);
1380
1381 gboolean gtk_widget_is_drawable (GtkWidget *widget);
1382
1383 # Already implemented above with GTK_WIDGET_IS_SENSITIVE.
1384 # gboolean gtk_widget_is_sensitive (GtkWidget *widget);
1385
1386 gboolean gtk_widget_is_toplevel (GtkWidget *widget);
1387
1388 void gtk_widget_set_window (GtkWidget *widget, GdkWindow *window);
1389
1390 #endif /* 2.18 */
1391
1392 #if GTK_CHECK_VERSION (2, 20, 0)
1393
1394 void gtk_widget_set_realized (GtkWidget *widget, gboolean realized);
1395
1396 gboolean gtk_widget_get_realized (GtkWidget *widget);
1397
1398 void gtk_widget_set_mapped (GtkWidget *widget, gboolean mapped);
1399
1400 gboolean gtk_widget_get_mapped (GtkWidget *widget);
1401
1402 # void gtk_widget_get_requisition (GtkWidget *widget, GtkRequisition *requisition)
1403 GtkRequisition_copy *
1404 gtk_widget_get_requisition (GtkWidget *widget)
1405 PREINIT:
1406 GtkRequisition requisition;
1407 CODE:
1408 gtk_widget_get_requisition (widget, &requisition);
1409 RETVAL = &requisition;
1410 OUTPUT:
1411 RETVAL
1412
1413 gboolean gtk_widget_has_rc_style (GtkWidget *widget);
1414
1415 void gtk_widget_style_attach (GtkWidget *style);
1416
1417 #endif /* 2.20 */
1418
1419 #if GTK_CHECK_VERSION (2, 22, 0)
1420
1421 gboolean gtk_widget_send_focus_change (GtkWidget *widget, GdkEvent *event);
1422
1423 #endif /* 2.22 */
1424