Copyright | Will Thompson Iñaki García Etxebarria and Jonas Platte |
---|---|
License | LGPL-2.1 |
Maintainer | Iñaki García Etxebarria |
Safe Haskell | None |
Language | Haskell2010 |
GtkToolButtons
are GtkToolItems
containing buttons.
Use toolButtonNew
to create a new ToolButton
.
The label of a ToolButton
is determined by the properties
ToolButton
:label-widget
, ToolButton
:label
, and
ToolButton
:stock-id
. If ToolButton
:label-widget
is
non-Nothing
, then that widget is used as the label. Otherwise, if
ToolButton
:label
is non-Nothing
, that string is used as the label.
Otherwise, if ToolButton
:stock-id
is non-Nothing
, the label is
determined by the stock item. Otherwise, the button does not have a label.
The icon of a ToolButton
is determined by the properties
ToolButton
:icon-widget
and ToolButton
:stock-id
. If
ToolButton
:icon-widget
is non-Nothing
, then
that widget is used as the icon. Otherwise, if ToolButton
:stock-id
is
non-Nothing
, the icon is determined by the stock item. Otherwise,
the button does not have a icon.
CSS nodes
GtkToolButton has a single CSS node with name toolbutton.
Synopsis
- newtype ToolButton = ToolButton (ManagedPtr ToolButton)
- class (GObject o, IsDescendantOf ToolButton o) => IsToolButton o
- toToolButton :: (MonadIO m, IsToolButton o) => o -> m ToolButton
- toolButtonGetIconName :: (HasCallStack, MonadIO m, IsToolButton a) => a -> m (Maybe Text)
- toolButtonGetIconWidget :: (HasCallStack, MonadIO m, IsToolButton a) => a -> m (Maybe Widget)
- toolButtonGetLabel :: (HasCallStack, MonadIO m, IsToolButton a) => a -> m (Maybe Text)
- toolButtonGetLabelWidget :: (HasCallStack, MonadIO m, IsToolButton a) => a -> m (Maybe Widget)
- toolButtonGetStockId :: (HasCallStack, MonadIO m, IsToolButton a) => a -> m Text
- toolButtonGetUseUnderline :: (HasCallStack, MonadIO m, IsToolButton a) => a -> m Bool
- toolButtonNew :: (HasCallStack, MonadIO m, IsWidget a) => Maybe a -> Maybe Text -> m ToolButton
- toolButtonNewFromStock :: (HasCallStack, MonadIO m) => Text -> m ToolButton
- toolButtonSetIconName :: (HasCallStack, MonadIO m, IsToolButton a) => a -> Maybe Text -> m ()
- toolButtonSetIconWidget :: (HasCallStack, MonadIO m, IsToolButton a, IsWidget b) => a -> Maybe b -> m ()
- toolButtonSetLabel :: (HasCallStack, MonadIO m, IsToolButton a) => a -> Maybe Text -> m ()
- toolButtonSetLabelWidget :: (HasCallStack, MonadIO m, IsToolButton a, IsWidget b) => a -> Maybe b -> m ()
- toolButtonSetStockId :: (HasCallStack, MonadIO m, IsToolButton a) => a -> Maybe Text -> m ()
- toolButtonSetUseUnderline :: (HasCallStack, MonadIO m, IsToolButton a) => a -> Bool -> m ()
- clearToolButtonIconName :: (MonadIO m, IsToolButton o) => o -> m ()
- constructToolButtonIconName :: (IsToolButton o, MonadIO m) => Text -> m (GValueConstruct o)
- getToolButtonIconName :: (MonadIO m, IsToolButton o) => o -> m (Maybe Text)
- setToolButtonIconName :: (MonadIO m, IsToolButton o) => o -> Text -> m ()
- clearToolButtonIconWidget :: (MonadIO m, IsToolButton o) => o -> m ()
- constructToolButtonIconWidget :: (IsToolButton o, MonadIO m, IsWidget a) => a -> m (GValueConstruct o)
- getToolButtonIconWidget :: (MonadIO m, IsToolButton o) => o -> m (Maybe Widget)
- setToolButtonIconWidget :: (MonadIO m, IsToolButton o, IsWidget a) => o -> a -> m ()
- clearToolButtonLabel :: (MonadIO m, IsToolButton o) => o -> m ()
- constructToolButtonLabel :: (IsToolButton o, MonadIO m) => Text -> m (GValueConstruct o)
- getToolButtonLabel :: (MonadIO m, IsToolButton o) => o -> m (Maybe Text)
- setToolButtonLabel :: (MonadIO m, IsToolButton o) => o -> Text -> m ()
- clearToolButtonLabelWidget :: (MonadIO m, IsToolButton o) => o -> m ()
- constructToolButtonLabelWidget :: (IsToolButton o, MonadIO m, IsWidget a) => a -> m (GValueConstruct o)
- getToolButtonLabelWidget :: (MonadIO m, IsToolButton o) => o -> m (Maybe Widget)
- setToolButtonLabelWidget :: (MonadIO m, IsToolButton o, IsWidget a) => o -> a -> m ()
- clearToolButtonStockId :: (MonadIO m, IsToolButton o) => o -> m ()
- constructToolButtonStockId :: (IsToolButton o, MonadIO m) => Text -> m (GValueConstruct o)
- getToolButtonStockId :: (MonadIO m, IsToolButton o) => o -> m Text
- setToolButtonStockId :: (MonadIO m, IsToolButton o) => o -> Text -> m ()
- constructToolButtonUseUnderline :: (IsToolButton o, MonadIO m) => Bool -> m (GValueConstruct o)
- getToolButtonUseUnderline :: (MonadIO m, IsToolButton o) => o -> m Bool
- setToolButtonUseUnderline :: (MonadIO m, IsToolButton o) => o -> Bool -> m ()
- type C_ToolButtonClickedCallback = Ptr () -> Ptr () -> IO ()
- type ToolButtonClickedCallback = IO ()
- afterToolButtonClicked :: (IsToolButton a, MonadIO m) => a -> ToolButtonClickedCallback -> m SignalHandlerId
- genClosure_ToolButtonClicked :: MonadIO m => ToolButtonClickedCallback -> m (GClosure C_ToolButtonClickedCallback)
- mk_ToolButtonClickedCallback :: C_ToolButtonClickedCallback -> IO (FunPtr C_ToolButtonClickedCallback)
- noToolButtonClickedCallback :: Maybe ToolButtonClickedCallback
- onToolButtonClicked :: (IsToolButton a, MonadIO m) => a -> ToolButtonClickedCallback -> m SignalHandlerId
- wrap_ToolButtonClickedCallback :: ToolButtonClickedCallback -> C_ToolButtonClickedCallback
Exported types
newtype ToolButton Source #
Memory-managed wrapper type.
Instances
Eq ToolButton Source # | |
Defined in GI.Gtk.Objects.ToolButton (==) :: ToolButton -> ToolButton -> Bool # (/=) :: ToolButton -> ToolButton -> Bool # | |
IsGValue ToolButton Source # | Convert |
Defined in GI.Gtk.Objects.ToolButton toGValue :: ToolButton -> IO GValue # fromGValue :: GValue -> IO ToolButton # | |
ManagedPtrNewtype ToolButton Source # | |
Defined in GI.Gtk.Objects.ToolButton | |
TypedObject ToolButton Source # | |
Defined in GI.Gtk.Objects.ToolButton | |
GObject ToolButton Source # | |
Defined in GI.Gtk.Objects.ToolButton | |
HasParentTypes ToolButton Source # | |
Defined in GI.Gtk.Objects.ToolButton | |
type ParentTypes ToolButton Source # | |
Defined in GI.Gtk.Objects.ToolButton type ParentTypes ToolButton = '[ToolItem, Bin, Container, Widget, Object, ImplementorIface, Actionable, Activatable, Buildable] |
class (GObject o, IsDescendantOf ToolButton o) => IsToolButton o Source #
Type class for types which can be safely cast to ToolButton
, for instance with toToolButton
.
Instances
(GObject o, IsDescendantOf ToolButton o) => IsToolButton o Source # | |
Defined in GI.Gtk.Objects.ToolButton |
toToolButton :: (MonadIO m, IsToolButton o) => o -> m ToolButton Source #
Cast to ToolButton
, for types for which this is known to be safe. For general casts, use castTo
.
Methods
Overloaded methods
getIconName
toolButtonGetIconName Source #
:: (HasCallStack, MonadIO m, IsToolButton a) | |
=> a |
|
-> m (Maybe Text) | Returns: the icon name or |
Returns the name of the themed icon for the tool button,
see toolButtonSetIconName
.
Since: 2.8
getIconWidget
toolButtonGetIconWidget Source #
:: (HasCallStack, MonadIO m, IsToolButton a) | |
=> a |
|
-> m (Maybe Widget) | Returns: The widget used as icon
on |
Return the widget used as icon widget on button
.
See toolButtonSetIconWidget
.
Since: 2.4
getLabel
:: (HasCallStack, MonadIO m, IsToolButton a) | |
=> a |
|
-> m (Maybe Text) | Returns: The label, or |
Returns the label used by the tool button, or Nothing
if the tool button
doesn’t have a label. or uses a the label from a stock item. The returned
string is owned by GTK+, and must not be modified or freed.
Since: 2.4
getLabelWidget
toolButtonGetLabelWidget Source #
:: (HasCallStack, MonadIO m, IsToolButton a) | |
=> a |
|
-> m (Maybe Widget) | Returns: The widget used as label
on |
Returns the widget used as label on button
.
See toolButtonSetLabelWidget
.
Since: 2.4
getStockId
:: (HasCallStack, MonadIO m, IsToolButton a) | |
=> a |
|
-> m Text | Returns: the name of the stock item for |
Deprecated: (Since version 3.10)Use toolButtonGetIconName
instead.
Returns the name of the stock item. See toolButtonSetStockId
.
The returned string is owned by GTK+ and must not be freed or modifed.
Since: 2.4
getUseUnderline
toolButtonGetUseUnderline Source #
:: (HasCallStack, MonadIO m, IsToolButton a) | |
=> a |
|
-> m Bool | Returns: |
Returns whether underscores in the label property are used as mnemonics
on menu items on the overflow menu. See toolButtonSetUseUnderline
.
Since: 2.4
new
:: (HasCallStack, MonadIO m, IsWidget a) | |
=> Maybe a |
|
-> Maybe Text |
|
-> m ToolButton | Returns: A new |
Creates a new ToolButton
using iconWidget
as contents and label
as
label.
Since: 2.4
newFromStock
toolButtonNewFromStock Source #
:: (HasCallStack, MonadIO m) | |
=> Text |
|
-> m ToolButton | Returns: A new |
Deprecated: (Since version 3.10)Use toolButtonNew
together withimageNewFromIconName
instead.
Creates a new ToolButton
containing the image and text from a
stock item. Some stock ids have preprocessor macros like STOCK_OK
and STOCK_APPLY
.
It is an error if stockId
is not a name of a stock item.
Since: 2.4
setIconName
toolButtonSetIconName Source #
:: (HasCallStack, MonadIO m, IsToolButton a) | |
=> a |
|
-> Maybe Text |
|
-> m () |
Sets the icon for the tool button from a named themed icon.
See the docs for IconTheme
for more details.
The ToolButton
:icon-name
property only has an effect if not
overridden by non-Nothing
ToolButton
:label-widget
,
ToolButton
:icon-widget
and ToolButton
:stock-id
properties.
Since: 2.8
setIconWidget
toolButtonSetIconWidget Source #
:: (HasCallStack, MonadIO m, IsToolButton a, IsWidget b) | |
=> a |
|
-> Maybe b |
|
-> m () |
Sets icon
as the widget used as icon on button
. If iconWidget
is
Nothing
the icon is determined by the ToolButton
:stock-id
property. If the
ToolButton
:stock-id
property is also Nothing
, button
will not have an icon.
Since: 2.4
setLabel
:: (HasCallStack, MonadIO m, IsToolButton a) | |
=> a |
|
-> Maybe Text |
|
-> m () |
Sets label
as the label used for the tool button. The ToolButton
:label
property only has an effect if not overridden by a non-Nothing
ToolButton
:label-widget
property. If both the ToolButton
:label-widget
and ToolButton
:label
properties are Nothing
, the label is determined by the
ToolButton
:stock-id
property. If the ToolButton
:stock-id
property is
also Nothing
, button
will not have a label.
Since: 2.4
setLabelWidget
toolButtonSetLabelWidget Source #
:: (HasCallStack, MonadIO m, IsToolButton a, IsWidget b) | |
=> a |
|
-> Maybe b |
|
-> m () |
Sets labelWidget
as the widget that will be used as the label
for button
. If labelWidget
is Nothing
the ToolButton
:label
property is used
as label. If ToolButton
:label
is also Nothing
, the label in the stock item
determined by the ToolButton
:stock-id
property is used as label. If
ToolButton
:stock-id
is also Nothing
, button
does not have a label.
Since: 2.4
setStockId
:: (HasCallStack, MonadIO m, IsToolButton a) | |
=> a |
|
-> Maybe Text |
|
-> m () |
Deprecated: (Since version 3.10)Use toolButtonSetIconName
instead.
Sets the name of the stock item. See toolButtonNewFromStock
.
The stock_id property only has an effect if not overridden by non-Nothing
ToolButton
:label-widget
and ToolButton
:icon-widget
properties.
Since: 2.4
setUseUnderline
toolButtonSetUseUnderline Source #
:: (HasCallStack, MonadIO m, IsToolButton a) | |
=> a |
|
-> Bool |
|
-> m () |
If set, an underline in the label property indicates that the next character
should be used for the mnemonic accelerator key in the overflow menu. For
example, if the label property is “_Open” and useUnderline
is True
,
the label on the tool button will be “Open” and the item on the overflow
menu will have an underlined “O”.
Labels shown on tool buttons never have mnemonics on them; this property only affects the menu item on the overflow menu.
Since: 2.4
Properties
iconName
The name of the themed icon displayed on the item.
This property only has an effect if not overridden by
ToolButton
:label-widget
, ToolButton
:icon-widget
or
ToolButton
:stock-id
properties.
Since: 2.8
clearToolButtonIconName :: (MonadIO m, IsToolButton o) => o -> m () Source #
Set the value of the “icon-name
” property to Nothing
.
When overloading is enabled, this is equivalent to
clear
#iconName
constructToolButtonIconName :: (IsToolButton o, MonadIO m) => Text -> m (GValueConstruct o) Source #
Construct a GValueConstruct
with valid value for the “icon-name
” property. This is rarely needed directly, but it is used by new
.
getToolButtonIconName :: (MonadIO m, IsToolButton o) => o -> m (Maybe Text) Source #
Get the value of the “icon-name
” property.
When overloading is enabled, this is equivalent to
get
toolButton #iconName
setToolButtonIconName :: (MonadIO m, IsToolButton o) => o -> Text -> m () Source #
Set the value of the “icon-name
” property.
When overloading is enabled, this is equivalent to
set
toolButton [ #iconName:=
value ]
iconWidget
No description available in the introspection data.
clearToolButtonIconWidget :: (MonadIO m, IsToolButton o) => o -> m () Source #
Set the value of the “icon-widget
” property to Nothing
.
When overloading is enabled, this is equivalent to
clear
#iconWidget
constructToolButtonIconWidget :: (IsToolButton o, MonadIO m, IsWidget a) => a -> m (GValueConstruct o) Source #
Construct a GValueConstruct
with valid value for the “icon-widget
” property. This is rarely needed directly, but it is used by new
.
getToolButtonIconWidget :: (MonadIO m, IsToolButton o) => o -> m (Maybe Widget) Source #
Get the value of the “icon-widget
” property.
When overloading is enabled, this is equivalent to
get
toolButton #iconWidget
setToolButtonIconWidget :: (MonadIO m, IsToolButton o, IsWidget a) => o -> a -> m () Source #
Set the value of the “icon-widget
” property.
When overloading is enabled, this is equivalent to
set
toolButton [ #iconWidget:=
value ]
label
No description available in the introspection data.
clearToolButtonLabel :: (MonadIO m, IsToolButton o) => o -> m () Source #
Set the value of the “label
” property to Nothing
.
When overloading is enabled, this is equivalent to
clear
#label
constructToolButtonLabel :: (IsToolButton o, MonadIO m) => Text -> m (GValueConstruct o) Source #
Construct a GValueConstruct
with valid value for the “label
” property. This is rarely needed directly, but it is used by new
.
getToolButtonLabel :: (MonadIO m, IsToolButton o) => o -> m (Maybe Text) Source #
Get the value of the “label
” property.
When overloading is enabled, this is equivalent to
get
toolButton #label
setToolButtonLabel :: (MonadIO m, IsToolButton o) => o -> Text -> m () Source #
Set the value of the “label
” property.
When overloading is enabled, this is equivalent to
set
toolButton [ #label:=
value ]
labelWidget
No description available in the introspection data.
clearToolButtonLabelWidget :: (MonadIO m, IsToolButton o) => o -> m () Source #
Set the value of the “label-widget
” property to Nothing
.
When overloading is enabled, this is equivalent to
clear
#labelWidget
constructToolButtonLabelWidget :: (IsToolButton o, MonadIO m, IsWidget a) => a -> m (GValueConstruct o) Source #
Construct a GValueConstruct
with valid value for the “label-widget
” property. This is rarely needed directly, but it is used by new
.
getToolButtonLabelWidget :: (MonadIO m, IsToolButton o) => o -> m (Maybe Widget) Source #
Get the value of the “label-widget
” property.
When overloading is enabled, this is equivalent to
get
toolButton #labelWidget
setToolButtonLabelWidget :: (MonadIO m, IsToolButton o, IsWidget a) => o -> a -> m () Source #
Set the value of the “label-widget
” property.
When overloading is enabled, this is equivalent to
set
toolButton [ #labelWidget:=
value ]
stockId
No description available in the introspection data.
clearToolButtonStockId :: (MonadIO m, IsToolButton o) => o -> m () Source #
Set the value of the “stock-id
” property to Nothing
.
When overloading is enabled, this is equivalent to
clear
#stockId
constructToolButtonStockId :: (IsToolButton o, MonadIO m) => Text -> m (GValueConstruct o) Source #
Construct a GValueConstruct
with valid value for the “stock-id
” property. This is rarely needed directly, but it is used by new
.
getToolButtonStockId :: (MonadIO m, IsToolButton o) => o -> m Text Source #
Get the value of the “stock-id
” property.
When overloading is enabled, this is equivalent to
get
toolButton #stockId
setToolButtonStockId :: (MonadIO m, IsToolButton o) => o -> Text -> m () Source #
Set the value of the “stock-id
” property.
When overloading is enabled, this is equivalent to
set
toolButton [ #stockId:=
value ]
useUnderline
No description available in the introspection data.
constructToolButtonUseUnderline :: (IsToolButton o, MonadIO m) => Bool -> m (GValueConstruct o) Source #
Construct a GValueConstruct
with valid value for the “use-underline
” property. This is rarely needed directly, but it is used by new
.
getToolButtonUseUnderline :: (MonadIO m, IsToolButton o) => o -> m Bool Source #
Get the value of the “use-underline
” property.
When overloading is enabled, this is equivalent to
get
toolButton #useUnderline
setToolButtonUseUnderline :: (MonadIO m, IsToolButton o) => o -> Bool -> m () Source #
Set the value of the “use-underline
” property.
When overloading is enabled, this is equivalent to
set
toolButton [ #useUnderline:=
value ]
Signals
clicked
type C_ToolButtonClickedCallback = Ptr () -> Ptr () -> IO () Source #
Type for the callback on the (unwrapped) C side.
type ToolButtonClickedCallback = IO () Source #
This signal is emitted when the tool button is clicked with the mouse or activated with the keyboard.
afterToolButtonClicked :: (IsToolButton a, MonadIO m) => a -> ToolButtonClickedCallback -> m SignalHandlerId Source #
Connect a signal handler for the clicked signal, to be run after the default handler. When overloading is enabled, this is equivalent to
after
toolButton #clicked callback
genClosure_ToolButtonClicked :: MonadIO m => ToolButtonClickedCallback -> m (GClosure C_ToolButtonClickedCallback) Source #
Wrap the callback into a GClosure
.
mk_ToolButtonClickedCallback :: C_ToolButtonClickedCallback -> IO (FunPtr C_ToolButtonClickedCallback) Source #
Generate a function pointer callable from C code, from a C_ToolButtonClickedCallback
.
noToolButtonClickedCallback :: Maybe ToolButtonClickedCallback Source #
A convenience synonym for
.Nothing
:: Maybe
ToolButtonClickedCallback
onToolButtonClicked :: (IsToolButton a, MonadIO m) => a -> ToolButtonClickedCallback -> m SignalHandlerId Source #
Connect a signal handler for the clicked signal, to be run before the default handler. When overloading is enabled, this is equivalent to
on
toolButton #clicked callback