[][src]Trait gtk::WidgetExt

pub trait WidgetExt {
    fn activate(&self) -> bool;
fn add_accelerator(
        &self,
        accel_signal: &str,
        accel_group: &AccelGroup,
        accel_key: u32,
        accel_mods: ModifierType,
        accel_flags: AccelFlags
    );
fn add_device_events<P: IsA<Device>>(&self, device: &P, events: EventMask);
fn add_events(&self, events: i32);
fn add_mnemonic_label<P: IsA<Widget>>(&self, label: &P);
fn can_activate_accel(&self, signal_id: u32) -> bool;
fn child_focus(&self, direction: DirectionType) -> bool;
fn child_notify(&self, child_property: &str);
fn compute_expand(&self, orientation: Orientation) -> bool;
fn create_pango_context(&self) -> Option<Context>;
fn create_pango_layout<'a, P: Into<Option<&'a str>>>(
        &self,
        text: P
    ) -> Option<Layout>;
fn destroy(&self);
fn device_is_shadowed<P: IsA<Device>>(&self, device: &P) -> bool;
fn drag_begin<'a, P: Into<Option<&'a Event>>>(
        &self,
        targets: &TargetList,
        actions: DragAction,
        button: i32,
        event: P
    ) -> Option<DragContext>;
fn drag_begin_with_coordinates<'a, P: Into<Option<&'a Event>>>(
        &self,
        targets: &TargetList,
        actions: DragAction,
        button: i32,
        event: P,
        x: i32,
        y: i32
    ) -> Option<DragContext>;
fn drag_check_threshold(
        &self,
        start_x: i32,
        start_y: i32,
        current_x: i32,
        current_y: i32
    ) -> bool;
fn drag_dest_add_image_targets(&self);
fn drag_dest_add_text_targets(&self);
fn drag_dest_add_uri_targets(&self);
fn drag_dest_find_target<'a, P: Into<Option<&'a TargetList>>>(
        &self,
        context: &DragContext,
        target_list: P
    ) -> Option<Atom>;
fn drag_dest_get_target_list(&self) -> Option<TargetList>;
fn drag_dest_get_track_motion(&self) -> bool;
fn drag_dest_set_proxy(
        &self,
        proxy_window: &Window,
        protocol: DragProtocol,
        use_coordinates: bool
    );
fn drag_dest_set_target_list<'a, P: Into<Option<&'a TargetList>>>(
        &self,
        target_list: P
    );
fn drag_dest_set_track_motion(&self, track_motion: bool);
fn drag_dest_unset(&self);
fn drag_get_data(&self, context: &DragContext, target: &Atom, time_: u32);
fn drag_highlight(&self);
fn drag_source_add_image_targets(&self);
fn drag_source_add_text_targets(&self);
fn drag_source_add_uri_targets(&self);
fn drag_source_get_target_list(&self) -> Option<TargetList>;
fn drag_source_set_icon_gicon<P: IsA<Icon>>(&self, icon: &P);
fn drag_source_set_icon_name(&self, icon_name: &str);
fn drag_source_set_icon_pixbuf(&self, pixbuf: &Pixbuf);
fn drag_source_set_icon_stock(&self, stock_id: &str);
fn drag_source_set_target_list<'a, P: Into<Option<&'a TargetList>>>(
        &self,
        target_list: P
    );
fn drag_source_unset(&self);
fn drag_unhighlight(&self);
fn draw(&self, cr: &Context);
fn error_bell(&self);
fn event(&self, event: &Event) -> bool;
fn freeze_child_notify(&self);
fn get_action_group(&self, prefix: &str) -> Option<ActionGroup>;
fn get_allocated_baseline(&self) -> i32;
fn get_allocated_height(&self) -> i32;
fn get_allocated_size(&self) -> (Allocation, i32);
fn get_allocated_width(&self) -> i32;
fn get_allocation(&self) -> Allocation;
fn get_ancestor(&self, widget_type: Type) -> Option<Widget>;
fn get_app_paintable(&self) -> bool;
fn get_can_default(&self) -> bool;
fn get_can_focus(&self) -> bool;
fn get_child_visible(&self) -> bool;
fn get_clip(&self) -> Allocation;
fn get_clipboard(&self, selection: &Atom) -> Clipboard;
fn get_composite_name(&self) -> Option<String>;
fn get_device_enabled<P: IsA<Device>>(&self, device: &P) -> bool;
fn get_device_events<P: IsA<Device>>(&self, device: &P) -> EventMask;
fn get_direction(&self) -> TextDirection;
fn get_display(&self) -> Option<Display>;
fn get_double_buffered(&self) -> bool;
fn get_events(&self) -> i32;
fn get_focus_on_click(&self) -> bool;
fn get_font_map(&self) -> Option<FontMap>;
fn get_font_options(&self) -> Option<FontOptions>;
fn get_frame_clock(&self) -> Option<FrameClock>;
fn get_halign(&self) -> Align;
fn get_has_tooltip(&self) -> bool;
fn get_has_window(&self) -> bool;
fn get_hexpand(&self) -> bool;
fn get_hexpand_set(&self) -> bool;
fn get_mapped(&self) -> bool;
fn get_margin_bottom(&self) -> i32;
fn get_margin_end(&self) -> i32;
fn get_margin_left(&self) -> i32;
fn get_margin_right(&self) -> i32;
fn get_margin_start(&self) -> i32;
fn get_margin_top(&self) -> i32;
fn get_modifier_mask(&self, intent: ModifierIntent) -> ModifierType;
fn get_name(&self) -> Option<String>;
fn get_no_show_all(&self) -> bool;
fn get_opacity(&self) -> f64;
fn get_pango_context(&self) -> Option<Context>;
fn get_parent(&self) -> Option<Widget>;
fn get_parent_window(&self) -> Option<Window>;
fn get_path(&self) -> WidgetPath;
fn get_preferred_height(&self) -> (i32, i32);
fn get_preferred_height_and_baseline_for_width(
        &self,
        width: i32
    ) -> (i32, i32, i32, i32);
fn get_preferred_height_for_width(&self, width: i32) -> (i32, i32);
fn get_preferred_size(&self) -> (Requisition, Requisition);
fn get_preferred_width(&self) -> (i32, i32);
fn get_preferred_width_for_height(&self, height: i32) -> (i32, i32);
fn get_realized(&self) -> bool;
fn get_receives_default(&self) -> bool;
fn get_request_mode(&self) -> SizeRequestMode;
fn get_root_window(&self) -> Option<Window>;
fn get_scale_factor(&self) -> i32;
fn get_screen(&self) -> Option<Screen>;
fn get_sensitive(&self) -> bool;
fn get_settings(&self) -> Option<Settings>;
fn get_size_request(&self) -> (i32, i32);
fn get_state_flags(&self) -> StateFlags;
fn get_style_context(&self) -> Option<StyleContext>;
fn get_support_multidevice(&self) -> bool;
fn get_template_child(
        &self,
        widget_type: Type,
        name: &str
    ) -> Option<Object>;
fn get_tooltip_markup(&self) -> Option<String>;
fn get_tooltip_text(&self) -> Option<String>;
fn get_tooltip_window(&self) -> Option<Window>;
fn get_toplevel(&self) -> Option<Widget>;
fn get_valign(&self) -> Align;
fn get_valign_with_baseline(&self) -> Align;
fn get_vexpand(&self) -> bool;
fn get_vexpand_set(&self) -> bool;
fn get_visible(&self) -> bool;
fn get_visual(&self) -> Option<Visual>;
fn get_window(&self) -> Option<Window>;
fn grab_add(&self);
fn grab_default(&self);
fn grab_focus(&self);
fn grab_remove(&self);
fn has_default(&self) -> bool;
fn has_focus(&self) -> bool;
fn has_grab(&self) -> bool;
fn has_screen(&self) -> bool;
fn has_visible_focus(&self) -> bool;
fn hide(&self);
fn hide_on_delete(&self) -> bool;
fn in_destruction(&self) -> bool;
fn init_template(&self);
fn input_shape_combine_region<'a, P: Into<Option<&'a Region>>>(
        &self,
        region: P
    );
fn insert_action_group<'a, P: IsA<ActionGroup> + 'a, Q: Into<Option<&'a P>>>(
        &self,
        name: &str,
        group: Q
    );
fn is_ancestor<P: IsA<Widget>>(&self, ancestor: &P) -> bool;
fn is_composited(&self) -> bool;
fn is_drawable(&self) -> bool;
fn is_focus(&self) -> bool;
fn is_sensitive(&self) -> bool;
fn is_toplevel(&self) -> bool;
fn is_visible(&self) -> bool;
fn keynav_failed(&self, direction: DirectionType) -> bool;
fn list_accel_closures(&self) -> Vec<Closure>;
fn list_action_prefixes(&self) -> Vec<String>;
fn list_mnemonic_labels(&self) -> Vec<Widget>;
fn map(&self);
fn mnemonic_activate(&self, group_cycling: bool) -> bool;
fn override_background_color<'a, P: Into<Option<&'a RGBA>>>(
        &self,
        state: StateFlags,
        color: P
    );
fn override_color<'a, P: Into<Option<&'a RGBA>>>(
        &self,
        state: StateFlags,
        color: P
    );
fn override_cursor<'a, 'b, P: Into<Option<&'a RGBA>>, Q: Into<Option<&'b RGBA>>>(
        &self,
        cursor: P,
        secondary_cursor: Q
    );
fn override_font<'a, P: Into<Option<&'a FontDescription>>>(
        &self,
        font_desc: P
    );
fn override_symbolic_color<'a, P: Into<Option<&'a RGBA>>>(
        &self,
        name: &str,
        color: P
    );
fn queue_allocate(&self);
fn queue_compute_expand(&self);
fn queue_draw(&self);
fn queue_draw_area(&self, x: i32, y: i32, width: i32, height: i32);
fn queue_draw_region(&self, region: &Region);
fn queue_resize(&self);
fn queue_resize_no_redraw(&self);
fn realize(&self);
fn region_intersect(&self, region: &Region) -> Option<Region>;
fn register_window(&self, window: &Window);
fn remove_accelerator(
        &self,
        accel_group: &AccelGroup,
        accel_key: u32,
        accel_mods: ModifierType
    ) -> bool;
fn remove_mnemonic_label<P: IsA<Widget>>(&self, label: &P);
fn remove_tick_callback(&self, id: u32);
fn render_icon_pixbuf(&self, stock_id: &str, size: i32) -> Option<Pixbuf>;
fn reparent<P: IsA<Widget>>(&self, new_parent: &P);
fn reset_style(&self);
fn send_expose(&self, event: &Event) -> i32;
fn send_focus_change(&self, event: &Event) -> bool;
fn set_accel_path<'a, 'b, P: Into<Option<&'a str>>, Q: Into<Option<&'b AccelGroup>>>(
        &self,
        accel_path: P,
        accel_group: Q
    );
fn set_allocation(&self, allocation: &Allocation);
fn set_app_paintable(&self, app_paintable: bool);
fn set_can_default(&self, can_default: bool);
fn set_can_focus(&self, can_focus: bool);
fn set_child_visible(&self, is_visible: bool);
fn set_clip(&self, clip: &Allocation);
fn set_composite_name(&self, name: &str);
fn set_device_enabled<P: IsA<Device>>(&self, device: &P, enabled: bool);
fn set_device_events<P: IsA<Device>>(&self, device: &P, events: EventMask);
fn set_direction(&self, dir: TextDirection);
fn set_double_buffered(&self, double_buffered: bool);
fn set_events(&self, events: i32);
fn set_focus_on_click(&self, focus_on_click: bool);
fn set_font_map<'a, P: Into<Option<&'a FontMap>>>(&self, font_map: P);
fn set_font_options<'a, P: Into<Option<&'a FontOptions>>>(&self, options: P);
fn set_halign(&self, align: Align);
fn set_has_tooltip(&self, has_tooltip: bool);
fn set_has_window(&self, has_window: bool);
fn set_hexpand(&self, expand: bool);
fn set_hexpand_set(&self, set: bool);
fn set_mapped(&self, mapped: bool);
fn set_margin_bottom(&self, margin: i32);
fn set_margin_end(&self, margin: i32);
fn set_margin_left(&self, margin: i32);
fn set_margin_right(&self, margin: i32);
fn set_margin_start(&self, margin: i32);
fn set_margin_top(&self, margin: i32);
fn set_name(&self, name: &str);
fn set_no_show_all(&self, no_show_all: bool);
fn set_opacity(&self, opacity: f64);
fn set_parent<P: IsA<Widget>>(&self, parent: &P);
fn set_parent_window(&self, parent_window: &Window);
fn set_realized(&self, realized: bool);
fn set_receives_default(&self, receives_default: bool);
fn set_redraw_on_allocate(&self, redraw_on_allocate: bool);
fn set_sensitive(&self, sensitive: bool);
fn set_size_request(&self, width: i32, height: i32);
fn set_state_flags(&self, flags: StateFlags, clear: bool);
fn set_support_multidevice(&self, support_multidevice: bool);
fn set_tooltip_markup<'a, P: Into<Option<&'a str>>>(&self, markup: P);
fn set_tooltip_text<'a, P: Into<Option<&'a str>>>(&self, text: P);
fn set_tooltip_window<'a, P: IsA<Window> + 'a, Q: Into<Option<&'a P>>>(
        &self,
        custom_window: Q
    );
fn set_valign(&self, align: Align);
fn set_vexpand(&self, expand: bool);
fn set_vexpand_set(&self, set: bool);
fn set_visible(&self, visible: bool);
fn set_visual<'a, P: Into<Option<&'a Visual>>>(&self, visual: P);
fn set_window(&self, window: &Window);
fn shape_combine_region<'a, P: Into<Option<&'a Region>>>(&self, region: P);
fn show(&self);
fn show_all(&self);
fn show_now(&self);
fn size_allocate(&self, allocation: &mut Allocation);
fn size_allocate_with_baseline(
        &self,
        allocation: &mut Allocation,
        baseline: i32
    );
fn thaw_child_notify(&self);
fn translate_coordinates<P: IsA<Widget>>(
        &self,
        dest_widget: &P,
        src_x: i32,
        src_y: i32
    ) -> Option<(i32, i32)>;
fn trigger_tooltip_query(&self);
fn unmap(&self);
fn unparent(&self);
fn unrealize(&self);
fn unregister_window(&self, window: &Window);
fn unset_state_flags(&self, flags: StateFlags);
fn get_property_composite_child(&self) -> bool;
fn get_property_expand(&self) -> bool;
fn set_property_expand(&self, expand: bool);
fn get_property_has_default(&self) -> bool;
fn set_property_has_default(&self, has_default: bool);
fn get_property_has_focus(&self) -> bool;
fn set_property_has_focus(&self, has_focus: bool);
fn get_property_height_request(&self) -> i32;
fn set_property_height_request(&self, height_request: i32);
fn get_property_is_focus(&self) -> bool;
fn set_property_is_focus(&self, is_focus: bool);
fn get_property_margin(&self) -> i32;
fn set_property_margin(&self, margin: i32);
fn get_property_width_request(&self) -> i32;
fn set_property_width_request(&self, width_request: i32);
fn connect_accel_closures_changed<F: Fn(&Self) + 'static>(
        &self,
        f: F
    ) -> SignalHandlerId;
