[][src]Trait gtk::NotebookExt

pub trait NotebookExt: 'static {
    fn detach_tab<P: IsA<Widget>>(&self, child: &P);
fn get_action_widget(&self, pack_type: PackType) -> Option<Widget>;
fn get_group_name(&self) -> Option<GString>;
fn get_menu_label<P: IsA<Widget>>(&self, child: &P) -> Option<Widget>;
fn get_menu_label_text<P: IsA<Widget>>(&self, child: &P) -> Option<GString>;
fn get_scrollable(&self) -> bool;
fn get_show_border(&self) -> bool;
fn get_show_tabs(&self) -> bool;
fn get_tab_detachable<P: IsA<Widget>>(&self, child: &P) -> bool;
fn get_tab_label<P: IsA<Widget>>(&self, child: &P) -> Option<Widget>;
fn get_tab_label_text<P: IsA<Widget>>(&self, child: &P) -> Option<GString>;
fn get_tab_pos(&self) -> PositionType;
fn get_tab_reorderable<P: IsA<Widget>>(&self, child: &P) -> bool;
fn next_page(&self);
fn popup_disable(&self);
fn popup_enable(&self);
fn prev_page(&self);
fn set_action_widget<P: IsA<Widget>>(&self, widget: &P, pack_type: PackType);
fn set_group_name(&self, group_name: Option<&str>);
fn set_menu_label<P: IsA<Widget>, Q: IsA<Widget>>(
        &self,
        child: &P,
        menu_label: Option<&Q>
    );
fn set_menu_label_text<P: IsA<Widget>>(&self, child: &P, menu_text: &str);
fn set_scrollable(&self, scrollable: bool);
fn set_show_border(&self, show_border: bool);
fn set_show_tabs(&self, show_tabs: bool);
fn set_tab_detachable<P: IsA<Widget>>(&self, child: &P, detachable: bool);
fn set_tab_label<P: IsA<Widget>, Q: IsA<Widget>>(
        &self,
        child: &P,
        tab_label: Option<&Q>
    );
fn set_tab_label_text<P: IsA<Widget>>(&self, child: &P, tab_text: &str);
fn set_tab_pos(&self, pos: PositionType);
fn set_tab_reorderable<P: IsA<Widget>>(&self, child: &P, reorderable: bool);
fn get_property_enable_popup(&self) -> bool;
fn set_property_enable_popup(&self, enable_popup: bool);
fn get_property_page(&self) -> i32;
fn set_property_page(&self, page: i32);
fn connect_change_current_page<F: Fn(&Self, i32) -> bool + 'static>(
        &self,
        f: F
    ) -> SignalHandlerId;
fn emit_change_current_page(&self, object: i32) -> bool;
fn connect_create_window<F: Fn(&Self, &Widget, i32, i32) -> Notebook + 'static>(
        &self,
        f: F
    ) -> SignalHandlerId;
fn connect_focus_tab<F: Fn(&Self, NotebookTab) -> bool + 'static>(
        &self,
        f: F
    ) -> SignalHandlerId;
fn emit_focus_tab(&self, object: NotebookTab) -> bool;
fn connect_move_focus_out<F: Fn(&Self, DirectionType) + 'static>(
        &self,
        f: F
    ) -> SignalHandlerId;
fn emit_move_focus_out(&self, object: DirectionType);
fn connect_page_added<F: Fn(&Self, &Widget, u32) + 'static>(
        &self,
        f: F
    ) -> SignalHandlerId;
fn connect_page_removed<F: Fn(&Self, &Widget, u32) + 'static>(
        &self,
        f: F
    ) -> SignalHandlerId;
fn connect_page_reordered<F: Fn(&Self, &Widget, u32) + 'static>(
        &self,
        f: F
    ) -> SignalHandlerId;
fn connect_reorder_tab<F: Fn(&Self, DirectionType, bool) -> bool + 'static>(
        &self,
        f: F
    ) -> SignalHandlerId;
fn emit_reorder_tab(&self, object: DirectionType, p0: bool) -> bool;
fn connect_select_page<F: Fn(&Self, bool) -> bool + 'static>(
        &self,
        f: F
    ) -> SignalHandlerId;
