]> Pileus Git - ~andy/gtk/blob - gtk/gtktoolpalette.h
4d5e9d835613f81e758e760eccfc339c59f8e41d
[~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 #if !defined (__GTK_H_INSIDE__) && !defined (GTK_COMPILATION)
23 #error "Only <gtk/gtk.h> can be included directly."
24 #endif
25
26 #ifndef __GTK_TOOL_PALETTE_H__
27 #define __GTK_TOOL_PALETTE_H__
28
29 #include <gtk/gtkcontainer.h>
30 #include <gtk/gtkdnd.h>
31 #include <gtk/gtktoolitem.h>
32
33 G_BEGIN_DECLS
34
35 #define GTK_TYPE_TOOL_PALETTE           (gtk_tool_palette_get_type ())
36 #define GTK_TOOL_PALETTE(obj)           (G_TYPE_CHECK_INSTANCE_CAST (obj, GTK_TYPE_TOOL_PALETTE, GtkToolPalette))
37 #define GTK_TOOL_PALETTE_CLASS(cls)     (G_TYPE_CHECK_CLASS_CAST (cls, GTK_TYPE_TOOL_PALETTE, GtkToolPaletteClass))
38 #define GTK_IS_TOOL_PALETTE(obj)        (G_TYPE_CHECK_INSTANCE_TYPE (obj, GTK_TYPE_TOOL_PALETTE))
39 #define GTK_IS_TOOL_PALETTE_CLASS(obj)  (G_TYPE_CHECK_CLASS_TYPE (obj, GTK_TYPE_TOOL_PALETTE))
40 #define GTK_TOOL_PALETTE_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GTK_TYPE_TOOL_PALETTE, GtkToolPaletteClass))
41
42 typedef struct _GtkToolPalette           GtkToolPalette;
43 typedef struct _GtkToolPaletteClass      GtkToolPaletteClass;
44 typedef struct _GtkToolPalettePrivate    GtkToolPalettePrivate;
45
46 /**
47  * GtkToolPaletteDragTargets:
48  * @GTK_TOOL_PALETTE_DRAG_ITEMS: Support drag of items.
49  * @GTK_TOOL_PALETTE_DRAG_GROUPS: Support drag of groups.
50  *
51  * Flags used to specify the supported drag targets.
52  */
53 typedef enum /*< flags >*/
54 {
55   GTK_TOOL_PALETTE_DRAG_ITEMS = (1 << 0),
56   GTK_TOOL_PALETTE_DRAG_GROUPS = (1 << 1)
57 }
58 GtkToolPaletteDragTargets;
59
60 /**
61  * GtkToolPalette:
62  *
63  * This should not be accessed directly. Use the accessor functions below.
64  */
65 struct _GtkToolPalette
66 {
67   GtkContainer parent_instance;
68   GtkToolPalettePrivate *priv;
69 };
70
71 struct _GtkToolPaletteClass
72 {
73   GtkContainerClass parent_class;
74
75   /* Padding for future expansion */
76   void (*_gtk_reserved1) (void);
77   void (*_gtk_reserved2) (void);
78   void (*_gtk_reserved3) (void);
79   void (*_gtk_reserved4) (void);
80 };
81
82 GType                          gtk_tool_palette_get_type              (void) G_GNUC_CONST;
83 GtkWidget*                     gtk_tool_palette_new                   (void);
84
85 void                           gtk_tool_palette_set_group_position    (GtkToolPalette            *palette,
86                                                                        GtkToolItemGroup          *group,
87                                                                        gint                       position);
88 void                           gtk_tool_palette_set_exclusive         (GtkToolPalette            *palette,
89                                                                        GtkToolItemGroup          *group,
90                                                                        gboolean                   exclusive);
91 void                           gtk_tool_palette_set_expand            (GtkToolPalette            *palette,
92                                                                        GtkToolItemGroup          *group,
93                                                                        gboolean                   expand);
94
95 gint                           gtk_tool_palette_get_group_position    (GtkToolPalette            *palette,
96                                                                        GtkToolItemGroup          *group);
97 gboolean                       gtk_tool_palette_get_exclusive         (GtkToolPalette            *palette,
98                                                                        GtkToolItemGroup          *group);
99 gboolean                       gtk_tool_palette_get_expand            (GtkToolPalette            *palette,
100                                                                        GtkToolItemGroup          *group);
101
102 void                           gtk_tool_palette_set_icon_size         (GtkToolPalette            *palette,
103                                                                        GtkIconSize                icon_size);
104 void                           gtk_tool_palette_unset_icon_size       (GtkToolPalette            *palette);
105 void                           gtk_tool_palette_set_style             (GtkToolPalette            *palette,
106                                                                        GtkToolbarStyle            style);
107 void                           gtk_tool_palette_unset_style           (GtkToolPalette            *palette);
108
109 GtkIconSize                    gtk_tool_palette_get_icon_size         (GtkToolPalette            *palette);
110 GtkToolbarStyle                gtk_tool_palette_get_style             (GtkToolPalette            *palette);
111
112 GtkToolItem*                   gtk_tool_palette_get_drop_item         (GtkToolPalette            *palette,
113                                                                        gint                       x,
114                                                                        gint                       y);
115 GtkToolItemGroup*              gtk_tool_palette_get_drop_group        (GtkToolPalette            *palette,
116                                                                        gint                       x,
117                                                                        gint                       y);
118 GtkWidget*                     gtk_tool_palette_get_drag_item         (GtkToolPalette            *palette,
119                                                                        const GtkSelectionData    *selection);
120
121 void                           gtk_tool_palette_set_drag_source       (GtkToolPalette            *palette,
122                                                                        GtkToolPaletteDragTargets  targets);
123 void                           gtk_tool_palette_add_drag_dest         (GtkToolPalette            *palette,
124                                                                        GtkWidget                 *widget,
125                                                                        GtkDestDefaults            flags,
126                                                                        GtkToolPaletteDragTargets  targets,
127                                                                        GdkDragAction              actions);
128
129
130 GDK_DEPRECATED_IN_3_0_FOR(gtk_scrollable_get_hadjustment)
131 GtkAdjustment*                 gtk_tool_palette_get_hadjustment       (GtkToolPalette            *palette);
132 GDK_DEPRECATED_IN_3_0_FOR(gtk_scrollable_get_vadjustment)
133 GtkAdjustment*                 gtk_tool_palette_get_vadjustment       (GtkToolPalette            *palette);
134
135 const GtkTargetEntry*          gtk_tool_palette_get_drag_target_item  (void) G_GNUC_CONST;
136 const GtkTargetEntry*          gtk_tool_palette_get_drag_target_group (void) G_GNUC_CONST;
137
138
139 G_END_DECLS
140
141 #endif /* __GTK_TOOL_PALETTE_H__ */