fn connect_button_press_event<F: Fn(&Self, &EventButton) -> Inhibit + 'static>(
        &self,
        f: F
    ) -> SignalHandlerId;
fn connect_button_release_event<F: Fn(&Self, &EventButton) -> Inhibit + 'static>(
        &self,
        f: F
    ) -> SignalHandlerId;
fn connect_can_activate_accel<F: Fn(&Self, u32) -> bool + 'static>(
        &self,
        f: F
    ) -> SignalHandlerId;
fn connect_composited_changed<F: Fn(&Self) + 'static>(
        &self,
        f: F
    ) -> SignalHandlerId;
fn emit_composited_changed(&self);
fn connect_configure_event<F: Fn(&Self, &EventConfigure) -> bool + 'static>(
        &self,
        f: F
    ) -> SignalHandlerId;
fn connect_damage_event<F: Fn(&Self, &EventExpose) -> bool + 'static>(
        &self,
        f: F
    ) -> SignalHandlerId;
fn connect_delete_event<F: Fn(&Self, &Event) -> Inhibit + 'static>(
        &self,
        f: F
    ) -> SignalHandlerId;
fn connect_destroy<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId;
fn connect_destroy_event<F: Fn(&Self, &Event) -> Inhibit + 'static>(
        &self,
        f: F
    ) -> SignalHandlerId;
fn connect_direction_changed<F: Fn(&Self, TextDirection) + 'static>(
        &self,
        f: F
    ) -> SignalHandlerId;
fn connect_drag_begin<F: Fn(&Self, &DragContext) + 'static>(
        &self,
        f: F
    ) -> SignalHandlerId;
fn connect_drag_data_delete<F: Fn(&Self, &DragContext) + 'static>(
        &self,
        f: F
    ) -> SignalHandlerId;
fn connect_drag_data_get<F: Fn(&Self, &DragContext, &SelectionData, u32, u32) + 'static>(
        &self,
        f: F
    ) -> SignalHandlerId;
fn connect_drag_data_received<F: Fn(&Self, &DragContext, i32, i32, &SelectionData, u32, u32) + 'static>(
        &self,
        f: F
    ) -> SignalHandlerId;
fn connect_drag_drop<F: Fn(&Self, &DragContext, i32, i32, u32) -> Inhibit + 'static>(
        &self,
        f: F
    ) -> SignalHandlerId;
fn connect_drag_end<F: Fn(&Self, &DragContext) + 'static>(
        &self,
        f: F
    ) -> SignalHandlerId;
fn connect_drag_failed<F: Fn(&Self, &DragContext, DragResult) -> Inhibit + 'static>(
        &self,
        f: F
    ) -> SignalHandlerId;
fn connect_drag_leave<F: Fn(&Self, &DragContext, u32) + 'static>(
        &self,
        f: F
    ) -> SignalHandlerId;
fn connect_drag_motion<F: Fn(&Self, &DragContext, i32, i32, u32) -> Inhibit + 'static>(
        &self,
        f: F
    ) -> SignalHandlerId;
fn connect_draw<F: Fn(&Self, &Context) -> Inhibit + 'static>(
        &self,
        f: F
    ) -> SignalHandlerId;
fn connect_enter_notify_event<F: Fn(&Self, &EventCrossing) -> Inhibit + 'static>(
        &self,
        f: F
    ) -> SignalHandlerId;
fn connect_event<F: Fn(&Self, &Event) -> Inhibit + 'static>(
        &self,
        f: F
    ) -> SignalHandlerId;
fn connect_event_after<F: Fn(&Self, &Event) + 'static>(
        &self,
        f: F
    ) -> SignalHandlerId;
fn connect_focus<F: Fn(&Self, DirectionType) -> Inhibit + 'static>(
        &self,
        f: F
    ) -> SignalHandlerId;
fn connect_focus_in_event<F: Fn(&Self, &EventFocus) -> Inhibit + 'static>(
        &self,
        f: F
    ) -> SignalHandlerId;
fn connect_focus_out_event<F: Fn(&Self, &EventFocus) -> Inhibit + 'static>(
        &self,
        f: F
    ) -> SignalHandlerId;
fn connect_grab_broken_event<F: Fn(&Self, &EventGrabBroken) -> Inhibit + 'static>(
        &self,
        f: F
    ) -> SignalHandlerId;
fn connect_grab_focus<F: Fn(&Self) + 'static>(
        &self,
        f: F
    ) -> SignalHandlerId;
fn emit_grab_focus(&self);
fn connect_grab_notify<F: Fn(&Self, bool) + 'static>(
        &self,
        f: F
    ) -> SignalHandlerId;
fn connect_hide<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId;
fn connect_hierarchy_changed<F: Fn(&Self, &Option<Widget>) + 'static>(
        &self,
        f: F
    ) -> SignalHandlerId;
fn connect_key_press_event<F: Fn(&Self, &EventKey) -> Inhibit + 'static>(
        &self,
        f: F
    ) -> SignalHandlerId;
fn connect_key_release_event<F: Fn(&Self, &EventKey) -> Inhibit + 'static>(
        &self,
        f: F
    ) -> SignalHandlerId;
fn connect_keynav_failed<F: Fn(&Self, DirectionType) -> Inhibit + 'static>(
        &self,
        f: F
    ) -> SignalHandlerId;
fn connect_leave_notify_event<F: Fn(&Self, &EventCrossing) -> Inhibit + 'static>(
        &self,
        f: F
    ) -> SignalHandlerId;
fn connect_map<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId;
fn connect_mnemonic_activate<F: Fn(&Self, bool) -> Inhibit + 'static>(
        &self,
        f: F
    ) -> SignalHandlerId;
fn connect_motion_notify_event<F: Fn(&Self, &EventMotion) -> Inhibit + 'static>(
        &self,
        f: F
    ) -> SignalHandlerId;
fn connect_move_focus<F: Fn(&Self, DirectionType) + 'static>(
        &self,
        f: F
    ) -> SignalHandlerId;
fn emit_move_focus(&self, direction: DirectionType);
fn connect_parent_set<F: Fn(&Self, &Option<Widget>) + 'static>(
        &self,
        f: F
    ) -> SignalHandlerId;
fn connect_popup_menu<F: Fn(&Self) -> bool + 'static>(
        &self,
        f: F
    ) -> SignalHandlerId;
fn emit_popup_menu(&self) -> bool;
fn connect_property_notify_event<F: Fn(&Self, &EventProperty) -> Inhibit + 'static>(
        &self,
        f: F
    ) -> SignalHandlerId;
fn connect_proximity_in_event<F: Fn(&Self, &EventProximity) -> Inhibit + 'static>(
        &self,
        f: F
    ) -> SignalHandlerId;
fn connect_proximity_out_event<F: Fn(&Self, &EventProximity) -> Inhibit + 'static>(
        &self,
        f: F
    ) -> SignalHandlerId;
fn connect_query_tooltip<F: Fn(&Self, i32, i32, bool, &Tooltip) -> bool + 'static>(
        &self,
        f: F
    ) -> SignalHandlerId;
fn connect_realize<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId;
fn connect_screen_changed<F: Fn(&Self, &Option<Screen>) + 'static>(
        &self,
        f: F
    ) -> SignalHandlerId;
fn connect_scroll_event<F: Fn(&Self, &EventScroll) -> Inhibit + 'static>(
        &self,
        f: F
    ) -> SignalHandlerId;
fn connect_selection_clear_event<F: Fn(&Self, &EventSelection) -> Inhibit + 'static>(
        &self,
        f: F
    ) -> SignalHandlerId;
fn connect_selection_get<F: Fn(&Self, &SelectionData, u32, u32) + 'static>(
        &self,
        f: F
    ) -> SignalHandlerId;
fn connect_selection_notify_event<F: Fn(&Self, &EventSelection) -> Inhibit + 'static>(
        &self,
        f: F
    ) -> SignalHandlerId;
fn connect_selection_received<F: Fn(&Self, &SelectionData, u32) + 'static>(
        &self,
        f: F
    ) -> SignalHandlerId;
fn connect_selection_request_event<F: Fn(&Self, &EventSelection) -> Inhibit + 'static>(
        &self,
        f: F
    ) -> SignalHandlerId;
fn connect_show<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId;
fn connect_show_help<F: Fn(&Self, WidgetHelpType) -> bool + 'static>(
        &self,
        f: F
    ) -> SignalHandlerId;
fn emit_show_help(&self, help_type: WidgetHelpType) -> bool;
fn connect_size_allocate<F: Fn(&Self, &Allocation) + 'static>(
        &self,
        f: F
    ) -> SignalHandlerId;
fn connect_state_flags_changed<F: Fn(&Self, StateFlags) + 'static>(
        &self,
        f: F
    ) -> SignalHandlerId;
fn connect_style_updated<F: Fn(&Self) + 'static>(
        &self,
        f: F
    ) -> SignalHandlerId;
fn connect_touch_event<F: Fn(&Self, &Event) -> Inhibit + 'static>(
        &self,
        f: F
    ) -> SignalHandlerId;
fn connect_unmap<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId;
fn connect_unrealize<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId;
fn connect_visibility_notify_event<F: Fn(&Self, &EventVisibility) -> Inhibit + 'static>(
        &self,
        f: F
    ) -> SignalHandlerId;
fn connect_window_state_event<F: Fn(&Self, &EventWindowState) -> Inhibit + 'static>(
        &self,
        f: F
    ) -> SignalHandlerId;
fn connect_property_app_paintable_notify<F: Fn(&Self) + 'static>(
        &self,
        f: F
    ) -> SignalHandlerId;
fn connect_property_can_default_notify<F: Fn(&Self) + 'static>(
        &self,
        f: F
    ) -> SignalHandlerId;
fn connect_property_can_focus_notify<F: Fn(&Self) + 'static>(
        &self,
        f: F
    ) -> SignalHandlerId;
fn connect_property_composite_child_notify<F: Fn(&Self) + 'static>(
        &self,
        f: F
    ) -> SignalHandlerId;
fn connect_property_double_buffered_notify<F: Fn(&Self) + 'static>(
        &self,
        f: F
    ) -> SignalHandlerId;
fn connect_property_events_notify<F: Fn(&Self) + 'static>(
        &self,
        f: F
    ) -> SignalHandlerId;
fn connect_property_expand_notify<F: Fn(&Self) + 'static>(
        &self,
        f: F
    ) -> SignalHandlerId;
fn connect_property_focus_on_click_notify<F: Fn(&Self) + 'static>(
        &self,
        f: F
    ) -> SignalHandlerId;
fn connect_property_halign_notify<F: Fn(&Self) + 'static>(
        &self,
        f: F
    ) -> SignalHandlerId;
fn connect_property_has_default_notify<F: Fn(&Self) + 'static>(
        &self,
        f: F
    ) -> SignalHandlerId;
fn connect_property_has_focus_notify<F: Fn(&Self) + 'static>(
        &self,
        f: F
    ) -> SignalHandlerId;
fn connect_property_has_tooltip_notify<F: Fn(&Self) + 'static>(
        &self,
        f: F
    ) -> SignalHandlerId;
fn connect_property_height_request_notify<F: Fn(&Self) + 'static>(
        &self,
        f: F
    ) -> SignalHandlerId;
fn connect_property_hexpand_notify<F: Fn(&Self) + 'static>(
        &self,
        f: F
    ) -> SignalHandlerId;
fn connect_property_hexpand_set_notify<F: Fn(&Self) + 'static>(
        &self,
        f: F
    ) -> SignalHandlerId;
fn connect_property_is_focus_notify<F: Fn(&Self) + 'static>(
        &self,
        f: F
    ) -> SignalHandlerId;
fn connect_property_margin_notify<F: Fn(&Self) + 'static>(
        &self,
        f: F
    ) -> SignalHandlerId;
fn connect_property_margin_bottom_notify<F: Fn(&Self) + 'static>(
        &self,
        f: F
    ) -> SignalHandlerId;
fn connect_property_margin_end_notify<F: Fn(&Self) + 'static>(
        &self,
        f: F
    ) -> SignalHandlerId;
fn connect_property_margin_left_notify<F: Fn(&Self) + 'static>(
        &self,
        f: F
    ) -> SignalHandlerId;
fn connect_property_margin_right_notify<F: Fn(&Self) + 'static>(
        &self,
        f: F
    ) -> SignalHandlerId;
fn connect_property_margin_start_notify<F: Fn(&Self) + 'static>(
        &self,
        f: F
    ) -> SignalHandlerId;
fn connect_property_margin_top_notify<F: Fn(&Self) + 'static>(
        &self,
        f: F
    ) -> SignalHandlerId;
fn connect_property_name_notify<F: Fn(&Self) + 'static>(
        &self,
        f: F
    ) -> SignalHandlerId;
fn connect_property_no_show_all_notify<F: Fn(&Self) + 'static>(
        &self,
        f: F
    ) -> SignalHandlerId;
fn connect_property_opacity_notify<F: Fn(&Self) + 'static>(
        &self,
        f: F
    ) -> SignalHandlerId;
fn connect_property_parent_notify<F: Fn(&Self) + 'static>(
        &self,
        f: F
    ) -> SignalHandlerId;
fn connect_property_receives_default_notify<F: Fn(&Self) + 'static>(
        &self,
        f: F
    ) -> SignalHandlerId;
fn connect_property_scale_factor_notify<F: Fn(&Self) + 'static>(
        &self,
        f: F
    ) -> SignalHandlerId;
fn connect_property_sensitive_notify<F: Fn(&Self) + 'static>(
        &self,
        f: F
    ) -> SignalHandlerId;
fn connect_property_tooltip_markup_notify<F: Fn(&Self) + 'static>(
        &self,
        f: F
    ) -> SignalHandlerId;
fn connect_property_tooltip_text_notify<F: Fn(&Self) + 'static>(
        &self,
        f: F
    ) -> SignalHandlerId;
fn connect_property_valign_notify<F: Fn(&Self) + 'static>(
        &self,
        f: F
    ) -> SignalHandlerId;
fn connect_property_vexpand_notify<F: Fn(&Self) + 'static>(
        &self,
        f: F
    ) -> SignalHandlerId;
fn connect_property_vexpand_set_notify<F: Fn(&Self) + 'static>(
        &self,
        f: F
    ) -> SignalHandlerId;
fn connect_property_visible_notify<F: Fn(&Self) + 'static>(
        &self,
        f: F
    ) -> SignalHandlerId;
fn connect_property_width_request_notify<F: Fn(&Self) + 'static>(
        &self,
        f: F
    ) -> SignalHandlerId;
fn connect_property_window_notify<F: Fn(&Self) + 'static>(
        &self,
        f: F
    ) -> SignalHandlerId; }

Trait containing all Widget methods.

Implementors

Actionable, AppChooser, Calendar, CellEditable, Container, DrawingArea, Entry, GLArea, LevelBar, Misc, ProgressBar, Range, Separator, Spinner, Switch, ToolShell, Widget

