Class: Handy::TabView

Inherits:
Gtk::Bin
  • Object
show all
Defined in:
(unknown)

Instance Method Summary collapse

Constructor Details

#initializeHandy::TabView

Creates a new HdyTabView.

Instance Method Details

#add_page(child, parent) ⇒ Handy::TabPage

Adds child to self with parent as the parent.

This function can be used to automatically position new pages, and to select the correct page when this page is closed while being selected (see [methodTabView.close_page].

If parent is NULL, this function is equivalent to [methodTabView.append].

Parameters:

  • child (Gtk::Widget)

    a widget to add

  • parent (Handy::TabPage)

    a parent page for child

Returns:

#append(child) ⇒ Handy::TabPage

Inserts child as the last non-pinned page.

Parameters:

  • child (Gtk::Widget)

    a widget to add

Returns:

#append_pinned(child) ⇒ Handy::TabPage

Inserts child as the last pinned page.

Parameters:

  • child (Gtk::Widget)

    a widget to add

Returns:

#close_other_pages(page) ⇒ nil

Requests to close all pages other than page.

Parameters:

Returns:

  • (nil)

#close_page(page) ⇒ nil

Requests to close page.

Calling this function will result in [signalTabView::close-page] signal being emitted for page. Closing the page can then be confirmed or denied via [methodTabView.close_page_finish].

If the page is waiting for a [methodTabView.close_page_finish] call, this function will do nothing.

The default handler for [signalTabView::close-page] will immediately confirm closing the page if it's non-pinned, or reject it if it's pinned. This behavior can be changed by registering your own handler for that signal.

If page was selected, another page will be selected instead:

If the [propertyTabPage:parent] value is NULL, the next page will be selected when possible, or if the page was already last, the previous page will be selected instead.

If it's not NULL, the previous page will be selected if it's a descendant (possibly indirect) of the parent. If both the previous page and the parent are pinned, the parent will be selected instead.

Parameters:

Returns:

  • (nil)

#close_page_finish(page, confirm) ⇒ nil

Completes a [methodTabView.close_page] call for page.

If confirm is TRUE, page will be closed. If it's FALSE, ite will be reverted to its previous state and [methodTabView.close_page] can be called for it again.

This function should not be called unless a custom handler for [signalTabView::close-page] is used.

Parameters:

  • page (Handy::TabPage)

    a page of self

  • confirm (Boolean)

    whether to confirm or deny closing page

Returns:

  • (nil)

#close_pages_after(page) ⇒ nil

Requests to close all pages after page.

Parameters:

Returns:

  • (nil)

#close_pages_before(page) ⇒ nil

Requests to close all pages before page.

Parameters:

Returns:

  • (nil)

#default_iconGio::Icon

Default page icon.

If a page doesn't provide its own icon via [propertyTabPage:icon], default icon may be used instead for contexts where having an icon is necessary.

[classTabBar] will use default icon for pinned tabs in case the page is not loading, doesn't have an icon and an indicator. Default icon is never used for tabs that aren't pinned.

Returns:

  • (Gio::Icon)

    default-icon

#default_icon=(default_icon) ⇒ Gio::Icon

Default page icon.

If a page doesn't provide its own icon via [propertyTabPage:icon], default icon may be used instead for contexts where having an icon is necessary.

[classTabBar] will use default icon for pinned tabs in case the page is not loading, doesn't have an icon and an indicator. Default icon is never used for tabs that aren't pinned.

Parameters:

  • default_icon (Gio::Icon)

Returns:

  • (Gio::Icon)

    default-icon

  • (Gio::Icon)

    default-icon

#get_nth_page(position) ⇒ Handy::TabPage

Gets the [classTabPage] representing the child at position.

Parameters:

  • position (Integer)

    the index of the page in self, starting from 0

Returns:

#get_page(child) ⇒ Handy::TabPage

Gets the [classTabPage] object representing child.

Parameters:

  • child (Gtk::Widget)

    a child in self

Returns:

#get_page_position(page) ⇒ Integer

Finds the position of page in self, starting from 0.

Parameters:

Returns:

  • (Integer)

    the position of page in self

#insert(child, position) ⇒ Handy::TabPage

Inserts a non-pinned page at position.

It's an error to try to insert a page before a pinned page, in that case [methodTabView.insert_pinned] should be used instead.

Parameters:

  • child (Gtk::Widget)

    a widget to add

  • position (Integer)

    the position to add child at, starting from 0

Returns:

#insert_pinned(child, position) ⇒ Handy::TabPage

Inserts a pinned page at position.

It's an error to try to insert a pinned page after a non-pinned page, in that case [methodTabView.insert] should be used instead.

Parameters:

  • child (Gtk::Widget)

    a widget to add

  • position (Integer)

    the position to add child at, starting from 0

Returns:

#is_transferring_pageBoolean

Whether a page is being transferred.

Gets the value of [propertyTabView:is-transferring-page] property.

Returns:

  • (Boolean)

    whether a page is being transferred

#is_transferring_page=(is_transferring_page) ⇒ Boolean

Whether a page is being transferred.

This property will be set to TRUE when a drag-n-drop tab transfer starts on any [classTabView], and to FALSE after it ends.

During the transfer, children cannot receive pointer input and a tab can be safely dropped on the tab view.

Parameters:

  • is_transferring_page (Boolean)

Returns:

  • (Boolean)

    is-transferring-page

  • (Boolean)

    is-transferring-page

#is_transferring_page?Boolean

Whether a page is being transferred.

This property will be set to TRUE when a drag-n-drop tab transfer starts on any [classTabView], and to FALSE after it ends.

During the transfer, children cannot receive pointer input and a tab can be safely dropped on the tab view.

Returns:

  • (Boolean)

    is-transferring-page

Tab context menu model.

When a context menu is shown for a tab, it will be constructed from the provided menu model. Use [signalTabView::setup-menu] signal to set up the menu actions for the particular tab.

Returns:

  • (Gio::MenuModel)

    menu-model

Tab context menu model.

When a context menu is shown for a tab, it will be constructed from the provided menu model. Use [signalTabView::setup-menu] signal to set up the menu actions for the particular tab.

Parameters:

  • menu_model (Gio::MenuModel)

Returns:

  • (Gio::MenuModel)

    menu-model

  • (Gio::MenuModel)

    menu-model

#n_pagesInteger

The number of pages in the tab view.

Returns:

  • (Integer)

    n-pages

#n_pages=(n_pages) ⇒ Integer

The number of pages in the tab view.

Parameters:

  • n_pages (Integer)

Returns:

  • (Integer)

    n-pages

  • (Integer)

    n-pages

#n_pinned_pagesInteger

The number of pinned pages in the tab view.

See [methodTabView.set_page_pinned].

Returns:

  • (Integer)

    n-pinned-pages

#n_pinned_pages=(n_pinned_pages) ⇒ Integer

The number of pinned pages in the tab view.

See [methodTabView.set_page_pinned].

Parameters:

  • n_pinned_pages (Integer)

Returns:

  • (Integer)

    n-pinned-pages

  • (Integer)

    n-pinned-pages

#pagesGio::ListModel

Returns a [ifaceGio.ListModel] containing the pages of self.

This model can be used to keep an up to date view of the pages.

Returns:

  • (Gio::ListModel)

    the model containing pages of self

#prepend(child) ⇒ Handy::TabPage

Inserts child as the first non-pinned page.

Parameters:

  • child (Gtk::Widget)

    a widget to add

Returns:

#prepend_pinned(child) ⇒ Handy::TabPage

Inserts child as the first pinned page.

Parameters:

  • child (Gtk::Widget)

    a widget to add

Returns:

#reorder_backward(page) ⇒ Boolean

Reorders page to before its previous page if possible.

Parameters:

Returns:

  • (Boolean)

    whether page was moved

#reorder_first(page) ⇒ Boolean

Reorders page to the first possible position.

Parameters:

Returns:

  • (Boolean)

    whether page was moved

#reorder_forward(page) ⇒ Boolean

Reorders page to after its next page if possible.

Parameters:

Returns:

  • (Boolean)

    whether page was moved

#reorder_last(page) ⇒ Boolean

Reorders page to the last possible position.

Parameters:

Returns:

  • (Boolean)

    whether page was moved

#reorder_page(page, position) ⇒ Boolean

Reorders page to position.

It's a programmer error to try to reorder a pinned page after a non-pinned one, or a non-pinned page before a pinned one.

Parameters:

  • page (Handy::TabPage)

    a page of self

  • position (Integer)

    the position to insert the page at, starting at 0

Returns:

  • (Boolean)

    whether page was moved

#select_next_pageBoolean

Selects the page after the currently selected page.

If the last page was already selected, this function does nothing.

Returns:

  • (Boolean)

    whether the selected page was changed

#select_previous_pageBoolean

Selects the page before the currently selected page.

If the first page was already selected, this function does nothing.

Returns:

  • (Boolean)

    whether the selected page was changed

#selected_pageHandy::TabPage

The currently selected page.

Returns:

#selected_page=(selected_page) ⇒ Handy::TabPage

The currently selected page.

Parameters:

Returns:

#set_page_pinned(page, pinned) ⇒ nil

Pins or unpins page.

Pinned pages are guaranteed to be placed before all non-pinned pages; at any given moment the first [propertyTabView:n-pinned-pages] pages in self are guaranteed to be pinned.

When a page is pinned or unpinned, it's automatically reordered: pinning a page moves it after other pinned pages; unpinning a page moves it before other non-pinned pages.

Pinned pages can still be reordered between each other.

[classTabBar] will display pinned pages in a compact form, never showing the title or close button, and only showing a single icon, selected in the following order:

  1. [propertyTabPage:indicator-icon]
  2. A spinner if [propertyTabPage:loading] is TRUE
  3. [propertyTabPage:icon]
  4. [propertyTabView:default-icon]

Pinned pages cannot be closed by default, see [signalTabView::close-page] for how to override that behavior.

Parameters:

  • page (Handy::TabPage)

    a page of self

  • pinned (Boolean)

    whether page should be pinned

Returns:

  • (nil)

#shortcut_widgetGtk::Widget

Tab shortcut widget.

Has the following shortcuts:

  • Ctrl+Page Up - switch to the previous page
  • Ctrl+Page Down - switch to the next page
  • Ctrl+Home - switch to the first page
  • Ctrl+End - switch to the last page
  • Ctrl+Shift+Page Up - move the current page backward
  • Ctrl+Shift+Page Down - move the current page forward
  • Ctrl+Shift+Home - move the current page at the start
  • Ctrl+Shift+End - move the current page at the end
  • Ctrl+Tab - switch to the next page, with looping
  • Ctrl+Shift+Tab - switch to the previous page, with looping
  • Alt+19 - switch to pages 1-9
  • Alt+0 - switch to page 10

These shortcuts are always available on self, this property is useful if they should be available globally.

Returns:

  • (Gtk::Widget)

    shortcut-widget

#shortcut_widget=(shortcut_widget) ⇒ Gtk::Widget

Tab shortcut widget.

Has the following shortcuts:

  • Ctrl+Page Up - switch to the previous page
  • Ctrl+Page Down - switch to the next page
  • Ctrl+Home - switch to the first page
  • Ctrl+End - switch to the last page
  • Ctrl+Shift+Page Up - move the current page backward
  • Ctrl+Shift+Page Down - move the current page forward
  • Ctrl+Shift+Home - move the current page at the start
  • Ctrl+Shift+End - move the current page at the end
  • Ctrl+Tab - switch to the next page, with looping
  • Ctrl+Shift+Tab - switch to the previous page, with looping
  • Alt+19 - switch to pages 1-9
  • Alt+0 - switch to page 10

These shortcuts are always available on self, this property is useful if they should be available globally.

Parameters:

  • shortcut_widget (Gtk::Widget)

Returns:

  • (Gtk::Widget)

    shortcut-widget

  • (Gtk::Widget)

    shortcut-widget

#transfer_page(page, other_view, position) ⇒ nil

Transfers page from self to other_view.

The page object will be reused.

It's a programmer error to try to insert a pinned page after a non-pinned one, or a non-pinned page before a pinned one.

Parameters:

  • page (Handy::TabPage)

    a page of self

  • other_view (Handy::TabView)

    the tab view to transfer the page to

  • position (Integer)

    the position to insert the page at, starting at 0

Returns:

  • (nil)