fn emit_select_page(&self, object: bool) -> bool;
fn connect_switch_page<F: Fn(&Self, &Widget, u32) + 'static>(
        &self,
        f: F
    ) -> SignalHandlerId;
fn connect_property_enable_popup_notify<F: Fn(&Self) + 'static>(
        &self,
        f: F
    ) -> SignalHandlerId;
fn connect_property_group_name_notify<F: Fn(&Self) + 'static>(
        &self,
        f: F
    ) -> SignalHandlerId;
fn connect_property_page_notify<F: Fn(&Self) + 'static>(
        &self,
        f: F
    ) -> SignalHandlerId;
fn connect_property_scrollable_notify<F: Fn(&Self) + 'static>(
        &self,
        f: F
    ) -> SignalHandlerId;
fn connect_property_show_border_notify<F: Fn(&Self) + 'static>(
        &self,
        f: F
    ) -> SignalHandlerId;
fn connect_property_show_tabs_notify<F: Fn(&Self) + 'static>(
        &self,
        f: F
    ) -> SignalHandlerId;
fn connect_property_tab_pos_notify<F: Fn(&Self) + 'static>(
        &self,
        f: F
    ) -> SignalHandlerId; }

Trait containing all Notebook methods.

Implementors

Notebook

Required methods

fn detach_tab<P: IsA<Widget>>(&self, child: &P)

Removes the child from the notebook.

This function is very similar to ContainerExt::remove, but additionally informs the notebook that the removal is happening as part of a tab DND operation, which should not be cancelled.

Feature: v3_16

child

a child

fn get_action_widget(&self, pack_type: PackType) -> Option<Widget>

Gets one of the action widgets. See NotebookExt::set_action_widget.

pack_type

pack type of the action widget to receive

Returns

The action widget with the given pack_type or None when this action widget has not been set

fn get_group_name(&self) -> Option<GString>

Gets the current group name for self.

Returns

the group name, or None if none is set

fn get_menu_label<P: IsA<Widget>>(&self, child: &P) -> Option<Widget>

Retrieves the menu label widget of the page containing child.

child

a widget contained in a page of self

Returns

the menu label, or None if the notebook page does not have a menu label other than the default (the tab label).

fn get_menu_label_text<P: IsA<Widget>>(&self, child: &P) -> Option<GString>

Retrieves the text of the menu label for the page containing child.

child

the child widget of a page of the notebook.

Returns

the text of the tab label, or None if the widget does not have a menu label other than the default menu label, or the menu label widget is not a Label. The string is owned by the widget and must not be freed.

fn get_scrollable(&self) -> bool

Returns whether the tab label area has arrows for scrolling. See NotebookExt::set_scrollable.

Returns

true if arrows for scrolling are present

fn get_show_border(&self) -> bool

Returns whether a bevel will be drawn around the notebook pages. See NotebookExt::set_show_border.

Returns

true if the bevel is drawn

fn get_show_tabs(&self) -> bool

Returns whether the tabs of the notebook are shown. See NotebookExt::set_show_tabs.

Returns

true if the tabs are shown

fn get_tab_detachable<P: IsA<Widget>>(&self, child: &P) -> bool

Returns whether the tab contents can be detached from self.

child

a child Widget

Returns

true if the tab is detachable.

fn get_tab_label<P: IsA<Widget>>(&self, child: &P) -> Option<Widget>

Returns the tab label widget for the page child. None is returned if child is not in self or if no tab label has specifically been set for child.

child

the page

Returns

the tab label

fn get_tab_label_text<P: IsA<Widget>>(&self, child: &P) -> Option<GString>

Retrieves the text of the tab label for the page containing child.

child

a widget contained in a page of self

Returns

the text of the tab label, or None if the tab label widget is not a Label. The string is owned by the widget and must not be freed.

fn get_tab_pos(&self) -> PositionType

Gets the edge at which the tabs for switching pages in the notebook are drawn.

Returns

the edge at which the tabs are drawn

fn get_tab_reorderable<P: IsA<Widget>>(&self, child: &P) -> bool

Gets whether the tab can be reordered via drag and drop or not.

child

a child Widget

Returns

true if the tab is reorderable.

fn next_page(&self)