Required Methods

For widgets that can be “activated” (buttons, menu items, etc.) this function activates them. Activation is what happens when you press Enter on a widget during key navigation. If self isn't activatable, the function returns false.

Returns

true if the widget was activatable

Installs an accelerator for this self in accel_group that causes accel_signal to be emitted if the accelerator is activated. The accel_group needs to be added to the widget’s toplevel via GtkWindowExt::add_accel_group, and the signal must be of type gobject::SignalFlags::Action. Accelerators added through this function are not user changeable during runtime. If you want to support accelerators that can be changed by the user, use AccelMap::add_entry and WidgetExt::set_accel_path or MenuItemExt::set_accel_path instead.

accel_signal

widget signal to emit on accelerator activation

accel_group

accel group for this widget, added to its toplevel

accel_key

GDK keyval of the accelerator

accel_mods

modifier key combination of the accelerator

accel_flags

flag accelerators, e.g. AccelFlags::Visible

Adds the device events in the bitfield events to the event mask for self. See WidgetExt::set_device_events for details.

device

a gdk::Device

events

an event mask, see gdk::EventMask

Adds the events in the bitfield events to the event mask for self. See WidgetExt::set_events and the [input handling overview][event-masks] for details.

events

an event mask, see gdk::EventMask

Adds a widget to the list of mnemonic labels for this widget. (See WidgetExt::list_mnemonic_labels). Note the list of mnemonic labels for the widget is cleared when the widget is destroyed, so the caller must make sure to update its internal state at this point as well, by using a connection to the Widget::destroy signal or a weak notifier.

label

a Widget that acts as a mnemonic label for self

Determines whether an accelerator that activates the signal identified by signal_id can currently be activated. This is done by emitting the Widget::can-activate-accel signal on self; if the signal isn’t overridden by a handler or in a derived widget, then the default check is that the widget must be sensitive, and the widget and all its ancestors mapped.

signal_id

the ID of a signal installed on self

Returns

true if the accelerator can be activated.

This function is used by custom widget implementations; if you're writing an app, you’d use WidgetExt::grab_focus to move the focus to a particular widget, and ContainerExt::set_focus_chain to change the focus tab order. So you may want to investigate those functions instead.

WidgetExt::child_focus is called by containers as the user moves around the window using keyboard shortcuts. direction indicates what kind of motion is taking place (up, down, left, right, tab forward, tab backward). WidgetExt::child_focus emits the Widget::focus signal; widgets override the default handler for this signal in order to implement appropriate focus behavior.

The default ::focus handler for a widget should return true if moving in direction left the focus on a focusable location inside that widget, and false if moving in direction moved the focus outside the widget. If returning true, widgets normally call WidgetExt::grab_focus to place the focus accordingly; if returning false, they don’t modify the current focus location.

direction

direction of focus movement

Returns

true if focus ended up inside self

Emits a Widget::child-notify signal for the [child property][child-properties] child_property on self.

This is the analogue of gobject::ObjectExt::notify for child properties.

Also see ContainerExt::child_notify.

child_property

the name of a child property installed on the class of self’s parent

Computes whether a container should give this widget extra space when possible. Containers should check this, rather than looking at WidgetExt::get_hexpand or WidgetExt::get_vexpand.

This function already checks whether the widget is visible, so visibility does not need to be checked separately. Non-visible widgets are not expanded.

The computed expand value uses either the expand setting explicitly set on the widget itself, or, if none has been explicitly set, the widget may expand if some of its children do.

orientation

expand direction

Returns

whether widget tree rooted here should be expanded

Creates a new pango::Context with the appropriate font map, font options, font description, and base direction for drawing text for this widget. See also WidgetExt::get_pango_context.

Returns

the new pango::Context

Creates a new pango::Layout with the appropriate font map, font description, and base direction for drawing text for this widget.

If you keep a pango::Layout created in this way around, you need to re-create it when the widget pango::Context is replaced. This can be tracked by using the Widget::screen-changed signal on the widget.

text

text to set on the layout (can be None)

Returns

the new pango::Layout

Destroys a widget.

When a widget is destroyed all references it holds on other objects will be released:

  • if the widget is inside a container, it will be removed from its parent
  • if the widget is a container, all its children will be destroyed, recursively
  • if the widget is a top level, it will be removed from the list of top level widgets that GTK+ maintains internally

It's expected that all references held on the widget will also be released; you should connect to the Widget::destroy signal if you hold a reference to self and you wish to remove it when this function is called. It is not necessary to do so if you are implementing a Container, as you'll be able to use the ContainerClass.remove() virtual function for that.

It's important to notice that WidgetExt::destroy will only cause the self to be finalized if no additional references, acquired using gobject::ObjectExt::ref, are held on it. In case additional references are in place, the self will be in an "inert" state after calling this function; self will still point to valid memory, allowing you to release the references you hold, but you may not query the widget's own state.

You should typically call this function on top level widgets, and rarely on child widgets.

See also: ContainerExt::remove

Returns true if device has been shadowed by a GTK+ device grab on another widget, so it would stop sending events to self. This may be used in the Widget::grab-notify signal to check for specific devices. See gtk_device_grab_add.

device

a gdk::Device

Returns

true if there is an ongoing grab on device by another Widget than self.

This function is equivalent to WidgetExt::drag_begin_with_coordinates, passing -1, -1 as coordinates.

Deprecated since 3.10

Use WidgetExt::drag_begin_with_coordinates instead

targets

The targets (data formats) in which the source can provide the data

actions

A bitmask of the allowed drag actions for this drag

button

The button the user clicked to start the drag

event

The event that triggered the start of the drag, or None if none can be obtained.

Returns

the context for this drag

Initiates a drag on the source side. The function only needs to be used when the application is starting drags itself, and is not needed when Widget::drag_source_set is used.

The event is used to retrieve the timestamp that will be used internally to grab the pointer. If event is None, then GDK_CURRENT_TIME will be used. However, you should try to pass a real event in all cases, since that can be used to get information about the drag.

Generally there are three cases when you want to start a drag by hand by calling this function:

  1. During a Widget::button-press-event handler, if you want to start a drag immediately when the user presses the mouse button. Pass the event that you have in your Widget::button-press-event handler.

  2. During a Widget::motion-notify-event handler, if you want to start a drag when the mouse moves past a certain threshold distance after a button-press. Pass the event that you have in your Widget::motion-notify-event handler.

  3. During a timeout handler, if you want to start a drag after the mouse button is held down for some time. Try to save the last event that you got from the mouse, using gdk_event_copy, and pass it to this function (remember to free the event with gdk_event_free when you are done). If you can really not pass a real event, pass None instead.

Feature: v3_10

targets

The targets (data formats) in which the source can provide the data

actions

A bitmask of the allowed drag actions for this drag

button

The button the user clicked to start the drag

event

The event that triggered the start of the drag, or None if none can be obtained.

x

The initial x coordinate to start dragging from, in the coordinate space of self. If -1 is passed, the coordinates are retrieved from event or the current pointer position

y

The initial y coordinate to start dragging from, in the coordinate space of self. If -1 is passed, the coordinates are retrieved from event or the current pointer position

Returns

the context for this drag

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.

start_x

X coordinate of start of drag

start_y

Y coordinate of start of drag

current_x

current X coordinate

current_y

current Y coordinate

Returns

true if the drag threshold has been passed.

Add the image targets supported by SelectionData to the target list of the drag destination. The targets are added with info = 0. If you need another value, use TargetList::add_image_targets and WidgetExt::drag_dest_set_target_list.

Add the text targets supported by SelectionData to the target list of the drag destination. The targets are added with info = 0. If you need another value, use TargetList::add_text_targets and WidgetExt::drag_dest_set_target_list.

Add the URI targets supported by SelectionData to the target list of the drag destination. The targets are added with info = 0. If you need another value, use TargetList::add_uri_targets and WidgetExt::drag_dest_set_target_list.

Looks for a match between the supported targets of context and the dest_target_list, returning the first matching target, otherwise returning GDK_NONE. dest_target_list should usually be the return value from WidgetExt::drag_dest_get_target_list, but some widgets may have different valid targets for different parts of the widget; in that case, they will have to implement a drag_motion handler that passes the correct target list to this function.

context

drag context

target_list

list of droppable targets, or None to use gtk_drag_dest_get_target_list (self).

Returns

first target that the source offers and the dest can accept, or GDK_NONE

Returns the list of targets this widget can accept from drag-and-drop.

Returns

the TargetList, or None if none

Returns whether the widget has been configured to always emit Widget::drag-motion signals.

Returns

true if the widget always emits Widget::drag-motion events

Sets this widget as a proxy for drops to another window.

Deprecated since 3.22

proxy_window

the window to which to forward drag events

protocol

the drag protocol which the proxy_window accepts (You can use gdk_drag_get_protocol to determine this)

use_coordinates

If true, send the same coordinates to the destination, because it is an embedded subwindow.

Sets the target types that this widget can accept from drag-and-drop. The widget must first be made into a drag destination with Widget::drag_dest_set.

target_list

list of droppable targets, or None for none

Tells the widget to emit Widget::drag-motion and Widget::drag-leave events regardless of the targets and the DestDefaults::Motion flag.

This may be used when a widget wants to do generic actions regardless of the targets that the source offers.

track_motion

whether to accept all targets

Clears information about a drop destination set with Widget::drag_dest_set. The widget will no longer receive notification of drags.

Gets the data associated with a drag. When the data is received or the retrieval fails, GTK+ will emit a Widget::drag-data-received signal. Failure of the retrieval is indicated by the length field of the selection_data signal parameter being negative. However, when WidgetExt::drag_get_data is called implicitely because the DestDefaults::Drop was set, then the widget will not receive notification of failed drops.

context

the drag context

target

the target (form of the data) to retrieve

time_

a timestamp for retrieving the data. This will generally be the time received in a Widget::drag-motion or Widget::drag-drop signal

Highlights a widget as a currently hovered drop target. To end the highlight, call WidgetExt::drag_unhighlight. GTK+ calls this automatically if DestDefaults::Highlight is set.

Add the writable image targets supported by SelectionData to the target list of the drag source. The targets are added with info = 0. If you need another value, use TargetList::add_image_targets and WidgetExt::drag_source_set_target_list.

Add the text targets supported by SelectionData to the target list of the drag source. The targets are added with info = 0. If you need another value, use TargetList::add_text_targets and WidgetExt::drag_source_set_target_list.

Add the URI targets supported by SelectionData to the target list of the drag source. The targets are added with info = 0. If you need another value, use TargetList::add_uri_targets and WidgetExt::drag_source_set_target_list.

Gets the list of targets this widget can provide for drag-and-drop.

Returns

the TargetList, or None if none

Sets the icon that will be used for drags from a particular source to icon. See the docs for IconTheme for more details.

icon

A gio::Icon

Sets the icon that will be used for drags from a particular source to a themed icon. See the docs for IconTheme for more details.

icon_name

name of icon to use

Sets the icon that will be used for drags from a particular widget from a gdk_pixbuf::Pixbuf. GTK+ retains a reference for pixbuf and will release it when it is no longer needed.

pixbuf

the gdk_pixbuf::Pixbuf for the drag icon

Sets the icon that will be used for drags from a particular source to a stock icon.

Deprecated since 3.10

Use WidgetExt::drag_source_set_icon_name instead.

stock_id

the ID of the stock icon to use

Changes the target types that this widget offers for drag-and-drop. The widget must first be made into a drag source with Widget::drag_source_set.

target_list

list of draggable targets, or None for none

Undoes the effects of Widget::drag_source_set.

Removes a highlight set by WidgetExt::drag_highlight from a widget.

Draws self to cr. The top left corner of the widget will be drawn to the currently set origin point of cr.

You should pass a cairo context as cr argument that is in an original state. Otherwise the resulting drawing is undefined. For example changing the operator using cairo_set_operator or the line width using cairo_set_line_width might have unwanted side effects. You may however change the context’s transform matrix - like with cairo_scale, cairo_translate or cairo_set_matrix and clip region with cairo_clip prior to calling this function. Also, it is fine to modify the context with cairo_save and cairo_push_group prior to calling this function.

Note that special-purpose widgets may contain special code for rendering to the screen and might appear differently on screen and when rendered using WidgetExt::draw.

cr

a cairo context to draw to

Notifies the user about an input-related error on this widget. If the Settings:gtk-error-bell setting is true, it calls gdk::WindowExt::beep, otherwise it does nothing.

Note that the effect of gdk::WindowExt::beep can be configured in many ways, depending on the windowing backend and the desktop environment or window manager that is used.

Rarely-used function. This function is used to emit the event signals on a widget (those signals should never be emitted without using this function to do so). If you want to synthesize an event though, don’t use this function; instead, use gtk_main_do_event so the event will behave as if it were in the event queue. Don’t synthesize expose events; instead, use gdk::WindowExt::invalidate_rect to invalidate a region of the window.

event

a GdkEvent

Returns

return from the event signal emission (true if the event was handled)

Stops emission of Widget::child-notify signals on self. The signals are queued until WidgetExt::thaw_child_notify is called on self.

This is the analogue of gobject::ObjectExt::freeze_notify for child properties.

Retrieves the gio::ActionGroup that was registered using prefix. The resulting gio::ActionGroup may have been registered to self or any Widget in its ancestry.

If no action group was found matching prefix, then None is returned.

Feature: v3_16

prefix

The “prefix” of the action group.

Returns

A gio::ActionGroup or None.

Returns the baseline that has currently been allocated to self. This function is intended to be used when implementing handlers for the Widget::draw function, and when allocating child widgets in Widget::size_allocate.

Feature: v3_10

Returns

the baseline of the self, or -1 if none

Returns the height that has currently been allocated to self. This function is intended to be used when implementing handlers for the Widget::draw function.

Returns

the height of the self

Retrieves the widget’s allocated size.

This function returns the last values passed to WidgetExt::size_allocate_with_baseline. The value differs from the size returned in WidgetExt::get_allocation in that functions like WidgetExt::set_halign can adjust the allocation, but not the value returned by this function.

If a widget is not visible, its allocated size is 0.

Feature: v3_20

allocation

a pointer to a Allocation to copy to

baseline

a pointer to an integer to copy to

Returns the width that has currently been allocated to self. This function is intended to be used when implementing handlers for the Widget::draw function.

Returns

the width of the self

Retrieves the widget’s allocation.

Note, when implementing a Container: a widget’s allocation will be its “adjusted” allocation, that is, the widget’s parent container typically calls WidgetExt::size_allocate with an allocation, and that allocation is then adjusted (to handle margin and alignment for example) before assignment to the widget. WidgetExt::get_allocation returns the adjusted allocation that was actually assigned to the widget. The adjusted allocation is guaranteed to be completely contained within the WidgetExt::size_allocate allocation, however. So a Container is guaranteed that its children stay inside the assigned bounds, but not that they have exactly the bounds the container assigned. There is no way to get the original allocation assigned by WidgetExt::size_allocate, since it isn’t stored; if a container implementation needs that information it will have to track it itself.

