Package: gtk

Class gtk-notebook

Superclasses

gtk-container, gtk-widget, g-initially-unowned, gtk-buildable, g-object, common-lisp:standard-object, common-lisp:t

Documented Subclasses

None

Direct Slots

enable-popup
The enable-popup property of type :boolean (Read / Write)
If true, pressing the right mouse button on the notebook pops up a menu that you can use to go to a page.
Default value: nil
group-name
The group-name property of type :string (Read / Write)
Group name for tab drag and drop.
Default value: nil
page
The page property of type :int (Read / Write)
The index of the current page.
Allowed values: >= -1
Default value: -1
scrollable
The scrollable property of type :boolean (Read / Write)
If true, scroll arrows are added if there are too many tabs to fit.
Default value: nil
show-border
The show-border property of type :boolean (Read / Write)
Whether the border should be shown.
Default value: true
show-tabs
The show-tabs property of type :boolean (Read / Write)
Whether tabs should be shown.
Default value: true
tab-pos
The tab-pos property of type gtk-position-type (Read / Write)
Which side of the notebook holds the tabs.
Default value: :top

Details

The gtk-notebook container is a gtk-container whose children are pages that can be switched between using tab labels along one edge.



There are many configuration options for gtk-notebook. Among other things, you can choose on which edge the tabs appear, see the function gtk-notebook-tab-pos, whether, if there are too many tabs to fit the notebook should be made bigger or scrolling arrows added, see the function gtk-notebook-scrollable, and whether there will be a popup menu allowing the users to switch pages, see the functions gtk-notebook-popup-enable and gtk-notebook-popup-disable.

GtkNotebook as GtkBuildable

The gtk-notebook implementation of the gtk-buildable interface supports placing children into tabs by specifying "tab" as the "type" attribute of a <child> element. Note that the content of the tab must be created before the tab can be filled. A tab child can be specified without specifying a <child> type attribute.

To add a child widget in the notebooks action area, specify "action-start" or "action-end" as the "type" attribute of the <child> element.

Example: A UI definition fragment with gtk-notebook
 <object class="GtkNotebook">
   <child>
     <object class="GtkLabel" id="notebook-content">
       <property name="label">Content</property>
     </object>
   </child>
   <child type="tab">
     <object class="GtkLabel" id="notebook-tab">
       <property name="label">Tab</property>
     </object>
   </child>
 </object>    

CSS nodes

  notebook
  ├── header.top
  │   ├── [<action widget>]
  │   ├── tabs
  │   │   ├── [arrow]
  │   │   ├── tab
  │   │   │   ╰── <tab label>
  ┊   ┊   ┊
  │   │   ├── tab[.reorderable-page]
  │   │   │   ╰── <tab label>
  │   │   ╰── [arrow]
  │   ╰── [<action widget>]
  │
  ╰── stack
      ├── <child>
      ┊
      ╰── <child>    
gtk-notebook has a main CSS node with name notebook, a subnode with name header and below that a subnode with name tabs which contains one subnode per tab with name tab.

If action widgets are present, their CSS nodes are placed next to the tabs node. If the notebook is scrollable, CSS nodes with name arrow are placed as first and last child of the tabs node.

The main node gets the .frame style class when the notebook has a border, see the gtk-notebook-show-border function.

The header node gets one of the style class .top, .bottom, .left or .right, depending on where the tabs are placed. For reorderable pages, the tab node gets the .reorderable-page class.

A tab node gets the .dnd style class while it is moved with drag-and-drop.

The nodes are always arranged from left-to-right, regarldess of text direction.

Child Property Details

detachable
The detachable child property of type :boolean (Read / Write)
Whether the tab is detachable.
Default value: nil
menu-label
The menu-label child property of type :string (Read / Write)
The string displayed in the child's menu entry.
Default value: nil
position
The position child property of type :int (Read / Write)
The index of the child in the parent.
Allowed values: >= 0
Default value: 0
reorderable
The reorderable child property of type :boolean (Read / Write)
Whether the tab is reorderable by user action.
Default value: nil
tab-expand
The tab-expand child property of type :boolean (Read / Write)
Whether to expand the child's tab.
Default value: nil
tab-fill
The tab-fill child property of type :boolean (Read / Write)
Whether the child's tab should fill the allocated area.
Default value: true
tab-label
The tab-label child property of type :string (Read / Write)
The string displayed on the child's tab label.
Default value: nil

