Maintainer | gtk2hs-users@lists.sourceforge.net |
---|---|
Stability | provisional |
Portability | portable (depends on GHC) |
Safe Haskell | None |
Language | Haskell98 |
A tabbed notebook container
- data Notebook
- class ContainerClass o => NotebookClass o
- castToNotebook :: GObjectClass obj => obj -> Notebook
- gTypeNotebook :: GType
- toNotebook :: NotebookClass o => o -> Notebook
- notebookNew :: IO Notebook
- notebookAppendPage :: (NotebookClass self, WidgetClass child, GlibString string) => 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, GlibString string) => 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, GlibString string) => 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
- 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
- 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, GlibString string) => self -> child -> string -> IO ()
- notebookGetMenuLabelText :: (NotebookClass self, WidgetClass child, GlibString string) => 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, GlibString string) => self -> child -> IO (Maybe string)
- data Packing
- data PackType
- notebookSetTabLabel :: (NotebookClass self, WidgetClass child, WidgetClass tabLabel) => self -> child -> tabLabel -> IO ()
- notebookSetTabLabelText :: (NotebookClass self, WidgetClass child, GlibString string) => self -> child -> string -> IO ()
- notebookSetTabReorderable :: (NotebookClass self, WidgetClass child) => self -> child -> Bool -> IO ()
- notebookGetTabReorderable :: (NotebookClass self, WidgetClass child) => self -> child -> IO Bool
- notebookSetTabDetachable :: (NotebookClass self, WidgetClass child) => self -> child -> Bool -> IO ()
- notebookGetTabDetachable :: (NotebookClass self, WidgetClass child) => self -> child -> IO Bool
- notebookSetActionWidget :: (NotebookClass self, WidgetClass widget) => self -> widget -> PackType -> IO ()
- notebookGetActionWidget :: NotebookClass self => self -> PackType -> IO (Maybe Widget)
- 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, GlibString string) => child -> Attr self string
- notebookChildMenuLabel :: (NotebookClass self, WidgetClass child, GlibString string) => 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
- notebookChildDetachable :: NotebookClass self => Attr self Bool
- notebookChildReorderable :: NotebookClass self => Attr self Bool
- notebookChildTabExpand :: NotebookClass self => Attr self Bool
- notebookChildTabFill :: NotebookClass self => Attr self Bool
- notebookStyleArrowSpacing :: NotebookClass self => ReadAttr self Bool
- notebookStyleHasBackwardStepper :: NotebookClass self => ReadAttr self Bool
- notebookStyleHasForwardStepper :: NotebookClass self => ReadAttr self Bool
- notebookStyleHasSecondaryBackwardStepper :: NotebookClass self => ReadAttr self Bool
- notebookStyleHasSecondaryForwardStepper :: NotebookClass self => ReadAttr self Bool
- notebookStyleTabCurvature :: NotebookClass self => ReadAttr self Int
- notebookStyleTabOverlap :: NotebookClass self => ReadAttr self Int
- switchPage :: NotebookClass self => Signal self (Int -> IO ())
- pageAdded :: NotebookClass self => Signal self (Widget -> Int -> IO ())
- pageRemoved :: NotebookClass self => Signal self (Widget -> Int -> IO ())
- pageReordered :: NotebookClass self => Signal self (Widget -> Int -> IO ())
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
Types
class ContainerClass o => NotebookClass o Source
castToNotebook :: GObjectClass obj => obj -> Notebook Source
toNotebook :: NotebookClass o => o -> Notebook Source
Constructors
notebookNew :: IO Notebook Source
Creates a new Notebook
widget with no pages.
Methods
:: (NotebookClass self, WidgetClass child, GlibString string) | |
=> self | |
-> child |
|
-> string |
|
-> 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
:: (NotebookClass self, WidgetClass child, WidgetClass tabLabel, WidgetClass menuLabel) | |
=> self | |
-> child |
|
-> tabLabel |
|
-> menuLabel |
|
-> 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
:: (NotebookClass self, WidgetClass child, GlibString string) | |
=> self | |
-> child |
|
-> string |
|
-> 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
notebookPrependPageMenu Source
:: (NotebookClass self, WidgetClass child, WidgetClass tabLabel, WidgetClass menuLabel) | |
=> self | |
-> child |
|
-> tabLabel |
|
-> menuLabel |
|
-> 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
:: (NotebookClass self, WidgetClass child, GlibString string) | |
=> self | |
-> child |
|
-> string |
|
-> Int |
|
-> 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
:: (NotebookClass self, WidgetClass child, WidgetClass tabLabel, WidgetClass menuLabel) | |
=> self | |
-> child |
|
-> tabLabel |
|
-> menuLabel |
|
-> Int |
|
-> 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
:: NotebookClass self | |
=> self | |
-> Int |
|
-> 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.
:: NotebookClass self | |
=> self | |
-> Int |
|
-> 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.
:: (NotebookClass self, WidgetClass child) | |
=> self | |
-> child |
|
-> Int |
|
-> 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
:: NotebookClass self | |
=> self | |
-> PositionType |
|
-> IO () |
Sets the edge at which the tabs for switching pages in the notebook are drawn.
:: 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.
:: NotebookClass self | |
=> self | |
-> Bool |
|
-> IO () |
Sets whether to show the tabs for the notebook or not.
:: NotebookClass self | |
=> self | |
-> IO Bool | returns |
Returns whether the tabs of the notebook are shown. See
notebookSetShowTabs
.
:: NotebookClass self | |
=> self | |
-> Bool |
|
-> 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
.
:: NotebookClass self | |
=> self | |
-> IO Bool | returns |
Returns whether a bevel will be drawn around the notebook pages. See
notebookSetShowBorder
.
:: NotebookClass self | |
=> self | |
-> Bool |
|
-> IO () |
Sets whether the tab label area will have arrows for scrolling if there are too many tabs to fit in the area.
:: NotebookClass self | |
=> self | |
-> IO Bool | returns |
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.
:: 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.
:: (NotebookClass self, WidgetClass child, WidgetClass menuLabel) | |
=> self | |
-> child |
|
-> Maybe menuLabel |
|
-> IO () |
Changes the menu label for the page containing child
.
:: (NotebookClass self, WidgetClass child) | |
=> self | |
-> child |
|
-> IO (Maybe Widget) | returns the menu label, or |
Retrieves the menu label widget of the page containing child
.
notebookSetMenuLabelText Source
:: (NotebookClass self, WidgetClass child, GlibString string) | |
=> self | |
-> child |
|
-> string |
|
-> IO () |
Creates a new label and sets it as the menu label of child
.
notebookGetMenuLabelText Source
:: (NotebookClass self, WidgetClass child, GlibString string) | |
=> self | |
-> child |
|
-> IO (Maybe string) | returns value: the text of the tab label, or
|
Retrieves the text of the menu label for the page containing child
.
:: NotebookClass self | |
=> self | |
-> Int |
|
-> IO (Maybe Widget) | returns the child widget, or |
Returns the child widget contained in page number pageNum
.
notebookGetNPages :: NotebookClass self => self -> IO Int Source
Gets the number of pages in a notebook.
- Available since Gtk version 2.2
:: (NotebookClass self, WidgetClass child) | |
=> self | |
-> child |
|
-> 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 Source
:: (NotebookClass self, WidgetClass child, GlibString string) | |
=> self | |
-> child |
|
-> IO (Maybe string) | returns value: the text of the tab label, or
|
Retrieves the text of the tab label for the page containing child
.
Packing parameters of a widget
- The
Packing
parameter determines how the child behaves in the horizontal or vertical way in anHBox
orVBox
, respectively.PackNatural
means the child is as big as it requests. It will stay at the start or end of aBox
if there is more space available. All children packed withPackRepel
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 aVBox
with the packing optionPackNatural
. The working area of a window (e.g. the text area in an editor) should expand when the window is resized. Here the packing optionPackGrow
is the right choice and it is irrelevant whether the main area is inserted at the start or the end of a box. FinallyPackRepel
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.
Packing of widgets at start or end in a box
:: (NotebookClass self, WidgetClass child, WidgetClass tabLabel) | |
=> self | |
-> child |
|
-> tabLabel |
|
-> IO () |
Changes the tab label for child
.
notebookSetTabLabelText Source
:: (NotebookClass self, WidgetClass child, GlibString string) | |
=> self | |
-> child |
|
-> string |
|
-> IO () |
Creates a new label and sets it as the tab label for the page containing
child
.
notebookSetTabReorderable Source
:: (NotebookClass self, WidgetClass child) | |
=> self | |
-> child |
|
-> Bool |
|
-> IO () |
Sets whether the notebook tab can be reordered via drag and drop or not.
- Available since Gtk version 2.10
notebookGetTabReorderable Source
:: (NotebookClass self, WidgetClass child) | |
=> self | |
-> child |
|
-> IO Bool | return |
Gets whether the tab can be reordered via drag and drop or not.
- Available since Gtk version 2.10
notebookSetTabDetachable Source
:: (NotebookClass self, WidgetClass child) | |
=> self | |
-> child |
|
-> Bool |
|
-> 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
notebookGetTabDetachable Source
:: (NotebookClass self, WidgetClass child) | |
=> self | |
-> child |
|
-> IO Bool | return |
Returns whether the tab contents can be detached from notebook.
- Available since Gtk version 2.10
notebookSetActionWidget Source
:: (NotebookClass self, WidgetClass widget) | |
=> self | |
-> widget | |
-> PackType |
|
-> 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
notebookGetActionWidget Source
:: NotebookClass self | |
=> self | |
-> PackType |
|
-> IO (Maybe Widget) |
Gets one of the action widgets. See notebookSetActionWidget
.
- Available since Gtk version 2.20
Attributes
notebookPage :: NotebookClass self => Attr self Int Source
The index of the current page.
Allowed values: >= 0
Default value: 0
notebookTabPos :: NotebookClass self => Attr self PositionType Source
Which side of the notebook holds the tabs.
Default value: PosTop
notebookTabBorder :: NotebookClass self => WriteAttr self Int Source
Width of the border around the tab labels.
Default value: 2
notebookTabHborder :: NotebookClass self => Attr self Int Source
Width of the horizontal border of tab labels.
Default value: 2
notebookTabVborder :: NotebookClass self => Attr self Int Source
Width of the vertical border of tab labels.
Default value: 2
notebookShowTabs :: NotebookClass self => Attr self Bool Source
Whether tabs should be shown or not.
Default value: True
notebookShowBorder :: NotebookClass self => Attr self Bool Source
Whether the border should be shown or not.
Default value: True
notebookScrollable :: NotebookClass self => Attr self Bool Source
If True
, scroll arrows are added if there are too many tabs to fit.
Default value: False
notebookEnablePopup :: NotebookClass self => Attr self Bool Source
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 Source
Whether tabs should have homogeneous sizes.
Default value: False
notebookCurrentPage :: NotebookClass self => Attr self Int Source
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, GlibString string) => child -> Attr self string Source
The string displayed on the child's tab label.
Default value: Nothing
notebookChildMenuLabel :: (NotebookClass self, WidgetClass child, GlibString string) => child -> Attr self string Source
The string displayed in the child's menu entry.
Default value: Nothing
notebookChildPosition :: (NotebookClass self, WidgetClass child) => child -> Attr self Int Source
The index of the child in the parent.
Allowed values: >= -1
Default value: 0
notebookChildTabPacking :: (NotebookClass self, WidgetClass child) => child -> Attr self Packing Source
The packing style of the child's tab.
Default value: PackGrow
notebookChildTabPackType :: (NotebookClass self, WidgetClass child) => child -> Attr self PackType Source
notebookChildDetachable :: NotebookClass self => Attr self Bool Source
Whether the tab is detachable.
Default value: False
notebookChildReorderable :: NotebookClass self => Attr self Bool Source
Whether the tab is reorderable by user action or not.
Default value: False
notebookChildTabExpand :: NotebookClass self => Attr self Bool Source
Whether to expand the child's tab or not.
Default value : False
notebookChildTabFill :: NotebookClass self => Attr self Bool Source
Whether the child's tab should fill the allocated area or not.
Default value : False
Style Attributes
notebookStyleArrowSpacing :: NotebookClass self => ReadAttr self Bool Source
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 Bool Source
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 Bool Source
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 Bool Source
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 Bool Source
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 Int Source
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 Int Source
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