allocation

a pointer to a Allocation to copy to

Gets the first ancestor of self with type widget_type. For example, gtk_widget_get_ancestor (widget, GTK_TYPE_BOX) gets the first Box that’s an ancestor of self. No reference will be added to the returned widget; it should not be unreferenced. See note about checking for a toplevel Window in the docs for WidgetExt::get_toplevel.

Note that unlike WidgetExt::is_ancestor, WidgetExt::get_ancestor considers self to be an ancestor of itself.

widget_type

ancestor type

Returns

the ancestor widget, or None if not found

Determines whether the application intends to draw on the widget in an Widget::draw handler.

See WidgetExt::set_app_paintable

Returns

true if the widget is app paintable

Determines whether self can be a default widget. See WidgetExt::set_can_default.

Returns

true if self can be a default widget, false otherwise

Determines whether self can own the input focus. See WidgetExt::set_can_focus.

Returns

true if self can own the input focus, false otherwise

Gets the value set with WidgetExt::set_child_visible. If you feel a need to use this function, your code probably needs reorganization.

This function is only useful for container implementations and never should be called by an application.

Returns

true if the widget is mapped with the parent.

Retrieves the widget’s clip area.

The clip area is the area in which all of self's drawing will happen. Other toolkits call it the bounding box.

Historically, in GTK+ the clip area has been equal to the allocation retrieved via WidgetExt::get_allocation.

Feature: v3_14

clip

a pointer to a Allocation to copy to

Returns the clipboard object for the given selection to be used with self. self must have a gdk::Display associated with it, so must be attached to a toplevel window.

selection

a gdk::Atom which identifies the clipboard to use. GDK_SELECTION_CLIPBOARD gives the default clipboard. Another common value is GDK_SELECTION_PRIMARY, which gives the primary X selection.

Returns

the appropriate clipboard object. If no clipboard already exists, a new one will be created. Once a clipboard object has been created, it is persistent for all time.

Obtains the composite name of a widget.

Deprecated since 3.10

Use WidgetClass::set_template, or don’t use this API at all.

Returns

the composite name of self, or None if self is not a composite child. The string should be freed when it is no longer needed.

Returns whether device can interact with self and its children. See WidgetExt::set_device_enabled.

device

a gdk::Device

Returns

true is device is enabled for self

Returns the events mask for the widget corresponding to an specific device. These are the events that the widget will receive when device operates on it.

device

a gdk::Device

Returns

device event mask for self

Gets the reading direction for a particular widget. See WidgetExt::set_direction.

Returns

the reading direction for the widget.

Get the gdk::Display for the toplevel window associated with this widget. This function can only be called after the widget has been added to a widget hierarchy with a Window at the top.

In general, you should only create display specific resources when a widget has been realized, and you should free those resources when the widget is unrealized.

Returns

the gdk::Display for the toplevel for this widget.

Determines whether the widget is double buffered.

See WidgetExt::set_double_buffered

Returns

true if the widget is double buffered

Returns the event mask (see gdk::EventMask) for the widget. These are the events that the widget will receive.

Note: Internally, the widget event mask will be the logical OR of the event mask set through WidgetExt::set_events or WidgetExt::add_events, and the event mask necessary to cater for every EventController created for the widget.

Returns

event mask for self

Returns whether the widget should grab focus when it is clicked with the mouse. See WidgetExt::set_focus_on_click.

Feature: v3_20

Returns

true if the widget should grab focus when it is clicked with the mouse.

Gets the font map that has been set with WidgetExt::set_font_map.

Feature: v3_18

Returns

A pango::FontMap, or None

Returns the cairo::FontOptions used for Pango rendering. When not set, the defaults font options for the gdk::Screen will be used.

Feature: v3_18

Returns

the cairo::FontOptions or None if not set

Obtains the frame clock for a widget. The frame clock is a global “ticker” that can be used to drive animations and repaints. The most common reason to get the frame clock is to call gdk::FrameClockExt::get_frame_time, in order to get a time to use for animating. For example you might record the start of the animation with an initial value from gdk::FrameClockExt::get_frame_time, and then update the animation by calling gdk::FrameClockExt::get_frame_time again during each repaint.

gdk::FrameClockExt::request_phase will result in a new frame on the clock, but won’t necessarily repaint any widgets. To repaint a widget, you have to use WidgetExt::queue_draw which invalidates the widget (thus scheduling it to receive a draw on the next frame). WidgetExt::queue_draw will also end up requesting a frame on the appropriate frame clock.

A widget’s frame clock will not change while the widget is mapped. Reparenting a widget (which implies a temporary unmap) can change the widget’s frame clock.

Unrealized widgets do not have a frame clock.

Feature: v3_8

Returns

a gdk::FrameClock, or None if widget is unrealized

Gets the value of the Widget:halign property.

For backwards compatibility reasons this method will never return Align::Baseline, but instead it will convert it to Align::Fill. Baselines are not supported for horizontal alignment.

Returns

the horizontal alignment of self

Returns the current value of the has-tooltip property. See Widget:has-tooltip for more information.

Returns

current value of has-tooltip on self.

Determines whether self has a gdk::Window of its own. See WidgetExt::set_has_window.

Returns

true if self has a window, false otherwise

Gets whether the widget would like any available extra horizontal space. When a user resizes a Window, widgets with expand=TRUE generally receive the extra space. For example, a list or scrollable area or document in your window would often be set to expand.

Containers should use WidgetExt::compute_expand rather than this function, to see whether a widget, or any of its children, has the expand flag set. If any child of a widget wants to expand, the parent may ask to expand also.

This function only looks at the widget’s own hexpand flag, rather than computing whether the entire widget tree rooted at this widget wants to expand.

Returns

whether hexpand flag is set

Gets whether WidgetExt::set_hexpand has been used to explicitly set the expand flag on this widget.

If hexpand is set, then it overrides any computed expand value based on child widgets. If hexpand is not set, then the expand value depends on whether any children of the widget would like to expand.

There are few reasons to use this function, but it’s here for completeness and consistency.

Returns

whether hexpand has been explicitly set

Whether the widget is mapped.

Returns

true if the widget is mapped, false otherwise.

Gets the value of the Widget:margin-bottom property.

Returns

The bottom margin of self

Gets the value of the Widget:margin-end property.

Feature: v3_12

Returns

The end margin of self

Gets the value of the Widget:margin-left property.

Deprecated since 3.12

Use WidgetExt::get_margin_start instead.

Returns

The left margin of self

Gets the value of the Widget:margin-right property.

Deprecated since 3.12

Use WidgetExt::get_margin_end instead.

Returns

The right margin of self

Gets the value of the Widget:margin-start property.

Feature: v3_12

Returns

The start margin of self

Gets the value of the Widget:margin-top property.

Returns

The top margin of self

Returns the modifier mask the self’s windowing system backend uses for a particular purpose.

See gdk::Keymap::get_modifier_mask.

intent

the use case for the modifier mask

Returns

the modifier mask used for intent.

Retrieves the name of a widget. See WidgetExt::set_name for the significance of widget names.

Returns

name of the widget. This string is owned by GTK+ and should not be modified or freed

Returns the current value of the Widget:no-show-all property, which determines whether calls to WidgetExt::show_all will affect this widget.

Returns

the current value of the “no-show-all” property.

Fetches the requested opacity for this widget. See WidgetExt::set_opacity.

Feature: v3_8

Returns

the requested opacity for this widget.

Gets a pango::Context with the appropriate font map, font description, and base direction for this widget. Unlike the context returned by WidgetExt::create_pango_context, this context is owned by the widget (it can be used until the screen for the widget changes or the widget is removed from its toplevel), and will be updated to match any changes to the widget’s attributes. This can be tracked by using the Widget::screen-changed signal on the widget.

Returns

the pango::Context for the widget.

Returns the parent container of self.

Returns

the parent container of self, or None

Gets self’s parent window, or None if it does not have one.

Returns

the parent window of self, or None if it does not have a parent window.

Returns the WidgetPath representing self, if the widget is not connected to a toplevel widget, a partial path will be created.

Returns

The WidgetPath representing self

Retrieves a widget’s initial minimum and natural height.

This call is specific to width-for-height requests.

The returned request will be modified by the WidgetClass::adjust_size_request virtual method and by any GtkSizeGroups that have been applied. That is, the returned request is the one that should be used for layout, not necessarily the one returned by the widget itself.

minimum_height

location to store the minimum height, or None

natural_height

location to store the natural height, or None

Retrieves a widget’s minimum and natural height and the corresponding baselines if it would be given the specified width, or the default height if width is -1. The baselines may be -1 which means that no baseline is requested for this widget.

The returned request will be modified by the WidgetClass::adjust_size_request and WidgetClass::adjust_baseline_request virtual methods and by any GtkSizeGroups that have been applied. That is, the returned request is the one that should be used for layout, not necessarily the one returned by the widget itself.

Feature: v3_10

width

the width which is available for allocation, or -1 if none

minimum_height

location for storing the minimum height, or None

natural_height

location for storing the natural height, or None

minimum_baseline

location for storing the baseline for the minimum height, or None

natural_baseline

location for storing the baseline for the natural height, or None

Retrieves a widget’s minimum and natural height if it would be given the specified width.

The returned request will be modified by the WidgetClass::adjust_size_request virtual method and by any GtkSizeGroups that have been applied. That is, the returned request is the one that should be used for layout, not necessarily the one returned by the widget itself.

width

the width which is available for allocation

minimum_height

location for storing the minimum height, or None

natural_height

location for storing the natural height, or None

Retrieves the minimum and natural size of a widget, taking into account the widget’s preference for height-for-width management.

This is used to retrieve a suitable size by container widgets which do not impose any restrictions on the child placement. It can be used to deduce toplevel window and menu sizes as well as child widgets in free-form containers such as Layout.

Handle with care. Note that the natural height of a height-for-width widget will generally be a smaller size than the minimum height, since the required height for the natural width is generally smaller than the required height for the minimum width.

Use WidgetExt::get_preferred_height_and_baseline_for_width if you want to support baseline alignment.

minimum_size

location for storing the minimum size, or None

natural_size

location for storing the natural size, or None

Retrieves a widget’s initial minimum and natural width.

This call is specific to height-for-width requests.

The returned request will be modified by the WidgetClass::adjust_size_request virtual method and by any GtkSizeGroups that have been applied. That is, the returned request is the one that should be used for layout, not necessarily the one returned by the widget itself.

minimum_width

location to store the minimum width, or None

natural_width

location to store the natural width, or None

Retrieves a widget’s minimum and natural width if it would be given the specified height.

The returned request will be modified by the WidgetClass::adjust_size_request virtual method and by any GtkSizeGroups that have been applied. That is, the returned request is the one that should be used for layout, not necessarily the one returned by the widget itself.

height

the height which is available for allocation

minimum_width

location for storing the minimum width, or None

natural_width

location for storing the natural width, or None

Determines whether self is realized.

Returns

true if self is realized, false otherwise

Determines whether self is always treated as the default widget within its toplevel when it has the focus, even if another widget is the default.

See WidgetExt::set_receives_default.

Returns

true if self acts as the default widget when focused, false otherwise

Gets whether the widget prefers a height-for-width layout or a width-for-height layout.

Bin widgets generally propagate the preference of their child, container widgets need to request something either in context of their children or in context of their allocation capabilities.

Returns

The SizeRequestMode preferred by self.

Get the root window where this widget is located. This function can only be called after the widget has been added to a widget hierarchy with Window at the top.

The root window is useful for such purposes as creating a popup gdk::Window associated with the window. In general, you should only create display specific resources when a widget has been realized, and you should free those resources when the widget is unrealized.

Deprecated since 3.12

Use gdk::ScreenExt::get_root_window instead

Returns

the gdk::Window root window for the toplevel for this widget.

Retrieves the internal scale factor that maps from window coordinates to the actual device pixels. On traditional systems this is 1, on high density outputs, it can be a higher value (typically 2).

See gdk::WindowExt::get_scale_factor.

Feature: v3_10

Returns

the scale factor for self

Get the gdk::Screen from the toplevel window associated with this widget. This function can only be called after the widget has been added to a widget hierarchy with a Window at the top.

In general, you should only create screen specific resources when a widget has been realized, and you should free those resources when the widget is unrealized.

Returns

the gdk::Screen for the toplevel for this widget.

Returns the widget’s sensitivity (in the sense of returning the value that has been set using WidgetExt::set_sensitive).

The effective sensitivity of a widget is however determined by both its own and its parent widget’s sensitivity. See WidgetExt::is_sensitive.

Returns

true if the widget is sensitive

Gets the settings object holding the settings used for this widget.

Note that this function can only be called when the Widget is attached to a toplevel, since the settings object is specific to a particular gdk::Screen.

Returns

the relevant Settings object

Gets the size request that was explicitly set for the widget using WidgetExt::set_size_request. A value of -1 stored in width or height indicates that that dimension has not been set explicitly and the natural requisition of the widget will be used instead. See WidgetExt::set_size_request. To get the size a widget will actually request, call WidgetExt::get_preferred_size instead of this function.

width

return location for width, or None

height

return location for height, or None

Returns the widget state as a flag set. It is worth mentioning that the effective StateFlags::Insensitive state will be returned, that is, also based on parent insensitivity, even if self itself is sensitive.

Also note that if you are looking for a way to obtain the StateFlags to pass to a StyleContext method, you should look at StyleContextExt::get_state.

Returns

The state flags for widget

Returns the style context associated to self. The returned object is guaranteed to be the same for the lifetime of self.

Returns

a StyleContext. This memory is owned by self and must not be freed.

Returns true if self is multiple pointer aware. See WidgetExt::set_support_multidevice for more information.

Returns

true if self is multidevice aware.

Fetch an object build from the template XML for widget_type in this self instance.

This will only report children which were previously declared with WidgetClass::bind_template_child_full or one of its variants.

This function is only meant to be called for code which is private to the widget_type which declared the child and is meant for language bindings which cannot easily make use of the GObject structure offsets.

widget_type

The glib::Type to get a template child for

name

The “id” of the child defined in the template XML

Returns

The object built in the template XML with the id name

Gets the contents of the tooltip for self.

Returns

the tooltip text, or None. You should free the returned string with g_free when done.

Gets the contents of the tooltip for self.

Returns

the tooltip text, or None. You should free the returned string with g_free when done.

Returns the Window of the current tooltip. This can be the Window created by default, or the custom tooltip window set using WidgetExt::set_tooltip_window.

Returns

The Window of the current tooltip.

This function returns the topmost widget in the container hierarchy self is a part of. If self has no parent widgets, it will be returned as the topmost widget. No reference will be added to the returned widget; it should not be unreferenced.

Note the difference in behavior vs. WidgetExt::get_ancestor; gtk_widget_get_ancestor (widget, GTK_TYPE_WINDOW) would return None if self wasn’t inside a toplevel window, and if the window was inside a Window-derived widget which was in turn inside the toplevel Window. While the second case may seem unlikely, it actually happens when a Plug is embedded inside a Socket within the same application.

