Class: Gtk::Notebook
- Inherits:
-
Object
- Object
- Gtk::Notebook
- Defined in:
- (unknown)
Instance Method Summary collapse
-
#append_page(child, tab_label) ⇒ Integer
Appends a page to notebook.
-
#append_page_menu(child, tab_label, menu_label) ⇒ Integer
Appends a page to notebook, specifying the widget to use as the label in the popup menu.
-
#current_page ⇒ Integer
Returns the page number of the current page.
-
#current_page=(page_num) ⇒ nil
Switches to the page number page_num.
-
#detach_tab(child) ⇒ nil
Removes the child from the notebook.
- #enable_popup=(enable_popup) ⇒ TrueClass
-
#enable_popup? ⇒ TrueClass
Enable-popup.
-
#get_action_widget(pack_type) ⇒ Gtk::Widget
Gets one of the action widgets.
-
#get_menu_label(child) ⇒ Gtk::Widget
Retrieves the menu label widget of the page containing child.
-
#get_menu_label_text(child) ⇒ String
Retrieves the text of the menu label for the page containing child.
-
#get_nth_page(page_num) ⇒ Gtk::Widget
Returns the child widget contained in page number page_num.
-
#get_tab_detachable(child) ⇒ TrueClass
Returns whether the tab contents can be detached from notebook.
-
#get_tab_label(child) ⇒ Gtk::Widget
Returns the tab label widget for the page child.
-
#get_tab_label_text(child) ⇒ String
Retrieves the text of the tab label for the page containing child.
-
#get_tab_reorderable(child) ⇒ TrueClass
Gets whether the tab can be reordered via drag and drop or not.
-
#group_name ⇒ String
Group name for tab drag and drop.
-
#group_name=(group_name) ⇒ String
Group name for tab drag and drop.
-
#insert_page(child, tab_label, position) ⇒ Integer
Insert a page into notebook at the given position.
-
#insert_page_menu(child, tab_label, menu_label, position) ⇒ Integer
Insert a page into notebook at the given position, specifying the widget to use as the label in the popup menu.
-
#n_pages ⇒ Integer
Gets the number of pages in a notebook.
-
#new ⇒ Gtk::Widget
Creates a new Gtk::Notebook widget with no pages.
-
#next_page ⇒ nil
Switches to the next page.
-
#page ⇒ Integer
Page.
- #page=(page) ⇒ Integer
-
#page_num(child) ⇒ Integer
Finds the index of the page which contains the given child widget.
-
#popup_disable ⇒ nil
Disables the popup menu.
-
#popup_enable ⇒ nil
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.
-
#prepend_page(child, tab_label) ⇒ Integer
Prepends a page to notebook.
-
#prepend_page_menu(child, tab_label, menu_label) ⇒ Integer
Prepends a page to notebook, specifying the widget to use as the label in the popup menu.
-
#prev_page ⇒ nil
Switches to the previous page.
-
#remove_page(page_num) ⇒ nil
Removes a page from the notebook given its index in the notebook.
-
#reorder_child(child, position) ⇒ nil
Reorders the page containing child, so that it appears in position position.
-
#scrollable ⇒ TrueClass
Returns whether the tab label area has arrows for scrolling.
- #scrollable=(scrollable) ⇒ TrueClass
-
#scrollable? ⇒ TrueClass
Scrollable.
-
#set_action_widget(widget, pack_type) ⇒ nil
Sets widget as one of the action widgets.
-
#set_menu_label(child, menu_label) ⇒ nil
Changes the menu label for the page containing child.
-
#set_menu_label_text(child, menu_text) ⇒ nil
Creates a new label and sets it as the menu label of child.
-
#set_tab_detachable(child, detachable) ⇒ nil
Sets whether the tab can be detached from notebook to another notebook or widget.
-
#set_tab_label(child, tab_label) ⇒ nil
Changes the tab label for child.
-
#set_tab_label_text(child, tab_text) ⇒ nil
Creates a new label and sets it as the tab label for the page containing child.
-
#set_tab_reorderable(child, reorderable) ⇒ nil
Sets whether the notebook tab can be reordered via drag and drop or not.
-
#show_border ⇒ TrueClass
Returns whether a bevel will be drawn around the notebook pages.
- #show_border=(show_border) ⇒ TrueClass
-
#show_border? ⇒ TrueClass
Show-border.
-
#show_tabs ⇒ TrueClass
Returns whether the tabs of the notebook are shown.
- #show_tabs=(show_tabs) ⇒ TrueClass
-
#show_tabs? ⇒ TrueClass
Show-tabs.
-
#tab_hborder ⇒ Integer
Returns the horizontal width of a tab border.
-
#tab_pos ⇒ Gtk::PositionType
Tab-pos.
- #tab_pos=(tab_pos) ⇒ Gtk::PositionType
-
#tab_vborder ⇒ Integer
Returns the vertical width of a tab border.
Instance Method Details
#append_page(child, tab_label) ⇒ Integer
Appends a page to notebook.
#append_page_menu(child, tab_label, menu_label) ⇒ Integer
Appends a page to notebook, specifying the widget to use as the label in the popup menu.
#current_page ⇒ Integer
Returns the page number of the current page.
#current_page=(page_num) ⇒ nil
Switches to the page number page_num.
Note that due to historical reasons, GtkNotebook refuses to switch to a page unless the child widget is visible. Therefore, it is recommended to show child widgets before adding them to a notebook.
#detach_tab(child) ⇒ nil
Removes the child from the notebook.
This function is very similar to gtk_container_remove(), but additionally informs the notebook that the removal is happening as part of a tab DND operation, which should not be cancelled.
#enable_popup=(enable_popup) ⇒ TrueClass
#enable_popup? ⇒ TrueClass
Returns enable-popup.
#get_action_widget(pack_type) ⇒ Gtk::Widget
Gets one of the action widgets. See gtk_notebook_set_action_widget(). pack_type or nil when this action widget has not been set
#get_menu_label(child) ⇒ Gtk::Widget
Retrieves the menu label widget of the page containing child. notebook page does not have a menu label other than the default (the tab label).
#get_menu_label_text(child) ⇒ String
Retrieves the text of the menu label for the page containing child. not have a menu label other than the default menu label, or the menu label widget is not a Gtk::Label. The string is owned by the widget and must not be freed.
#get_nth_page(page_num) ⇒ Gtk::Widget
Returns the child widget contained in page number page_num. is out of bounds
#get_tab_detachable(child) ⇒ TrueClass
Returns whether the tab contents can be detached from notebook.
#get_tab_label(child) ⇒ Gtk::Widget
Returns the tab label widget for the page child. nil is returned if child is not in notebook or if no tab label has specifically been set for child.
#get_tab_label_text(child) ⇒ String
Retrieves the text of the tab label for the page containing child. widget is not a Gtk::Label. The string is owned by the widget and must not be freed.
#get_tab_reorderable(child) ⇒ TrueClass
Gets whether the tab can be reordered via drag and drop or not.
#group_name ⇒ String
Group name for tab drag and drop.
#group_name=(group_name) ⇒ String
Group name for tab drag and drop.
#insert_page(child, tab_label, position) ⇒ Integer
Insert a page into notebook at the given position.
#insert_page_menu(child, tab_label, menu_label, position) ⇒ Integer
Insert a page into notebook at the given position, specifying the widget to use as the label in the popup menu.
#n_pages ⇒ Integer
Gets the number of pages in a notebook.
#new ⇒ Gtk::Widget
Creates a new Gtk::Notebook widget with no pages.
#next_page ⇒ nil
Switches to the next page. Nothing happens if the current page is the last page.
#page ⇒ Integer
Returns page.
#page=(page) ⇒ Integer
#page_num(child) ⇒ Integer
Finds the index of the page which contains the given child widget.
#popup_disable ⇒ nil
Disables the popup menu.
#popup_enable ⇒ nil
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.
#prepend_page(child, tab_label) ⇒ Integer
Prepends a page to notebook.
#prepend_page_menu(child, tab_label, menu_label) ⇒ Integer
Prepends a page to notebook, specifying the widget to use as the label in the popup menu.
#prev_page ⇒ nil
Switches to the previous page. Nothing happens if the current page is the first page.
#remove_page(page_num) ⇒ nil
Removes a page from the notebook given its index in the notebook.
#reorder_child(child, position) ⇒ nil
Reorders the page containing child, so that it appears in position position. If position is greater than or equal to the number of children in the list or negative, child will be moved to the end of the list.
#scrollable ⇒ TrueClass
Returns whether the tab label area has arrows for scrolling. See gtk_notebook_set_scrollable().
#scrollable=(scrollable) ⇒ TrueClass
#scrollable? ⇒ TrueClass
Returns scrollable.
#set_action_widget(widget, pack_type) ⇒ nil
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 Gtk::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 gtk_container_foreach().
#set_menu_label(child, menu_label) ⇒ nil
Changes the menu label for the page containing child.
#set_menu_label_text(child, menu_text) ⇒ nil
Creates a new label and sets it as the menu label of child.
#set_tab_detachable(child, detachable) ⇒ nil
Sets whether the tab can be detached from notebook to another notebook or widget.
Note that 2 notebooks must share a common group identificator (see gtk_notebook_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 gtk_notebook_detach_tab() instead of gtk_container_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.
#set_tab_label(child, tab_label) ⇒ nil
Changes the tab label for child. If nil is specified for tab_label, then the page will have the label “page N”.
#set_tab_label_text(child, tab_text) ⇒ nil
Creates a new label and sets it as the tab label for the page containing child.
#set_tab_reorderable(child, reorderable) ⇒ nil
Sets whether the notebook tab can be reordered via drag and drop or not.
#show_border ⇒ TrueClass
Returns whether a bevel will be drawn around the notebook pages. See gtk_notebook_set_show_border().
#show_border=(show_border) ⇒ TrueClass
#show_border? ⇒ TrueClass
Returns show-border.
#show_tabs ⇒ TrueClass
Returns whether the tabs of the notebook are shown. See gtk_notebook_set_show_tabs().
#show_tabs=(show_tabs) ⇒ TrueClass
#show_tabs? ⇒ TrueClass
Returns show-tabs.
#tab_hborder ⇒ Integer
Returns the horizontal width of a tab border.
#tab_pos ⇒ Gtk::PositionType
Returns tab-pos.
#tab_pos=(tab_pos) ⇒ Gtk::PositionType
#tab_vborder ⇒ Integer
Returns the vertical width of a tab border.