Gtk2::Widget(3)
π NAME π
ok so bestie, Gtk2::Widget is literally just the Perl wrapper for GtkWidget. that's the whole vibe. the humble little building block everything in GTK+ is made of. iconic behavior honestly. π
π HIERARCHY π
the family tree, so you know where she comes from:
Glib::Object
+----Glib::InitiallyUnowned
+----Gtk2::Object
+----Gtk2::Widget
π¦ INTERFACES π¦
she also does these, like a queen with multiple side quests:
Glib::Object::_Unregistered::AtkImplementorIface
Gtk2::Buildable
β¨ CONSTANTS β¨
ok so EVENT_STOP and EVENT_PROPAGATE?? these are for when you're returning from widget event signal handlers and stuff like that. EVENT_STOP is true = stop, EVENT_PROPAGATE is false = propagate. the whole point of these names is so you don't have to play the "wait which one is true again π" game. and if you wanna remember it another way: think of the return value as meaning "handled" β that's the jargon some other signal handler types use. iykyk π
Gtk2::EVENT_STOP # true
Gtk2::EVENT_PROPAGATE # false
πΈ METHODS πΈ
$widget->set_accel_path ($accel_path, $accel_group)
$accel_path</p> (string or undef)$accel_group</p> (Gtk2::AccelGroup or undef)
object = $widget->get_accessible
action or undef = $widget->get_action
Since: gtk+ 2.10
boolean = $widget->activate
so this one works by emitting an action signal that the various widget subclasses nominate. normally that signal is called activate, but like... it doesn't have to be. no cap.
heads up: right now if you make a widget subclass in Perl, there's genuinely no way to nominate a signal for $widget->activate to emit. a signal that's just named activate does not get automatically hooked up. sorry bestie π
$widget->add_accelerator ($accel_signal, $accel_group, $accel_key, $accel_mods, $flags)
$accel_signal</p> (string)$accel_group</p> (Gtk2::AccelGroup)$accel_key</p> (integer)$accel_mods</p> (Gtk2::Gdk::ModifierType)$flags</p> (Gtk2::AccelFlags)
$widget->add_events ($events)
$events</p> (Gtk2::Gdk::EventMask)
$widget->add_mnemonic_label ($label)
$label</p> (Gtk2::Widget)
Since: gtk+ 2.4
rectangle = $widget->allocation
gives you back the current allocated size and position of $widget inside its parent widget. and like, the allocated size is not necessarily the same as the requested size, ok, they're different things.
β οΈ the returned rect object points into$widget, so it's only usable for as long as$widgetexists. she's a loan, not a gift π
rectangle = $widget->get_allocation
Since: gtk+ 2.18
$widget->set_allocation ($allocation)
$allocation</p> (Gtk2::Gdk::Rectangle)
Since: gtk+ 2.18
widget or undef = $widget->get_ancestor ($ancestor_package)
$ancestor_package</p> (string)
$widget->app_paintable ($boolean)
boolean = $widget->app_paintable
boolean = $widget->get_app_paintable
Since: gtk+ 2.18
$widget->set_app_paintable ($app_paintable)
$app_paintable</p> (boolean)
boolean = $widget->can_activate_accel ($signal_id)
$signal_id</p> (integer)
Since: gtk+ 2.4
$widget->can_default ($boolean)
boolean = $widget->can_default
boolean = $widget->get_can_default
Since: gtk+ 2.18
$widget->set_can_default ($can_default)
$can_default</p> (boolean)
Since: gtk+ 2.18
$widget->can_focus ($boolean)
boolean = $widget->can_focus
boolean = $widget->get_can_focus
Since: gtk+ 2.18
$widget->set_can_focus ($can_focus)
$can_focus</p> (boolean)
Since: gtk+ 2.18
boolean = $widget->child_focus ($direction)
$direction</p> (Gtk2::DirectionType)
$widget->child_notify ($child_property)
$child_property</p> (string)
requisition = $widget->get_child_requisition
ok this one is strictly for widget implementations, like behind-the-scenes only, not for the general public bestie. it obtains $widget->requisition... unless somebody has forced a particular geometry onto the widget (for example with set_usize(), in which case it returns that geometry instead of the widget's requisition.
this function differs from size_request() in that it retrieves the last size request value from $widget->requisition, while size_request() actually calls the size_request virtual method (that is, it emits the size-request signal) on the $widget to compute the size request and fill in $widget->requisition, and only then returns $widget->requisition.
and because this function does not call the size_request method, it can only be used when you know that $widget->requisition is up-to-date. in general, only container implementations have this information; applications should use size_request ().
boolean = $widget->get_child_visible
$widget->set_child_visible ($is_visible)
$is_visible</p> (boolean)
(path, path_reversed) = $widget->class_path
clipboard = $widget->get_clipboard ($selection=GDK_SELECTION_CLIPBOARD)
$selection</p> (Gtk2::Gdk::Atom)
Since: gtk+ 2.2
colormap = $widget->get_colormap
$widget->set_colormap ($colormap)
$colormap</p> (Gtk2::Gdk::Colormap)
$widget->composite_child ($boolean)
boolean = $widget->composite_child
string or undef = $widget->get_composite_name
$widget->set_composite_name ($name)
$name</p> (string)
context = $widget->create_pango_context
layout = $widget->create_pango_layout ($text=undef)
$text</p> (string or undef)
colormap = Gtk2::Widget->get_default_colormap
colormap = $widget->get_default_colormap
Gtk2::Widget->set_default_colormap ($colormap)
$widget->set_default_colormap ($colormap)
$colormap</p> (Gtk2::Gdk::Colormap)
textdirection = Gtk2::Widget->get_default_direction
Gtk2::Widget->set_default_direction ($dir)
$dir</p> (Gtk2::TextDirection)
style = Gtk2::Widget->get_default_style
style = $widget->get_default_style
visual = Gtk2::Widget->get_default_visual
visual = $widget->get_default_visual
$widget->destroy
textdirection = $widget->get_direction
$widget->set_direction ($dir)
$dir</p> (Gtk2::TextDirection)
display = $widget->get_display
Since: gtk+ 2.2
$widget->double_buffered ($boolean)
boolean = $widget->double_buffered
boolean = $widget->get_double_buffered
Since: gtk+ 2.18
$widget->set_double_buffered ($double_buffered)
$double_buffered</p> (boolean)
dragcontext = $widget->drag_begin ($targets, $actions, $button, $event)
$targets</p> (Gtk2::TargetList)$actions</p> (Gtk2::Gdk::DragAction)$button</p> (integer)$event</p> (Gtk2::Gdk::Event)
boolean = $widget->drag_check_threshold ($start_x, $start_y, $current_x, $current_y)
$start_x</p> (integer)$start_y</p> (integer)$current_x</p> (integer)$current_y</p> (integer)
$widget->drag_dest_add_image_targets
Since: gtk+ 2.6
$widget->drag_dest_add_text_targets
Since: gtk+ 2.6
$widget->drag_dest_add_uri_targets
Since: gtk+ 2.6
atom = $widget->drag_dest_find_target ($context, $target_list)
$context</p> (Gtk2::Gdk::DragContext)$target_list</p> (Gtk2::TargetList or undef)
targetlist or undef = $widget->drag_dest_get_target_list
boolean = $widget->drag_dest_get_track_motion
Since: gtk+ 2.10
$widget->drag_dest_set ($flags, $actions, ...)
$flags</p> (Gtk2::DestDefaults)$actions</p> (Gtk2::Gdk::DragAction)...</p> (list) of Gtk2::TargetEntry's
$widget->drag_dest_set_proxy ($proxy_window, $protocol, $use_coordinates)
$proxy_window</p> (Gtk2::Gdk::Window)$protocol</p> (Gtk2::Gdk::DragProtocol)$use_coordinates</p> (boolean)
$widget->drag_dest_set_target_list ($target_list)
$target_list</p> (Gtk2::TargetList or undef)
$widget->drag_dest_set_track_motion ($track_motion)
$track_motion</p> (boolean)
Since: gtk+ 2.10
$widget->drag_dest_unset
$widget->drag_get_data ($context, $target, $time_)
$context</p> (Gtk2::Gdk::DragContext)$target</p> (Gtk2::Gdk::Atom)$time_</p> (unsigned)
$widget->drag_highlight
$widget->drag_source_add_image_targets
Since: gtk+ 2.6
$widget->drag_source_add_text_targets
Since: gtk+ 2.6
$widget->drag_source_add_uri_targets
Since: gtk+ 2.6
targetlist or undef = $widget->drag_source_get_target_list
Since: gtk+ 2.4
$widget->drag_source_set ($start_button_mask, $actions, ...)
$start_button_mask</p> (Gtk2::Gdk::ModifierType)$actions</p> (Gtk2::Gdk::DragAction)...</p> (list) of Gtk2::TargetEntry's
$widget->drag_source_set_icon ($colormap, $pixmap, $mask)
$colormap</p> (Gtk2::Gdk::Colormap or undef)$pixmap</p> (Gtk2::Gdk::Pixmap or undef)$mask</p> (Gtk2::Gdk::Bitmap or undef)
$widget->drag_source_set_icon_name ($icon_name)
$icon_name</p> (string)
Since: gtk+ 2.8
$widget->drag_source_set_icon_pixbuf ($pixbuf)
$pixbuf</p> (Gtk2::Gdk::Pixbuf or undef)
$widget->drag_source_set_icon_stock ($stock_id)
$stock_id</p> (string)
$widget->drag_source_set_target_list ($target_list)
$target_list</p> (Gtk2::TargetList or undef)
Since: gtk+ 2.4
$widget->drag_source_unset
$widget->drag_unhighlight
$widget->drawable ($boolean)
boolean = $widget->drawable
$widget->ensure_style
$widget->error_bell
Since: gtk+ 2.12
boolean = $widget->event ($event)
$event</p> (Gtk2::Gdk::Event)
ok so this one is rarely-used, she emits an event signal on $widget. do NOT use this to synthesize events β use Gtk2->main_do_event instead. do NOT synthesize expose events β use $gdkwindow->invalidate_rect instead. basically, the main use for this in gtk2-perl is passing motion notify events to rulers from other widgets. that's it, that's the whole job π
eventmask = $widget->get_events
$widget->set_events ($events)
$events</p> (Gtk2::Gdk::EventMask)
extensionmode = $widget->get_extension_events
$widget->set_extension_events ($mode)
$mode</p> (Gtk2::Gdk::ExtensionMode)
pspec or undef = $widget_or_class_name->find_style_property ($name)
$name</p> (string)
returns a Glib::ParamSpec for the style property $name on widget $widget_or_class_name. and if there's no property $name?? it returns undef. see Glib::Object list_properties for the fields in a ParamSpec. π«Ά
Since: gtk+ 2.2
widgetflags = $widget->flags
widgetflags = $widget->get_flags
$widget->set_flags ($flags)
$flags</p> (Gtk2::WidgetFlags)
$widget->freeze_child_notify
$widget->grab_default
$widget->grab_focus
$widget->has_default ($boolean)
boolean = $widget->has_default
$widget->has_focus ($boolean)
boolean = $widget->has_focus
$widget->has_grab ($boolean)
boolean = $widget->has_grab
boolean = $widget->has_rc_style
Since: gtk+ 2.20
boolean = $widget->has_screen
Since: gtk+ 2.2
boolean = $widget->get_has_tooltip
Since: gtk+ 2.12
$widget->set_has_tooltip ($has_tooltip)
$has_tooltip</p> (boolean)
Since: gtk+ 2.12
boolean = $widget->get_has_window
Since: gtk+ 2.18
$widget->set_has_window ($has_window)
$has_window</p> (boolean)
Since: gtk+ 2.18
$widget->hide
$widget->hide_all
boolean = Gtk2::Widget::hide_on_delete ($widget, ...)
$widget</p> (Gtk2::Widget)...</p> (list) other arguments ignored (event etc)
this is a lil helper function meant to be used as the callback for the delete-event signal:
$wiget->signal_connect (
delete_event => \&Gtk2::Widget::hide_on_delete);
(yes, $wiget is spelled like that in the source. we don't fix it, we preserve it, that's the rule bestie π)
$widget->input_shape_combine_mask ($shape_mask, $offset_x, $offset_y)
$shape_mask</p> (Gtk2::Gdk::Bitmap or undef)$offset_x</p> (integer)$offset_y</p> (integer)
β¨ to be continued, bestie β this was just part 1 of 4, more chaos incoming β¨
Since: gtk+ 2.10
rectangle = $widget->intersect ($area)β bestie, this checks if your widget and$areaintersect. β¨$area(Gtk2::Gdk::Rectangle)- Returns
undefif$widgetand$areado not intersect. π
boolean = $widget->is_ancestor ($ancestor)β is$ancestoran ancestor of$widget? π$ancestor(Gtk2::Widget)
boolean = $widget->is_compositedβ returns whether the widget is composited. π¦ Since: gtk+ 2.10boolean = $widget->is_drawableβ can it be drawn on? π¨ Since: gtk+ 2.18boolean = $widget->is_focusβ does it have focus? π$widget->is_sensitive ($boolean)andboolean = $widget->is_sensitiveβ set or get sensitivity. πboolean = $widget->is_toplevelβ is it a toplevel? π Since: gtk+ 2.18boolean = $widget->keynav_failed ($direction)β keynav failed? π$direction(Gtk2::DirectionType) Since: gtk+ 2.12
list = $widget->list_mnemonic_labelsβ list of mnemonic labels. π·οΈ Since: gtk+ 2.4list = $widget_or_class_name->list_style_propertiesβ returns a list ofGlib::ParamSpecobjects which are the style properties available on$widget_or_class_name. SeeGlib::Objectlist_propertiesfor the fields in a ParamSpec. π Since: gtk+ 2.2$widget->map,$widget->mapped ($boolean),boolean = $widget->mapped,boolean = $widget->get_mappedβ map or check mapped status. πΊοΈ Since: gtk+ 2.20$widget->set_mapped ($mapped)β set mapped. π§$mapped(boolean) Since: gtk+ 2.20
boolean = $widget->mnemonic_activate ($group_cycling)β activate mnemonic. β¨οΈ$group_cycling(boolean)
rcstyle = $widget->get_modifier_styleβ get modifier style. π$widget->modify_base ($state, $color)β modify base color. π¨$state(Gtk2::StateType)$color(Gtk2::Gdk::Colororundef)
$widget->modify_bg ($state, $color)β modify background. π$state(Gtk2::StateType)$color(Gtk2::Gdk::Colororundef)
$widget->modify_cursor ($primary, $secondary)β modify cursor colors. π±οΈ$primary(Gtk2::Gdk::Colororundef)$secondary(Gtk2::Gdk::Colororundef) Since: gtk+ 2.12
$widget->modify_fg ($state, $color)β modify foreground. β¨$state(Gtk2::StateType)$color(Gtk2::Gdk::Colororundef)
$widget->modify_font ($font_desc)β modify font. π€$font_desc(Pango::FontDescriptionorundef)
$widget->modify_style ($style)β modify style. π$style(Gtk2::RcStyle)
$widget->modify_text ($state, $color)β modify text color. π$state(Gtk2::StateType)$color(Gtk2::Gdk::Colororundef)
string = $widget->get_nameand$widget->set_name ($name)β get or set the widget name. π·οΈ$name(string)
boolean = $widget->get_no_show_allβ get no-show-all flag. π Since: gtk+ 2.4$widget->set_no_show_all ($no_show_all)β set no-show-all. π«$no_show_all(boolean) Since: gtk+ 2.4
$widget->no_window ($boolean)andboolean = $widget->no_windowβ no window? πͺcontext = $widget->get_pango_contextβ get Pango context. ποΈwidget or undef = $widget->parentandwidget or undef = $widget->get_parentβ get parent widget. πͺ$widget->parent_sensitive ($boolean)andboolean = $widget->parent_sensitiveβ parent sensitive? π$widget->set_parent ($parent)β set parent. π¨βπ§$parent(Gtk2::Widget)
window = $widget->get_parent_windowand$widget->set_parent_window ($parent_window)β get or set parent window. πͺ$parent_window(Gtk2::Gdk::Window)
(path, path_reversed) = $widget->pathβ get path. π€οΈ(x, y) = $widget->get_pointerβ get pointer coords. π±οΈGtk2::Widget->pop_colormap (cmap)and$widget->pop_colormap (cmap)β pop colormap. π¨Gtk2::Widget->pop_composite_childand$widget->pop_composite_childβ pop composite child. πΆ$widget->propagate_event ($event)β propagate an event. β‘$event(Gtk2::Gdk::Event)
From gtk+'s API documentation: You most likely don't want to use any of these functions; synthesizing events is rarely needed. Consider asking on the mailing list for better ways to achieve your goals. For example, useGtk2::Gdk::invalidate_rectorGtk2::Widget::queue_drawinstead of making up expose events. π¬
Gtk2::Widget->push_colormap (cmap)and$widget->push_colormap (cmap)β push colormap. π$cmap(Gtk2::Gdk::Colormap)
Gtk2::Widget->push_composite_childand$widget->push_composite_childβ push composite child. πΆ$widget->queue_drawβ queue a draw. π¨$widget->queue_draw_area ($x, $y, $width, $height)β queue draw for area. ποΈ$x(integer)$y(integer)$width(integer)$height(integer)
$widget->queue_resizeβ queue resize. π$widget->queue_resize_no_redrawβ queue resize without redraw. π«π¨ Since: gtk+ 2.4$widget->rc_style ($boolean)andboolean = $widget->rc_styleβ rc style? π$widget->realizeβ realize the widget. β¨$widget->realized ($boolean),boolean = $widget->realized,boolean = $widget->get_realizedβ realized status. β Since: gtk+ 2.20$widget->set_realized ($realized)β set realized. π§$realized(boolean) Since: gtk+ 2.20
$widget->receives_default ($boolean),boolean = $widget->receives_default,boolean = $widget->get_receives_defaultβ receives default? π― Since: gtk+ 2.18$widget->set_receives_default ($receives_default)β set receives default. π―$receives_default(boolean) Since: gtk+ 2.18
$widget->set_redraw_on_allocate ($redraw_on_allocate)β set redraw on allocate. π$redraw_on_allocate(boolean)
region = $widget->region_intersect ($region)β intersect region. πΊοΈ$region(Gtk2::Gdk::Region)
boolean = $widget->remove_accelerator ($accel_group, $accel_key, $accel_mods)β remove accelerator. β¨οΈ$accel_group(Gtk2::AccelGroup)$accel_key(integer)$accel_mods(Gtk2::Gdk::ModifierType)
$widget->remove_mnemonic_label ($label)β remove mnemonic label. π·οΈ$label(Gtk2::Widget) Since: gtk+ 2.4
pixbuf = $widget->render_icon ($stock_id, $size, $detail=undef)β render icon. πΌοΈ$stock_id(string)$size(Gtk2::IconSize)$detail(string)
$widget->reparent ($new_parent)β reparent. πͺ$new_parent(Gtk2::Widget)
requisition = $widget->requisitionβ return the currently desired width and height of$widget. Basically this is the result from the lastsize_requestcall on$widget, and therefore may not be up-to-date if$widgethas asked for a resize but its container parent has not yet calledsize_request. π
The returned requisition object points into$widgetand can only be used as long as$widgetexists. β οΈ
requisition = $widget->get_requisitionβ get requisition. π Since: gtk+ 2.20$widget->reset_rc_stylesβ reset rc styles. π$widget->reset_shapesβ reset shapes. π·window = $widget->get_root_windowβ get root window. πͺ Since: gtk+ 2.2statetype = $widget->saved_stateβ saved state. πΎscreen = $widget->get_screenβ get screen. π₯οΈ Since: gtk+ 2.2boolean = $widget->set_scroll_adjustments ($hadjustment, $vadjustment)β set scroll adjustments. π$hadjustment(Gtk2::Adjustmentorundef)$vadjustment(Gtk2::Adjustmentorundef) This function works by emitting a setter signal nominated by the various widget types which have "native" scrolling. The signal is normally called "set-scroll-adjustments", but it doesn't have to be. If you make a widget subclass in Perl and create a signal in it called "set-scroll-adjustments" taking twoGtk2::Adjustmentparameters then the subclassing automatically hooks that up to be emitted by$widget->set_scroll_adjustments. (Your "class closure" default handler code should then store the adjustment objects somewhere.) π§
$widget->selection_add_target ($selection, $target, $info)β add selection target. π―$selection(Gtk2::Gdk::Atom)$target(Gtk2::Gdk::Atom)$info(integer)
$widget->selection_add_targets ($selection, ...)β add multiple selection targets. π―$selection(Gtk2::Gdk::Atom)...(list) ofGtk2::TargetEntry's
$widget->selection_clear_targets ($selection)β clear selection targets. π§Ή$selection(Gtk2::Gdk::Atom)
boolean = $widget->selection_convert ($selection, $target, $time_)β convert selection. π$selection(Gtk2::Gdk::Atom)$target(Gtk2::Gdk::Atom)$time_(unsigned)
$widget->selection_remove_allβ remove all selections. ποΈboolean = $widget->send_focus_change ($event)β send focus change. π―$event(Gtk2::Gdk::Event) Since: gtk+ 2.22
$widget->sensitive ($boolean),boolean = $widget->sensitive,boolean = $widget->get_sensitiveβ sensitivity. π Since: gtk+ 2.18$widget->set_sensitive ($sensitive)β set sensitive. π$sensitive(boolean)
settings = $widget->get_settingsβ get settings. βοΈ$widget->shape_combine_mask ($shape_mask, $offset_x, $offset_y)β combine shape mask. π·$shape_mask(Gtk2::Gdk::Bitmaporundef)$offset_x(integer)$offset_y(integer)
$widget->show,$widget->show_all,$widget->show_nowβ show the widget. π$widget->size_allocate ($allocation)β allocate size. π$allocation(Gtk2::Gdk::Rectangle)
requisition = $widget->size_requestβ this function is typically used when implementing aGtkContainersubclass. Obtains the preferred size of a widget. The container uses this information to arrange its child widgets and decide what size allocations to give them withsize_allocate (). π You can also call this function from an application, with some caveats. Most notably, getting a size request requires the widget to be associated with a screen, because font information may be needed. Multihead-aware applications should keep this in mind. π₯οΈ Also remember that the size request is not necessarily the size a widget will actually be allocated. β οΈ See alsoget_child_requisition ()(width, height) = $widget->get_size_requestβ gets the size request that was explicitly set for the widget usingset_size_request(). A value of-1for width or height indicates that the dimension has not been explicitly set and the natural requisition of the widget will be used instead. Seeset_size_request(). To get the size a widget will actually use, callsize_request()instead of this function. π$widget->set_size_request ($width=-1, $height=-1)β set size request. π$width(integer)$height(integer)
pixmap or undef = $widget->get_snapshot ($clip_rect=undef)β get snapshot. πΈ$clip_rect(Gtk2::Gdk::Rectangleorundef) Since: gtk+ 2.14
statetype = $widget->state,statetype = $widget->get_stateβ state. πΎ Since: gtk+ 2.18$widget->set_state ($state)β set state. πΎ$state(Gtk2::StateType)
style = $widget->style,$style->style_attachβ style and attach. π¨ Since: gtk+ 2.20style = $widget->get_styleβ get style. π¨list = $widget->style_get ($first_property_name, ...)β get style properties. π$first_property_name(string)...(list) 0 or more additional property names Returns the values of the requested style properties. Since: gtk+ 2.2
list = $widget->style_get_property ($first_property_name, ...)β an alias forstyle_get. π$first_property_name(string)...(list) 0 or more additional property names Since: gtk+ 2.2
$widget->set_style ($style)β set style. π¨$style(Gtk2::Styleorundef)
$widget->thaw_child_notifyβ thaw child notify. π₯string = $widget->get_tooltip_markupβ get tooltip markup. π¬ Since: gtk+ 2.12$widget->set_tooltip_markup ($markup)β set tooltip markup. π¬$markup(string orundef) Since: gtk+ 2.12
string = $widget->get_tooltip_textβ get tooltip text. π¬ Since: gtk+ 2.12$widget->set_tooltip_text ($text)β set tooltip text. π¬$text(string orundef) Since: gtk+ 2.12
window or undef = $widget->get_tooltip_windowβ get tooltip window. πͺ Since: gtk+ 2.12$widget->set_tooltip_window ($custom_window)β set tooltip window. πͺ$custom_window(Gtk2::Windoworundef) Since: gtk+ 2.12
$widget->toplevel ($value),boolean = $widget->toplevel,widget = $widget->get_toplevelβ toplevel stuff. π(dst_x, dst_y) = $src_widget->translate_coordinates ($dest_widget, $src_x, $src_y)β translate coordinates. πΊοΈ$dest_widget(Gtk2::Widget)$src_x(integer)$src_y(integer) Returns an empty list if either widget is not realized or if they do not share a common ancestor. π«
$widget->trigger_tooltip_queryβ trigger tooltip query. π¬ Since: gtk+ 2.12$widget->unmap,$widget->unparent,$widget->unrealizeβ unmap, unparent, unrealize. πͺ$widget->unset_flags ($flags)β unset flags. π©$flags(Gtk2::WidgetFlags)
$widget->visible ($boolean),boolean = $widget->visible,boolean = $widget->get_visibleβ visibility. π Since: gtk+ 2.18$widget->set_visible ($visible)β set visible. π$visible(boolean) Since: gtk+ 2.18
visual = $widget->get_visualβ get visual. π¨window or undef = $widget->window ($new=undef)β window. πͺ$new(Gtk2::Gdk::Windoworundef)
window or undef = $widget->get_window
Since: gtk+ 2.14 β¨ β bestie, you get back the widget's window, or undef if it hasn't got one yet. No window, no undef-crisis, just vibes.
$widget->set_window ($window)
$window(Gtk2::Gdk::Window) β the window you're handing over π«Ά
Since: gtk+ 2.18
πΈ PROPERTIES πΈ
Every single one of these is a real, certified property, okay? Type, default and flags included, no gatekeeping π
'app-paintable'β typeboolean, defaultfalse, flagsreadable / writable / private / static-nick / static-blurb. Whether the application will paint directly on the widget π¨'can-default'β typeboolean, defaultfalse, flagsreadable / writable / private / static-nick / static-blurb. Whether the widget can be the default widget π'can-focus'β typeboolean, defaultfalse, flagsreadable / writable / private / static-nick / static-blurb. Whether the widget can accept the input focus β¨'composite-child'β typeboolean, defaultfalse, flagsreadable / private / static-nick / static-blurb. Whether the widget is part of a composite widget π§©'double-buffered'β typeboolean, defaulttrue, flagsreadable / writable / private / static-nick / static-blurb. Whether or not the widget is double buffered πͺ'events'β type Gtk2::Gdk::EventMask, defaultstructure-mask, flagsreadable / writable / private / static-nick / static-blurb. The event mask that decides what kind of GdkEvents this widget gets ποΈ'extension-events'β type Gtk2::Gdk::ExtensionMode, default"none", flagsreadable / writable / private / static-nick / static-blurb. The mask that decides what kind of extension events this widget gets π'has-default'β typeboolean, defaultfalse, flagsreadable / writable / private / static-nick / static-blurb. Whether the widget is the default widget π'has-focus'β typeboolean, defaultfalse, flagsreadable / writable / private / static-nick / static-blurb. Whether the widget has the input focus β¨'has-tooltip'β typeboolean, defaultfalse, flagsreadable / writable / private / static-nick / static-blurb. Whether this widget has a tooltip π¬'height-request'β typeinteger, default-1, flagsreadable / writable / private / static-nick / static-blurb. Override for height request of the widget, or-1if the natural request should be used π'is-focus'β typeboolean, defaultfalse, flagsreadable / writable / private / static-nick / static-blurb. Whether the widget is the focus widget within the toplevel π―'name'β typestring, defaultundef, flagsreadable / writable / private / static-nick / static-blurb. The name of the widget π·οΈ'no-show-all'β typeboolean, defaultfalse, flagsreadable / writable / private / static-nick / static-blurb. Whethergtk_widget_show_all()should not affect this widget π'parent'β type Gtk2::Container, defaultundef, flagsreadable / writable / private / static-nick / static-blurb. The parent widget of this widget. Must be a Container widget π¨βπ©βπ§'receives-default'β typeboolean, defaultfalse, flagsreadable / writable / private / static-nick / static-blurb. IfTRUE, the widget will receive the default action when it is focused π'sensitive'β typeboolean, defaulttrue, flagsreadable / writable / private / static-nick / static-blurb. Whether the widget responds to input π«Ά'style'β type Gtk2::Style, defaultundef, flagsreadable / writable / private / static-nick / static-blurb. The style of the widget, which contains information about how it will look (colors etc) π'tooltip-markup'β typestring, defaultundef, flagsreadable / writable / private / static-nick / static-blurb. The contents of the tooltip for this widget π¬'tooltip-text'β typestring, defaultundef, flagsreadable / writable / private / static-nick / static-blurb. The contents of the tooltip for this widget π¬'visible'β typeboolean, defaultfalse, flagsreadable / writable / private / static-nick / static-blurb. Whether the widget is visible π'width-request'β typeinteger, default-1, flagsreadable / writable / private / static-nick / static-blurb. Override for width request of the widget, or-1if the natural request should be used π'window'β type Gtk2::Gdk::Window, defaultundef, flagsreadable / private / static-nick / static-blurb. The widget's window if it is realized πͺ
π STYLE PROPERTIES π
These ones are style, not vibes-only β they're the actual style properties, and yes every single flag is coming with us π
'cursor-aspect-ratio'β typefloat, default0.04, flagsreadable / private / static-nick / static-blurb. Aspect ratio with which to draw insertion cursor βοΈ'cursor-color'β type Gtk2::Gdk::Color, defaultundef, flagsreadable / private / static-nick / static-blurb. Color with which to draw insertion cursor βοΈ'draw-border'β type Gtk2::Border, defaultundef, flagsreadable / private / static-nick / static-blurb. Size of areas outside the widget's allocation to draw πΌοΈ'focus-line-pattern'β typestring, default"\1\1", flagsreadable / private / static-nick / static-blurb. Dash pattern used to draw the focus indicator π―'focus-line-width'β typeinteger, default1, flagsreadable / private / static-nick / static-blurb. Width, in pixels, of the focus indicator line π―'focus-padding'β typeinteger, default1, flagsreadable / private / static-nick / static-blurb. Width, in pixels, between focus indicator and the widget 'box' π―'interior-focus'β typeboolean, defaulttrue, flagsreadable / private / static-nick / static-blurb. Whether to draw the focus indicator inside widgets π―'link-color'β type Gtk2::Gdk::Color, defaultundef, flagsreadable / private / static-nick / static-blurb. Color of unvisited links π'scroll-arrow-hlength'β typeinteger, default16, flagsreadable / private / static-nick / static-blurb. The length of horizontal scroll arrows βοΈ'scroll-arrow-vlength'β typeinteger, default16, flagsreadable / private / static-nick / static-blurb. The length of vertical scroll arrows βοΈ'secondary-cursor-color'β type Gtk2::Gdk::Color, defaultundef, flagsreadable / private / static-nick / static-blurb. Color with which to draw the secondary insertion cursor when editing mixed right-to-left and left-to-right text βοΈ'separator-height'β typeinteger, default0, flagsreadable / private / static-nick / static-blurb. The height of separators if"wide-separators"isTRUEβ'separator-width'β typeinteger, default0, flagsreadable / private / static-nick / static-blurb. The width of separators ifwide-separatorsisTRUEβ'tooltip-alpha'β type Glib::UChar, default255, flagsreadable / private / static-nick / static-blurb. The opacity to be used when drawing tooltips π¬'tooltip-radius'β type Glib::UInt, default0, flagsreadable / private / static-nick / static-blurb. The radius to be used when drawing tooltips π¬'visited-link-color'β type Gtk2::Gdk::Color, defaultundef, flagsreadable / private / static-nick / static-blurb. Color of visited links π'wide-separators'β typeboolean, defaultfalse, flagsreadable / private / static-nick / static-blurb. Whether separators have configurable width and should be drawn using a box instead of a line β'window-dragging'β typeboolean, defaultfalse, flagsreadable / writable / private / static-nick / static-blurb. Window dragging πͺ
π₯ SIGNALS π₯
Okay so here's the whole signal list, every last one, signatures verbatim because I do not play about accuracy π«Ά Where you see boolean = at the front, that's the listing telling you the return value is a boolean, iykyk.
accel-closures-changedβ(Gtk2::Widget)boolean = button-press-eventβ(Gtk2::Widget, Gtk2::Gdk::Event)boolean = button-release-eventβ(Gtk2::Widget, Gtk2::Gdk::Event)boolean = can-activate-accelβ(Gtk2::Widget, Glib::UInt)child-notifyβ(Gtk2::Widget, Glib::ParamSpec)boolean = client-eventβ(Gtk2::Widget, Gtk2::Gdk::Event)composited-changedβ(Gtk2::Widget)boolean = configure-eventβ(Gtk2::Widget, Gtk2::Gdk::Event)boolean = damage-eventβ(Gtk2::Widget, Gtk2::Gdk::Event)boolean = delete-eventβ(Gtk2::Widget, Gtk2::Gdk::Event)boolean = destroy-eventβ(Gtk2::Widget, Gtk2::Gdk::Event)direction-changedβ(Gtk2::Widget, Gtk2::TextDirection)drag-beginβ(Gtk2::Widget, Gtk2::Gdk::DragContext)drag-data-deleteβ(Gtk2::Widget, Gtk2::Gdk::DragContext)drag-data-getβ(Gtk2::Widget, Gtk2::Gdk::DragContext, Gtk2::SelectionData, Glib::UInt, Glib::UInt)drag-data-receivedβ(Gtk2::Widget, Gtk2::Gdk::DragContext, integer, integer, Gtk2::SelectionData, Glib::UInt, Glib::UInt)boolean = drag-dropβ(Gtk2::Widget, Gtk2::Gdk::DragContext, integer, integer, Glib::UInt)drag-endβ(Gtk2::Widget, Gtk2::Gdk::DragContext)boolean = drag-failedβ(Gtk2::Widget, Gtk2::Gdk::DragContext, Gtk2::DragResult)drag-leaveβ(Gtk2::Widget, Gtk2::Gdk::DragContext, Glib::UInt)boolean = drag-motionβ(Gtk2::Widget, Gtk2::Gdk::DragContext, integer, integer, Glib::UInt)boolean = enter-notify-eventβ(Gtk2::Widget, Gtk2::Gdk::Event)boolean = eventβ(Gtk2::Widget, Gtk2::Gdk::Event)event-afterβ(Gtk2::Widget, Gtk2::Gdk::Event)boolean = expose-eventβ(Gtk2::Widget, Gtk2::Gdk::Event)boolean = focusβ(Gtk2::Widget, Gtk2::DirectionType)boolean = focus-in-eventβ(Gtk2::Widget, Gtk2::Gdk::Event)boolean = focus-out-eventβ(Gtk2::Widget, Gtk2::Gdk::Event)boolean = grab-broken-eventβ(Gtk2::Widget, Gtk2::Gdk::Event)grab-focusβ(Gtk2::Widget)grab-notifyβ(Gtk2::Widget, boolean)hideβ(Gtk2::Widget)hierarchy-changedβ(Gtk2::Widget, Gtk2::Widget)boolean = key-press-eventβ(Gtk2::Widget, Gtk2::Gdk::Event)boolean = key-release-eventβ(Gtk2::Widget, Gtk2::Gdk::Event)boolean = keynav-failedβ(Gtk2::Widget, Gtk2::DirectionType)boolean = leave-notify-eventβ(Gtk2::Widget, Gtk2::Gdk::Event)mapβ(Gtk2::Widget)boolean = map-eventβ(Gtk2::Widget, Gtk2::Gdk::Event)boolean = mnemonic-activateβ(Gtk2::Widget, boolean)boolean = motion-notify-eventβ(Gtk2::Widget, Gtk2::Gdk::Event)move-focusβ(Gtk2::Widget, Gtk2::DirectionType)boolean = no-expose-eventβ(Gtk2::Widget, Gtk2::Gdk::Event)parent-setβ(Gtk2::Widget, Gtk2::Widget)boolean = popup-menuβ(Gtk2::Widget)boolean = property-notify-eventβ(Gtk2::Widget, Gtk2::Gdk::Event)boolean = proximity-in-eventβ(Gtk2::Widget, Gtk2::Gdk::Event)boolean = proximity-out-eventβ(Gtk2::Widget, Gtk2::Gdk::Event)boolean = query-tooltipβ(Gtk2::Widget, integer, integer, boolean, Gtk2::Tooltip)realizeβ(Gtk2::Widget)screen-changedβ(Gtk2::Widget, Gtk2::Gdk::Screen)boolean = scroll-eventβ(Gtk2::Widget, Gtk2::Gdk::Event)boolean = selection-clear-eventβ(Gtk2::Widget, Gtk2::Gdk::Event)selection-getβ(Gtk2::Widget, Gtk2::SelectionData, Glib::UInt, Glib::UInt)boolean = selection-notify-eventβ(Gtk2::Widget, Gtk2::Gdk::Event)selection-receivedβ(Gtk2::Widget, Gtk2::SelectionData, Glib::UInt)boolean = selection-request-eventβ(Gtk2::Widget, Gtk2::Gdk::Event)showβ(Gtk2::Widget)boolean = show-helpβ(Gtk2::Widget, Gtk2::WidgetHelpType)size-allocateβ(Gtk2::Widget, Gtk2::Gdk::Rectangle)size-requestβ(Gtk2::Widget, Gtk2::Requisition)state-changedβ(Gtk2::Widget, Gtk2::StateType)style-setβ(Gtk2::Widget, Gtk2::Style)unmapβ(Gtk2::Widget)boolean = unmap-eventβ(Gtk2::Widget, Gtk2::Gdk::Event)unrealizeβ(Gtk2::Widget)boolean = visibility-notify-eventβ(Gtk2::Widget, Gtk2::Gdk::Event)boolean = window-state-eventβ(Gtk2::Widget, Gtk2::Gdk::Event)
π that's 68 signals, bestie. All of them. Not one skipped, not one merged, periodt.
π ENUMS AND FLAGS π
okay bestie, this is the big ol' bucket of all the enums and flags you might bump into while messing with widgets π each one shows you the cute Perl name and the C name it's chillin' with, so you can pass whichever and nobody's gonna be mad at you.
flags Gtk2::AccelFlags
'visible'/'GTK_ACCEL_VISIBLE''locked'/'GTK_ACCEL_LOCKED''mask'/'GTK_ACCEL_MASK'
flags Gtk2::DestDefaults
'motion'/'GTK_DEST_DEFAULT_MOTION''highlight'/'GTK_DEST_DEFAULT_HIGHLIGHT''drop'/'GTK_DEST_DEFAULT_DROP''all'/'GTK_DEST_DEFAULT_ALL'
enum Gtk2::DirectionType
'tab-forward'/'GTK_DIR_TAB_FORWARD''tab-backward'/'GTK_DIR_TAB_BACKWARD''up'/'GTK_DIR_UP''down'/'GTK_DIR_DOWN''left'/'GTK_DIR_LEFT''right'/'GTK_DIR_RIGHT'
enum Gtk2::DragResult
'success'/'GTK_DRAG_RESULT_SUCCESS''no-target'/'GTK_DRAG_RESULT_NO_TARGET''user-cancelled'/'GTK_DRAG_RESULT_USER_CANCELLED''timeout-expired'/'GTK_DRAG_RESULT_TIMEOUT_EXPIRED''grab-broken'/'GTK_DRAG_RESULT_GRAB_BROKEN''error'/'GTK_DRAG_RESULT_ERROR'
flags Gtk2::Gdk::DragAction
'default'/'GDK_ACTION_DEFAULT''copy'/'GDK_ACTION_COPY''move'/'GDK_ACTION_MOVE''link'/'GDK_ACTION_LINK''private'/'GDK_ACTION_PRIVATE''ask'/'GDK_ACTION_ASK'
enum Gtk2::Gdk::DragProtocol
'motif'/'GDK_DRAG_PROTO_MOTIF''xdnd'/'GDK_DRAG_PROTO_XDND''rootwin'/'GDK_DRAG_PROTO_ROOTWIN''none'/'GDK_DRAG_PROTO_NONE''win32-dropfiles'/'GDK_DRAG_PROTO_WIN32_DROPFILES''ole2'/'GDK_DRAG_PROTO_OLE2''local'/'GDK_DRAG_PROTO_LOCAL'
flags Gtk2::Gdk::EventMask
like, this one is the list β every single mask is here, no skips, we don't gatekeep π
'exposure-mask'/'GDK_EXPOSURE_MASK''pointer-motion-mask'/'GDK_POINTER_MOTION_MASK''pointer-motion-hint-mask'/'GDK_POINTER_MOTION_HINT_MASK''button-motion-mask'/'GDK_BUTTON_MOTION_MASK''button1-motion-mask'/'GDK_BUTTON1_MOTION_MASK''button2-motion-mask'/'GDK_BUTTON2_MOTION_MASK''button3-motion-mask'/'GDK_BUTTON3_MOTION_MASK''button-press-mask'/'GDK_BUTTON_PRESS_MASK''button-release-mask'/'GDK_BUTTON_RELEASE_MASK''key-press-mask'/'GDK_KEY_PRESS_MASK''key-release-mask'/'GDK_KEY_RELEASE_MASK''enter-notify-mask'/'GDK_ENTER_NOTIFY_MASK''leave-notify-mask'/'GDK_LEAVE_NOTIFY_MASK''focus-change-mask'/'GDK_FOCUS_CHANGE_MASK''structure-mask'/'GDK_STRUCTURE_MASK''property-change-mask'/'GDK_PROPERTY_CHANGE_MASK''visibility-notify-mask'/'GDK_VISIBILITY_NOTIFY_MASK''proximity-in-mask'/'GDK_PROXIMITY_IN_MASK''proximity-out-mask'/'GDK_PROXIMITY_OUT_MASK''substructure-mask'/'GDK_SUBSTRUCTURE_MASK''scroll-mask'/'GDK_SCROLL_MASK''all-events-mask'/'GDK_ALL_EVENTS_MASK'
enum Gtk2::Gdk::ExtensionMode
'none'/'GDK_EXTENSION_EVENTS_NONE''all'/'GDK_EXTENSION_EVENTS_ALL''cursor'/'GDK_EXTENSION_EVENTS_CURSOR'
flags Gtk2::Gdk::ModifierType
keyboard warriors assemble β¨οΈβ¨
'shift-mask'/'GDK_SHIFT_MASK''lock-mask'/'GDK_LOCK_MASK''control-mask'/'GDK_CONTROL_MASK''mod1-mask'/'GDK_MOD1_MASK''mod2-mask'/'GDK_MOD2_MASK''mod3-mask'/'GDK_MOD3_MASK''mod4-mask'/'GDK_MOD4_MASK''mod5-mask'/'GDK_MOD5_MASK''button1-mask'/'GDK_BUTTON1_MASK''button2-mask'/'GDK_BUTTON2_MASK''button3-mask'/'GDK_BUTTON3_MASK''button4-mask'/'GDK_BUTTON4_MASK''button5-mask'/'GDK_BUTTON5_MASK''super-mask'/'GDK_SUPER_MASK''hyper-mask'/'GDK_HYPER_MASK''meta-mask'/'GDK_META_MASK''release-mask'/'GDK_RELEASE_MASK''modifier-mask'/'GDK_MODIFIER_MASK'
enum Gtk2::IconSize
'invalid'/'GTK_ICON_SIZE_INVALID''menu'/'GTK_ICON_SIZE_MENU''small-toolbar'/'GTK_ICON_SIZE_SMALL_TOOLBAR''large-toolbar'/'GTK_ICON_SIZE_LARGE_TOOLBAR''button'/'GTK_ICON_SIZE_BUTTON''dnd'/'GTK_ICON_SIZE_DND''dialog'/'GTK_ICON_SIZE_DIALOG'
enum Gtk2::StateType
'normal'/'GTK_STATE_NORMAL''active'/'GTK_STATE_ACTIVE''prelight'/'GTK_STATE_PRELIGHT''selected'/'GTK_STATE_SELECTED''insensitive'/'GTK_STATE_INSENSITIVE'
enum Gtk2::TextDirection
'none'/'GTK_TEXT_DIR_NONE''ltr'/'GTK_TEXT_DIR_LTR''rtl'/'GTK_TEXT_DIR_RTL'
flags Gtk2::WidgetFlags
ngl this is the one you'll actually be reaching for β it's basically the widget's whole mood board π«Ά
'toplevel'/'GTK_TOPLEVEL''no-window'/'GTK_NO_WINDOW''realized'/'GTK_REALIZED''mapped'/'GTK_MAPPED''visible'/'GTK_VISIBLE''sensitive'/'GTK_SENSITIVE''parent-sensitive'/'GTK_PARENT_SENSITIVE''can-focus'/'GTK_CAN_FOCUS''has-focus'/'GTK_HAS_FOCUS''can-default'/'GTK_CAN_DEFAULT''has-default'/'GTK_HAS_DEFAULT''has-grab'/'GTK_HAS_GRAB''rc-style'/'GTK_RC_STYLE''composite-child'/'GTK_COMPOSITE_CHILD''no-reparent'/'GTK_NO_REPARENT''app-paintable'/'GTK_APP_PAINTABLE''receives-default'/'GTK_RECEIVES_DEFAULT''double-buffered'/'GTK_DOUBLE_BUFFERED''no-show-all'/'GTK_NO_SHOW_ALL'
enum Gtk2::WidgetHelpType
'tooltip'/'GTK_WIDGET_HELP_TOOLTIP''whats-this'/'GTK_WIDGET_HELP_WHATS_THIS'
π SEE ALSO π
go read these next, they're all connected fr fr π§
Gtk2Glib::ObjectGlib::InitiallyUnownedGtk2::ObjectGtk2::TargetEntry
π COPYRIGHT π
Copyright (C) 2003-2011 by the gtk2-perl team.
This software is licensed under the LGPL. See Gtk2 for a full notice.
okay that's the whole page bestie, you made it to the end π and fun lil' footnote for the archivists in the chat: this was built from perl v5.42.0, dated 2025-07-25, and it's the Gtk2::Widget(3) page β icon behavior, no cap π go forth and slay your widget game, ily, bye β¨π¦
π¦ where this page comes from
- fedora 43: perl-Gtk2 1.24993-23.fc43 Β· LicenseRef-Callaway-LGPLv2+
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms