Copyright | Will Thompson Iñaki García Etxebarria and Jonas Platte |
---|---|
License | LGPL-2.1 |
Maintainer | Iñaki García Etxebarria |
Safe Haskell | Safe-Inferred |
Language | Haskell2010 |
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 (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 dragDataReceived
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.
Since: 2.20
Synopsis
- newtype ToolPalette = ToolPalette (ManagedPtr ToolPalette)
- class (GObject o, IsDescendantOf ToolPalette o) => IsToolPalette o
- toToolPalette :: (MonadIO m, IsToolPalette o) => o -> m ToolPalette
- toolPaletteAddDragDest :: (HasCallStack, MonadIO m, IsToolPalette a, IsWidget b) => a -> b -> [DestDefaults] -> [ToolPaletteDragTargets] -> [DragAction] -> m ()
- toolPaletteGetDragItem :: (HasCallStack, MonadIO m, IsToolPalette a) => a -> SelectionData -> m Widget
- toolPaletteGetDragTargetGroup :: (HasCallStack, MonadIO m) => m TargetEntry
- toolPaletteGetDragTargetItem :: (HasCallStack, MonadIO m) => m TargetEntry
- toolPaletteGetDropGroup :: (HasCallStack, MonadIO m, IsToolPalette a) => a -> Int32 -> Int32 -> m (Maybe ToolItemGroup)
- toolPaletteGetDropItem :: (HasCallStack, MonadIO m, IsToolPalette a) => a -> Int32 -> Int32 -> m (Maybe ToolItem)
- toolPaletteGetExclusive :: (HasCallStack, MonadIO m, IsToolPalette a, IsToolItemGroup b) => a -> b -> m Bool
- toolPaletteGetExpand :: (HasCallStack, MonadIO m, IsToolPalette a, IsToolItemGroup b) => a -> b -> m Bool
- toolPaletteGetGroupPosition :: (HasCallStack, MonadIO m, IsToolPalette a, IsToolItemGroup b) => a -> b -> m Int32
- toolPaletteGetHadjustment :: (HasCallStack, MonadIO m, IsToolPalette a) => a -> m Adjustment
- toolPaletteGetIconSize :: (HasCallStack, MonadIO m, IsToolPalette a) => a -> m Int32
- toolPaletteGetStyle :: (HasCallStack, MonadIO m, IsToolPalette a) => a -> m ToolbarStyle
- toolPaletteGetVadjustment :: (HasCallStack, MonadIO m, IsToolPalette a) => a -> m Adjustment
- toolPaletteNew :: (HasCallStack, MonadIO m) => m ToolPalette
- toolPaletteSetDragSource :: (HasCallStack, MonadIO m, IsToolPalette a) => a -> [ToolPaletteDragTargets] -> m ()
- toolPaletteSetExclusive :: (HasCallStack, MonadIO m, IsToolPalette a, IsToolItemGroup b) => a -> b -> Bool -> m ()
- toolPaletteSetExpand :: (HasCallStack, MonadIO m, IsToolPalette a, IsToolItemGroup b) => a -> b -> Bool -> m ()
- toolPaletteSetGroupPosition :: (HasCallStack, MonadIO m, IsToolPalette a, IsToolItemGroup b) => a -> b -> Int32 -> m ()
- toolPaletteSetIconSize :: (HasCallStack, MonadIO m, IsToolPalette a) => a -> Int32 -> m ()
- toolPaletteSetStyle :: (HasCallStack, MonadIO m, IsToolPalette a) => a -> ToolbarStyle -> m ()
- toolPaletteUnsetIconSize :: (HasCallStack, MonadIO m, IsToolPalette a) => a -> m ()
- toolPaletteUnsetStyle :: (HasCallStack, MonadIO m, IsToolPalette a) => a -> m ()
- constructToolPaletteIconSize :: (IsToolPalette o, MonadIO m) => IconSize -> m (GValueConstruct o)
- getToolPaletteIconSize :: (MonadIO m, IsToolPalette o) => o -> m IconSize
- setToolPaletteIconSize :: (MonadIO m, IsToolPalette o) => o -> IconSize -> m ()
- constructToolPaletteIconSizeSet :: (IsToolPalette o, MonadIO m) => Bool -> m (GValueConstruct o)
- getToolPaletteIconSizeSet :: (MonadIO m, IsToolPalette o) => o -> m Bool
- setToolPaletteIconSizeSet :: (MonadIO m, IsToolPalette o) => o -> Bool -> m ()
- constructToolPaletteToolbarStyle :: (IsToolPalette o, MonadIO m) => ToolbarStyle -> m (GValueConstruct o)
- getToolPaletteToolbarStyle :: (MonadIO m, IsToolPalette o) => o -> m ToolbarStyle
- setToolPaletteToolbarStyle :: (MonadIO m, IsToolPalette o) => o -> ToolbarStyle -> m ()
Exported types
newtype ToolPalette Source #
Memory-managed wrapper type.
ToolPalette (ManagedPtr ToolPalette) |
Instances
Eq ToolPalette Source # | |
Defined in GI.Gtk.Objects.ToolPalette (==) :: ToolPalette -> ToolPalette -> Bool # (/=) :: ToolPalette -> ToolPalette -> Bool # | |
GObject ToolPalette Source # | |
Defined in GI.Gtk.Objects.ToolPalette | |
ManagedPtrNewtype ToolPalette Source # | |
Defined in GI.Gtk.Objects.ToolPalette toManagedPtr :: ToolPalette -> ManagedPtr ToolPalette | |
TypedObject ToolPalette Source # | |
Defined in GI.Gtk.Objects.ToolPalette | |
HasParentTypes ToolPalette Source # | |
Defined in GI.Gtk.Objects.ToolPalette | |
IsGValue (Maybe ToolPalette) Source # | Convert |
Defined in GI.Gtk.Objects.ToolPalette gvalueGType_ :: IO GType gvalueSet_ :: Ptr GValue -> Maybe ToolPalette -> IO () gvalueGet_ :: Ptr GValue -> IO (Maybe ToolPalette) | |
type ParentTypes ToolPalette Source # | |
Defined in GI.Gtk.Objects.ToolPalette type ParentTypes ToolPalette = '[Container, Widget, Object, ImplementorIface, Buildable, Orientable, Scrollable] |
class (GObject o, IsDescendantOf ToolPalette o) => IsToolPalette o Source #
Type class for types which can be safely cast to ToolPalette
, for instance with toToolPalette
.
Instances
(GObject o, IsDescendantOf ToolPalette o) => IsToolPalette o Source # | |
Defined in GI.Gtk.Objects.ToolPalette |
toToolPalette :: (MonadIO m, IsToolPalette o) => o -> m ToolPalette Source #
Cast to ToolPalette
, for types for which this is known to be safe. For general casts, use castTo
.
Methods
Click to display all available methods, including inherited ones
Methods
activate, add, addAccelerator, addChild, addDeviceEvents, addDragDest, addEvents, addMnemonicLabel, addTickCallback, bindProperty, bindPropertyFull, canActivateAccel, checkResize, childFocus, childGetProperty, childNotify, childNotifyByPspec, childSetProperty, childType, classPath, computeExpand, constructChild, createPangoContext, createPangoLayout, customFinished, customTagEnd, customTagStart, destroy, destroyed, deviceIsShadowed, dragBegin, dragBeginWithCoordinates, dragCheckThreshold, dragDestAddImageTargets, dragDestAddTextTargets, dragDestAddUriTargets, dragDestFindTarget, dragDestGetTargetList, dragDestGetTrackMotion, dragDestSet, dragDestSetProxy, dragDestSetTargetList, dragDestSetTrackMotion, dragDestUnset, dragGetData, dragHighlight, dragSourceAddImageTargets, dragSourceAddTextTargets, dragSourceAddUriTargets, dragSourceGetTargetList, dragSourceSet, dragSourceSetIconGicon, dragSourceSetIconName, dragSourceSetIconPixbuf, dragSourceSetIconStock, dragSourceSetTargetList, dragSourceUnset, dragUnhighlight, draw, ensureStyle, errorBell, event, forall, forceFloating, foreach, freezeChildNotify, freezeNotify, getv, grabAdd, grabDefault, grabFocus, grabRemove, hasDefault, hasFocus, hasGrab, hasRcStyle, hasScreen, hasVisibleFocus, hide, hideOnDelete, inDestruction, initTemplate, inputShapeCombineRegion, insertActionGroup, intersect, isAncestor, isComposited, isDrawable, isFloating, isFocus, isSensitive, isToplevel, isVisible, keynavFailed, listAccelClosures, listActionPrefixes, listMnemonicLabels, map, mnemonicActivate, modifyBase, modifyBg, modifyCursor, modifyFg, modifyFont, modifyStyle, modifyText, notify, notifyByPspec, overrideBackgroundColor, overrideColor, overrideCursor, overrideFont, overrideSymbolicColor, parserFinished, path, propagateDraw, queueAllocate, queueComputeExpand, queueDraw, queueDrawArea, queueDrawRegion, queueResize, queueResizeNoRedraw, realize, ref, refSink, regionIntersect, registerWindow, remove, removeAccelerator, removeMnemonicLabel, removeTickCallback, renderIcon, renderIconPixbuf, reparent, resetRcStyles, resetStyle, resizeChildren, runDispose, sendExpose, sendFocusChange, shapeCombineRegion, show, showAll, showNow, sizeAllocate, sizeAllocateWithBaseline, sizeRequest, stealData, stealQdata, styleAttach, styleGetProperty, thawChildNotify, thawNotify, translateCoordinates, triggerTooltipQuery, unmap, unparent, unrealize, unref, unregisterWindow, unsetFocusChain, unsetIconSize, unsetStateFlags, unsetStyle, watchClosure.
Getters
getAccessible, getActionGroup, getAllocatedBaseline, getAllocatedHeight, getAllocatedSize, getAllocatedWidth, getAllocation, getAncestor, getAppPaintable, getBorder, getBorderWidth, getCanDefault, getCanFocus, getChildRequisition, getChildVisible, getChildren, getClip, getClipboard, getCompositeName, getData, getDeviceEnabled, getDeviceEvents, getDirection, getDisplay, getDoubleBuffered, getDragItem, getDropGroup, getDropItem, getEvents, getExclusive, getExpand, getFocusChain, getFocusChild, getFocusHadjustment, getFocusOnClick, getFocusVadjustment, getFontMap, getFontOptions, getFrameClock, getGroupPosition, getHadjustment, getHalign, getHasTooltip, getHasWindow, getHexpand, getHexpandSet, getHscrollPolicy, getIconSize, getInternalChild, getMapped, getMarginBottom, getMarginEnd, getMarginLeft, getMarginRight, getMarginStart, getMarginTop, getModifierMask, getModifierStyle, getName, getNoShowAll, getOpacity, getOrientation, getPangoContext, getParent, getParentWindow, getPath, getPathForChild, getPointer, getPreferredHeight, getPreferredHeightAndBaselineForWidth, getPreferredHeightForWidth, getPreferredSize, getPreferredWidth, getPreferredWidthForHeight, getProperty, getQdata, getRealized, getReceivesDefault, getRequestMode, getRequisition, getResizeMode, getRootWindow, getScaleFactor, getScreen, getSensitive, getSettings, getSizeRequest, getState, getStateFlags, getStyle, getStyleContext, getSupportMultidevice, getTemplateChild, getTooltipMarkup, getTooltipText, getTooltipWindow, getToplevel, getVadjustment, getValign, getValignWithBaseline, getVexpand, getVexpandSet, getVisible, getVisual, getVscrollPolicy, getWindow.
Setters
setAccelPath, setAllocation, setAppPaintable, setBorderWidth, setBuildableProperty, setCanDefault, setCanFocus, setChildVisible, setClip, setCompositeName, setData, setDataFull, setDeviceEnabled, setDeviceEvents, setDirection, setDoubleBuffered, setDragSource, setEvents, setExclusive, setExpand, setFocusChain, setFocusChild, setFocusHadjustment, setFocusOnClick, setFocusVadjustment, setFontMap, setFontOptions, setGroupPosition, setHadjustment, setHalign, setHasTooltip, setHasWindow, setHexpand, setHexpandSet, setHscrollPolicy, setIconSize, setMapped, setMarginBottom, setMarginEnd, setMarginLeft, setMarginRight, setMarginStart, setMarginTop, setName, setNoShowAll, setOpacity, setOrientation, setParent, setParentWindow, setProperty, setRealized, setReallocateRedraws, setReceivesDefault, setRedrawOnAllocate, setResizeMode, setSensitive, setSizeRequest, setState, setStateFlags, setStyle, setSupportMultidevice, setTooltipMarkup, setTooltipText, setTooltipWindow, setVadjustment, setValign, setVexpand, setVexpandSet, setVisible, setVisual, setVscrollPolicy, setWindow.
addDragDest
toolPaletteAddDragDest Source #
:: (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
toolPaletteGetDragItem Source #
:: (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 #
:: (HasCallStack, MonadIO m) | |
=> m TargetEntry | Returns: the |
Get the target entry for a dragged ToolItemGroup
.
Since: 2.20
getDragTargetItem
toolPaletteGetDragTargetItem Source #
:: (HasCallStack, MonadIO m) | |
=> m TargetEntry | Returns: the |
Gets the target entry for a dragged ToolItem
.
Since: 2.20
getDropGroup
toolPaletteGetDropGroup Source #
:: (HasCallStack, MonadIO m, IsToolPalette a) | |
=> a |
|
-> Int32 |
|
-> Int32 |
|
-> m (Maybe ToolItemGroup) | Returns: the |
Gets the group at position (x, y).
Since: 2.20
getDropItem
toolPaletteGetDropItem Source #
:: (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
toolPaletteGetExclusive Source #
:: (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
:: (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
toolPaletteGetGroupPosition Source #
:: (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
toolPaletteGetHadjustment Source #
:: (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
toolPaletteGetIconSize Source #
:: (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
:: (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
toolPaletteGetVadjustment Source #
:: (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
:: (HasCallStack, MonadIO m) | |
=> m ToolPalette | Returns: a new |
Creates a new tool palette.
Since: 2.20
setDragSource
toolPaletteSetDragSource Source #
:: (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
toolPaletteSetExclusive Source #
:: (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
:: (HasCallStack, MonadIO m, IsToolPalette a, IsToolItemGroup b) | |
=> a |
|
-> b |
|
-> Bool |
|
-> m () |
Sets whether the group should be given extra space.
Since: 2.20
setGroupPosition
toolPaletteSetGroupPosition Source #
:: (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
toolPaletteSetIconSize Source #
:: (HasCallStack, MonadIO m, IsToolPalette a) | |
=> a |
|
-> Int32 |
|
-> m () |
Sets the size of icons in the tool palette.
Since: 2.20
setStyle
:: (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
toolPaletteUnsetIconSize Source #
:: (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
toolPaletteUnsetStyle Source #
:: (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
The size of the icons in a tool palette. When this property is set, it overrides the default setting.
This should only be used for special-purpose tool palettes, normal application tool palettes should respect the user preferences for the size of icons.
Since: 2.20
constructToolPaletteIconSize :: (IsToolPalette o, MonadIO m) => IconSize -> m (GValueConstruct o) Source #
Construct a GValueConstruct
with valid value for the “icon-size
” property. This is rarely needed directly, but it is used by new
.
getToolPaletteIconSize :: (MonadIO m, IsToolPalette o) => o -> m IconSize Source #
Get the value of the “icon-size
” property.
When overloading is enabled, this is equivalent to
get
toolPalette #iconSize
setToolPaletteIconSize :: (MonadIO m, IsToolPalette o) => o -> IconSize -> m () Source #
Set the value of the “icon-size
” property.
When overloading is enabled, this is equivalent to
set
toolPalette [ #iconSize:=
value ]
iconSizeSet
Is True
if the ToolPalette
:icon-size
property has been set.
Since: 2.20
constructToolPaletteIconSizeSet :: (IsToolPalette o, MonadIO m) => Bool -> m (GValueConstruct o) Source #
Construct a GValueConstruct
with valid value for the “icon-size-set
” property. This is rarely needed directly, but it is used by new
.
getToolPaletteIconSizeSet :: (MonadIO m, IsToolPalette o) => o -> m Bool Source #
Get the value of the “icon-size-set
” property.
When overloading is enabled, this is equivalent to
get
toolPalette #iconSizeSet
setToolPaletteIconSizeSet :: (MonadIO m, IsToolPalette o) => o -> Bool -> m () Source #
Set the value of the “icon-size-set
” property.
When overloading is enabled, this is equivalent to
set
toolPalette [ #iconSizeSet:=
value ]
toolbarStyle
The style of items in the tool palette.
Since: 2.20
constructToolPaletteToolbarStyle :: (IsToolPalette o, MonadIO m) => ToolbarStyle -> m (GValueConstruct o) Source #
Construct a GValueConstruct
with valid value for the “toolbar-style
” property. This is rarely needed directly, but it is used by new
.
getToolPaletteToolbarStyle :: (MonadIO m, IsToolPalette o) => o -> m ToolbarStyle Source #
Get the value of the “toolbar-style
” property.
When overloading is enabled, this is equivalent to
get
toolPalette #toolbarStyle
setToolPaletteToolbarStyle :: (MonadIO m, IsToolPalette o) => o -> ToolbarStyle -> m () Source #
Set the value of the “toolbar-style
” property.
When overloading is enabled, this is equivalent to
set
toolPalette [ #toolbarStyle:=
value ]