Switches to the next page. Nothing happens if the current page is the last page.

fn popup_disable(&self)

Disables the popup menu.

fn popup_enable(&self)

Enables the popup menu: if the user clicks with the right mouse button on the tab labels, a menu with all the pages will be popped up.

fn prev_page(&self)

Switches to the previous page. Nothing happens if the current page is the first page.

fn set_action_widget<P: IsA<Widget>>(&self, widget: &P, pack_type: PackType)

Sets widget as one of the action widgets. Depending on the pack type the widget will be placed before or after the tabs. You can use a Box if you need to pack more than one widget on the same side.

Note that action widgets are “internal” children of the notebook and thus not included in the list returned from ContainerExt::foreach.

widget

a Widget

pack_type

pack type of the action widget

fn set_group_name(&self, group_name: Option<&str>)

Sets a group name for self.

Notebooks with the same name will be able to exchange tabs via drag and drop. A notebook with a None group name will not be able to exchange tabs with any other notebook.

group_name

the name of the notebook group, or None to unset it

fn set_menu_label<P: IsA<Widget>, Q: IsA<Widget>>(
    &self,
    child: &P,
    menu_label: Option<&Q>
)

Changes the menu label for the page containing child.

child

the child widget

the menu label, or None for default

fn set_menu_label_text<P: IsA<Widget>>(&self, child: &P, menu_text: &str)

Creates a new label and sets it as the menu label of child.

child

the child widget

the label text

fn set_scrollable(&self, scrollable: bool)

Sets whether the tab label area will have arrows for scrolling if there are too many tabs to fit in the area.

scrollable

true if scroll arrows should be added

fn set_show_border(&self, show_border: bool)

Sets whether a bevel will be drawn around the notebook pages. This only has a visual effect when the tabs are not shown. See NotebookExt::set_show_tabs.

show_border

true if a bevel should be drawn around the notebook

fn set_show_tabs(&self, show_tabs: bool)

Sets whether to show the tabs for the notebook or not.

show_tabs

true if the tabs should be shown

fn set_tab_detachable<P: IsA<Widget>>(&self, child: &P, detachable: bool)

Sets whether the tab can be detached from self to another notebook or widget.

Note that 2 notebooks must share a common group identificator (see NotebookExt::set_group_name) to allow automatic tabs interchange between them.

If you want a widget to interact with a notebook through DnD (i.e.: accept dragged tabs from it) it must be set as a drop destination and accept the target “GTK_NOTEBOOK_TAB”. The notebook will fill the selection with a Widget** pointing to the child widget that corresponds to the dropped tab.

Note that you should use NotebookExt::detach_tab instead of ContainerExt::remove if you want to remove the tab from the source notebook as part of accepting a drop. Otherwise, the source notebook will think that the dragged tab was removed from underneath the ongoing drag operation, and will initiate a drag cancel animation.

 static void
 on_drag_data_received (GtkWidget        *widget,
                        GdkDragContext   *context,
                        gint              x,
                        gint              y,
                        GtkSelectionData *data,
                        guint             info,
                        guint             time,
                        gpointer          user_data)
 {
   GtkWidget *notebook;
   GtkWidget **child;

   notebook = gtk_drag_get_source_widget (context);
   child = (void*) gtk_selection_data_get_data (data);

   // process_widget (*child);

   gtk_notebook_detach_tab (GTK_NOTEBOOK (notebook), *child);
 }

If you want a notebook to accept drags from other widgets, you will have to set your own DnD code to do it.

child

a child Widget

detachable

whether the tab is detachable or not

fn set_tab_label<P: IsA<Widget>, Q: IsA<Widget>>(
    &self,
    child: &P,
    tab_label: Option<&Q>
)

Changes the tab label for child. If None is specified for tab_label, then the page will have the label “page N”.

child

the page

tab_label

the tab label widget to use, or None for default tab label

fn set_tab_label_text<P: IsA<Widget>>(&self, child: &P, tab_text: &str)

Creates a new label and sets it as the tab label for the page containing child.

child

the page

tab_text

the label text

fn set_tab_pos(&self, pos: PositionType)

Sets the edge at which the tabs for switching pages in the notebook are drawn.

pos

the edge to draw the tabs at

