| Copyright | Will Thompson, Iñaki García Etxebarria and Jonas Platte |
|---|---|
| License | LGPL-2.1 |
| Maintainer | Iñaki García Etxebarria (garetxe@gmail.com) |
| Safe Haskell | None |
| Language | Haskell2010 |
GI.Gtk.Objects.ToolPalette
Contents
Description
A ToolPalette allows you to add GtkToolItems to a palette-like
container with different categories and drag and drop support.
A ToolPalette is created with a call to toolPaletteNew.
GtkToolItems cannot be added directly to a ToolPalette -
instead they are added to a ToolItemGroup which can than be added
to a ToolPalette. To add a ToolItemGroup to a ToolPalette,
use containerAdd.
C code
GtkWidget *palette, *group;
GtkToolItem *item;
palette = gtk_tool_palette_new ();
group = gtk_tool_item_group_new (_("Test Category"));
gtk_container_add (GTK_CONTAINER (palette), group);
item = gtk_tool_button_new_new (NULL, _("_Open"));
gtk_tool_button_set_icon_name (GTK_TOOL_BUTTON (item), "document-open");
gtk_tool_item_group_insert (GTK_TOOL_ITEM_GROUP (group), item, -1);The easiest way to use drag and drop with ToolPalette is to call
toolPaletteAddDragDest with the desired drag source palette
and the desired drag target widget. Then toolPaletteGetDragItem
can be used to get the dragged item in the Widget::drag-data-received
signal handler of the drag target.
C code
static void
passive_canvas_drag_data_received (GtkWidget *widget,
GdkDragContext *context,
gint x,
gint y,
GtkSelectionData *selection,
guint info,
guint time,
gpointer data)
{
GtkWidget *palette;
GtkWidget *item;
// Get the dragged item
palette = gtk_widget_get_ancestor (gtk_drag_get_source_widget (context),
GTK_TYPE_TOOL_PALETTE);
if (palette != NULL)
item = gtk_tool_palette_get_drag_item (GTK_TOOL_PALETTE (palette),
selection);
// Do something with item
}
GtkWidget *target, palette;
palette = gtk_tool_palette_new ();
target = gtk_drawing_area_new ();
g_signal_connect (G_OBJECT (target), "drag-data-received",
G_CALLBACK (passive_canvas_drag_data_received), NULL);
gtk_tool_palette_add_drag_dest (GTK_TOOL_PALETTE (palette), target,
GTK_DEST_DEFAULT_ALL,
GTK_TOOL_PALETTE_DRAG_ITEMS,
GDK_ACTION_COPY);CSS nodes
GtkToolPalette has a single CSS node named toolpalette.
- newtype ToolPalette = ToolPalette (ManagedPtr ToolPalette)
- class GObject o => IsToolPalette o
- toToolPalette :: IsToolPalette o => o -> IO ToolPalette
- noToolPalette :: Maybe ToolPalette
- data ToolPaletteAddDragDestMethodInfo
- toolPaletteAddDragDest :: (HasCallStack, MonadIO m, IsToolPalette a, IsWidget b) => a -> b -> [DestDefaults] -> [ToolPaletteDragTargets] -> [DragAction] -> m ()
- data ToolPaletteGetDragItemMethodInfo
- toolPaletteGetDragItem :: (HasCallStack, MonadIO m, IsToolPalette a) => a -> SelectionData -> m Widget
- toolPaletteGetDragTargetGroup :: (HasCallStack, MonadIO m) => m TargetEntry
- toolPaletteGetDragTargetItem :: (HasCallStack, MonadIO m) => m TargetEntry
- data ToolPaletteGetDropGroupMethodInfo
- toolPaletteGetDropGroup :: (HasCallStack, MonadIO m, IsToolPalette a) => a -> Int32 -> Int32 -> m (Maybe ToolItemGroup)
- data ToolPaletteGetDropItemMethodInfo
- toolPaletteGetDropItem :: (HasCallStack, MonadIO m, IsToolPalette a) => a -> Int32 -> Int32 -> m (Maybe ToolItem)
- data ToolPaletteGetExclusiveMethodInfo
- toolPaletteGetExclusive :: (HasCallStack, MonadIO m, IsToolPalette a, IsToolItemGroup b) => a -> b -> m Bool
- data ToolPaletteGetExpandMethodInfo
- toolPaletteGetExpand :: (HasCallStack, MonadIO m, IsToolPalette a, IsToolItemGroup b) => a -> b -> m Bool
- data ToolPaletteGetGroupPositionMethodInfo
- toolPaletteGetGroupPosition :: (HasCallStack, MonadIO m, IsToolPalette a, IsToolItemGroup b) => a -> b -> m Int32
- data ToolPaletteGetHadjustmentMethodInfo
- toolPaletteGetHadjustment :: (HasCallStack, MonadIO m, IsToolPalette a) => a -> m Adjustment
- data ToolPaletteGetIconSizeMethodInfo
- toolPaletteGetIconSize :: (HasCallStack, MonadIO m, IsToolPalette a) => a -> m Int32
- data ToolPaletteGetStyleMethodInfo
- toolPaletteGetStyle :: (HasCallStack, MonadIO m, IsToolPalette a) => a -> m ToolbarStyle
- data ToolPaletteGetVadjustmentMethodInfo
- toolPaletteGetVadjustment :: (HasCallStack, MonadIO m, IsToolPalette a) => a -> m Adjustment
- toolPaletteNew :: (HasCallStack, MonadIO m) => m ToolPalette
- data ToolPaletteSetDragSourceMethodInfo
- toolPaletteSetDragSource :: (HasCallStack, MonadIO m, IsToolPalette a) => a -> [ToolPaletteDragTargets] -> m ()
- data ToolPaletteSetExclusiveMethodInfo
- toolPaletteSetExclusive :: (HasCallStack, MonadIO m, IsToolPalette a, IsToolItemGroup b) => a -> b -> Bool -> m ()
- data ToolPaletteSetExpandMethodInfo
- toolPaletteSetExpand :: (HasCallStack, MonadIO m, IsToolPalette a, IsToolItemGroup b) => a -> b -> Bool -> m ()
- data ToolPaletteSetGroupPositionMethodInfo
- toolPaletteSetGroupPosition :: (HasCallStack, MonadIO m, IsToolPalette a, IsToolItemGroup b) => a -> b -> Int32 -> m ()
- data ToolPaletteSetIconSizeMethodInfo
- toolPaletteSetIconSize :: (HasCallStack, MonadIO m, IsToolPalette a) => a -> Int32 -> m ()
- data ToolPaletteSetStyleMethodInfo
- toolPaletteSetStyle :: (HasCallStack, MonadIO m, IsToolPalette a) => a -> ToolbarStyle -> m ()
- data ToolPaletteUnsetIconSizeMethodInfo
- toolPaletteUnsetIconSize :: (HasCallStack, MonadIO m, IsToolPalette a) => a -> m ()
- data ToolPaletteUnsetStyleMethodInfo
- toolPaletteUnsetStyle :: (HasCallStack, MonadIO m, IsToolPalette a) => a -> m ()
- data ToolPaletteIconSizePropertyInfo
- constructToolPaletteIconSize :: IsToolPalette o => IconSize -> IO (GValueConstruct o)
- getToolPaletteIconSize :: (MonadIO m, IsToolPalette o) => o -> m IconSize
- setToolPaletteIconSize :: (MonadIO m, IsToolPalette o) => o -> IconSize -> m ()
- toolPaletteIconSize :: AttrLabelProxy "iconSize"
- data ToolPaletteIconSizeSetPropertyInfo
- constructToolPaletteIconSizeSet :: IsToolPalette o => Bool -> IO (GValueConstruct o)
- getToolPaletteIconSizeSet :: (MonadIO m, IsToolPalette o) => o -> m Bool
- setToolPaletteIconSizeSet :: (MonadIO m, IsToolPalette o) => o -> Bool -> m ()
- toolPaletteIconSizeSet :: AttrLabelProxy "iconSizeSet"
- data ToolPaletteToolbarStylePropertyInfo
- constructToolPaletteToolbarStyle :: IsToolPalette o => ToolbarStyle -> IO (GValueConstruct o)
- getToolPaletteToolbarStyle :: (MonadIO m, IsToolPalette o) => o -> m ToolbarStyle
- setToolPaletteToolbarStyle :: (MonadIO m, IsToolPalette o) => o -> ToolbarStyle -> m ()
- toolPaletteToolbarStyle :: AttrLabelProxy "toolbarStyle"
Exported types
newtype ToolPalette Source #
Constructors
| ToolPalette (ManagedPtr ToolPalette) |
Instances
| GObject ToolPalette Source # | |
| IsImplementorIface ToolPalette Source # | |
| IsObject ToolPalette Source # | |
| IsWidget ToolPalette Source # | |
| IsContainer ToolPalette Source # | |
| IsScrollable ToolPalette Source # | |
| IsOrientable ToolPalette Source # | |
| IsBuildable ToolPalette Source # | |
| IsToolPalette ToolPalette Source # | |
| ((~) * info (ResolveToolPaletteMethod t ToolPalette), MethodInfo * info ToolPalette p) => IsLabel t (ToolPalette -> p) Source # | |
| ((~) * info (ResolveToolPaletteMethod t ToolPalette), MethodInfo * info ToolPalette p) => IsLabelProxy t (ToolPalette -> p) Source # | |
| HasAttributeList * ToolPalette Source # | |
| type AttributeList ToolPalette Source # | |
| type SignalList ToolPalette Source # | |
class GObject o => IsToolPalette o Source #
Instances
toToolPalette :: IsToolPalette o => o -> IO ToolPalette Source #
Methods
addDragDest
data ToolPaletteAddDragDestMethodInfo Source #
Instances
| ((~) * signature (b -> [DestDefaults] -> [ToolPaletteDragTargets] -> [DragAction] -> m ()), MonadIO m, IsToolPalette a, IsWidget b) => MethodInfo * ToolPaletteAddDragDestMethodInfo a signature Source # | |
toolPaletteAddDragDest Source #
Arguments
| :: (HasCallStack, MonadIO m, IsToolPalette a, IsWidget b) | |
| => a |
|
| -> b |
|
| -> [DestDefaults] |
|
| -> [ToolPaletteDragTargets] |
|
| -> [DragAction] |
|
| -> m () |
Sets palette as drag source (see toolPaletteSetDragSource)
and sets widget as a drag destination for drags from palette.
See widgetDragDestSet.
Since: 2.20
getDragItem
data ToolPaletteGetDragItemMethodInfo Source #
Instances
| ((~) * signature (SelectionData -> m Widget), MonadIO m, IsToolPalette a) => MethodInfo * ToolPaletteGetDragItemMethodInfo a signature Source # | |
toolPaletteGetDragItem Source #
Arguments
| :: (HasCallStack, MonadIO m, IsToolPalette a) | |
| => a |
|
| -> SelectionData |
|
| -> m Widget | Returns: the dragged item in selection |
Get the dragged item from the selection.
This could be a ToolItem or a ToolItemGroup.
Since: 2.20
getDragTargetGroup
toolPaletteGetDragTargetGroup Source #
Arguments
| :: (HasCallStack, MonadIO m) | |
| => m TargetEntry | Returns: the |
Get the target entry for a dragged ToolItemGroup.
Since: 2.20
getDragTargetItem
toolPaletteGetDragTargetItem Source #
Arguments
| :: (HasCallStack, MonadIO m) | |
| => m TargetEntry | Returns: the |
Gets the target entry for a dragged ToolItem.
Since: 2.20
getDropGroup
data ToolPaletteGetDropGroupMethodInfo Source #
Instances
| ((~) * signature (Int32 -> Int32 -> m (Maybe ToolItemGroup)), MonadIO m, IsToolPalette a) => MethodInfo * ToolPaletteGetDropGroupMethodInfo a signature Source # | |
toolPaletteGetDropGroup Source #
Arguments
| :: (HasCallStack, MonadIO m, IsToolPalette a) | |
| => a |
|
| -> Int32 |
|
| -> Int32 |
|
| -> m (Maybe ToolItemGroup) | Returns: the |
Gets the group at position (x, y).
Since: 2.20
getDropItem
data ToolPaletteGetDropItemMethodInfo Source #
Instances
| ((~) * signature (Int32 -> Int32 -> m (Maybe ToolItem)), MonadIO m, IsToolPalette a) => MethodInfo * ToolPaletteGetDropItemMethodInfo a signature Source # | |
toolPaletteGetDropItem Source #
Arguments
| :: (HasCallStack, MonadIO m, IsToolPalette a) | |
| => a |
|
| -> Int32 |
|
| -> Int32 |
|
| -> m (Maybe ToolItem) | Returns: the |
Gets the item at position (x, y).
See toolPaletteGetDropGroup.
Since: 2.20
getExclusive
data ToolPaletteGetExclusiveMethodInfo Source #
Instances
| ((~) * signature (b -> m Bool), MonadIO m, IsToolPalette a, IsToolItemGroup b) => MethodInfo * ToolPaletteGetExclusiveMethodInfo a signature Source # | |
toolPaletteGetExclusive Source #
Arguments
| :: (HasCallStack, MonadIO m, IsToolPalette a, IsToolItemGroup b) | |
| => a |
|
| -> b |
|
| -> m Bool | Returns: |
Gets whether group is exclusive or not.
See toolPaletteSetExclusive.
Since: 2.20
getExpand
data ToolPaletteGetExpandMethodInfo Source #
Instances
| ((~) * signature (b -> m Bool), MonadIO m, IsToolPalette a, IsToolItemGroup b) => MethodInfo * ToolPaletteGetExpandMethodInfo a signature Source # | |
Arguments
| :: (HasCallStack, MonadIO m, IsToolPalette a, IsToolItemGroup b) | |
| => a |
|
| -> b |
|
| -> m Bool | Returns: |
Gets whether group should be given extra space.
See toolPaletteSetExpand.
Since: 2.20
getGroupPosition
data ToolPaletteGetGroupPositionMethodInfo Source #
Instances
| ((~) * signature (b -> m Int32), MonadIO m, IsToolPalette a, IsToolItemGroup b) => MethodInfo * ToolPaletteGetGroupPositionMethodInfo a signature Source # | |
toolPaletteGetGroupPosition Source #
Arguments
| :: (HasCallStack, MonadIO m, IsToolPalette a, IsToolItemGroup b) | |
| => a |
|
| -> b |
|
| -> m Int32 | Returns: the index of group or -1 if |
Gets the position of group in palette as index.
See toolPaletteSetGroupPosition.
Since: 2.20
getHadjustment
data ToolPaletteGetHadjustmentMethodInfo Source #
Instances
| ((~) * signature (m Adjustment), MonadIO m, IsToolPalette a) => MethodInfo * ToolPaletteGetHadjustmentMethodInfo a signature Source # | |
toolPaletteGetHadjustment Source #
Arguments
| :: (HasCallStack, MonadIO m, IsToolPalette a) | |
| => a |
|
| -> m Adjustment | Returns: the horizontal adjustment of |
Deprecated: (Since version 3.0)Use scrollableGetHadjustment
Gets the horizontal adjustment of the tool palette.
Since: 2.20
getIconSize
data ToolPaletteGetIconSizeMethodInfo Source #
Instances
| ((~) * signature (m Int32), MonadIO m, IsToolPalette a) => MethodInfo * ToolPaletteGetIconSizeMethodInfo a signature Source # | |
toolPaletteGetIconSize Source #
Arguments
| :: (HasCallStack, MonadIO m, IsToolPalette a) | |
| => a |
|
| -> m Int32 | Returns: the |
Gets the size of icons in the tool palette.
See toolPaletteSetIconSize.
Since: 2.20
getStyle
data ToolPaletteGetStyleMethodInfo Source #
Instances
| ((~) * signature (m ToolbarStyle), MonadIO m, IsToolPalette a) => MethodInfo * ToolPaletteGetStyleMethodInfo a signature Source # | |
Arguments
| :: (HasCallStack, MonadIO m, IsToolPalette a) | |
| => a |
|
| -> m ToolbarStyle | Returns: the |
Gets the style (icons, text or both) of items in the tool palette.
Since: 2.20
getVadjustment
data ToolPaletteGetVadjustmentMethodInfo Source #
Instances
| ((~) * signature (m Adjustment), MonadIO m, IsToolPalette a) => MethodInfo * ToolPaletteGetVadjustmentMethodInfo a signature Source # | |
toolPaletteGetVadjustment Source #
Arguments
| :: (HasCallStack, MonadIO m, IsToolPalette a) | |
| => a |
|
| -> m Adjustment | Returns: the vertical adjustment of |
Deprecated: (Since version 3.0)Use scrollableGetVadjustment
Gets the vertical adjustment of the tool palette.
Since: 2.20
new
Arguments
| :: (HasCallStack, MonadIO m) | |
| => m ToolPalette | Returns: a new |
Creates a new tool palette.
Since: 2.20
setDragSource
data ToolPaletteSetDragSourceMethodInfo Source #
Instances
| ((~) * signature ([ToolPaletteDragTargets] -> m ()), MonadIO m, IsToolPalette a) => MethodInfo * ToolPaletteSetDragSourceMethodInfo a signature Source # | |
toolPaletteSetDragSource Source #
Arguments
| :: (HasCallStack, MonadIO m, IsToolPalette a) | |
| => a |
|
| -> [ToolPaletteDragTargets] |
|
| -> m () |
Sets the tool palette as a drag source.
Enables all groups and items in the tool palette as drag sources
on button 1 and button 3 press with copy and move actions.
See widgetDragSourceSet.
Since: 2.20
setExclusive
data ToolPaletteSetExclusiveMethodInfo Source #
Instances
| ((~) * signature (b -> Bool -> m ()), MonadIO m, IsToolPalette a, IsToolItemGroup b) => MethodInfo * ToolPaletteSetExclusiveMethodInfo a signature Source # | |
toolPaletteSetExclusive Source #
Arguments
| :: (HasCallStack, MonadIO m, IsToolPalette a, IsToolItemGroup b) | |
| => a |
|
| -> b |
|
| -> Bool |
|
| -> m () |
Sets whether the group should be exclusive or not. If an exclusive group is expanded all other groups are collapsed.
Since: 2.20
setExpand
data ToolPaletteSetExpandMethodInfo Source #
Instances
| ((~) * signature (b -> Bool -> m ()), MonadIO m, IsToolPalette a, IsToolItemGroup b) => MethodInfo * ToolPaletteSetExpandMethodInfo a signature Source # | |
Arguments
| :: (HasCallStack, MonadIO m, IsToolPalette a, IsToolItemGroup b) | |
| => a |
|
| -> b |
|
| -> Bool |
|
| -> m () |
Sets whether the group should be given extra space.
Since: 2.20
setGroupPosition
data ToolPaletteSetGroupPositionMethodInfo Source #
Instances
| ((~) * signature (b -> Int32 -> m ()), MonadIO m, IsToolPalette a, IsToolItemGroup b) => MethodInfo * ToolPaletteSetGroupPositionMethodInfo a signature Source # | |
toolPaletteSetGroupPosition Source #
Arguments
| :: (HasCallStack, MonadIO m, IsToolPalette a, IsToolItemGroup b) | |
| => a |
|
| -> b |
|
| -> Int32 |
|
| -> m () |
Sets the position of the group as an index of the tool palette. If position is 0 the group will become the first child, if position is -1 it will become the last child.
Since: 2.20
setIconSize
data ToolPaletteSetIconSizeMethodInfo Source #
Instances
| ((~) * signature (Int32 -> m ()), MonadIO m, IsToolPalette a) => MethodInfo * ToolPaletteSetIconSizeMethodInfo a signature Source # | |
toolPaletteSetIconSize Source #
Arguments
| :: (HasCallStack, MonadIO m, IsToolPalette a) | |
| => a |
|
| -> Int32 |
|
| -> m () |
Sets the size of icons in the tool palette.
Since: 2.20
setStyle
data ToolPaletteSetStyleMethodInfo Source #
Instances
| ((~) * signature (ToolbarStyle -> m ()), MonadIO m, IsToolPalette a) => MethodInfo * ToolPaletteSetStyleMethodInfo a signature Source # | |
Arguments
| :: (HasCallStack, MonadIO m, IsToolPalette a) | |
| => a |
|
| -> ToolbarStyle |
|
| -> m () |
Sets the style (text, icons or both) of items in the tool palette.
Since: 2.20
unsetIconSize
data ToolPaletteUnsetIconSizeMethodInfo Source #
Instances
| ((~) * signature (m ()), MonadIO m, IsToolPalette a) => MethodInfo * ToolPaletteUnsetIconSizeMethodInfo a signature Source # | |
toolPaletteUnsetIconSize Source #
Arguments
| :: (HasCallStack, MonadIO m, IsToolPalette a) | |
| => a |
|
| -> m () |
Unsets the tool palette icon size set with toolPaletteSetIconSize,
so that user preferences will be used to determine the icon size.
Since: 2.20
unsetStyle
data ToolPaletteUnsetStyleMethodInfo Source #
Instances
| ((~) * signature (m ()), MonadIO m, IsToolPalette a) => MethodInfo * ToolPaletteUnsetStyleMethodInfo a signature Source # | |
toolPaletteUnsetStyle Source #
Arguments
| :: (HasCallStack, MonadIO m, IsToolPalette a) | |
| => a |
|
| -> m () |
Unsets a toolbar style set with toolPaletteSetStyle,
so that user preferences will be used to determine the toolbar style.
Since: 2.20
Properties
iconSize
data ToolPaletteIconSizePropertyInfo Source #
Instances
constructToolPaletteIconSize :: IsToolPalette o => IconSize -> IO (GValueConstruct o) Source #
getToolPaletteIconSize :: (MonadIO m, IsToolPalette o) => o -> m IconSize Source #
setToolPaletteIconSize :: (MonadIO m, IsToolPalette o) => o -> IconSize -> m () Source #
toolPaletteIconSize :: AttrLabelProxy "iconSize" Source #
iconSizeSet
data ToolPaletteIconSizeSetPropertyInfo Source #
Instances
constructToolPaletteIconSizeSet :: IsToolPalette o => Bool -> IO (GValueConstruct o) Source #
getToolPaletteIconSizeSet :: (MonadIO m, IsToolPalette o) => o -> m Bool Source #
setToolPaletteIconSizeSet :: (MonadIO m, IsToolPalette o) => o -> Bool -> m () Source #
toolPaletteIconSizeSet :: AttrLabelProxy "iconSizeSet" Source #
toolbarStyle
data ToolPaletteToolbarStylePropertyInfo Source #
Instances
constructToolPaletteToolbarStyle :: IsToolPalette o => ToolbarStyle -> IO (GValueConstruct o) Source #
getToolPaletteToolbarStyle :: (MonadIO m, IsToolPalette o) => o -> m ToolbarStyle Source #
setToolPaletteToolbarStyle :: (MonadIO m, IsToolPalette o) => o -> ToolbarStyle -> m () Source #
toolPaletteToolbarStyle :: AttrLabelProxy "toolbarStyle" Source #