Trait gtk::prelude::NotebookExt[][src]

pub trait NotebookExt: 'static {
Show methods fn detach_tab<P: IsA<Widget>>(&self, child: &P);
fn action_widget(&self, pack_type: PackType) -> Option<Widget>;
fn group_name(&self) -> Option<GString>;
fn menu_label<P: IsA<Widget>>(&self, child: &P) -> Option<Widget>;
fn menu_label_text<P: IsA<Widget>>(&self, child: &P) -> Option<GString>;
fn is_scrollable(&self) -> bool;
fn shows_border(&self) -> bool;
fn shows_tabs(&self) -> bool;
fn tab_is_detachable<P: IsA<Widget>>(&self, child: &P) -> bool;
fn tab_label<P: IsA<Widget>>(&self, child: &P) -> Option<Widget>;
fn tab_label_text<P: IsA<Widget>>(&self, child: &P) -> Option<GString>;
fn tab_pos(&self) -> PositionType;
fn tab_is_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 enables_popup(&self) -> bool;
fn set_enable_popup(&self, enable_popup: bool);
fn page(&self) -> i32;
fn set_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_enable_popup_notify<F: Fn(&Self) + 'static>(
        &self,
        f: F
    ) -> SignalHandlerId;
fn connect_group_name_notify<F: Fn(&Self) + 'static>(
        &self,
        f: F
    ) -> SignalHandlerId;
fn connect_page_notify<F: Fn(&Self) + 'static>(
        &self,
        f: F
    ) -> SignalHandlerId;
fn connect_scrollable_notify<F: Fn(&Self) + 'static>(
        &self,
        f: F
    ) -> SignalHandlerId;
fn connect_show_border_notify<F: Fn(&Self) + 'static>(
        &self,
        f: F
    ) -> SignalHandlerId;
fn connect_show_tabs_notify<F: Fn(&Self) + 'static>(
        &self,
        f: F
    ) -> SignalHandlerId;
fn connect_tab_pos_notify<F: Fn(&Self) + 'static>(
        &self,
        f: F
    ) -> SignalHandlerId;
}
Expand description

Trait containing all Notebook methods.

Implementors

Notebook

Required methods

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.

child

a child

Gets one of the action widgets. See 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

Gets the current group name for self.

Returns

the group name, or None if none is set

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).

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.

Returns whether the tab label area has arrows for scrolling. See set_scrollable().

Returns

true if arrows for scrolling are present

Returns whether a bevel will be drawn around the notebook pages. See set_show_border().

Returns

true if the bevel is drawn

Returns whether the tabs of the notebook are shown. See set_show_tabs().

Returns

true if the tabs are shown

Returns whether the tab contents can be detached from self.

child

a child Widget

Returns

true if the tab is detachable.

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

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.

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

Returns

the edge at which the tabs are drawn

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

child

a child Widget

Returns

true if the tab is reorderable.

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

Disables the popup menu.

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.

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

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

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

Changes the menu label for the page containing child.

child

the child widget

the menu label, or None for default

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

child

the child widget

the label text

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

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

show_border

true if a bevel should be drawn around the notebook

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

show_tabs

true if the tabs should be shown

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 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 GtkWidget** pointing to the child widget that corresponds to the dropped tab.

Note that you should use 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.

⚠️ The following code is in C ⚠️

 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

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

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

child

the page

tab_text

the label text

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

pos

the edge to draw the tabs at

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

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 property::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.

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

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

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

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

page

the new current page

page_num

the index of the page

Implementors