Gtk::Widget Class Reference
Inheritance diagram for Gtk::Widget:

Detailed Description
Abstract Widget (Base class for all widgets).As the base class of all widgets this contains all of the properties and methods common to all widgets. It is an abstract class that can not be instantiated.
Important part of widgets are the *_event signals and virtual methods that every widget have. Those are events coming directly from gdk and thus also from XLib. By overriding those virtual methods you can trap everything a widget can ever do. In order to capture events from a widget, the event mask must first be set with ().
Only widgets with a Gdk::Window on the server side are allowed to capture events. Widgets in the Gtk::Misc group for example lack a Gdk::Window.
Public Member Functions | |
| bool | activate () |
| For widgets that can be "activated" (buttons, menu items, etc. | |
| void | add_accelerator (const Glib::ustring& accel_signal, const Glib::RefPtr<AccelGroup>& accel_group, guint accel_key, Gdk::ModifierType accel_mods, AccelFlags accel_flags) |
| Installs an accelerator for this widget in accel_group that causes accel_signal to be emitted if the accelerator is activated. | |
| void | add_events (Gdk::EventMask events) |
| Adds the events in the bitfield events to the event mask for widget. | |
| void | add_mnemonic_label (Widget& label) |
| Adds a widget to the list of mnemonic labels for this widget. | |
| void | add_modal_grab () |
| Block events to everything else than this widget and its children. | |
| bool | app_paintable () const |
| bool | can_default () const |
| bool | can_focus () const |
| bool | child_focus (DirectionType direction) |
| This function is used by custom widget implementations; if you're writing an app, you'd use grab_focus() to move the focus to a particular widget, and Gtk::Container::set_focus_chain() to change the focus tab order. | |
| void | child_notify (const Glib::ustring& child_property) |
| Emits a Gtk::Widget::child-notify signal for the child property child_property on widget. | |
| void | class_path (Glib::ustring& path, Glib::ustring& path_reversed) |
| Glib::RefPtr<Pango::Context> | create_pango_context () |
| Creates a new Pango::Context with the appropriate font map, font description, and base direction for drawing text for this widget. | |
| Glib::RefPtr<Pango::Layout> | create_pango_layout (const Glib::ustring& text) |
| Creates a new Pango::Layout with the appropriate font map, font description, and base direction for drawing text for this widget. | |
| bool | double_buffered () const |
| Glib::RefPtr<Gdk::DragContext> | drag_begin (const Glib::RefPtr<TargetList>& targets, Gdk::DragAction actions, int button, GdkEvent* event) |
| Initiates a drag on the source side. | |
| bool | drag_check_threshold (int start_x, int start_y, int current_x, int current_y) |
| Checks to see if a mouse drag starting at ( start_x, start_y) and ending at ( current_x, current_y) has passed the GTK+ drag threshold, and thus should trigger the beginning of a drag-and-drop operation. | |
| void | drag_dest_add_image_targets () |
| Add the image targets supported by Gtk::Selection to the target list of the drag destination. | |
| void | drag_dest_add_text_targets () |
| Add the text targets supported by Gtk::Selection to the target list of the drag destination. | |
| void | drag_dest_add_uri_targets () |
| Add the URI targets supported by Gtk::Selection to the target list of the drag destination. | |
| Glib::ustring | drag_dest_find_target (const Glib::RefPtr<Gdk::DragContext>& context) const |
| Glib::ustring | drag_dest_find_target (const Glib::RefPtr<Gdk::DragContext>& context, const Glib::RefPtr<TargetList>& target_list) const |
| Looks for a match between context->targets and the dest_target_list, returning the first matching target, otherwise returning Gdk::NONE. | |
| Glib::RefPtr<const TargetList> | drag_dest_get_target_list () const |
Return value: the Gtk::TargetList, or 0 if none. | |
| Glib::RefPtr<TargetList> | drag_dest_get_target_list () |
Return value: the Gtk::TargetList, or 0 if none. | |
| void | drag_dest_set (const ArrayHandle_TargetEntry& targets, DestDefaults flags=DEST_DEFAULT_ALL, Gdk::DragAction actions=Gdk::ACTION_COPY) |
| void | drag_dest_set (DestDefaults flags=DestDefaults(0), Gdk::DragAction actions=Gdk::DragAction(0)) |
| void | drag_dest_set_proxy (const Glib::RefPtr<Gdk::Window>& proxy_window, Gdk::DragProtocol protocol, bool use_coordinates) |
| void | drag_dest_set_target_list (const Glib::RefPtr<TargetList>& target_list) |
| Sets the target types that this widget can accept from drag-and-drop. | |
| void | drag_dest_unset () |
| void | drag_get_data (const Glib::RefPtr<Gdk::DragContext>& context, const Glib::ustring& target, guint32 time) |
| void | drag_get_data (const Glib::RefPtr<Gdk::DragContext>& context, Glib::ustring& target, guint32 time) |
| void | drag_highlight () |
| void | drag_set_as_icon (const Glib::RefPtr<Gdk::DragContext>& context, int hot_x, int hot_y) |
| void | drag_source_add_image_targets () |
| Add the writable image targets supported by Gtk::Selection to the target list of the drag source. | |
| void | drag_source_add_text_targets () |
| Add the text targets supported by Gtk::Selection to the target list of the drag source. | |
| void | drag_source_add_uri_targets () |
| Add the URI targets supported by Gtk::Selection to the target list of the drag source. | |
| void | drag_source_set (const ArrayHandle_TargetEntry& targets, Gdk::ModifierType start_button_mask=Gdk::MODIFIER_MASK, Gdk::DragAction actions=Gdk::ACTION_COPY) |
| void | drag_source_set_icon (const Glib::ustring& icon_name) |
| Sets the icon that will be used for drags from a particular source to a themed icon. | |
| void | drag_source_set_icon (const StockID& stock_id) |
| Sets the icon that will be used for drags from a particular source to a stock icon. | |
| void | drag_source_set_icon (const Glib::RefPtr<Gdk::Pixbuf>& pixbuf) |
| Sets the icon that will be used for drags from a particular widget from a Gdk::Pixbuf. | |
| void | drag_source_set_icon (const Glib::RefPtr<Gdk::Colormap>& colormap, const Glib::RefPtr<Gdk::Pixmap>& pixmap, const Glib::RefPtr<Gdk::Bitmap>& mask) |
| Sets the icon that will be used for drags from a particular widget from a pixmap/mask. | |
| void | drag_source_unset () |
| void | drag_unhighlight () |
| void | draw_insertion_cursor (Glib::RefPtr<Gdk::Drawable> drawable, const Gdk::Rectangle& area, const Gdk::Rectangle& location, bool is_primary, TextDirection direction, bool draw_arrow=true) |
| void | ensure_style () |
| Ensures that widget has a style ( widget->style). | |
| void | error_bell () |
| Notifies the user about an input-related error on this widget. | |
| bool | event (GdkEvent* event) |
| Rarely-used function. | |
| void | freeze_child_notify () |
| Stops emission of Gtk::Widget::child-notify signals on widget. | |
| Glib::RefPtr<Atk::Object> | get_accessible () |
| Returns: the Atk::Object associated with widget. | |
| Glib::RefPtr<const Action> | get_action () const |
| Returns: the action that a widget is a proxy for, or. | |
| Glib::RefPtr<Action> | get_action () |
| Returns: the action that a widget is a proxy for, or. | |
| Allocation | get_allocation () const |
| const Widget* | get_ancestor (GType widget_type) const |
| Gets the first ancestor of widget with type widget_type. | |
| Widget* | get_ancestor (GType widget_type) |
| Gets the first ancestor of widget with type widget_type. | |
| bool | get_child_visible () const |
| Gets the value set with set_child_visible(). | |
| Glib::RefPtr<const Clipboard> | get_clipboard (const Glib::ustring& selection) const |
| Return value: the appropriate clipboard object. | |
| Glib::RefPtr<Clipboard> | get_clipboard (const Glib::ustring& selection) |
| Return value: the appropriate clipboard object. | |
| Glib::RefPtr<Gdk::Colormap> | get_colormap () |
| Gets the colormap that will be used to render widget. | |
| Glib::ustring | get_composite_name () const |
| Obtains the composite name of a widget. | |
| TextDirection | get_direction () const |
| Gets the reading direction for a particular widget. | |
| TextDirection | get_direction () |
| Gets the reading direction for a particular widget. | |
| Glib::RefPtr<const Gdk::Display> | get_display () const |
| Get the Gdk::Display for the toplevel window associated with this widget. | |
| Glib::RefPtr<Gdk::Display> | get_display () |
| Get the Gdk::Display for the toplevel window associated with this widget. | |
| Gdk::EventMask | get_events () const |
| Return value: event mask for widget. | |
| Gdk::ExtensionMode | get_extension_events () const |
| Retrieves the extension events the widget will receive; see gdk_input_set_extension_events(). | |
| WidgetFlags | get_flags () const |
| bool | get_has_tooltip () const |
| Return value: current value of has-tooltip on widget. | |
| int | get_height () const |
| Glib::RefPtr<const RcStyle> | get_modifier_style () const |
| Return value: the modifier style for the widget. | |
| Glib::RefPtr<RcStyle> | get_modifier_style () |
| Return value: the modifier style for the widget. | |
| Glib::ustring | get_name () const |
| Retrieves the name of a widget. | |
| bool | get_no_show_all () const |
| Return value: the current value of the "no-show-all" property. | |
| Glib::RefPtr<Pango::Context> | get_pango_context () |
| Gets a Pango::Context with the appropriate font map, font description, and base direction for this widget. | |
| const Container* | get_parent () const |
Return value: the parent container of widget, or 0. | |
| Container* | get_parent () |
Return value: the parent container of widget, or 0. | |
| Glib::RefPtr<const Gdk::Window> | get_parent_window () const |
| Gets widget's parent window. | |
| Glib::RefPtr<Gdk::Window> | get_parent_window () |
| Gets widget's parent window. | |
| void | get_pointer (int& x, int& y) const |
| Obtains the location of the mouse pointer in widget coordinates. | |
| Requisition | get_requisition () const |
| Glib::RefPtr<const Gdk::Window> | get_root_window () const |
| Get the root window where this widget is located. | |
| Glib::RefPtr<Gdk::Window> | get_root_window () |
| Get the root window where this widget is located. | |
| Gtk::StateType | get_saved_state () const |
| Glib::RefPtr<const Gdk::Screen> | get_screen () const |
| Get the Gdk::Screen from the toplevel window associated with this widget. | |
| Glib::RefPtr<Gdk::Screen> | get_screen () |
| Get the Gdk::Screen from the toplevel window associated with this widget. | |
| Glib::RefPtr<Settings> | get_settings () |
| Gets the settings object holding the settings (global property settings, RC file information, etc) used for this widget. | |
| void | get_size_request (int& width, int& height) const |
| Gets the size request that was explicitly set for the widget using set_size_request(). | |
| Gtk::StateType | get_state () const |
| Glib::RefPtr<const Style> | get_style () const |
| Simply an accessor function that returns widget->style. | |
| Glib::RefPtr<Style> | get_style () |
| Simply an accessor function that returns widget->style. | |
| template<class PropertyType> | |
| void | get_style_property (const Glib::ustring& the_property_name, PropertyType& value) const |
| Glib::ustring | get_tooltip_markup () const |
| Gets the contents of the tooltip for widget. | |
| Glib::ustring | get_tooltip_text () const |
| Gets the contents of the tooltip for widget. | |
| Window* | get_tooltip_window () |
| Return value: The Gtk::Window of the current tooltip. | |
| const Container* | get_toplevel () const |
| This function returns the topmost widget in the container hierarchy widget is a part of. | |
| Container* | get_toplevel () |
| This function returns the topmost widget in the container hierarchy widget is a part of. | |
| Glib::RefPtr<Gdk::Visual> | get_visual () |
| Gets the visual that will be used to render widget. | |
| int | get_width () const |
| Glib::RefPtr<const Gdk::Window> | get_window () const |
| Glib::RefPtr<Gdk::Window> | get_window () |
| const GtkWidget* | gobj () const |
| Provides access to the underlying C GtkObject. | |
| GtkWidget* | gobj () |
| Provides access to the underlying C GtkObject. | |
| void | grab_default () |
| Causes widget to become the default widget. | |
| void | grab_focus () |
| Causes widget to have the keyboard focus for the Gtk::Window it's inside. | |
| bool | has_default () const |
| bool | has_focus () const |
| bool | has_grab () const |
| bool | has_no_window () const |
| bool | has_screen () const |
| Checks whether there is a Gdk::Screen is associated with this widget. | |
| void | hide () |
| Reverses the effects of show(), causing the widget to be hidden (invisible to the user). | |
| void | hide_all () |
| Recursively hides a widget and any child widgets. | |
| void | input_shape_combine_mask (const Glib::RefPtr<const Gdk::Bitmap>& shape_mask, int offset_x, int offset_y) |
| Sets an input shape for this widget's GDK window. | |
| bool | intersect (const Gdk::Rectangle& area, Gdk::Rectangle& intersection) const |
Computes the intersection of a widget's area and area, storing the intersection in intersection, and returns true if there was an intersection. | |
| bool | intersect (const Gdk::Rectangle& area) const |
| bool | is_ancestor (Widget& ancestor) const |
| Determines whether widget is somewhere inside ancestor, possibly with intermediate containers. | |
| bool | is_composite_child () const |
| bool | is_composited () const |
| Whether widget can rely on having its alpha channel drawn correctly. | |
| bool | is_drawable () const |
| bool | is_focus () const |
| Determines if the widget is the focus widget within its toplevel. | |
| bool | is_mapped () const |
| bool | is_realized () const |
| bool | is_sensitive () const |
| bool | is_toplevel () const |
| bool | is_visible () const |
| bool | keynav_failed (DirectionType direction) |
| This function should be called whenever keyboard navigation within a single widget hits a boundary. | |
| Glib::ListHandle<const Widget*> | list_mnemonic_labels () const |
| Return value: the list of mnemonic labels; free this list. | |
| Glib::ListHandle<Widget*> | list_mnemonic_labels () |
| Return value: the list of mnemonic labels; free this list. | |
| void | map () |
| This function is only for use in widget implementations. | |
| bool | mnemonic_activate (bool group_cycling) |
| void | modify_base (StateType state, const Gdk::Color& color) |
| Sets the base color for a widget in a particular state. | |
| void | modify_bg (StateType state, const Gdk::Color& color) |
| Sets the background color for a widget in a particular state. | |
| void | modify_bg_pixmap (StateType state, const Glib::ustring& pixmap_name) |
| void | modify_cursor (const Gdk::Color& primary, const Gdk::Color& secondary) |
| Sets the cursor color to use in a widget, overriding the cursor_color and secondary_cursor_color style properties. | |
| void | modify_fg (StateType state, const Gdk::Color& color) |
| Sets the foreground color for a widget in a particular state. | |
| void | modify_font (const Pango::FontDescription& font_desc) |
| Sets the font to use for a widget. | |
| void | modify_style (const Glib::RefPtr<RcStyle>& style) |
| Modifies style values on the widget. | |
| void | modify_text (StateType state, const Gdk::Color& color) |
| Sets the text color for a widget in a particular state. | |
| bool | parent_sensitive () const |
| void | path (Glib::ustring& path, Glib::ustring& path_reversed) |
| Compute a widget's path of the form "GtkWindow.MyLabel". | |
| Glib::PropertyProxy_ReadOnly <bool> | property_app_paintable () const |
| Whether the application will paint directly on the widget. | |
| Glib::PropertyProxy<bool> | property_app_paintable () |
| Whether the application will paint directly on the widget. | |
| Glib::PropertyProxy_ReadOnly <bool> | property_can_default () const |
| Whether the widget can be the default widget. | |
| Glib::PropertyProxy<bool> | property_can_default () |
| Whether the widget can be the default widget. | |
| Glib::PropertyProxy_ReadOnly <bool> | property_can_focus () const |
| Whether the widget can accept the input focus. | |
| Glib::PropertyProxy<bool> | property_can_focus () |
| Whether the widget can accept the input focus. | |
| Glib::PropertyProxy_ReadOnly <bool> | property_composite_child () const |
| Whether the widget is part of a composite widget. | |
| Glib::PropertyProxy_ReadOnly <Gdk::EventMask> | property_events () const |
| The event mask that decides what kind of GdkEvents this widget gets. | |
| Glib::PropertyProxy <Gdk::EventMask> | property_events () |
| The event mask that decides what kind of GdkEvents this widget gets. | |
| Glib::PropertyProxy_ReadOnly <Gdk::ExtensionMode> | property_extension_events () const |
| The mask that decides what kind of extension events this widget gets. | |
| Glib::PropertyProxy <Gdk::ExtensionMode> | property_extension_events () |
| The mask that decides what kind of extension events this widget gets. | |
| Glib::PropertyProxy_ReadOnly <bool> | property_has_default () const |
| Whether the widget is the default widget. | |
| Glib::PropertyProxy<bool> | property_has_default () |
| Whether the widget is the default widget. | |
| Glib::PropertyProxy_ReadOnly <bool> | property_has_focus () const |
| Whether the widget has the input focus. | |
| Glib::PropertyProxy<bool> | property_has_focus () |
| Whether the widget has the input focus. | |
| Glib::PropertyProxy_ReadOnly <bool> | property_has_tooltip () const |
| Whether this widget has a tooltip. | |
| Glib::PropertyProxy<bool> | property_has_tooltip () |
| Whether this widget has a tooltip. | |
| Glib::PropertyProxy_ReadOnly<int> | property_height_request () const |
| Override for height request of the widget. | |
| Glib::PropertyProxy<int> | property_height_request () |
| Override for height request of the widget. | |
| Glib::PropertyProxy_ReadOnly <Glib::ustring> | property_name () const |
| The name of the widget. | |
| Glib::PropertyProxy <Glib::ustring> | property_name () |
| The name of the widget. | |
| Glib::PropertyProxy_ReadOnly <Container*> | property_parent () const |
| The parent widget of this widget. | |
| Glib::PropertyProxy<Container*> | property_parent () |
| The parent widget of this widget. | |
| Glib::PropertyProxy_ReadOnly <bool> | property_receives_default () const |
| If TRUE. | |
| Glib::PropertyProxy<bool> | property_receives_default () |
| If TRUE. | |
| Glib::PropertyProxy_ReadOnly <bool> | property_sensitive () const |
| Whether the widget responds to input. | |
| Glib::PropertyProxy<bool> | property_sensitive () |
| Whether the widget responds to input. | |
| Glib::PropertyProxy_ReadOnly <Glib::RefPtr<Style>> | property_style () const |
| The style of the widget. | |
| Glib::PropertyProxy <Glib::RefPtr<Style>> | property_style () |
| The style of the widget. | |
| Glib::PropertyProxy_ReadOnly <Glib::ustring> | property_tooltip_markup () const |
| The contents of the tooltip for this widget. | |
| Glib::PropertyProxy <Glib::ustring> | property_tooltip_markup () |
| The contents of the tooltip for this widget. | |
| Glib::PropertyProxy_ReadOnly <Glib::ustring> | property_tooltip_text () const |
| The contents of the tooltip for this widget. | |
| Glib::PropertyProxy <Glib::ustring> | property_tooltip_text () |
| The contents of the tooltip for this widget. | |
| Glib::PropertyProxy_ReadOnly <bool> | property_visible () const |
| Whether the widget is visible. | |
| Glib::PropertyProxy<bool> | property_visible () |
| Whether the widget is visible. | |
| Glib::PropertyProxy_ReadOnly<int> | property_width_request () const |
| Override for width request of the widget. | |
| Glib::PropertyProxy<int> | property_width_request () |
| Override for width request of the widget. | |
| void | queue_draw () |
| Equivalent to calling queue_draw_area() for the entire area of a widget. | |
| void | queue_draw_area (int x, int y, int width, int height) |
| Invalidates the rectangular area of widget defined by x, y, width and height by calling gdk_window_invalidate_rect() on the widget's window and all its child windows. | |
| void | queue_resize () |
| This function is only for use in widget implementations. | |
| void | queue_resize_no_redraw () |
| This function works like queue_resize(), except that the widget is not invalidated. | |
| bool | rc_style () const |
| bool | receives_default () const |
| Gdk::Region | region_intersect (const Gdk::Region& region) const |
| Computes the intersection of a widget's area and region, returning the intersection. | |
| bool | remove_accelerator (const Glib::RefPtr<AccelGroup>& accel_group, guint accel_key, Gdk::ModifierType accel_mods) |
| Removes an accelerator from widget, previously installed with add_accelerator(). | |
| void | remove_mnemonic_label (Widget& label) |
| Removes a widget from the list of mnemonic labels for this widget. | |
| void | remove_modal_grab () |
| Remove the modal grab of the widget in case it was previously grabbed. | |
| Glib::RefPtr<Gdk::Pixbuf> | render_icon (const StockID& stock_id, IconSize size, const Glib::ustring& detail=Glib::ustring()) |
| A convenience function that uses the theme engine and RC file settings for the widget to look up stock_id and render it to a pixbuf. | |
| void | reparent (Widget& new_parent) |
| Moves a widget from one Gtk::Container to another, handling reference count issues to avoid destroying the widget. | |
| void | reset_rc_styles () |
| void | reset_shapes () |
| Recursively resets the shape on this widget and its descendants. | |
| int | send_expose (GdkEvent* event) |
| Very rarely-used function. | |
| bool | sensitive () const |
| void | set_accel_path (const Glib::ustring& accel_path, const Glib::RefPtr<AccelGroup>& accel_group) |
| Given an accelerator group, accel_group, and an accelerator path, accel_path, sets up an accelerator in accel_group so whenever the key binding that is defined for accel_path is pressed, widget will be activated. | |
| void | set_app_paintable (bool app_paintable=true) |
| Sets whether the application intends to draw on the widget in an Gtk::Widget::expose-event handler. | |
| void | set_child_visible (bool is_visible=true) |
| Sets whether widget should be mapped along with its when its parent is mapped and widget has been shown with show(). | |
| void | set_colormap (const Glib::RefPtr<const Gdk::Colormap>& colormap) |
| Sets the colormap for the widget to the given value. | |
| void | set_composite_name (const Glib::ustring& name) |
| Sets a widgets composite name. | |
| void | set_direction (TextDirection dir) |
| Sets the reading direction on a particular widget. | |
| void | set_double_buffered (bool double_buffered=true) |
| Widgets are double buffered by default; you can use this function to turn off the buffering. | |
| void | set_events (Gdk::EventMask events) |
| Sets the event mask (see Gdk::EventMask) for a widget. | |
| void | set_extension_events (Gdk::ExtensionMode mode) |
| Sets the extension events mask to mode. | |
| void | set_flags (WidgetFlags flags) |
| void | set_has_tooltip (bool has_tooltip=TRUE) |
| Sets the has-tooltip property on widget to has_tooltip. | |
| void | set_name (const Glib::ustring& name) |
| Widgets can be named, which allows you to refer to them from a gtkrc file. | |
| void | set_no_show_all (bool no_show_all=true) |
| Sets the Gtk::Widget:no-show-all property, which determines whether calls to show_all() and hide_all() will affect this widget. | |
| void | set_parent (Widget& parent) |
| This function is useful only when implementing subclasses of Gtk::Container. | |
| void | set_parent_window (const Glib::RefPtr<const Gdk::Window>& parent_window) |
| Sets a non default parent window for widget. | |
| void | set_redraw_on_allocate (bool redraw_on_allocate=true) |
| Sets whether the entire widget is queued for drawing when its size allocation changes. | |
| bool | set_scroll_adjustments (Adjustment& hadjustment, Adjustment& vadjustment) |
For widgets that support scrolling, sets the scroll adjustments and Return value: true if the widget supports scrolling. | |
| void | set_sensitive (bool sensitive=true) |
| Sets the sensitivity of a widget. | |
| void | set_size_request (int width=-1, int height=-1) |
| Sets the minimum size of a widget; that is, the widget's size request will be width by height. | |
| void | set_state (Gtk::StateType state) |
| This function is for use in widget implementations. | |
| void | set_style (const Glib::RefPtr<Style>& style) |
| Sets the Gtk::Style for a widget ( widget->style). | |
| void | set_tooltip_markup (const Glib::ustring& markup) |
