gtk3-0.12.5.6: Binding to the Gtk+ graphical user interface library.

Portabilityportable (depends on GHC)
Stabilityprovisional
Maintainergtk2hs-users@lists.sourceforge.net
Safe HaskellNone

Graphics.UI.Gtk.Layout.Notebook

Contents

Description

A tabbed notebook container

Synopsis

Detail

The Notebook widget is a Container whose children are pages that can be switched between using tab labels along one edge.

There are many configuration options for Notebook. Among other things, you can choose on which edge the tabs appear (see notebookSetTabPos), whether, if there are too many tabs to fit the noteobook should be made bigger or scrolling arrows added (see notebookSetScrollable), and whether there will be a popup menu allowing the users to switch pages. (see notebookEnablePopup)

Class Hierarchy

 | GObject
 | +----Object
 | +----Widget
 | +----Container
 | +----Notebook

Types

Constructors

notebookNew :: IO NotebookSource

Creates a new Notebook widget with no pages.

Methods

notebookAppendPageSource

Arguments

:: (NotebookClass self, WidgetClass child) 
=> self 
-> child

child - the Widget to use as the contents of the page.

-> String

tabLabel - the label for the page

-> IO Int

returns the index (starting from 0) of the appended page in the notebook, or -1 if function fails

Appends a page to notebook.

The given label will be used for the label widget of the new tab. In case the context menu is enabled, this name will also appear in the popup menu. If you want to specify something else to go in the tab, use notebookAppendPageMenu.

  • This function returned () in Gtk+ version 2.2.X and earlier

notebookAppendPageMenuSource

Arguments

:: (NotebookClass self, WidgetClass child, WidgetClass tabLabel, WidgetClass menuLabel) 
=> self 
-> child

child - the Widget to use as the contents of the page.

-> tabLabel

tabLabel - the Widget to be used as the label for the page (usually a Label widget).

-> menuLabel

menuLabel - the widget to use as a label for the page-switch menu, if that is enabled (usually a Label widget).

-> IO Int

returns the index (starting from 0) of the appended page in the notebook, or -1 if function fails

Appends a page to notebook, specifying the widget to use as the label in the popup menu.

Like notebookAppendPage but allows any widget to be used for the label of the new tab and the entry in the page-switch popup menu.

  • This function returned () in Gtk version 2.2.X and earlier

notebookPrependPageSource

Arguments

:: (NotebookClass self, WidgetClass child) 
=> self 
-> child

child - the Widget to use as the contents of the page.

-> String

tabLabel - the label for the page

-> IO Int

returns the index (starting from 0) of the prepended page in the notebook, or -1 if function fails

Prepends a page to notebook.

  • The given label will be used for the label widget of the new tab. In case the context menu is enabled, this name will also appear in the popup menu. If you want to specify something else to go in the tab, use notebookPrependPageMenu.
  • This function returned () in Gtk version 2.2.X and earlier

notebookPrependPageMenuSource

Arguments

:: (NotebookClass self, WidgetClass child, WidgetClass tabLabel, WidgetClass menuLabel) 
=> self 
-> child

child - the Widget to use as the contents of the page.

-> tabLabel

tabLabel - the Widget to be used as the label for the page (usually a Label widget).

-> menuLabel

menuLabel - the widget to use as a label for the page-switch menu, if that is enabled (usually a Label widget).

-> IO Int

returns the index (starting from 0) of the prepended page in the notebook, or -1 if function fails

Prepends a page to notebook, specifying the widget to use as the label in the popup menu.

Like notebookPrependPage but allows any widget to be used for the label of the new tab and then entry in the page-switch popup menu.

  • This function returned () in Gtk version 2.2.X and earlier

notebookInsertPageSource

Arguments

:: (NotebookClass self, WidgetClass child) 
=> self 
-> child

child - the Widget to use as the contents of the page.

-> String

tabLabel - the label for the page

-> Int

position - the index (starting at 0) at which to insert the page, or -1 to append the page after all other pages.

-> IO Int

returns the index (starting from 0) of the inserted page in the notebook, or -1 if function fails

Insert a page into notebook at the given position.

  • The given label will be used for the label widget of the new tab. In case the context menu is enabled, this name will also appear in the popup menu. If you want to specify something else to go in the tab, use notebookInsertPageMenu.
  • This function returned () in Gtk version 2.2.X and earlier

notebookInsertPageMenuSource

Arguments

:: (NotebookClass self, WidgetClass child, WidgetClass tabLabel, WidgetClass menuLabel) 
=> self 
-> child

child - the Widget to use as the contents of the page.

-> tabLabel

tabLabel - the Widget to be used as the label for the page (usually a Label widget).

