Gtk2HsContentsIndex
Graphics.UI.Gtk.Layout.Notebook
Portabilityportable (depends on GHC)
Stabilityprovisional
Maintainergtk2hs-users@lists.sourceforge.net
Contents
Detail
Class Hierarchy
Types
Constructors
Methods
Attributes
Child Attributes
Signals
Description
A tabbed notebook container
Synopsis
data Notebook
class ContainerClass o => NotebookClass o
castToNotebook :: GObjectClass obj => obj -> Notebook
toNotebook :: NotebookClass o => o -> Notebook
notebookNew :: IO Notebook
notebookAppendPage :: (NotebookClass self, WidgetClass child) => self -> child -> String -> IO Int
notebookAppendPageMenu :: (NotebookClass self, WidgetClass child, WidgetClass tabLabel, WidgetClass menuLabel) => self -> child -> tabLabel -> menuLabel -> IO Int
notebookPrependPage :: (NotebookClass self, WidgetClass child) => self -> child -> String -> IO Int
notebookPrependPageMenu :: (NotebookClass self, WidgetClass child, WidgetClass tabLabel, WidgetClass menuLabel) => self -> child -> tabLabel -> menuLabel -> IO Int
notebookInsertPage :: (NotebookClass self, WidgetClass child) => self -> child -> String -> Int -> IO Int
notebookInsertPageMenu :: (NotebookClass self, WidgetClass child, WidgetClass tabLabel, WidgetClass menuLabel) => self -> child -> tabLabel -> menuLabel -> Int -> IO Int
notebookRemovePage :: NotebookClass self => self -> Int -> IO ()
notebookPageNum :: (NotebookClass self, WidgetClass w) => self -> w -> IO (Maybe Int)
notebookSetCurrentPage :: NotebookClass self => self -> Int -> IO ()
notebookNextPage :: NotebookClass self => self -> IO ()
notebookPrevPage :: NotebookClass self => self -> IO ()
notebookReorderChild :: (NotebookClass self, WidgetClass child) => self -> child -> Int -> IO ()
data PositionType
= PosLeft
| PosRight
| PosTop
| PosBottom
notebookSetTabPos :: NotebookClass self => self -> PositionType -> IO ()
notebookGetTabPos :: NotebookClass self => self -> IO PositionType
notebookSetShowTabs :: NotebookClass self => self -> Bool -> IO ()
notebookGetShowTabs :: NotebookClass self => self -> IO Bool
notebookSetShowBorder :: NotebookClass self => self -> Bool -> IO ()
notebookGetShowBorder :: NotebookClass self => self -> IO Bool
notebookSetScrollable :: NotebookClass self => self -> Bool -> IO ()
notebookGetScrollable :: NotebookClass self => self -> IO Bool
notebookSetTabBorder :: NotebookClass self => self -> Int -> IO ()
notebookSetTabHBorder :: NotebookClass self => self -> Int -> IO ()
notebookSetTabVBorder :: NotebookClass self => self -> Int -> IO ()
notebookSetPopup :: NotebookClass self => self -> Bool -> IO ()
notebookGetCurrentPage :: NotebookClass self => self -> IO Int
notebookSetMenuLabel :: (NotebookClass self, WidgetClass child, WidgetClass menuLabel) => self -> child -> Maybe menuLabel -> IO ()
notebookGetMenuLabel :: (NotebookClass self, WidgetClass child) => self -> child -> IO (Maybe Widget)
notebookSetMenuLabelText :: (NotebookClass self, WidgetClass child) => self -> child -> String -> IO ()
notebookGetMenuLabelText :: (NotebookClass self, WidgetClass child) => self -> child -> IO (Maybe String)
notebookGetNthPage :: NotebookClass self => self -> Int -> IO (Maybe Widget)
notebookGetNPages :: NotebookClass self => self -> IO Int
notebookGetTabLabel :: (NotebookClass self, WidgetClass child) => self -> child -> IO (Maybe Widget)
notebookGetTabLabelText :: (NotebookClass self, WidgetClass child) => self -> child -> IO (Maybe String)
data Packing
= PackRepel
| PackGrow
| PackNatural
data PackType
= PackStart
| PackEnd
notebookQueryTabLabelPacking :: (NotebookClass self, WidgetClass child) => self -> child -> IO (Packing, PackType)
notebookSetTabLabelPacking :: (NotebookClass self, WidgetClass child) => self -> child -> Packing -> PackType -> IO ()
notebookSetHomogeneousTabs :: NotebookClass self => self -> Bool -> IO ()
notebookSetTabLabel :: (NotebookClass self, WidgetClass child, WidgetClass tabLabel) => self -> child -> tabLabel -> IO ()
notebookSetTabLabelText :: (NotebookClass self, WidgetClass child) => self -> child -> String -> IO ()
notebookPage :: NotebookClass self => Attr self Int
notebookTabPos :: NotebookClass self => Attr self PositionType
notebookTabBorder :: NotebookClass self => WriteAttr self Int
notebookTabHborder :: NotebookClass self => Attr self Int
notebookTabVborder :: NotebookClass self => Attr self Int
notebookShowTabs :: NotebookClass self => Attr self Bool
notebookShowBorder :: NotebookClass self => Attr self Bool
notebookScrollable :: NotebookClass self => Attr self Bool
notebookEnablePopup :: NotebookClass self => Attr self Bool
notebookHomogeneous :: NotebookClass self => Attr self Bool
notebookCurrentPage :: NotebookClass self => Attr self Int
notebookChildTabLabel :: (NotebookClass self, WidgetClass child) => child -> Attr self String
notebookChildMenuLabel :: (NotebookClass self, WidgetClass child) => child -> Attr self String
notebookChildPosition :: (NotebookClass self, WidgetClass child) => child -> Attr self Int
notebookChildTabPacking :: (NotebookClass self, WidgetClass child) => child -> Attr self Packing
notebookChildTabPackType :: (NotebookClass self, WidgetClass child) => child -> Attr self PackType
onSwitchPage :: NotebookClass nb => nb -> (Int -> IO ()) -> IO (ConnectId nb)
afterSwitchPage :: NotebookClass nb => nb -> (Int -> IO ()) -> IO (ConnectId nb)
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
data Notebook
show/hide Instances
class ContainerClass o => NotebookClass o
show/hide Instances
castToNotebook :: GObjectClass obj => obj -> Notebook
toNotebook :: NotebookClass o => o -> Notebook
Constructors
notebookNew :: IO Notebook
Creates a new Notebook widget with no pages.
Methods
notebookAppendPage
:: (NotebookClass self, WidgetClass child)
=> self
-> childchild - the Widget to use as the contents of the page.
-> StringtabLabel - the label for the page
-> IO Intreturns 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
notebookAppendPageMenu
:: (NotebookClass self, WidgetClass child, WidgetClass tabLabel, WidgetClass menuLabel)
=> self
-> childchild - the Widget to use as the contents of the page.
-> tabLabeltabLabel - the Widget to be used as the label for the page (usually a Label widget).
-> menuLabelmenuLabel - the widget to use as a label for the page-switch menu, if that is enabled (usually a Label widget).
-> IO Intreturns 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
notebookPrependPage
:: (NotebookClass self, WidgetClass child)
=> self
-> childchild - the Widget to use as the contents of the page.
-> StringtabLabel - the label for the page
-> IO Intreturns 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
notebookPrependPageMenu
:: (NotebookClass self, WidgetClass child, WidgetClass tabLabel, WidgetClass menuLabel)
=> self
-> childchild - the Widget to use as the contents of the page.
-> tabLabeltabLabel - the Widget to be used as the label for the page (usually a Label widget).
-> menuLabelmenuLabel - the widget to use as a label for the page-switch menu, if that is enabled (usually a Label widget).
-> IO Intreturns 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
notebookInsertPage
:: (NotebookClass self, WidgetClass child)
=> self
-> childchild - the Widget to use as the contents of the page.
-> StringtabLabel - the label for the page
-> Intposition - the index (starting at 0) at which to insert the page, or -1 to append the page after all other pages.
-> IO Intreturns 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
notebookInsertPageMenu
:: (NotebookClass self, WidgetClass child, WidgetClass tabLabel, WidgetClass menuLabel)
=> self
-> childchild - the Widget to use as the contents of the page.
-> tabLabeltabLabel - the Widget to be used as the label for the page (usually a Label widget).
-> menuLabelmenuLabel - the widget to use as a label for the page-switch menu, if that is enabled (usually a Label widget).
-> Intposition - the index (starting at 0) at which to insert the page, or -1 to append the page after all other pages.
-> IO Intreturns 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
notebookRemovePage
:: NotebookClass self
=> self
-> IntpageNum - 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)

