File: toolpalette.hg

package info (click to toggle)
gtkmm3.0 3.24.0-2
  • links: PTS, VCS
  • area: main
  • in suites: buster
  • size: 22,680 kB
  • sloc: xml: 121,333; cpp: 8,531; sh: 4,250; makefile: 262; perl: 236
file content (108 lines) | stat: -rw-r--r-- 5,069 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
/* 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, write to the Free Software
 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
 */

#include <gtkmm/container.h>
#include <gtkmm/toolitem.h>
#include <gtkmm/orientable.h>
#include <gtkmm/scrollable.h>
#include <gtkmm/toolitemgroup.h>

_DEFS(gtkmm,gtk)
_PINCLUDE(gtkmm/private/container_p.h)

namespace Gtk
{

_WRAP_ENUM(ToolPaletteDragTargets, GtkToolPaletteDragTargets)

/** 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 ToolPalette
: public Container,
  public Orientable,
  public Scrollable
{
  _CLASS_GTKOBJECT(ToolPalette, GtkToolPalette, GTK_TOOL_PALETTE, Gtk::Container, GtkContainer)
  _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