-> menuLabel

menuLabel - the widget to use as a label for the page-switch menu, if that is enabled (usually a Label widget).

-> Int

position - the index (starting at 0) at which to insert the page, or -1 to append the page after all other pages.

-> IO Int

returns the index (starting from 0) of the inserted page in the notebook, or -1 if function fails

Insert a page into notebook at the given position, specifying the widget to use as the label in the popup menu.

Like notebookInsertPage but allows any widget to be used for the label of the new tab and then entry in the page-switch popup menu.

  • This function returned () in Gtk version 2.2.X and earlier

notebookRemovePageSource

Arguments

:: NotebookClass self 
=> self 
-> Int

pageNum - the index of a notebook page, starting from 0. If -1, the last page will be removed.

-> IO () 

Removes a page from the notebook given its index in the notebook.

notebookPageNum :: (NotebookClass self, WidgetClass w) => self -> w -> IO (Maybe Int)Source

Query the page the child widget is contained in.

  • The function returns the page number if the child was found, Nothing otherwise.

notebookSetCurrentPageSource

Arguments

:: NotebookClass self 
=> self 
-> Int

pageNum - index of the page to switch to, starting from 0. If negative, the last page will be used. If greater than the number of pages in the notebook, nothing will be done.

-> IO () 

Switches to the page number pageNum. Page numbers start from 0. Use -1 to request the last page.

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

notebookNextPage :: NotebookClass self => self -> IO ()Source

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

notebookPrevPage :: NotebookClass self => self -> IO ()Source

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

notebookReorderChildSource

Arguments

:: (NotebookClass self, WidgetClass child) 
=> self 
-> child

child - the child to move

-> Int

position - the new position, or -1 to move to the end

-> IO () 

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.

data PositionType Source

Position a scale's value is drawn relative to the trough

Constructors

PosLeft 
PosRight 
PosTop 
PosBottom 

notebookSetTabPosSource

Arguments

:: NotebookClass self 
=> self 
-> PositionType

pos - the edge to draw the tabs at.

-> IO () 

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

notebookGetTabPosSource

Arguments

:: NotebookClass self 
=> self 
-> IO PositionType

returns the edge at which the tabs are drawn

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

notebookSetShowTabsSource

Arguments

:: NotebookClass self 
=> self 
-> Bool

showTabs - True if the tabs should be shown.

-> IO () 

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

notebookGetShowTabsSource

Arguments

:: NotebookClass self 
=> self 
-> IO Bool

returns True if the tabs are shown

Returns whether the tabs of the notebook are shown. See notebookSetShowTabs.

notebookSetShowBorderSource

Arguments

:: NotebookClass self 
=> self 
-> Bool

showBorder - True if a bevel should be drawn around the notebook.

-> IO () 

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

notebookGetShowBorderSource

Arguments

:: NotebookClass self 
=> self 
-> IO Bool

returns True if the bevel is drawn

Returns whether a bevel will be drawn around the notebook pages. See notebookSetShowBorder.

notebookSetScrollableSource

Arguments

:: NotebookClass self 
=> self 
-> Bool

scrollable - True if scroll arrows should be added

-> IO () 

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

notebookGetScrollableSource

Arguments

:: NotebookClass self 
=> self 
-> IO Bool

returns True if arrows for scrolling are present

Returns whether the tab label area has arrows for scrolling. See notebookSetScrollable.

notebookSetPopup :: NotebookClass self => self -> Bool -> IO ()Source

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

notebookGetCurrentPageSource

Arguments

:: NotebookClass self 
=> self 
-> IO Int

returns the index (starting from 0) of the current page in the notebook. If the notebook has no pages, then -1 will be returned.

Returns the page number of the current page.

notebookSetMenuLabelSource

Arguments

:: (NotebookClass self, WidgetClass child, WidgetClass menuLabel) 
=> self 
-> child

child - the child widget

-> Maybe menuLabel

menuLabel - the menu label, or Nothing for default

-> IO () 

Changes the menu label for the page containing child.

notebookGetMenuLabelSource

Arguments

:: (NotebookClass self, WidgetClass child) 
=> self 
-> child

child - a widget contained in a page of notebook

-> IO (Maybe Widget)

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

Retrieves the menu label widget of the page containing child.

notebookSetMenuLabelTextSource

Arguments

:: (NotebookClass self, WidgetClass child) 
=> self 
-> child

child - the child widget

-> String

menuText - the label text

-> IO () 

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

notebookGetMenuLabelTextSource

Arguments

:: (NotebookClass self, WidgetClass child) 
=> self 
-> child

child - the child widget of a page of the notebook.

-> IO (Maybe String)