To reliably find the toplevel Window, use WidgetExt::get_toplevel and call WidgetExt::is_toplevel on the result.

 GtkWidget *toplevel = gtk_widget_get_toplevel (widget);
 if (gtk_widget_is_toplevel (toplevel))
   {
     // Perform action on toplevel.
   }

Returns

the topmost ancestor of self, or self itself if there’s no ancestor.

Gets the value of the Widget:valign property.

For backwards compatibility reasons this method will never return Align::Baseline, but instead it will convert it to Align::Fill. If your widget want to support baseline aligned children it must use WidgetExt::get_valign_with_baseline, or g_object_get (widget, "valign", &value, NULL), which will also report the true value.

Returns

the vertical alignment of self, ignoring baseline alignment

Gets the value of the Widget:valign property, including Align::Baseline.

Feature: v3_10

Returns

the vertical alignment of self

Gets whether the widget would like any available extra vertical space.

See WidgetExt::get_hexpand for more detail.

Returns

whether vexpand flag is set

Gets whether WidgetExt::set_vexpand has been used to explicitly set the expand flag on this widget.

See WidgetExt::get_hexpand_set for more detail.

Returns

whether vexpand has been explicitly set

Determines whether the widget is visible. If you want to take into account whether the widget’s parent is also marked as visible, use WidgetExt::is_visible instead.

This function does not check if the widget is obscured in any way.

See WidgetExt::set_visible.

Returns

true if the widget is visible

Gets the visual that will be used to render self.

Returns

the visual for self

Returns the widget’s window if it is realized, None otherwise

Returns

self’s window.

Makes self the current grabbed widget.

This means that interaction with other widgets in the same application is blocked and mouse as well as keyboard events are delivered to this widget.

If self is not sensitive, it is not set as the current grabbed widget and this function does nothing.

Causes self to become the default widget. self must be able to be a default widget; typically you would ensure this yourself by calling WidgetExt::set_can_default with a true value. The default widget is activated when the user presses Enter in a window. Default widgets must be activatable, that is, WidgetExt::activate should affect them. Note that Entry widgets require the “activates-default” property set to true before they activate the default widget when Enter is pressed and the Entry is focused.

Causes self to have the keyboard focus for the Window it's inside. self must be a focusable widget, such as a Entry; something like Frame won’t work.

More precisely, it must have the GTK_CAN_FOCUS flag set. Use WidgetExt::set_can_focus to modify that flag.

The widget also needs to be realized and mapped. This is indicated by the related signals. Grabbing the focus immediately after creating the widget will likely fail and cause critical warnings.

Removes the grab from the given widget.

You have to pair calls to WidgetExt::grab_add and WidgetExt::grab_remove.

If self does not have the grab, this function does nothing.

Determines whether self is the current default widget within its toplevel. See WidgetExt::set_can_default.

Returns

true if self is the current default widget within its toplevel, false otherwise

Determines if the widget has the global input focus. See WidgetExt::is_focus for the difference between having the global input focus, and only having the focus within a toplevel.

Returns

true if the widget has the global input focus.

Determines whether the widget is currently grabbing events, so it is the only widget receiving input events (keyboard and mouse).

See also WidgetExt::grab_add.

Returns

true if the widget is in the grab_widgets stack

Checks whether there is a gdk::Screen is associated with this widget. All toplevel widgets have an associated screen, and all widgets added into a hierarchy with a toplevel window at the top.

Returns

true if there is a gdk::Screen associated with the widget.

Determines if the widget should show a visible indication that it has the global input focus. This is a convenience function for use in ::draw handlers that takes into account whether focus indication should currently be shown in the toplevel window of self. See GtkWindowExt::get_focus_visible for more information about focus indication.

To find out if the widget has the global input focus, use WidgetExt::has_focus.

Returns

true if the widget should display a “focus rectangle”

Reverses the effects of WidgetExt::show, causing the widget to be hidden (invisible to the user).

Utility function; intended to be connected to the Widget::delete-event signal on a Window. The function calls WidgetExt::hide on its argument, then returns true. If connected to ::delete-event, the result is that clicking the close button for a window (on the window frame, top right corner usually) will hide but not destroy the window. By default, GTK+ destroys windows when ::delete-event is received.

Returns

true

Returns whether the widget is currently being destroyed. This information can sometimes be used to avoid doing unnecessary work.

Returns

true if self is being destroyed

Creates and initializes child widgets defined in templates. This function must be called in the instance initializer for any class which assigned itself a template using WidgetClass::set_template

It is important to call this function in the instance initializer of a Widget subclass and not in gobject::Object.constructed() or gobject::Object.constructor() for two reasons.

One reason is that generally derived widgets will assume that parent class composite widgets have been created in their instance initializers.

Another reason is that when calling gobject::Object::new on a widget with composite templates, it’s important to build the composite widgets before the construct properties are set. Properties passed to gobject::Object::new should take precedence over properties set in the private template XML.

Feature: v3_10

Sets an input shape for this widget’s GDK window. This allows for windows which react to mouse click in a nonrectangular region, see gdk::WindowExt::input_shape_combine_region for more information.

region

shape to be added, or None to remove an existing shape

Inserts group into self. Children of self that implement Actionable can then be associated with actions in group by setting their “action-name” to prefix.action-name.

If group is None, a previously inserted group for name is removed from self.

Feature: v3_6

name

the prefix for actions in group

group

a gio::ActionGroup, or None

Determines whether self is somewhere inside ancestor, possibly with intermediate containers.

ancestor

another Widget

Returns

true if ancestor contains self as a child, grandchild, great grandchild, etc.

Whether self can rely on having its alpha channel drawn correctly. On X11 this function returns whether a compositing manager is running for self’s screen.

Please note that the semantics of this call will change in the future if used on a widget that has a composited window in its hierarchy (as set by gdk::WindowExt::set_composited).

Deprecated since 3.22

Use gdk::ScreenExt::is_composited instead.

Returns

true if the widget can rely on its alpha channel being drawn correctly.

Determines whether self can be drawn to. A widget can be drawn to if it is mapped and visible.

Returns

true if self is drawable, false otherwise

Determines if the widget is the focus widget within its toplevel. (This does not mean that the Widget:has-focus property is necessarily set; Widget:has-focus will only be set if the toplevel widget additionally has the global input focus.)

Returns

true if the widget is the focus widget.

Returns the widget’s effective sensitivity, which means it is sensitive itself and also its parent widget is sensitive

Returns

true if the widget is effectively sensitive

Determines whether self is a toplevel widget.

Currently only Window and Invisible (and out-of-process GtkPlugs) are toplevel widgets. Toplevel widgets have no parent widget.

Returns

true if self is a toplevel, false otherwise

Determines whether the widget and all its parents are marked as visible.

This function does not check if the widget is obscured in any way.

See also WidgetExt::get_visible and WidgetExt::set_visible

Feature: v3_8

Returns

true if the widget and all its parents are visible

This function should be called whenever keyboard navigation within a single widget hits a boundary. The function emits the Widget::keynav-failed signal on the widget and its return value should be interpreted in a way similar to the return value of WidgetExt::child_focus:

When true is returned, stay in the widget, the failed keyboard navigation is OK and/or there is nowhere we can/should move the focus to.

When false is returned, the caller should continue with keyboard navigation outside the widget, e.g. by calling WidgetExt::child_focus on the widget’s toplevel.

The default ::keynav-failed handler returns true for DirectionType::TabForward and DirectionType::TabBackward. For the other values of DirectionType it returns false.

Whenever the default handler returns true, it also calls WidgetExt::error_bell to notify the user of the failed keyboard navigation.

A use case for providing an own implementation of ::keynav-failed (either by connecting to it or by overriding it) would be a row of Entry widgets where the user should be able to navigate the entire row with the cursor keys, as e.g. known from user interfaces that require entering license keys.

direction

direction of focus movement

Returns

true if stopping keyboard navigation is fine, false if the emitting widget should try to handle the keyboard navigation attempt in its parent container(s).

Lists the closures used by self for accelerator group connections with AccelGroupExt::connect_by_path or AccelGroupExt::connect. The closures can be used to monitor accelerator changes on self, by connecting to the AccelGroup::accel-changed signal of the AccelGroup of a closure which can be found out with AccelGroup::from_accel_closure.

Returns

a newly allocated glib::List of closures

Retrieves a None-terminated array of strings containing the prefixes of gio::ActionGroup's available to self.

Feature: v3_16

Returns

a None-terminated array of strings.

Returns a newly allocated list of the widgets, normally labels, for which this widget is the target of a mnemonic (see for example, LabelExt::set_mnemonic_widget).

The widgets in the list are not individually referenced. If you want to iterate through the list and perform actions involving callbacks that might destroy the widgets, you must call g_list_foreach (result, (GFunc)g_object_ref, NULL) first, and then unref all the widgets afterwards.

Returns

the list of mnemonic labels; free this list with glib::List::free when you are done with it.

This function is only for use in widget implementations. Causes a widget to be mapped if it isn’t already.

Emits the Widget::mnemonic-activate signal.

group_cycling

true if there are other widgets with the same mnemonic

Returns

true if the signal has been handled

Sets the background color to use for a widget.

All other style values are left untouched. See WidgetExt::override_color.

Deprecated since 3.16

This function is not useful in the context of CSS-based rendering. If you wish to change the way a widget renders its background you should use a custom CSS style, through an application-specific StyleProvider and a CSS style class. You can also override the default drawing of a widget through the Widget::draw signal, and use Cairo to draw a specific color, regardless of the CSS style.

state

the state for which to set the background color

color

the color to assign, or None to undo the effect of previous calls to WidgetExt::override_background_color

Sets the color to use for a widget.

All other style values are left untouched.

This function does not act recursively. Setting the color of a container does not affect its children. Note that some widgets that you may not think of as containers, for instance GtkButtons, are actually containers.

This API is mostly meant as a quick way for applications to change a widget appearance. If you are developing a widgets library and intend this change to be themeable, it is better done by setting meaningful CSS classes in your widget/container implementation through StyleContextExt::add_class.

This way, your widget library can install a CssProvider with the GTK_STYLE_PROVIDER_PRIORITY_FALLBACK priority in order to provide a default styling for those widgets that need so, and this theming may fully overridden by the user’s theme.

Note that for complex widgets this may bring in undesired results (such as uniform background color everywhere), in these cases it is better to fully style such widgets through a CssProvider with the GTK_STYLE_PROVIDER_PRIORITY_APPLICATION priority.

Deprecated since 3.16

Use a custom style provider and style classes instead

state

the state for which to set the color

color

the color to assign, or None to undo the effect of previous calls to WidgetExt::override_color

Sets the cursor color to use in a widget, overriding the cursor-color and secondary-cursor-color style properties. All other style values are left untouched. See also Widget::modify_style.

Note that the underlying properties have the gdk::Color type, so the alpha value in primary and secondary will be ignored.

Deprecated since 3.16

This function is not useful in the context of CSS-based rendering. If you wish to change the color used to render the primary and secondary cursors you should use a custom CSS style, through an application-specific StyleProvider and a CSS style class.

cursor

the color to use for primary cursor (does not need to be allocated), or None to undo the effect of previous calls to of WidgetExt::override_cursor.

secondary_cursor

the color to use for secondary cursor (does not need to be allocated), or None to undo the effect of previous calls to of WidgetExt::override_cursor.

Sets the font to use for a widget. All other style values are left untouched. See WidgetExt::override_color.

Deprecated since 3.16

This function is not useful in the context of CSS-based rendering. If you wish to change the font a widget uses to render its text you should use a custom CSS style, through an application-specific StyleProvider and a CSS style class.

font_desc

the font description to use, or None to undo the effect of previous calls to WidgetExt::override_font

Sets a symbolic color for a widget.

All other style values are left untouched. See WidgetExt::override_color for overriding the foreground or background color.

Deprecated since 3.16

This function is not useful in the context of CSS-based rendering. If you wish to change the color used to render symbolic icons you should use a custom CSS style, through an application-specific StyleProvider and a CSS style class.

name

the name of the symbolic color to modify

color

the color to assign (does not need to be allocated), or None to undo the effect of previous calls to WidgetExt::override_symbolic_color

This function is only for use in widget implementations.

Flags the widget for a rerun of the WidgetClass::size_allocate function. Use this function instead of WidgetExt::queue_resize when the self's size request didn't change but it wants to reposition its contents.

An example user of this function is WidgetExt::set_halign.

Feature: v3_20

Mark self as needing to recompute its expand flags. Call this function when setting legacy expand child properties on the child of a container.

See WidgetExt::compute_expand.

Equivalent to calling WidgetExt::queue_draw_area for the entire area of a widget.

Convenience function that calls WidgetExt::queue_draw_region on the region created from the given coordinates.

The region here is specified in widget coordinates. Widget coordinates are a bit odd; for historical reasons, they are defined as self->window coordinates for widgets that return true for WidgetExt::get_has_window, and are relative to self->allocation.x, self->allocation.y otherwise.

width or height may be 0, in this case this function does nothing. Negative values for width and height are not allowed.

x

x coordinate of upper-left corner of rectangle to redraw

y

y coordinate of upper-left corner of rectangle to redraw

width

width of region to draw

height

height of region to draw

Invalidates the area of self defined by region by calling gdk::WindowExt::invalidate_region on the widget’s window and all its child windows. Once the main loop becomes idle (after the current batch of events has been processed, roughly), the window will receive expose events for the union of all regions that have been invalidated.

Normally you would only use this function in widget implementations. You might also use it to schedule a redraw of a DrawingArea or some portion thereof.

region

region to draw

This function is only for use in widget implementations. Flags a widget to have its size renegotiated; should be called when a widget for some reason has a new size request. For example, when you change the text in a Label, Label queues a resize to ensure there’s enough space for the new text.

Note that you cannot call WidgetExt::queue_resize on a widget from inside its implementation of the WidgetClass::size_allocate virtual method. Calls to WidgetExt::queue_resize from inside WidgetClass::size_allocate will be silently ignored.

This function works like WidgetExt::queue_resize, except that the widget is not invalidated.

Creates the GDK (windowing system) resources associated with a widget. For example, self->window will be created when a widget is realized. Normally realization happens implicitly; if you show a widget and all its parent containers, then the widget will be realized and mapped automatically.

Realizing a widget requires all the widget’s parent widgets to be realized; calling WidgetExt::realize realizes the widget’s parents in addition to self itself. If a widget is not yet inside a toplevel window when you realize it, bad things will happen.

This function is primarily used in widget implementations, and isn’t very useful otherwise. Many times when you think you might need it, a better approach is to connect to a signal that will be called after the widget is realized automatically, such as Widget::draw. Or simply g_signal_connect () to the Widget::realize signal.

Computes the intersection of a self’s area and region, returning the intersection. The result may be empty, use cairo_region_is_empty to check.

Deprecated since 3.14

Use WidgetExt::get_allocation and cairo_region_intersect_rectangle to get the same behavior.

region

a cairo::Region, in the same coordinate system as self->allocation. That is, relative to self->window for widgets which return false from WidgetExt::get_has_window; relative to the parent window of self->window otherwise.

Returns

A newly allocated region holding the intersection of self and region.

