| ||||||||||||||||
| ||||||||||||||||
| ||||||||||||||||
Description | ||||||||||||||||
Create bars of buttons and other widgets | ||||||||||||||||
Synopsis | ||||||||||||||||
Detail | ||||||||||||||||
This widget underwent a signficant overhaul in gtk 2.4 and the recommended api changed substantially. The old interface is still supported but it is not recommended.
A toolbar is created with a call to toolbarNew. A toolbar can contain instances of a subclass of ToolItem. To add a ToolItem to the a toolbar, use toolbarInsert. To remove an item from the toolbar use containerRemove. To add a button to the toolbar, add an instance of ToolButton. Toolbar items can be visually grouped by adding instances of SeparatorToolItem to the toolbar. If a SeparatorToolItem has the "expand" property set to True and the "draw" property set to False the effect is to force all following items to the end of the toolbar. Creating a context menu for the toolbar can be done using onPopupContextMenu. | ||||||||||||||||
Buttons, RadioButtons and ToggleButtons can be added by refering to stock images. Their size can be changed by calling toolbarSetIconSize. In contrast, normal widget cannot be added. Due to the bad interface of Toolbar mnemonics of RadioButtons and ToggleButtons are not honored. All the append, insert and prepend functions use an internal function to do the actual work. In fact the interface is pretty skrewed up: To insert icons by using stock items is definitely the best practice as all other images cannot react to toolbarSetIconSize and other theming actions. On the other hand toolbarInsertStock always generates simple Buttons but is the only function that is able to insert Mnemonics on the label. Our solution is to use StockItems to specify all Images of the Buttons. If the user inserts RadioButtons or ToggleButtons, the stock image lookup is done manually. A mnemonic in the labels is sadly not honored this way. | ||||||||||||||||
Class Hierarchy | ||||||||||||||||
| GObject | +----Object | +----Widget | +----Container | +----Toolbar | ||||||||||||||||
Types | ||||||||||||||||
data Toolbar | ||||||||||||||||
| ||||||||||||||||
class ContainerClass o => ToolbarClass o | ||||||||||||||||
| ||||||||||||||||
castToToolbar :: GObjectClass obj => obj -> Toolbar | ||||||||||||||||
toToolbar :: ToolbarClass o => o -> Toolbar | ||||||||||||||||
data Orientation | ||||||||||||||||
| ||||||||||||||||
data ToolbarStyle | ||||||||||||||||
| ||||||||||||||||
Constructors | ||||||||||||||||
toolbarNew :: IO Toolbar | ||||||||||||||||
Creates a new toolbar. | ||||||||||||||||
Methods | ||||||||||||||||
toolbarInsertNewButton :: ToolbarClass self => self -> Int -> String -> Maybe (String, String) -> IO Button | ||||||||||||||||
Insert a new Button into the Toolbar. The new Button is created at position pos, counting from 0. The icon and label for the button is referenced by stockId which must be a valid entry in the Toolbars Style or the default IconFactory. If you whish to have Tooltips added to this button you can specify Just (tipText, tipPrivate) , otherwise specify Nothing. The newly created Button is returned. Use this button to add an action function with "connectToClicked".
| ||||||||||||||||
toolbarAppendNewButton :: ToolbarClass self => self -> String -> Maybe (String, String) -> IO Button | ||||||||||||||||
Append a new Button to the Toolbar. See toolbarInsertNewButton for details.
| ||||||||||||||||
toolbarPrependNewButton :: ToolbarClass self => self -> String -> Maybe (String, String) -> IO Button | ||||||||||||||||
Prepend a new Button to the Toolbar. See toolbarInsertNewButton for details.
| ||||||||||||||||
toolbarInsertNewToggleButton :: ToolbarClass self => self -> Int -> String -> Maybe (String, String) -> IO ToggleButton | ||||||||||||||||
Insert a new ToggleButton into the Toolbar. See toolbarInsertNewButton for details.
| ||||||||||||||||
toolbarAppendNewToggleButton :: ToolbarClass self => self -> String -> Maybe (String, String) -> IO ToggleButton | ||||||||||||||||
Append a new ToggleButton to the Toolbar. See toolbarInsertNewButton for details.
| ||||||||||||||||
toolbarPrependNewToggleButton :: ToolbarClass self => self -> String -> Maybe (String, String) -> IO ToggleButton | ||||||||||||||||
Prepend a new ToggleButton to the Toolbar. See toolbarInsertNewButton for details.
| ||||||||||||||||
toolbarInsertNewRadioButton :: (ToolbarClass self, RadioButtonClass rb) => self -> Int -> String -> Maybe (String, String) -> Maybe rb -> IO RadioButton | ||||||||||||||||
Insert a new RadioButton into the Toolbar. See toolbarInsertNewButton for details.
The parent argument must be set to another RadioButton in the group. If Nothing is given, a new group is generated (which is the desired behavious for the first button of a group).
| ||||||||||||||||
toolbarAppendNewRadioButton :: (ToolbarClass self, RadioButtonClass rb) => self -> String -> Maybe (String, String) -> Maybe rb -> IO RadioButton | ||||||||||||||||
Append a new RadioButton to the Toolbar. See toolbarInsertNewButton for details.
| ||||||||||||||||
toolbarPrependNewRadioButton :: (ToolbarClass self, RadioButtonClass rb) => self -> String -> Maybe (String, String) -> Maybe rb -> IO RadioButton | ||||||||||||||||
Prepend a new RadioButton to the Toolbar. See toolbarInsertNewButton for details.
| ||||||||||||||||
toolbarInsertNewWidget :: (ToolbarClass self, WidgetClass w) => self -> Int -> w -> Maybe (String, String) -> IO () | ||||||||||||||||
Insert an arbitrary widget to the Toolbar. The Widget should not be a button. Adding Buttons with the toolbarInsertButton,... functions with stock objects is much better as it takes care of theme handling.
| ||||||||||||||||
toolbarAppendNewWidget :: (ToolbarClass self, WidgetClass w) => self -> w -> Maybe (String, String) -> IO () | ||||||||||||||||
Append a new Widget to the Toolbar. See toolbarInsertNewButton for details.
| ||||||||||||||||
toolbarPrependNewWidget :: (ToolbarClass self, WidgetClass w) => self -> w -> Maybe (String, String) -> IO () | ||||||||||||||||
Prepend a new Widget to the Toolbar. See toolbarInsertNewButton for details.
| ||||||||||||||||
toolbarSetOrientation :: ToolbarClass self => self -> Orientation -> IO () | ||||||||||||||||
Sets whether a toolbar should appear horizontally or vertically. | ||||||||||||||||
toolbarGetOrientation :: ToolbarClass self => self -> IO Orientation | ||||||||||||||||
Retrieves the current orientation of the toolbar. See toolbarSetOrientation. | ||||||||||||||||
toolbarSetStyle :: ToolbarClass self => self -> ToolbarStyle -> IO () | ||||||||||||||||
Alters the view of the toolbar to display either icons only, text only, or both. | ||||||||||||||||
toolbarGetStyle :: ToolbarClass self => self -> IO ToolbarStyle | ||||||||||||||||
Retrieves whether the toolbar has text, icons, or both. See toolbarSetStyle. | ||||||||||||||||
toolbarUnsetStyle :: ToolbarClass self => self -> IO () | ||||||||||||||||
Unsets a toolbar style set with toolbarSetStyle, so that user preferences will be used to determine the toolbar style. | ||||||||||||||||
toolbarSetTooltips | ||||||||||||||||
| ||||||||||||||||
toolbarGetTooltips :: ToolbarClass self => self -> IO Bool | ||||||||||||||||
Retrieves whether tooltips are enabled. See toolbarSetTooltips. | ||||||||||||||||
type IconSize = Int | ||||||||||||||||
The size of an icon in pixels. | ||||||||||||||||
iconSizeInvalid :: IconSize | ||||||||||||||||
Don't scale but use any of the available sizes. | ||||||||||||||||
iconSizeSmallToolbar :: IconSize | ||||||||||||||||
Icon size for small toolbars. | ||||||||||||||||
iconSizeLargeToolbar :: IconSize | ||||||||||||||||
Icon size for larger toolbars. | ||||||||||||||||
toolbarSetIconSize :: ToolbarClass self => self -> IconSize -> IO () | ||||||||||||||||
This function sets the size of stock icons in the toolbar. You can call it both before you add the icons and after they've been added. The size you set will override user preferences for the default icon size. It might be sensible to restrict oneself to IconSizeSmallToolbar and IconSizeLargeToolbar.
| ||||||||||||||||
toolbarGetIconSize :: ToolbarClass self => self -> IO IconSize | ||||||||||||||||
Retrieves the icon size for the toolbar. See toolbarSetIconSize. | ||||||||||||||||
toolbarInsert | ||||||||||||||||
| ||||||||||||||||
toolbarGetItemIndex | ||||||||||||||||
| ||||||||||||||||
toolbarGetNItems :: ToolbarClass self => self -> IO Int | ||||||||||||||||
Returns the number of items on the toolbar.
| ||||||||||||||||
toolbarGetNthItem | ||||||||||||||||
| ||||||||||||||||
toolbarGetDropIndex | ||||||||||||||||
| ||||||||||||||||
toolbarSetDropHighlightItem | ||||||||||||||||
| ||||||||||||||||
toolbarSetShowArrow :: ToolbarClass self => self -> Bool -> IO () | ||||||||||||||||
Sets whether to show an overflow menu when the toolbar doesn't have room for all items on it. If True, items that there are not room are available through an overflow menu.
| ||||||||||||||||
toolbarGetShowArrow :: ToolbarClass self => self -> IO Bool | ||||||||||||||||
Returns whether the toolbar has an overflow menu. See toolbarSetShowArrow.
| ||||||||||||||||
data ReliefStyle | ||||||||||||||||
| ||||||||||||||||
toolbarGetReliefStyle :: ToolbarClass self => self -> IO ReliefStyle | ||||||||||||||||
Returns the relief style of buttons on the toolbar. See buttonSetRelief.
| ||||||||||||||||
Attributes | ||||||||||||||||
toolbarOrientation :: ToolbarClass self => Attr self Orientation | ||||||||||||||||
The orientation of the toolbar. Default value: OrientationHorizontal | ||||||||||||||||
toolbarShowArrow :: ToolbarClass self => Attr self Bool | ||||||||||||||||
If an arrow should be shown if the toolbar doesn't fit. Default value: True | ||||||||||||||||
toolbarTooltips :: ToolbarClass self => Attr self Bool | ||||||||||||||||
If the tooltips of the toolbar should be active or not. Default value: True | ||||||||||||||||
toolbarStyle :: ToolbarClass self => Attr self ToolbarStyle | ||||||||||||||||
How to draw the toolbar. Default value: ToolbarIcons | ||||||||||||||||
Child Attributes | ||||||||||||||||
toolbarChildExpand :: (ToolbarClass self, WidgetClass child) => child -> Attr self Bool | ||||||||||||||||
Whether the item should receive extra space when the toolbar grows. Default value: True | ||||||||||||||||
toolbarChildHomogeneous :: (ToolbarClass self, WidgetClass child) => child -> Attr self Bool | ||||||||||||||||
Whether the item should be the same size as other homogeneous items. Default value: True | ||||||||||||||||
Signals | ||||||||||||||||
onOrientationChanged :: ToolbarClass self => self -> (Orientation -> IO ()) -> IO (ConnectId self) | ||||||||||||||||
Emitted when the orientation of the toolbar changes. | ||||||||||||||||
afterOrientationChanged :: ToolbarClass self => self -> (Orientation -> IO ()) -> IO (ConnectId self) | ||||||||||||||||
onStyleChanged :: ToolbarClass self => self -> (ToolbarStyle -> IO ()) -> IO (ConnectId self) | ||||||||||||||||
Emitted when the style of the toolbar changes. | ||||||||||||||||
afterStyleChanged :: ToolbarClass self => self -> (ToolbarStyle -> IO ()) -> IO (ConnectId self) | ||||||||||||||||
onPopupContextMenu | ||||||||||||||||
| ||||||||||||||||
afterPopupContextMenu | ||||||||||||||||
| ||||||||||||||||
Produced by Haddock version 0.8 |