returns value: the text of the tab label, or Nothing if the widget does not have a menu label other than the default menu label, or the menu label widget is not a Label.

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

notebookGetNthPageSource

Arguments

:: NotebookClass self 
=> self 
-> Int

pageNum - the index of a page in the noteobok, or -1 to get the last page.

-> IO (Maybe Widget)

returns the child widget, or Nothing if pageNum is out of bounds.

Returns the child widget contained in page number pageNum.

notebookGetNPages :: NotebookClass self => self -> IO IntSource

Gets the number of pages in a notebook.

  • Available since Gtk version 2.2

notebookGetTabLabelSource

Arguments

:: (NotebookClass self, WidgetClass child) 
=> self 
-> child

child - the page

-> IO (Maybe Widget)

returns the tab label

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

notebookGetTabLabelTextSource

Arguments

:: (NotebookClass self, WidgetClass child) 
=> self 
-> child

child - a widget contained in a page of notebook

-> IO (Maybe String)

returns value: the text of the tab label, or Nothing if the tab label widget is not a Label.

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

data Packing Source

Packing parameters of a widget

  • The Packing parameter determines how the child behaves in the horizontal or vertical way in an HBox or VBox, respectively. PackNatural means the child is as big as it requests. It will stay at the start or end of a Box if there is more space available. All children packed with PackRepel will be padded on both sides with additional space. PackGrow will increase the size of a widget so that it covers the available space. A menu bar, for instance, should always stay at the top of a window and should only occupy as little space as possible. Hence it should be packed at the start of a VBox with the packing option PackNatural. The working area of a window (e.g. the text area in an editor) should expand when the window is resized. Here the packing option PackGrow is the right choice and it is irrelevant whether the main area is inserted at the start or the end of a box. Finally PackRepel is most useful in a window where no widget can make use of excess space. Examples include a dialog box without list boxes or text fields.

data PackType Source

Packing of widgets at start or end in a box

Constructors

PackStart 
PackEnd 

notebookSetTabLabelSource

Arguments

:: (NotebookClass self, WidgetClass child, WidgetClass tabLabel) 
=> self 
-> child

child - the page

-> tabLabel

tabLabel - the tab label widget to use

-> IO () 

Changes the tab label for child.

notebookSetTabLabelTextSource

Arguments

:: (NotebookClass self, WidgetClass child) 
=> self 
-> child

child - the page

-> String

tabText - the label text

-> IO () 

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

notebookSetTabReorderableSource

Arguments

:: (NotebookClass self, WidgetClass child) 
=> self 
-> child

child - a child page

-> Bool

reorderable - whether the tab is reorderable or not.

-> IO () 

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

  • Available since Gtk version 2.10

notebookGetTabReorderableSource

Arguments

:: (NotebookClass self, WidgetClass child) 
=> self 
-> child

child - the child page

-> IO Bool

return True if the tab is reorderable.

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

  • Available since Gtk version 2.10

notebookSetTabDetachableSource

Arguments

:: (NotebookClass self, WidgetClass child) 
=> self 
-> child

child - the child page

-> Bool

detachable - whether the tab is detachable or not

-> IO () 

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

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

  • Available since Gtk version 2.10

notebookGetTabDetachableSource

Arguments

:: (NotebookClass self, WidgetClass child) 
=> self 
-> child

child - the child page

-> IO Bool

return True if the tab is detachable.

Returns whether the tab contents can be detached from notebook.

  • Available since Gtk version 2.10

notebookSetActionWidgetSource

Arguments

:: (NotebookClass self, WidgetClass widget) 
=> self 
-> widget 
-> PackType

packType pack type of the action widget

-> IO () 

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

  • Available since Gtk version 2.20

notebookGetActionWidgetSource

Arguments

:: NotebookClass self 
=> self 
-> PackType

packType pack type of the action widget to receive

-> IO (Maybe Widget) 

Gets one of the action widgets. See notebookSetActionWidget.

  • Available since Gtk version 2.20

Attributes

notebookPage :: NotebookClass self => Attr self IntSource

The index of the current page.

Allowed values: >= 0

Default value: 0

notebookTabPos :: NotebookClass self => Attr self PositionTypeSource

Which side of the notebook holds the tabs.

Default value: PosTop

notebookTabBorder :: NotebookClass self => WriteAttr self IntSource

Width of the border around the tab labels.

Default value: 2

notebookTabHborder :: NotebookClass self => Attr self IntSource

Width of the horizontal border of tab labels.

Default value: 2

notebookTabVborder :: NotebookClass self => Attr self IntSource

Width of the vertical border of tab labels.

Default value: 2

notebookShowTabs :: NotebookClass self => Attr self BoolSource