fn set_tab_reorderable<P: IsA<Widget>>(&self, child: &P, reorderable: bool)

Sets whether the notebook tab can be reordered via drag and drop or not.

child

a child Widget

reorderable

whether the tab is reorderable or not

fn get_property_enable_popup(&self) -> bool

fn set_property_enable_popup(&self, enable_popup: bool)

fn get_property_page(&self) -> i32

fn set_property_page(&self, page: i32)

fn connect_change_current_page<F: Fn(&Self, i32) -> bool + 'static>(
    &self,
    f: F
) -> SignalHandlerId

fn emit_change_current_page(&self, object: i32) -> bool

fn connect_create_window<F: Fn(&Self, &Widget, i32, i32) -> Notebook + 'static>(
    &self,
    f: F
) -> SignalHandlerId

The ::create-window signal is emitted when a detachable tab is dropped on the root window.

A handler for this signal can create a window containing a notebook where the tab will be attached. It is also responsible for moving/resizing the window and adding the necessary properties to the notebook (e.g. the Notebook:group-name ).

page

the tab of notebook that is being detached

x

the X coordinate where the drop happens

y

the Y coordinate where the drop happens

Returns

a Notebook that page should be added to, or None.

fn connect_focus_tab<F: Fn(&Self, NotebookTab) -> bool + 'static>(
    &self,
    f: F
) -> SignalHandlerId

fn emit_focus_tab(&self, object: NotebookTab) -> bool

fn connect_move_focus_out<F: Fn(&Self, DirectionType) + 'static>(
    &self,
    f: F
) -> SignalHandlerId

fn emit_move_focus_out(&self, object: DirectionType)

fn connect_page_added<F: Fn(&Self, &Widget, u32) + 'static>(
    &self,
    f: F
) -> SignalHandlerId

the ::page-added signal is emitted in the notebook right after a page is added to the notebook.

child

the child Widget affected

page_num

the new page number for child

fn connect_page_removed<F: Fn(&Self, &Widget, u32) + 'static>(
    &self,
    f: F
) -> SignalHandlerId

the ::page-removed signal is emitted in the notebook right after a page is removed from the notebook.

child

the child Widget affected

page_num

the child page number

fn connect_page_reordered<F: Fn(&Self, &Widget, u32) + 'static>(
    &self,
    f: F
) -> SignalHandlerId

the ::page-reordered signal is emitted in the notebook right after a page has been reordered.

child

the child Widget affected

page_num

the new page number for child

fn connect_reorder_tab<F: Fn(&Self, DirectionType, bool) -> bool + 'static>(
    &self,
    f: F
) -> SignalHandlerId

fn emit_reorder_tab(&self, object: DirectionType, p0: bool) -> bool

fn connect_select_page<F: Fn(&Self, bool) -> bool + 'static>(
    &self,
    f: F
) -> SignalHandlerId

fn emit_select_page(&self, object: bool) -> bool

fn connect_switch_page<F: Fn(&Self, &Widget, u32) + 'static>(
    &self,
    f: F
) -> SignalHandlerId

Emitted when the user or a function changes the current page.

page

the new current page

page_num

the index of the page

fn connect_property_enable_popup_notify<F: Fn(&Self) + 'static>(
    &self,
    f: F
) -> SignalHandlerId

fn connect_property_group_name_notify<F: Fn(&Self) + 'static>(
    &self,
    f: F
) -> SignalHandlerId

fn connect_property_page_notify<F: Fn(&Self) + 'static>(
    &self,
    f: F
) -> SignalHandlerId

fn connect_property_scrollable_notify<F: Fn(&Self) + 'static>(
    &self,
    f: F
) -> SignalHandlerId

fn connect_property_show_border_notify<F: Fn(&Self) + 'static>(
    &self,
    f: F
) -> SignalHandlerId

fn connect_property_show_tabs_notify<F: Fn(&Self) + 'static>(
    &self,
    f: F
) -> SignalHandlerId

fn connect_property_tab_pos_notify<F: Fn(&Self) + 'static>(
    &self,
    f: F
) -> SignalHandlerId

Loading content...

Implementors

impl<O: IsA<Notebook>> NotebookExt for O[src]

Loading content...