Registers a gdk::Window with the widget and sets it up so that the widget receives events for it. Call WidgetExt::unregister_window when destroying the window.

Before 3.8 you needed to call gdk::WindowExt::set_user_data directly to set this up. This is now deprecated and you should use WidgetExt::register_window instead. Old code will keep working as is, although some new features like transparency might not work perfectly.

Feature: v3_8

window

a gdk::Window

Removes an accelerator from self, previously installed with WidgetExt::add_accelerator.

accel_group

accel group for this widget

accel_key

GDK keyval of the accelerator

accel_mods

modifier key combination of the accelerator

Returns

whether an accelerator was installed and could be removed

Removes a widget from the list of mnemonic labels for this widget. (See WidgetExt::list_mnemonic_labels). The widget must have previously been added to the list with WidgetExt::add_mnemonic_label.

label

a Widget that was previously set as a mnemonic label for self with WidgetExt::add_mnemonic_label.

Removes a tick callback previously registered with WidgetExt::add_tick_callback.

Feature: v3_8

id

an id returned by WidgetExt::add_tick_callback

A convenience function that uses the theme engine and style settings for self to look up stock_id and render it to a pixbuf. stock_id should be a stock icon ID such as GTK_STOCK_OPEN or GTK_STOCK_OK. size should be a size such as IconSize::Menu.

The pixels in the returned gdk_pixbuf::Pixbuf are shared with the rest of the application and should not be modified. The pixbuf should be freed after use with gobject::ObjectExt::unref.

Deprecated since 3.10

Use IconThemeExt::load_icon instead.

stock_id

a stock ID

size

a stock size (IconSize). A size of (GtkIconSize)-1 means render at the size of the source and don’t scale (if there are multiple source sizes, GTK+ picks one of the available sizes).

Returns

a new pixbuf, or None if the stock ID wasn’t known

Moves a widget from one Container to another, handling reference count issues to avoid destroying the widget.

Deprecated since 3.14

Use ContainerExt::remove and ContainerExt::add.

new_parent

a Container to move the widget into

Updates the style context of self and all descendants by updating its widget path. GtkContainers may want to use this on a child when reordering it in a way that a different style might apply to it. See also ContainerExt::get_path_for_child.

Very rarely-used function. This function is used to emit an expose event on a widget. This function is not normally used directly. The only time it is used is when propagating an expose event to a windowless child widget (WidgetExt::get_has_window is false), and that is normally done using ContainerExt::propagate_draw.

If you want to force an area of a window to be redrawn, use gdk::WindowExt::invalidate_rect or gdk::WindowExt::invalidate_region. To cause the redraw to be done immediately, follow that call with a call to gdk::WindowExt::process_updates.

Deprecated since 3.22

Application and widget code should not handle expose events directly; invalidation should use the Widget API, and drawing should only happen inside Widget::draw implementations

event

a expose GdkEvent

Returns

return from the event signal emission (true if the event was handled)

Sends the focus change event to self

This function is not meant to be used by applications. The only time it should be used is when it is necessary for a Widget to assign focus to a widget that is semantically owned by the first widget even though it’s not a direct child - for instance, a search entry in a floating window similar to the quick search in TreeView.

An example of its usage is:

  GdkEvent *fevent = gdk_event_new (GDK_FOCUS_CHANGE);

  fevent->focus_change.type = GDK_FOCUS_CHANGE;
  fevent->focus_change.in = TRUE;
  fevent->focus_change.window = _gtk_widget_get_window (widget);
  if (fevent->focus_change.window != NULL)
    g_object_ref (fevent->focus_change.window);

  gtk_widget_send_focus_change (widget, fevent);

  gdk_event_free (event);

event

a GdkEvent of type GDK_FOCUS_CHANGE

Returns

the return value from the event signal emission: true if the event was handled, and false otherwise

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, self will be activated. This removes any accelerators (for any accelerator group) installed by previous calls to WidgetExt::set_accel_path. Associating accelerators with paths allows them to be modified by the user and the modifications to be saved for future use. (See AccelMap::save.)

This function is a low level function that would most likely be used by a menu creation system like UIManager. If you use UIManager, setting up accelerator paths will be done automatically.

Even when you you aren’t using UIManager, if you only want to set up accelerators on menu items MenuItemExt::set_accel_path provides a somewhat more convenient interface.

Note that accel_path string will be stored in a glib::Quark. Therefore, if you pass a static string, you can save some memory by interning it first with g_intern_static_string.

accel_path

path used to look up the accelerator

accel_group

a AccelGroup.

Sets the widget’s allocation. This should not be used directly, but from within a widget’s size_allocate method.

The allocation set should be the “adjusted” or actual allocation. If you’re implementing a Container, you want to use WidgetExt::size_allocate instead of WidgetExt::set_allocation. The WidgetClass::adjust_size_allocation virtual method adjusts the allocation inside WidgetExt::size_allocate to create an adjusted allocation.

allocation

a pointer to a Allocation to copy from

Sets whether the application intends to draw on the widget in an Widget::draw handler.

This is a hint to the widget and does not affect the behavior of the GTK+ core; many widgets ignore this flag entirely. For widgets that do pay attention to the flag, such as EventBox and Window, the effect is to suppress default themed drawing of the widget's background. (Children of the widget will still be drawn.) The application is then entirely responsible for drawing the widget background.

Note that the background is still drawn when the widget is mapped.

app_paintable

true if the application will paint on the widget

Specifies whether self can be a default widget. See WidgetExt::grab_default for details about the meaning of “default”.

can_default

whether or not self can be a default widget.

Specifies whether self can own the input focus. See WidgetExt::grab_focus for actually setting the input focus on a widget.

can_focus

whether or not self can own the input focus.

Sets whether self should be mapped along with its when its parent is mapped and self has been shown with WidgetExt::show.

The child visibility can be set for widget before it is added to a container with WidgetExt::set_parent, to avoid mapping children unnecessary before immediately unmapping them. However it will be reset to its default state of true when the widget is removed from a container.

Note that changing the child visibility of a widget does not queue a resize on the widget. Most of the time, the size of a widget is computed from all visible children, whether or not they are mapped. If this is not the case, the container can queue a resize itself.

This function is only useful for container implementations and never should be called by an application.

is_visible

if true, self should be mapped along with its parent.

Sets the widget’s clip. This must not be used directly, but from within a widget’s size_allocate method. It must be called after WidgetExt::set_allocation (or after chaining up to the parent class), because that function resets the clip.

The clip set should be the area that self draws on. If self is a Container, the area must contain all children's clips.

If this function is not called by self during a ::size-allocate handler, the clip will be set to self's allocation.

Feature: v3_14

clip

a pointer to a Allocation to copy from

Sets a widgets composite name. The widget must be a composite child of its parent; see Widget::push_composite_child.

Deprecated since 3.10

Use WidgetClass::set_template, or don’t use this API at all.

name

the name to set

Enables or disables a gdk::Device to interact with self and all its children.

It does so by descending through the gdk::Window hierarchy and enabling the same mask that is has for core events (i.e. the one that gdk::WindowExt::get_events returns).

device

a gdk::Device

enabled

whether to enable the device

Sets the device event mask (see gdk::EventMask) for a widget. The event mask determines which events a widget will receive from device. Keep in mind that different widgets have different default event masks, and by changing the event mask you may disrupt a widget’s functionality, so be careful. This function must be called while a widget is unrealized. Consider WidgetExt::add_device_events for widgets that are already realized, or if you want to preserve the existing event mask. This function can’t be used with windowless widgets (which return false from WidgetExt::get_has_window); to get events on those widgets, place them inside a EventBox and receive events on the event box.

device

a gdk::Device

events

event mask

Sets the reading direction on a particular widget. This direction controls the primary direction for widgets containing text, and also the direction in which the children of a container are packed. The ability to set the direction is present in order so that correct localization into languages with right-to-left reading directions can be done. Generally, applications will let the default reading direction present, except for containers where the containers are arranged in an order that is explicitly visual rather than logical (such as buttons for text justification).

If the direction is set to TextDirection::None, then the value set by Widget::set_default_direction will be used.

dir

the new direction

Widgets are double buffered by default; you can use this function to turn off the buffering. “Double buffered” simply means that gdk::WindowExt::begin_draw_frame and gdk::WindowExt::end_draw_frame are called automatically around expose events sent to the widget. gdk::WindowExt::begin_draw_frame diverts all drawing to a widget's window to an offscreen buffer, and gdk::WindowExt::end_draw_frame draws the buffer to the screen. The result is that users see the window update in one smooth step, and don’t see individual graphics primitives being rendered.

In very simple terms, double buffered widgets don’t flicker, so you would only use this function to turn off double buffering if you had special needs and really knew what you were doing.

Note: if you turn off double-buffering, you have to handle expose events, since even the clearing to the background color or pixmap will not happen automatically (as it is done in gdk::WindowExt::begin_draw_frame).

In 3.10 GTK and GDK have been restructured for translucent drawing. Since then expose events for double-buffered widgets are culled into a single event to the toplevel GDK window. If you now unset double buffering, you will cause a separate rendering pass for every widget. This will likely cause rendering problems - in particular related to stacking - and usually increases rendering times significantly.

Deprecated since 3.14

This function does not work under non-X11 backends or with non-native windows. It should not be used in newly written code.

double_buffered

true to double-buffer a widget

Sets the event mask (see gdk::EventMask) for a widget. The event mask determines which events a widget will receive. Keep in mind that different widgets have different default event masks, and by changing the event mask you may disrupt a widget’s functionality, so be careful. This function must be called while a widget is unrealized. Consider WidgetExt::add_events for widgets that are already realized, or if you want to preserve the existing event mask. This function can’t be used with widgets that have no window. (See WidgetExt::get_has_window). To get events on those widgets, place them inside a EventBox and receive events on the event box.

events

event mask

Sets whether the widget should grab focus when it is clicked with the mouse. Making mouse clicks not grab focus is useful in places like toolbars where you don’t want the keyboard focus removed from the main area of the application.

Feature: v3_20

focus_on_click

whether the widget should grab focus when clicked with the mouse

Sets the font map to use for Pango rendering. When not set, the widget will inherit the font map from its parent.

Feature: v3_18

font_map

a pango::FontMap, or None to unset any previously set font map

Sets the cairo::FontOptions used for Pango rendering in this widget. When not set, the default font options for the gdk::Screen will be used.

Feature: v3_18

options

a cairo::FontOptions, or None to unset any previously set default font options.

Sets the horizontal alignment of self. See the Widget:halign property.

align

the horizontal alignment

Sets the has-tooltip property on self to has_tooltip. See Widget:has-tooltip for more information.

has_tooltip

whether or not self has a tooltip.

Specifies whether self has a gdk::Window of its own. Note that all realized widgets have a non-None “window” pointer (WidgetExt::get_window never returns a None window when a widget is realized), but for many of them it’s actually the gdk::Window of one of its parent widgets. Widgets that do not create a window for themselves in Widget::realize must announce this by calling this function with has_window = false.

This function should only be called by widget implementations, and they should call it in their init function.

has_window

whether or not self has a window.

Sets whether the widget would like any available extra horizontal space. When a user resizes a Window, widgets with expand=TRUE generally receive the extra space. For example, a list or scrollable area or document in your window would often be set to expand.

Call this function to set the expand flag if you would like your widget to become larger horizontally when the window has extra room.

By default, widgets automatically expand if any of their children want to expand. (To see if a widget will automatically expand given its current children and state, call WidgetExt::compute_expand. A container can decide how the expandability of children affects the expansion of the container by overriding the compute_expand virtual method on Widget.).

Setting hexpand explicitly with this function will override the automatic expand behavior.

This function forces the widget to expand or not to expand, regardless of children. The override occurs because WidgetExt::set_hexpand sets the hexpand-set property (see WidgetExt::set_hexpand_set) which causes the widget’s hexpand value to be used, rather than looking at children and widget state.

expand

whether to expand

Sets whether the hexpand flag (see WidgetExt::get_hexpand) will be used.

The hexpand-set property will be set automatically when you call WidgetExt::set_hexpand to set hexpand, so the most likely reason to use this function would be to unset an explicit expand flag.

If hexpand is set, then it overrides any computed expand value based on child widgets. If hexpand is not set, then the expand value depends on whether any children of the widget would like to expand.

There are few reasons to use this function, but it’s here for completeness and consistency.

set

value for hexpand-set property

Marks the widget as being realized.

This function should only ever be called in a derived widget's “map” or “unmap” implementation.

mapped

true to mark the widget as mapped

Sets the bottom margin of self. See the Widget:margin-bottom property.

margin

the bottom margin

Sets the end margin of self. See the Widget:margin-end property.

Feature: v3_12

margin

the end margin

Sets the left margin of self. See the Widget:margin-left property.

Deprecated since 3.12

Use WidgetExt::set_margin_start instead.

margin

the left margin

Sets the right margin of self. See the Widget:margin-right property.

Deprecated since 3.12

Use WidgetExt::set_margin_end instead.

margin

the right margin

Sets the start margin of self. See the Widget:margin-start property.

Feature: v3_12

margin

the start margin

Sets the top margin of self. See the Widget:margin-top property.

margin

the top margin

Widgets can be named, which allows you to refer to them from a CSS file. You can apply a style to widgets with a particular name in the CSS file. See the documentation for the CSS syntax (on the same page as the docs for StyleContext).