Whether tabs should be shown or not.

Default value: True

notebookShowBorder :: NotebookClass self => Attr self BoolSource

Whether the border should be shown or not.

Default value: True

notebookScrollable :: NotebookClass self => Attr self BoolSource

If True, scroll arrows are added if there are too many tabs to fit.

Default value: False

notebookEnablePopup :: NotebookClass self => Attr self BoolSource

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: False

notebookHomogeneous :: NotebookClass self => Attr self BoolSource

Whether tabs should have homogeneous sizes.

Default value: False

notebookCurrentPage :: NotebookClass self => Attr self IntSource

Switches to the page number pageNum.

Note that due to historical reasons, Notebook 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.

Returns the page number of the current page.

Child Attributes

notebookChildTabLabel :: (NotebookClass self, WidgetClass child) => child -> Attr self StringSource

The string displayed on the child's tab label.

Default value: Nothing

notebookChildMenuLabel :: (NotebookClass self, WidgetClass child) => child -> Attr self StringSource

The string displayed in the child's menu entry.

Default value: Nothing

notebookChildPosition :: (NotebookClass self, WidgetClass child) => child -> Attr self IntSource

The index of the child in the parent.

Allowed values: >= -1

Default value: 0

notebookChildTabPacking :: (NotebookClass self, WidgetClass child) => child -> Attr self PackingSource

The packing style of the child's tab.

Default value: PackGrow

notebookChildTabPackType :: (NotebookClass self, WidgetClass child) => child -> Attr self PackTypeSource

A PackType indicating whether the child is packed with reference to the start or end of the parent.

Default value: PackStart

notebookChildDetachable :: NotebookClass self => Attr self BoolSource

Whether the tab is detachable.

Default value: False

notebookChildReorderable :: NotebookClass self => Attr self BoolSource

Whether the tab is reorderable by user action or not.

Default value: False

notebookChildTabExpand :: NotebookClass self => Attr self BoolSource

Whether to expand the child's tab or not.

Default value : False

notebookChildTabFill :: NotebookClass self => Attr self BoolSource

Whether the child's tab should fill the allocated area or not.

Default value : False

Style Attributes

notebookStyleArrowSpacing :: NotebookClass self => ReadAttr self BoolSource

The notebookStyleArrowSpacing property defines the spacing between the scroll arrows and the tabs.

Allowed values: >= 0

Default value: 0

  • Available since Gtk version 2.10

notebookStyleHasBackwardStepper :: NotebookClass self => ReadAttr self BoolSource

The notebookStyleHasBackwardStepper property determines whether the standard backward arrow button is displayed.

Default value: True

  • Available since Gtk version 2.4

notebookStyleHasForwardStepper :: NotebookClass self => ReadAttr self BoolSource

The notebookStyleHasForwardStepper property determines whether the standard forward arrow button is displayed.

Default value : True

  • Available since Gtk version 2.4

notebookStyleHasSecondaryBackwardStepper :: NotebookClass self => ReadAttr self BoolSource

The notebookStyleHasSecondaryBackwardStepper property determines whether a second backward arrow button is displayed on the opposite end of the tab area.

Default value: False

  • Available since Gtk version 2.4

notebookStyleHasSecondaryForwardStepper :: NotebookClass self => ReadAttr self BoolSource

The notebookStyleHasSecondaryForwardStepper property determines whether a second forward arrow button is displayed on the opposite end of the tab area.

Default value: False

  • Available since Gtk version 2.4

notebookStyleTabCurvature :: NotebookClass self => ReadAttr self IntSource

The notebookStyleTabCurvature property defines size of tab curvature.

Allowed values: >= 0

Default value: 1

  • Available since Gtk version 2.10

notebookStyleTabOverlap :: NotebookClass self => ReadAttr self IntSource

The notebookStyleTabOverlap property defines size of tab overlap area.

Default value: 2

  • Available since Gtk version 2.10

Signals

switchPage :: NotebookClass self => Signal self (Int -> IO ())Source

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

pageAdded :: NotebookClass self => Signal self (Widget -> Int -> IO ())Source

The pageAdded signal is emitted in the notebook right after a page is added to the notebook.

  • Available since Gtk+ version 2.10

pageRemoved :: NotebookClass self => Signal self (Widget -> Int -> IO ())Source

The pageRemoved signal is emitted in the notebook right after a page is removed from the notebook.

  • Available since Gtk+ version 2.10

pageReordered :: NotebookClass self => Signal self (Widget -> Int -> IO ())Source

The pageReordered signal is emitted in the notebook right after a page has been reordered.

  • Available since Gtk+ version 2.10

Deprecated