]> Pileus Git - ~andy/gtk/blob - gtk/gtktoolpalette.h
Merge branch 'master' into toolpalette
[~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   /* 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   void (*_gtk_reserved5) (void);
81   void (*_gtk_reserved6) (void);  
82 };
83
84 GType                          gtk_tool_palette_get_type              (void) G_GNUC_CONST;
85 GtkWidget*                     gtk_tool_palette_new                   (void);
86
87 void                           gtk_tool_palette_set_group_position    (GtkToolPalette            *palette,
88                                                                        GtkWidget                 *group,
89                                                                        gint                       position);
90 void                           gtk_tool_palette_set_exclusive         (GtkToolPalette            *palette,
91                                                                        GtkWidget                 *group,
92                                                                        gboolean                   exclusive);
93 void                           gtk_tool_palette_set_expand            (GtkToolPalette            *palette,
94                                                                        GtkWidget                 *group,
95                                                                        gboolean                   expand);
96
97 gint                           gtk_tool_palette_get_group_position    (GtkToolPalette            *palette,
98                                                                        GtkWidget                 *group);
99 gboolean                       gtk_tool_palette_get_exclusive         (GtkToolPalette            *palette,
100                                                                        GtkWidget                 *group);
101 gboolean                       gtk_tool_palette_get_expand            (GtkToolPalette            *palette,
102                                                                        GtkWidget                 *group);
103
104 void                           gtk_tool_palette_set_icon_size         (GtkToolPalette            *palette,
105                                                                        GtkIconSize                icon_size);
106 void                           gtk_tool_palette_unset_icon_size       (GtkToolPalette            *palette);
107 void                           gtk_tool_palette_set_style             (GtkToolPalette            *palette,
108                                                                        GtkToolbarStyle            style);
109 void                           gtk_tool_palette_unset_style           (GtkToolPalette            *palette);
110
111 GtkIconSize                    gtk_tool_palette_get_icon_size         (GtkToolPalette            *palette);
112 GtkToolbarStyle                gtk_tool_palette_get_style             (GtkToolPalette            *palette);
113
114 GtkToolItem*                   gtk_tool_palette_get_drop_item         (GtkToolPalette            *palette,
115                                                                        gint                       x,
116                                                                        gint                       y);
117 GtkWidget*                     gtk_tool_palette_get_drop_group        (GtkToolPalette            *palette,
118                                                                        gint                       x,
119                                                                        gint                       y);
120 GtkWidget*                     gtk_tool_palette_get_drag_item         (GtkToolPalette            *palette,
121                                                                        const GtkSelectionData    *selection);
122
123 void                           gtk_tool_palette_set_drag_source       (GtkToolPalette            *palette,
124                                                                        GtkToolPaletteDragTargets  targets);
125 void                           gtk_tool_palette_add_drag_dest         (GtkToolPalette            *palette,
126                                                                        GtkWidget                 *widget,
127                                                                        GtkDestDefaults            flags,
128                                                                        GtkToolPaletteDragTargets  targets,
129                                                                        GdkDragAction              actions);
130
131 GtkAdjustment*                 gtk_tool_palette_get_hadjustment       (GtkToolPalette            *palette);
132 GtkAdjustment*                 gtk_tool_palette_get_vadjustment       (GtkToolPalette            *palette);
133
134 G_CONST_RETURN GtkTargetEntry* gtk_tool_palette_get_drag_target_item  (void) G_GNUC_CONST;
135 G_CONST_RETURN GtkTargetEntry* gtk_tool_palette_get_drag_target_group (void) G_GNUC_CONST;
136
137
138 G_END_DECLS
139
140 #endif /* __GTK_TOOL_PALETTE_H__ */