Query the page the child widget is contained in.

  • The function returns the page number if the child was found, Nothing otherwise.
notebookSetCurrentPage
:: NotebookClass self
=> self
-> IntpageNum - 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.
notebookNextPage :: NotebookClass self => self -> IO ()
Switches to the next page. Nothing happens if the current page is the last page.
notebookPrevPage :: NotebookClass self => self -> IO ()
Switches to the previous page. Nothing happens if the current page is the first page.
notebookReorderChild
:: (NotebookClass self, WidgetClass child)
=> self
-> childchild - the child to move
-> Intposition - 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
Position a scale's value is drawn relative to the trough
Constructors
PosLeft
PosRight
PosTop
PosBottom
show/hide Instances
notebookSetTabPos
:: NotebookClass self
=> self
-> PositionTypepos - the edge to draw the tabs at.
-> IO ()
Sets the edge at which the tabs for switching pages in the notebook are drawn.
notebookGetTabPos
:: NotebookClass self
=> self
-> IO PositionTypereturns the edge at which the tabs are drawn
Gets the edge at which the tabs for switching pages in the notebook are drawn.
notebookSetShowTabs
:: NotebookClass self
=> self
-> BoolshowTabs - True if the tabs should be shown.
-> IO ()
Sets whether to show the tabs for the notebook or not.
notebookGetShowTabs
:: NotebookClass self
=> self
-> IO Boolreturns True if the tabs are shown
Returns whether the tabs of the notebook are shown. See notebookSetShowTabs.
notebookSetShowBorder
:: NotebookClass self
=> self
-> BoolshowBorder - 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.
notebookGetShowBorder
:: NotebookClass self
=> self
-> IO Boolreturns True if the bevel is drawn
Returns whether a bevel will be drawn around the notebook pages. See notebookSetShowBorder.
notebookSetScrollable
:: NotebookClass self
=> self
-> Boolscrollable - 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.
notebookGetScrollable
:: NotebookClass self
=> self
-> IO Boolreturns True if arrows for scrolling are present
Returns whether the tab label area has arrows for scrolling. See notebookSetScrollable.
notebookSetTabBorder
:: NotebookClass self
=> self
-> IntborderWidth - width of the border around the tab labels.
-> IO ()

