/* Copyright (C) 2009 The gtkmm Development Team * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, see . */ #include #include #include #include #include _DEFS(gtkmm,gtk) _PINCLUDE(gtkmm/private/container_p.h) namespace Gtk { _WRAP_ENUM(ToolPaletteDragTargets, GtkToolPaletteDragTargets, decl_prefix GTKMM_API) /** A ToolPalette allows you to add ToolItems to a palette-like container with * various categories and drag and drop support. * * ToolItems 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 Gtk::Container::add(). * * The easiest way to use drag and drop with ToolPalette is to call * add_drag_dest() with the desired drag source palette and the desired drag * target widget. Then get_drag_item() can be used to get the dragged item in * the "drag-data-received" signal handler of the drag target. * * @newin{2,20} * * @ingroup Widgets * @ingroup Containers */ class GTKMM_API ToolPalette : public Container, public Orientable, public Scrollable { _CLASS_GTKOBJECT(ToolPalette, GtkToolPalette, GTK_TOOL_PALETTE, Gtk::Container, GtkContainer, , , GTKMM_API) _IMPLEMENTS_INTERFACE(Orientable) _IMPLEMENTS_INTERFACE(Scrollable) public: _CTOR_DEFAULT() _WRAP_METHOD(void set_group_position(ToolItemGroup& group, int position), gtk_tool_palette_set_group_position) _WRAP_METHOD(void set_exclusive(ToolItemGroup& group, bool exclusive), gtk_tool_palette_set_exclusive) _WRAP_METHOD(void set_expand(ToolItemGroup& group, bool expand = true), gtk_tool_palette_set_expand) _WRAP_METHOD(int get_group_position(ToolItemGroup& group) const, gtk_tool_palette_get_group_position) _WRAP_METHOD(bool get_exclusive(ToolItemGroup& group) const, gtk_tool_palette_get_exclusive) _WRAP_METHOD(bool get_expand(ToolItemGroup& group) const, gtk_tool_palette_get_expand) _WRAP_METHOD(void set_icon_size(IconSize icon_size), gtk_tool_palette_set_icon_size) _WRAP_METHOD(void unset_icon_size(), gtk_tool_palette_unset_icon_size) _WRAP_METHOD(void set_style(ToolbarStyle style), gtk_tool_palette_set_style) _WRAP_METHOD(void unset_style(), gtk_tool_palette_unset_style) _WRAP_METHOD(IconSize get_icon_size() const, gtk_tool_palette_get_icon_size) _WRAP_METHOD(ToolbarStyle get_style() const, gtk_tool_palette_get_style) _WRAP_METHOD(ToolItem* get_drop_item(int x, int y), gtk_tool_palette_get_drop_item) _WRAP_METHOD(const ToolItem* get_drop_item(int x, int y) const, gtk_tool_palette_get_drop_item, constversion) //This conversion is needed because of https://bugzilla.gnome.org/show_bug.cgi?id=567729#c37 #m4 _CONVERSION(`GtkWidget*',`ToolItemGroup*',`Glib::wrap(GTK_TOOL_ITEM_GROUP($3))') #m4 _CONVERSION(`GtkWidget*',`const ToolItemGroup*',`Glib::wrap(GTK_TOOL_ITEM_GROUP($3))') _WRAP_METHOD(ToolItemGroup* get_drop_group(int x, int y), gtk_tool_palette_get_drop_group) _WRAP_METHOD(const ToolItemGroup* get_drop_group(int x, int y) const, gtk_tool_palette_get_drop_group, constversion) _WRAP_METHOD(ToolItem* get_drag_item(const SelectionData& selection), gtk_tool_palette_get_drag_item) _WRAP_METHOD(const ToolItem* get_drag_item(const SelectionData& selection) const, gtk_tool_palette_get_drag_item, constversion) _WRAP_METHOD(void set_drag_source(ToolPaletteDragTargets targets = TOOL_PALETTE_DRAG_ITEMS), gtk_tool_palette_set_drag_source) _WRAP_METHOD(void add_drag_dest(Gtk::Widget& widget, DestDefaults flags = DEST_DEFAULT_ALL, ToolPaletteDragTargets targets = TOOL_PALETTE_DRAG_ITEMS, Gdk::DragAction actions = Gdk::ACTION_COPY), gtk_tool_palette_add_drag_dest) _IGNORE(gtk_tool_palette_get_hadjustment, gtk_tool_palette_get_hadjustment, gtk_tool_palette_get_vadjustment, gtk_tool_palette_get_vadjustment) #m4 _CONVERSION(`const GtkTargetEntry*',`TargetEntry',`TargetEntry(*$3)') _WRAP_METHOD(static TargetEntry get_drag_target_item(), gtk_tool_palette_get_drag_target_item) _WRAP_METHOD(static TargetEntry get_drag_target_group(), gtk_tool_palette_get_drag_target_group) _WRAP_PROPERTY("icon-size", IconSize) _WRAP_PROPERTY("icon-size-set", bool) _WRAP_PROPERTY("toolbar-style", ToolbarStyle) _WRAP_CHILD_PROPERTY("exclusive", bool) _WRAP_CHILD_PROPERTY("expand", bool) }; } // namespace Gtk