]> Pileus Git - ~andy/gtk/blob - gtk/gtktoolpalette.h
ToolPalette: Implement GtkOrientable.
[~andy/gtk] / gtk / gtktoolpalette.h
1 /* GtkToolPalette -- A tool palette with categories and DnD support
2  * Copyright (C) 2008  Openismus GmbH
3  *
4  * This library is free software; you can redistribute it and/or
5  * modify it under the terms of the GNU Lesser General Public
6  * License as published by the Free Software Foundation; either
7  * version 2.1 of the License, or (at your option) any later version.
8  *
9  * This library is distributed in the hope that it will be useful,
10  * but WITHOUT ANY WARRANTY; without even the implied warranty of
11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
12  * Lesser General Public License for more details.
13  *
14  * You should have received a copy of the GNU Lesser General Public
15  * License along with this library; if not, write to the Free Software
16  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
17  *
18  * Authors:
19  *      Mathias Hasselmann
20  */
21
22 #ifndef __GTK_TOOL_PALETTE_H__
23 #define __GTK_TOOL_PALETTE_H__
24
25 #include <gtk/gtkcontainer.h>
26 #include <gtk/gtkdnd.h>
27 #include <gtk/gtktoolitem.h>
28
29 G_BEGIN_DECLS
30
31 #define GTK_TYPE_TOOL_PALETTE           (gtk_tool_palette_get_type())
32 #define GTK_TOOL_PALETTE(obj)           (G_TYPE_CHECK_INSTANCE_CAST(obj, GTK_TYPE_TOOL_PALETTE, GtkToolPalette))
33 #define GTK_TOOL_PALETTE_CLASS(cls)     (G_TYPE_CHECK_CLASS_CAST(cls, GTK_TYPE_TOOL_PALETTE, GtkToolPaletteClass))
34 #define GTK_IS_TOOL_PALETTE(obj)        (G_TYPE_CHECK_INSTANCE_TYPE(obj, GTK_TYPE_TOOL_PALETTE))
35 #define GTK_IS_TOOL_PALETTE_CLASS(obj)  (G_TYPE_CHECK_CLASS_TYPE(obj, GTK_TYPE_TOOL_PALETTE))
36 #define GTK_TOOL_PALETTE_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS((obj), GTK_TYPE_TOOL_PALETTE, GtkToolPaletteClass))
37
38 typedef struct _GtkToolPalette           GtkToolPalette;
39 typedef struct _GtkToolPaletteClass      GtkToolPaletteClass;
40 typedef struct _GtkToolPalettePrivate    GtkToolPalettePrivate;
41
42 /**
43  * GtkToolPaletteDragTargets:
44  * @GTK_TOOL_PALETTE_DRAG_ITEMS: Support drag of items.
45  * @GTK_TOOL_PALETTE_DRAG_GROUPS: Support drag of groups.
46  *
47  * Flags used to specify the supported drag targets. 
48  */
49 typedef enum /*< flags >*/
50 {
51   GTK_TOOL_PALETTE_DRAG_ITEMS = (1 << 0),
52   GTK_TOOL_PALETTE_DRAG_GROUPS = (1 << 1)
53 }
54 GtkToolPaletteDragTargets;
55
56 /**
57  * GtkToolPalette:
58  *
59  * This should not be accessed directly. Use the accessor functions below.
60  */
61 struct _GtkToolPalette
62 {
63   GtkContainer parent_instance;
64   GtkToolPalettePrivate *priv;
65 };
66
67 struct _GtkToolPaletteClass
68 {
69   GtkContainerClass parent_class;
70
71   void (*set_scroll_adjustments) (GtkWidget     *widget,
72                                   GtkAdjustment *hadjustment,
73                                   GtkAdjustment *vadjustment);
74 };
75
76 GType                          gtk_tool_palette_get_type              (void) G_GNUC_CONST;
77 GtkWidget*                     gtk_tool_palette_new                   (void);
78
79 void                           gtk_tool_palette_set_group_position    (GtkToolPalette            *palette,
80                                                                        GtkWidget                 *group,
81                                                                        gint                       position);
82 void                           gtk_tool_palette_set_exclusive         (GtkToolPalette            *palette,
83                                                                        GtkWidget                 *group,
84                                                                        gboolean                   exclusive);
85 void                           gtk_tool_palette_set_expand            (GtkToolPalette            *palette,
86                                                                        GtkWidget                 *group,
87                                                                        gboolean                   expand);
88
89 gint                           gtk_tool_palette_get_group_position    (GtkToolPalette            *palette,
90                                                                        GtkWidget                 *group);
91 gboolean                       gtk_tool_palette_get_exclusive         (GtkToolPalette            *palette,
92                                                                        GtkWidget                 *group);
93 gboolean                       gtk_tool_palette_get_expand            (GtkToolPalette            *palette,
94                                                                        GtkWidget                 *group);
95
96 void                           gtk_tool_palette_set_icon_size         (GtkToolPalette            *palette,
97                                                                        GtkIconSize                icon_size);
98 void                           gtk_tool_palette_set_style             (GtkToolPalette            *palette,
99                                                                        GtkToolbarStyle            style);
100
101 GtkIconSize                    gtk_tool_palette_get_icon_size         (GtkToolPalette            *palette);
102 GtkToolbarStyle                gtk_tool_palette_get_style             (GtkToolPalette            *palette);
103
104 GtkToolItem*                   gtk_tool_palette_get_drop_item         (GtkToolPalette            *palette,
105                                                                        gint                       x,
106                                                                        gint                       y);
107 GtkWidget*                     gtk_tool_palette_get_drop_group        (GtkToolPalette            *palette,
108                                                                        gint                       x,
109                                                                        gint                       y);
110 GtkWidget*                     gtk_tool_palette_get_drag_item         (GtkToolPalette            *palette,
111                                                                        const GtkSelectionData    *selection);
112
113 void                           gtk_tool_palette_set_drag_source       (GtkToolPalette            *palette,
114                                                                        GtkToolPaletteDragTargets  targets);
115 void                           gtk_tool_palette_add_drag_dest         (GtkToolPalette            *palette,
116                                                                        GtkWidget                 *widget,
117                                                                        GtkDestDefaults            flags,
118                                                                        GtkToolPaletteDragTargets  targets,
119                                                                        GdkDragAction              actions);
120
121 GtkAdjustment*                 gtk_tool_palette_get_hadjustment       (GtkToolPalette            *palette);
122 GtkAdjustment*                 gtk_tool_palette_get_vadjustment       (GtkToolPalette            *palette);
123
124 G_CONST_RETURN GtkTargetEntry* gtk_tool_palette_get_drag_target_item  (void) G_GNUC_CONST;
125 G_CONST_RETURN GtkTargetEntry* gtk_tool_palette_get_drag_target_group (void) G_GNUC_CONST;
126
127
128 G_END_DECLS
129
130 #endif /* __GTK_TOOL_PALETTE_H__ */