Sets the width the border around the tab labels in a notebook. This is equivalent to calling notebookSetTabHBorder notebook borderWidth followed by notebookSetTabVBorder notebook borderWidth.

  • Warning: this function is deprecated and should not be used in newly-written code.
notebookSetTabHBorder
:: NotebookClass self
=> self
-> InttabHborder - width of the horizontal border of tab labels.
-> IO ()

Sets the width of the horizontal border of tab labels.

  • Warning: this function is deprecated and should not be used in newly-written code.
notebookSetTabVBorder
:: NotebookClass self
=> self
-> InttabVborder - width of the vertical border of tab labels.
-> IO ()

Sets the width of the vertical border of tab labels.

  • Warning: this function is deprecated and should not be used in newly-written code.
notebookSetPopup :: NotebookClass self => self -> Bool -> IO ()
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.
notebookGetCurrentPage
:: NotebookClass self
=> self
-> IO Intreturns 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.
notebookSetMenuLabel
:: (NotebookClass self, WidgetClass child, WidgetClass menuLabel)
=> self
-> childchild - the child widget
-> Maybe menuLabelmenuLabel - the menu label, or Nothing for default
-> IO ()
Changes the menu label for the page containing child.
notebookGetMenuLabel
:: (NotebookClass self, WidgetClass child)
=> self
-> childchild - 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.
notebookSetMenuLabelText
:: (NotebookClass self, WidgetClass child)
=> self
-> childchild - the child widget
-> StringmenuText - the label text
-> IO ()
Creates a new label and sets it as the menu label of child.
notebookGetMenuLabelText
:: (NotebookClass self, WidgetClass child)
=> self
-> childchild - 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.
notebookGetNthPage
:: NotebookClass self
=> self
-> IntpageNum - 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 Int