Style Property Details

arrow-spacing
The arrow-spacing style property of type :int (Read)
The arrow-spacing property defines the spacing between the scroll arrows and the tabs.
Warning: arrow-spacing has been deprecated since version 3.20 and should not be used in newly-written code. This property is ignored. Use margins on arrows or the "tabs" node to achieve the same effect.
Allowed values: >= 0
Default value: 0
has-backward-stepper
The has-backward-stepper style property of type :boolean (Read)
The has-backward-stepper property determines whether the standard backward arrow button is displayed.
Default value: true
has-forward-stepper
The has-forward-stepper style property of type :boolean (Read)
The has-forward-stepper property determines whether the standard forward arrow button is displayed.
Default value: true
has-secondary-backward-stepper
The has-secondary-backward-stepper style property of type :boolean (Read)
The has-secondary-backward-stepper property determines whether a second backward arrow button is displayed on the opposite end of the tab area.
Default value: nil
has-secondary-forward-stepper
The has-secondary-forward-stepper style property of type :boolean (Read)
The has-secondary-forward-stepper property determines whether a second forward arrow button is displayed on the opposite end of the tab area.
Default value: nil
has-tab-gap
The has-tab-gap style property of type :boolean (Read)
The has-tab-gap property defines whether the active tab is draw with a gap at the bottom. When true the theme engine uses gtk-render-extension to draw the active tab. When nil gtk-render-background and gtk-render-frame are used.
Warning: has-tab-gap has been deprecated since version 3.20 and should not be used in newly-written code. This function always behaves as if it was set to nil.
Default value: true
Since 3.12
initial-gap
The initial-gap style property of type :int (Read)
The initial-gap property defines the minimum size for the initial gap between the first tab.
Warning: initial-gap has been deprecated since version 3.20 and should not be used in newly-written code. The intial gap is ignored. Use margins on the header node to achieve the same effect.
Allowed values: >= 0
Default value: 0
tab-curvature
The tab-curvature style property of type :int (Read)
The tab-curvature property defines size of tab curvature.
Warning: tab-curvature has been deprecated since version 3.20 and should not be used in newly-written code. This property is ignored. Use margins on tab nodes to achieve the same effect.
Allowed values: >= 0
Default value: 1
tab-overlap
The tab-overlap style property of type :int (Read)
The tab-overlap property defines size of tab overlap area.
Warning; tab-overlap has been deprecated since version 3.20 and should not be used in newly-written code. This property is ignored. Use margins on tab nodes to achieve the same effect.
Default value: 2

Signal Details

The "change-current-page" signal
 lambda (notebook arg1)   : Action      


The "create-window" signal
 lambda (notebook page x y)   : Run Last      
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 "group".
notebook
The gtk-notebook emitting the signal.
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 gtk-notebook that page should be added to, or nil.
The "focus-tab" signal
 lambda (notebook arg1)   : Action      


The "move-focus-out" signal
 lambda (notebook arg1)   : Action      


The "page-added" signal
 lambda (notebook child page-num)   : Run Last      
The "page-added" signal is emitted in the notebook right after a page is added to the notebook.
notebook
The gtk-notebook.
child
The child gtk-widget affected.
page-num
The new page number for child.
The "page-removed" signal
 lambda (notebook child page-num)   : Run Last      
The "page-removed" signal is emitted in the notebook right after a page is removed from the notebook.
notebook
The gtk-notebook.
child
The child gtk-widget affected.
page-num
The child page number.
The "page-reordered" signal
 lambda (notebook child page-num)   : Run Last      
The "page-reordered" signal is emitted in the notebook right after a page has been reordered.
notebook
The gtk-notebook.
child
The child gtk-widget affected.
page-num
The new page number for child.
The "reorder-tab" signal
 lambda (notebook arg1 arg2)   : Action      


The "select-page" signal
 lambda (notebook arg1)   : Action      


The "switch-page" signal
 lambda (notebook page page-num)   : Run Last      
Emitted when the user or a function changes the current page.
notebook
The object which received the signal.
page
The new current page.
page-num
The index of the page.
 

Slot Access Functions

Inherited Slot Access Functions

2014-8-20