Note that the CSS syntax has certain special characters to delimit and represent elements in a selector (period, #, >, *...), so using these will make your widget impossible to match by name. Any combination of alphanumeric symbols, dashes and underscores will suffice.

name

name for the widget

Sets the Widget:no-show-all property, which determines whether calls to WidgetExt::show_all will affect this widget.

This is mostly for use in constructing widget hierarchies with externally controlled visibility, see UIManager.

no_show_all

the new value for the “no-show-all” property

Request the self to be rendered partially transparent, with opacity 0 being fully transparent and 1 fully opaque. (Opacity values are clamped to the [0,1] range.). This works on both toplevel widget, and child widgets, although there are some limitations:

For toplevel widgets this depends on the capabilities of the windowing system. On X11 this has any effect only on X screens with a compositing manager running. See WidgetExt::is_composited. On Windows it should work always, although setting a window’s opacity after the window has been shown causes it to flicker once on Windows.

For child widgets it doesn’t work if any affected widget has a native window, or disables double buffering.

Feature: v3_8

opacity

desired opacity, between 0 and 1

This function is useful only when implementing subclasses of Container. Sets the container as the parent of self, and takes care of some details such as updating the state and style of the child to reflect its new location. The opposite function is WidgetExt::unparent.

parent

parent container

Sets a non default parent window for self.

For Window classes, setting a parent_window effects whether the window is a toplevel window or can be embedded into other widgets.

For Window classes, this needs to be called before the window is realized.

parent_window

the new parent window.

Marks the widget as being realized. This function must only be called after all GdkWindows for the self have been created and registered.

This function should only ever be called in a derived widget's “realize” or “unrealize” implementation.

realized

true to mark the widget as realized

Specifies whether self will be treated as the default widget within its toplevel when it has the focus, even if another widget is the default.

See WidgetExt::grab_default for details about the meaning of “default”.

receives_default

whether or not self can be a default widget.

Sets whether the entire widget is queued for drawing when its size allocation changes. By default, this setting is true and the entire widget is redrawn on every size change. If your widget leaves the upper left unchanged when made bigger, turning this setting off will improve performance.

Note that for widgets where WidgetExt::get_has_window is false setting this flag to false turns off all allocation on resizing: the widget will not even redraw if its position changes; this is to allow containers that don’t draw anything to avoid excess invalidations. If you set this flag on a widget with no window that does draw on self->window, you are responsible for invalidating both the old and new allocation of the widget when the widget is moved and responsible for invalidating regions newly when the widget increases size.

redraw_on_allocate

if true, the entire widget will be redrawn when it is allocated to a new size. Otherwise, only the new portion of the widget will be redrawn.

Sets the sensitivity of a widget. A widget is sensitive if the user can interact with it. Insensitive widgets are “grayed out” and the user can’t interact with them. Insensitive widgets are known as “inactive”, “disabled”, or “ghosted” in some other toolkits.

sensitive

true to make the widget sensitive

Sets the minimum size of a widget; that is, the widget’s size request will be at least width by height. You can use this function to force a widget to be larger than it normally would be.

In most cases, GtkWindowExt::set_default_size is a better choice for toplevel windows than this function; setting the default size will still allow users to shrink the window. Setting the size request will force them to leave the window at least as large as the size request. When dealing with window sizes, GtkWindowExt::set_geometry_hints can be a useful function as well.

Note the inherent danger of setting any fixed size - themes, translations into other languages, different fonts, and user action can all change the appropriate size for a given widget. So, it's basically impossible to hardcode a size that will always be correct.

The size request of a widget is the smallest size a widget can accept while still functioning well and drawing itself correctly. However in some strange cases a widget may be allocated less than its requested size, and in many cases a widget may be allocated more space than it requested.

If the size request in a given direction is -1 (unset), then the “natural” size request of the widget will be used instead.

The size request set here does not include any margin from the Widget properties margin-left, margin-right, margin-top, and margin-bottom, but it does include pretty much all other padding or border properties set by any subclass of Widget.

width

width self should request, or -1 to unset

height

height self should request, or -1 to unset

This function is for use in widget implementations. Turns on flag values in the current widget state (insensitive, prelighted, etc.).

This function accepts the values StateFlags::DirLtr and StateFlags::DirRtl but ignores them. If you want to set the widget's direction, use WidgetExt::set_direction.

It is worth mentioning that any other state than StateFlags::Insensitive, will be propagated down to all non-internal children if self is a Container, while StateFlags::Insensitive itself will be propagated down to all Container children by different means than turning on the state flag down the hierarchy, both WidgetExt::get_state_flags and WidgetExt::is_sensitive will make use of these.

flags

State flags to turn on

clear

Whether to clear state before turning on flags

Enables or disables multiple pointer awareness. If this setting is true, self will start receiving multiple, per device enter/leave events. Note that if custom GdkWindows are created in Widget::realize, gdk::WindowExt::set_support_multidevice will have to be called manually on them.

support_multidevice

true to support input from multiple devices.

Sets markup as the contents of the tooltip, which is marked up with the Pango text markup language.

This function will take care of setting Widget:has-tooltip to true and of the default handler for the Widget::query-tooltip signal.

See also the Widget:tooltip-markup property and Tooltip::set_markup.

markup

the contents of the tooltip for self, or None

Sets text as the contents of the tooltip. This function will take care of setting Widget:has-tooltip to true and of the default handler for the Widget::query-tooltip signal.

See also the Widget:tooltip-text property and TooltipExt::set_text.

text

the contents of the tooltip for self

Replaces the default window used for displaying tooltips with custom_window. GTK+ will take care of showing and hiding custom_window at the right moment, to behave likewise as the default tooltip window. If custom_window is None, the default tooltip window will be used.

custom_window

a Window, or None

Sets the vertical alignment of self. See the Widget:valign property.

align

the vertical alignment

Sets whether the widget would like any available extra vertical space.

See WidgetExt::set_hexpand for more detail.

expand

whether to expand

Sets whether the vexpand flag (see WidgetExt::get_vexpand) will be used.

See WidgetExt::set_hexpand_set for more detail.

set

value for vexpand-set property

Sets the visibility state of self. Note that setting this to true doesn’t mean the widget is actually viewable, see WidgetExt::get_visible.

This function simply calls WidgetExt::show or WidgetExt::hide but is nicer to use when the visibility of the widget depends on some condition.

visible

whether the widget should be shown or not

Sets the visual that should be used for by widget and its children for creating GdkWindows. The visual must be on the same gdk::Screen as returned by WidgetExt::get_screen, so handling the Widget::screen-changed signal is necessary.

Setting a new visual will not cause self to recreate its windows, so you should call this function before self is realized.

visual

visual to be used or None to unset a previous one

Sets a widget’s window. This function should only be used in a widget’s Widget::realize implementation. The window passed is usually either new window created with gdk::Window::new, or the window of its parent widget as returned by WidgetExt::get_parent_window.

Widgets must indicate whether they will create their own gdk::Window by calling WidgetExt::set_has_window. This is usually done in the widget’s init function.

Note that this function does not add any reference to window.

window

a gdk::Window

Sets a shape for this widget’s GDK window. This allows for transparent windows etc., see gdk::WindowExt::shape_combine_region for more information.

region

shape to be added, or None to remove an existing shape

Flags a widget to be displayed. Any widget that isn’t shown will not appear on the screen. If you want to show all the widgets in a container, it’s easier to call WidgetExt::show_all on the container, instead of individually showing the widgets.

Remember that you have to show the containers containing a widget, in addition to the widget itself, before it will appear onscreen.

When a toplevel container is shown, it is immediately realized and mapped; other shown widgets are realized and mapped when their toplevel container is realized and mapped.

Recursively shows a widget, and any child widgets (if the widget is a container).

Shows a widget. If the widget is an unmapped toplevel widget (i.e. a Window that has not yet been shown), enter the main loop and wait for the window to actually be mapped. Be careful; because the main loop is running, anything can happen during this function.

This function is only used by Container subclasses, to assign a size and position to their child widgets.

In this function, the allocation may be adjusted. It will be forced to a 1x1 minimum size, and the adjust_size_allocation virtual method on the child will be used to adjust the allocation. Standard adjustments include removing the widget’s margins, and applying the widget’s Widget:halign and Widget:valign properties.

For baseline support in containers you need to use WidgetExt::size_allocate_with_baseline instead.

allocation

position and size to be allocated to self

This function is only used by Container subclasses, to assign a size, position and (optionally) baseline to their child widgets.

In this function, the allocation and baseline may be adjusted. It will be forced to a 1x1 minimum size, and the adjust_size_allocation virtual and adjust_baseline_allocation methods on the child will be used to adjust the allocation and baseline. Standard adjustments include removing the widget's margins, and applying the widget’s Widget:halign and Widget:valign properties.

If the child widget does not have a valign of Align::Baseline the baseline argument is ignored and -1 is used instead.

Feature: v3_10

allocation

position and size to be allocated to self

baseline

The baseline of the child, or -1

Reverts the effect of a previous call to WidgetExt::freeze_child_notify. This causes all queued Widget::child-notify signals on self to be emitted.

Translate coordinates relative to self’s allocation to coordinates relative to dest_widget’s allocations. In order to perform this operation, both widgets must be realized, and must share a common toplevel.

dest_widget

a Widget

src_x

X position relative to self

src_y

Y position relative to self

dest_x

location to store X position relative to dest_widget

dest_y

location to store Y position relative to dest_widget

Returns

false if either widget was not realized, or there was no common ancestor. In this case, nothing is stored in *dest_x and *dest_y. Otherwise true.

Triggers a tooltip query on the display where the toplevel of self is located. See Tooltip::trigger_tooltip_query for more information.

This function is only for use in widget implementations. Causes a widget to be unmapped if it’s currently mapped.

This function is only for use in widget implementations. Should be called by implementations of the remove method on Container, to dissociate a child from the container.

This function is only useful in widget implementations. Causes a widget to be unrealized (frees all GDK resources associated with the widget, such as self->window).

Unregisters a gdk::Window from the widget that was previously set up with WidgetExt::register_window. You need to call this when the window is no longer used by the widget, such as when you destroy it.

Feature: v3_8

window

a gdk::Window

This function is for use in widget implementations. Turns off flag values for the current widget state (insensitive, prelighted, etc.). See WidgetExt::set_state_flags.

flags

State flags to turn off

Whether to expand in both directions. Setting this sets both Widget:hexpand and Widget:vexpand

Whether to expand in both directions. Setting this sets both Widget:hexpand and Widget:vexpand

Sets all four sides' margin at once. If read, returns max margin on any side.

Sets all four sides' margin at once. If read, returns max margin on any side.

The ::button-press-event signal will be emitted when a button (typically from a mouse) is pressed.

To receive this signal, the gdk::Window associated to the widget needs to enable the gdk::EventMask::ButtonPressMask mask.

This signal will be sent to the grab widget if there is one.

event

the gdk::EventButton which triggered this signal.

Returns

true to stop other handlers from being invoked for the event. false to propagate the event further.

The ::button-release-event signal will be emitted when a button (typically from a mouse) is released.

To receive this signal, the gdk::Window associated to the widget needs to enable the gdk::EventMask::ButtonReleaseMask mask.

This signal will be sent to the grab widget if there is one.

event

the gdk::EventButton which triggered this signal.

Returns

true to stop other handlers from being invoked for the event. false to propagate the event further.

Determines whether an accelerator that activates the signal identified by signal_id can currently be activated. This signal is present to allow applications and derived widgets to override the default Widget handling for determining whether an accelerator can be activated.

signal_id

the ID of a signal installed on widget

Returns

true if the signal can be activated.

The ::composited-changed signal is emitted when the composited status of widgets screen changes. See gdk::ScreenExt::is_composited.

Deprecated since 3.22

Use gdk::Screen::composited-changed instead.

The ::configure-event signal will be emitted when the size, position or stacking of the widget's window has changed.

To receive this signal, the gdk::Window associated to the widget needs to enable the gdk::EventMask::StructureMask mask. GDK will enable this mask automatically for all new windows.

event

the gdk::EventConfigure which triggered this signal.

Returns

true to stop other handlers from being invoked for the event. false to propagate the event further.

Emitted when a redirected window belonging to widget gets drawn into. The region/area members of the event shows what area of the redirected drawable was drawn into.

event

the gdk::EventExpose event

Returns

true to stop other handlers from being invoked for the event. false to propagate the event further.

The ::delete-event signal is emitted if a user requests that a toplevel window is closed. The default handler for this signal destroys the window. Connecting WidgetExt::hide_on_delete to this signal will cause the window to be hidden instead, so that it can later be shown again without reconstructing it.

event

the event which triggered this signal

Returns

true to stop other handlers from being invoked for the event. false to propagate the event further.

Signals that all holders of a reference to the widget should release the reference that they hold. May result in finalization of the widget if all references are released.

This signal is not suitable for saving widget state.

The ::destroy-event signal is emitted when a gdk::Window is destroyed. You rarely get this signal, because most widgets disconnect themselves from their window before they destroy it, so no widget owns the window at destroy time.

To receive this signal, the gdk::Window associated to the widget needs to enable the gdk::EventMask::StructureMask mask. GDK will enable this mask automatically for all new windows.

event

the event which triggered this signal

Returns

true to stop other handlers from being invoked for the event. false to propagate the event further.

The ::direction-changed signal is emitted when the text direction of a widget changes.

previous_direction

the previous text direction of widget

The ::drag-begin signal is emitted on the drag source when a drag is started. A typical reason to connect to this signal is to set up a custom drag icon with e.g. WidgetExt::drag_source_set_icon_pixbuf.

Note that some widgets set up a drag icon in the default handler of this signal, so you may have to use g_signal_connect_after to override what the default handler did.

context

the drag context

The ::drag-data-delete signal is emitted on the drag source when a drag with the action gdk::DragAction::Move is successfully completed. The signal handler is responsible for deleting the data that has been dropped. What "delete" means depends on the context of the drag operation.

context

the drag context

The ::drag-data-get signal is emitted on the drag source when the drop site requests the data which is dragged. It is the responsibility of the signal handler to fill data with the data in the format which is indicated by info. See SelectionData::set and SelectionData::set_text.

context

the drag context

data

the SelectionData to be filled with the dragged data

info

the info that has been registered with the target in the TargetList

time

the timestamp at which the data was requested

The ::drag-data-received signal is emitted on the drop site when the dragged data has been received. If the data was received in order to determine whether the drop will be accepted, the handler is expected to call gdk_drag_status and not finish the drag. If the data was received in response to a Widget::drag-drop signal (and this is the last target to be received), the handler for this signal is expected to process the received data and then call gtk_drag_finish, setting the success parameter depending on whether the data was processed successfully.

Applications must create some means to determine why the signal was emitted and therefore whether to call gdk_drag_status or gtk_drag_finish.

The handler may inspect the selected action with gdk::DragContextExt::get_selected_action before calling gtk_drag_finish, e.g. to implement gdk::DragAction::Ask as shown in the following example:

void
drag_data_received (GtkWidget          *widget,
                    GdkDragContext     *context,
                    gint                x,
                    gint                y,
                    GtkSelectionData   *data,
                    guint               info,
                    guint               time)
{
  if ((data->length >= 0) && (data->format == 8))
    {
      GdkDragAction action;

      // handle data here

      action = gdk_drag_context_get_selected_action (context);
      if (action == GDK_ACTION_ASK)
        {
          GtkWidget *dialog;
          gint response;

          dialog = gtk_message_dialog_new (NULL,
                                           GTK_DIALOG_MODAL |
                                           GTK_DIALOG_DESTROY_WITH_PARENT,
                                           GTK_MESSAGE_INFO,
                                           GTK_BUTTONS_YES_NO,
                                           "Move the data ?\n");
          response = gtk_dialog_run (GTK_DIALOG (dialog));
          gtk_widget_destroy (dialog);

          if (response == GTK_RESPONSE_YES)
            action = GDK_ACTION_MOVE;
          else
            action = GDK_ACTION_COPY;
         }

      gtk_drag_finish (context, TRUE, action == GDK_ACTION_MOVE, time);
    }
  else
    gtk_drag_finish (context, FALSE, FALSE, time);
 }

context

the drag context

x

where the drop happened

y

where the drop happened

data

the received data

info

the info that has been registered with the target in the TargetList

time

the timestamp at which the data was received

The ::drag-drop signal is emitted on the drop site when the user drops the data onto the widget. The signal handler must determine whether the cursor position is in a drop zone or not. If it is not in a drop zone, it returns false and no further processing is necessary. Otherwise, the handler returns true. In this case, the handler must ensure that gtk_drag_finish is called to let the source know that the drop is done. The call to gtk_drag_finish can be done either directly or in a Widget::drag-data-received handler which gets triggered by calling WidgetExt::drag_get_data to receive the data for one or more of the supported targets.

context

the drag context

x

the x coordinate of the current cursor position

y

the y coordinate of the current cursor position

time

the timestamp of the motion event

Returns

whether the cursor position is in a drop zone

The ::drag-end signal is emitted on the drag source when a drag is finished. A typical reason to connect to this signal is to undo things done in Widget::drag-begin.

context

the drag context

The ::drag-failed signal is emitted on the drag source when a drag has failed. The signal handler may hook custom code to handle a failed DnD operation based on the type of error, it returns true is the failure has been already handled (not showing the default "drag operation failed" animation), otherwise it returns false.

context

the drag context

result

the result of the drag operation

Returns

true if the failed drag operation has been already handled.

The ::drag-leave signal is emitted on the drop site when the cursor leaves the widget. A typical reason to connect to this signal is to undo things done in Widget::drag-motion, e.g. undo highlighting with WidgetExt::drag_unhighlight.

Likewise, the Widget::drag-leave signal is also emitted before the ::drag-drop signal, for instance to allow cleaning up of a preview item created in the Widget::drag-motion signal handler.

context

the drag context

time

the timestamp of the motion event

The ::drag-motion signal is emitted on the drop site when the user moves the cursor over the widget during a drag. The signal handler must determine whether the cursor position is in a drop zone or not. If it is not in a drop zone, it returns false and no further processing is necessary. Otherwise, the handler returns true. In this case, the handler is responsible for providing the necessary information for displaying feedback to the user, by calling gdk_drag_status.

If the decision whether the drop will be accepted or rejected can't be made based solely on the cursor position and the type of the data, the handler may inspect the dragged data by calling WidgetExt::drag_get_data and defer the gdk_drag_status call to the Widget::drag-data-received handler. Note that you must pass DestDefaults::Drop, DestDefaults::Motion or DestDefaults::All to Widget::drag_dest_set when using the drag-motion signal that way.

Also note that there is no drag-enter signal. The drag receiver has to keep track of whether he has received any drag-motion signals since the last Widget::drag-leave and if not, treat the drag-motion signal as an "enter" signal. Upon an "enter", the handler will typically highlight the drop site with WidgetExt::drag_highlight.

static void
drag_motion (GtkWidget      *widget,
             GdkDragContext *context,
             gint            x,
             gint            y,
             guint           time)
{
  GdkAtom target;

  PrivateData *private_data = GET_PRIVATE_DATA (widget);

  if (!private_data->drag_highlight)
   {
     private_data->drag_highlight = 1;
     gtk_drag_highlight (widget);
   }

  target = gtk_drag_dest_find_target (widget, context, NULL);
  if (target == GDK_NONE)
    gdk_drag_status (context, 0, time);
  else
   {
     private_data->pending_status
        = gdk_drag_context_get_suggested_action (context);
     gtk_drag_get_data (widget, context, target, time);
   }

  return TRUE;
}

static void
drag_data_received (GtkWidget        *widget,
                    GdkDragContext   *context,
                    gint              x,
                    gint              y,
                    GtkSelectionData *selection_data,
                    guint             info,
                    guint             time)
{
  PrivateData *private_data = GET_PRIVATE_DATA (widget);

  if (private_data->suggested_action)
   {
     private_data->suggested_action = 0;

     // We are getting this data due to a request in drag_motion,
     // rather than due to a request in drag_drop, so we are just
     // supposed to call gdk_drag_status(), not actually paste in
     // the data.

     str = gtk_selection_data_get_text (selection_data);
     if (!data_is_acceptable (str))
       gdk_drag_status (context, 0, time);
     else
       gdk_drag_status (context,
                        private_data->suggested_action,
                        time);
   }
  else
   {
     // accept the drop
   }
}

context

the drag context

x

the x coordinate of the current cursor position

y

the y coordinate of the current cursor position

time

the timestamp of the motion event

Returns

whether the cursor position is in a drop zone

This signal is emitted when a widget is supposed to render itself. The widget's top left corner must be painted at the origin of the passed in context and be sized to the values returned by WidgetExt::get_allocated_width and WidgetExt::get_allocated_height.

Signal handlers connected to this signal can modify the cairo context passed as cr in any way they like and don't need to restore it. The signal emission takes care of calling cairo_save before and cairo_restore after invoking the handler.

The signal handler will get a cr with a clip region already set to the widget's dirty region, i.e. to the area that needs repainting. Complicated widgets that want to avoid redrawing themselves completely can get the full extents of the clip region with gdk_cairo_get_clip_rectangle, or they can get a finer-grained representation of the dirty region with cairo_copy_clip_rectangle_list.

cr

the cairo context to draw to

Returns

true to stop other handlers from being invoked for the event. false to propagate the event further.

The ::enter-notify-event will be emitted when the pointer enters the widget's window.

To receive this signal, the gdk::Window associated to the widget needs to enable the gdk::EventMask::EnterNotifyMask mask.

This signal will be sent to the grab widget if there is one.

event

the gdk::EventCrossing which triggered this signal.

Returns

true to stop other handlers from being invoked for the event. false to propagate the event further.

The GTK+ main loop will emit three signals for each GDK event delivered to a widget: one generic ::event signal, another, more specific, signal that matches the type of event delivered (e.g. Widget::key-press-event) and finally a generic Widget::event-after signal.

event

the GdkEvent which triggered this signal

Returns

true to stop other handlers from being invoked for the event and to cancel the emission of the second specific ::event signal. false to propagate the event further and to allow the emission of the second signal. The ::event-after signal is emitted regardless of the return value.

After the emission of the Widget::event signal and (optionally) the second more specific signal, ::event-after will be emitted regardless of the previous two signals handlers return values.

event

the GdkEvent which triggered this signal

Returns

true to stop other handlers from being invoked for the event. false to propagate the event further.

The ::focus-in-event signal will be emitted when the keyboard focus enters the widget's window.

To receive this signal, the gdk::Window associated to the widget needs to enable the gdk::EventMask::FocusChangeMask mask.

event

the gdk::EventFocus which triggered this signal.

Returns

true to stop other handlers from being invoked for the event. false to propagate the event further.

The ::focus-out-event signal will be emitted when the keyboard focus leaves the widget's window.

To receive this signal, the gdk::Window associated to the widget needs to enable the gdk::EventMask::FocusChangeMask mask.

event

the gdk::EventFocus which triggered this signal.

Returns

true to stop other handlers from being invoked for the event. false to propagate the event further.

Emitted when a pointer or keyboard grab on a window belonging to widget gets broken.

On X11, this happens when the grab window becomes unviewable (i.e. it or one of its ancestors is unmapped), or if the same application grabs the pointer or keyboard again.

event

the gdk::EventGrabBroken event

Returns

true to stop other handlers from being invoked for the event. false to propagate the event further.

The ::grab-notify signal is emitted when a widget becomes shadowed by a GTK+ grab (not a pointer or keyboard grab) on another widget, or when it becomes unshadowed due to a grab being removed.

A widget is shadowed by a WidgetExt::grab_add when the topmost grab widget in the grab stack of its window group is not its ancestor.

was_grabbed

false if the widget becomes shadowed, true if it becomes unshadowed

The ::hide signal is emitted when widget is hidden, for example with WidgetExt::hide.

The ::hierarchy-changed signal is emitted when the anchored state of a widget changes. A widget is “anchored” when its toplevel ancestor is a Window. This signal is emitted when a widget changes from un-anchored to anchored or vice-versa.

previous_toplevel

the previous toplevel ancestor, or None if the widget was previously unanchored

The ::key-press-event signal is emitted when a key is pressed. The signal emission will reoccur at the key-repeat rate when the key is kept pressed.

To receive this signal, the gdk::Window associated to the widget needs to enable the gdk::EventMask::KeyPressMask mask.

This signal will be sent to the grab widget if there is one.

event

the gdk::EventKey which triggered this signal.

Returns

true to stop other handlers from being invoked for the event. false to propagate the event further.

The ::key-release-event signal is emitted when a key is released.

To receive this signal, the gdk::Window associated to the widget needs to enable the gdk::EventMask::KeyReleaseMask mask.

This signal will be sent to the grab widget if there is one.

event

the gdk::EventKey which triggered this signal.

Returns

true to stop other handlers from being invoked for the event. false to propagate the event further.

Gets emitted if keyboard navigation fails. See WidgetExt::keynav_failed for details.

direction

the direction of movement

Returns

true if stopping keyboard navigation is fine, false if the emitting widget should try to handle the keyboard navigation attempt in its parent container(s).

The ::leave-notify-event will be emitted when the pointer leaves the widget's window.

To receive this signal, the gdk::Window associated to the widget needs to enable the gdk::EventMask::LeaveNotifyMask mask.

This signal will be sent to the grab widget if there is one.

event

the gdk::EventCrossing which triggered this signal.

Returns

true to stop other handlers from being invoked for the event. false to propagate the event further.

The ::map signal is emitted when widget is going to be mapped, that is when the widget is visible (which is controlled with WidgetExt::set_visible) and all its parents up to the toplevel widget are also visible. Once the map has occurred, Widget::map-event will be emitted.

The ::map signal can be used to determine whether a widget will be drawn, for instance it can resume an animation that was stopped during the emission of Widget::unmap.

The default handler for this signal activates widget if group_cycling is false, or just makes widget grab focus if group_cycling is true.

group_cycling

true if there are other widgets with the same mnemonic

Returns

true to stop other handlers from being invoked for the event. false to propagate the event further.

The ::motion-notify-event signal is emitted when the pointer moves over the widget's gdk::Window.

To receive this signal, the gdk::Window associated to the widget needs to enable the gdk::EventMask::PointerMotionMask mask.

This signal will be sent to the grab widget if there is one.

event

the gdk::EventMotion which triggered this signal.

Returns

true to stop other handlers from being invoked for the event. false to propagate the event further.

The ::parent-set signal is emitted when a new parent has been set on a widget.

old_parent

the previous parent, or None if the widget just got its initial parent.

This signal gets emitted whenever a widget should pop up a context menu. This usually happens through the standard key binding mechanism; by pressing a certain key while a widget is focused, the user can cause the widget to pop up a menu. For example, the Entry widget creates a menu with clipboard commands. See the [Popup Menu Migration Checklist][checklist-popup-menu] for an example of how to use this signal.

Returns

true if a menu was activated

The ::property-notify-event signal will be emitted when a property on the widget's window has been changed or deleted.

To receive this signal, the gdk::Window associated to the widget needs to enable the gdk::EventMask::PropertyChangeMask mask.

event

the gdk::EventProperty which triggered this signal.

Returns

true to stop other handlers from being invoked for the event. false to propagate the event further.

To receive this signal the gdk::Window associated to the widget needs to enable the gdk::EventMask::ProximityInMask mask.

This signal will be sent to the grab widget if there is one.

event

the gdk::EventProximity which triggered this signal.

Returns

true to stop other handlers from being invoked for the event. false to propagate the event further.

To receive this signal the gdk::Window associated to the widget needs to enable the gdk::EventMask::ProximityOutMask mask.

This signal will be sent to the grab widget if there is one.

event

the gdk::EventProximity which triggered this signal.

Returns

true to stop other handlers from being invoked for the event. false to propagate the event further.

Emitted when Widget:has-tooltip is true and the hover timeout has expired with the cursor hovering "above" widget; or emitted when widget got focus in keyboard mode.

Using the given coordinates, the signal handler should determine whether a tooltip should be shown for widget. If this is the case true should be returned, false otherwise. Note that if keyboard_mode is true, the values of x and y are undefined and should not be used.

The signal handler is free to manipulate tooltip with the therefore destined function calls.

x

the x coordinate of the cursor position where the request has been emitted, relative to widget's left side

y

the y coordinate of the cursor position where the request has been emitted, relative to widget's top

keyboard_mode

true if the tooltip was triggered using the keyboard

tooltip

a Tooltip

Returns

true if tooltip should be shown right now, false otherwise.

The ::realize signal is emitted when widget is associated with a gdk::Window, which means that WidgetExt::realize has been called or the widget has been mapped (that is, it is going to be drawn).

The ::screen-changed signal gets emitted when the screen of a widget has changed.

previous_screen

the previous screen, or None if the widget was not associated with a screen before

The ::scroll-event signal is emitted when a button in the 4 to 7 range is pressed. Wheel mice are usually configured to generate button press events for buttons 4 and 5 when the wheel is turned.

To receive this signal, the gdk::Window associated to the widget needs to enable the gdk::EventMask::ScrollMask mask.

This signal will be sent to the grab widget if there is one.

event

the gdk::EventScroll which triggered this signal.

Returns

true to stop other handlers from being invoked for the event. false to propagate the event further.

The ::selection-clear-event signal will be emitted when the the widget's window has lost ownership of a selection.

event

the gdk::EventSelection which triggered this signal.

Returns

true to stop other handlers from being invoked for the event. false to propagate the event further.

Returns

true to stop other handlers from being invoked for the event. false to propagate the event further.

The ::selection-request-event signal will be emitted when another client requests ownership of the selection owned by the widget's window.

event

the gdk::EventSelection which triggered this signal.

Returns

true to stop other handlers from being invoked for the event. false to propagate the event further.

The ::show signal is emitted when widget is shown, for example with WidgetExt::show.

Returns

true to stop other handlers from being invoked for the event. false to propagate the event further.

allocation

the region which has been allocated to the widget.

The ::state-flags-changed signal is emitted when the widget state changes, see WidgetExt::get_state_flags.

flags

The previous state flags.

The ::style-updated signal is a convenience signal that is emitted when the StyleContext::changed signal is emitted on the widget's associated StyleContext as returned by WidgetExt::get_style_context.

Note that style-modifying functions like WidgetExt::override_color also cause this signal to be emitted.

The ::unmap signal is emitted when widget is going to be unmapped, which means that either it or any of its parents up to the toplevel widget have been set as hidden.

As ::unmap indicates that a widget will not be shown any longer, it can be used to, for example, stop an animation on the widget.

The ::unrealize signal is emitted when the gdk::Window associated with widget is destroyed, which means that WidgetExt::unrealize has been called or the widget has been unmapped (that is, it is going to be hidden).

The ::visibility-notify-event will be emitted when the widget's window is obscured or unobscured.

To receive this signal the gdk::Window associated to the widget needs to enable the gdk::EventMask::VisibilityNotifyMask mask.

Deprecated since 3.12

Modern composited windowing systems with pervasive transparency make it impossible to track the visibility of a window reliably, so this signal can not be guaranteed to provide useful information.

event

the gdk::EventVisibility which triggered this signal.

Returns

true to stop other handlers from being invoked for the event. false to propagate the event further.

The ::window-state-event will be emitted when the state of the toplevel window associated to the widget changes.

To receive this signal the gdk::Window associated to the widget needs to enable the gdk::EventMask::StructureMask mask. GDK will enable this mask automatically for all new windows.

event

the gdk::EventWindowState which triggered this signal.

Returns

true to stop other handlers from being invoked for the event. false to propagate the event further.

Implementors

impl<O: IsA<Widget> + IsA<Object> + ObjectExt> WidgetExt for O
[src]