Gets the number of pages in a notebook.

  • Available since Gtk version 2.2
notebookGetTabLabel
:: (NotebookClass self, WidgetClass child)
=> self
-> childchild - 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.
notebookGetTabLabelText
:: (NotebookClass self, WidgetClass child)
=> self
-> childchild - 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

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 reqests. It will stay at the start of the 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.
Constructors
PackRepel
PackGrow
PackNatural
show/hide Instances
data PackType
Packing of widgets at start or end in a box
Constructors
PackStart
PackEnd
show/hide Instances
notebookQueryTabLabelPacking
:: (NotebookClass self, WidgetClass child)
=> self
-> childchild - the page
-> IO (Packing, PackType)
Query the packing attributes for the tab label of the page containing child.
notebookSetTabLabelPacking
:: (NotebookClass self, WidgetClass child)
=> self
-> childchild - the child widget
-> Packing
-> PackTypepackType - the position of the bookmark
-> IO ()
Sets the packing parameters for the tab label of the page containing child. See boxPackStart for the exact meaning of the parameters.
notebookSetHomogeneousTabs
:: NotebookClass self
=> self
-> Boolhomogeneous - True if all tabs should be the same size.
-> IO ()

Sets whether the tabs must have all the same size or not.

  • Warning: this function is deprecated and should not be used in newly-written code.
notebookSetTabLabel
:: (NotebookClass self, WidgetClass child, WidgetClass tabLabel)
=> self
-> childchild - the page
-> tabLabeltabLabel - the tab label widget to use
-> IO ()
Changes the tab label for child.
notebookSetTabLabelText
:: (NotebookClass self, WidgetClass child)
=> self
-> childchild - the page
-> StringtabText - the label text
-> IO ()
Creates a new label and sets it as the tab label for the page containing child.
Attributes
notebookPage :: NotebookClass self => Attr self Int

The index of the current page.

Allowed values: >= 0

Default value: 0

notebookTabPos :: NotebookClass self => Attr self PositionType

Which side of the notebook holds the tabs.

Default value: PosTop

notebookTabBorder :: NotebookClass self => WriteAttr self Int

Width of the border around the tab labels.

Default value: 2

notebookTabHborder :: NotebookClass self => Attr self Int

Width of the horizontal border of tab labels.

Default value: 2

notebookTabVborder :: NotebookClass self => Attr self Int

Width of the vertical border of tab labels.

Default value: 2

notebookShowTabs :: NotebookClass self => Attr self Bool

Whether tabs should be shown or not.

Default value: True

notebookShowBorder :: NotebookClass self => Attr self Bool

Whether the border should be shown or not.

Default value: True

notebookScrollable :: NotebookClass self => Attr self Bool

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

Default value: False

notebookEnablePopup :: NotebookClass self => Attr self Bool

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 Bool

Whether tabs should have homogeneous sizes.

Default value: False

notebookCurrentPage :: NotebookClass self => Attr self Int
'currentPage' property. See notebookGetCurrentPage and notebookSetCurrentPage
Child Attributes
notebookChildTabLabel :: (NotebookClass self, WidgetClass child) => child -> Attr self String

The string displayed on the child's tab label.

Default value: Nothing

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

The string displayed in the child's menu entry.

Default value: Nothing

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

The index of the child in the parent.

Allowed values: >= -1

Default value: 0

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

The packing style of the child's tab.

Default value: PackGrow

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

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

Default value: PackStart

Signals
onSwitchPage :: NotebookClass nb => nb -> (Int -> IO ()) -> IO (ConnectId nb)
This signal is emitted when a new page is selected.
afterSwitchPage :: NotebookClass nb => nb -> (Int -> IO ()) -> IO (ConnectId nb)
Produced by Haddock version 0.8