]> Pileus Git - ~andy/gtk/blob - modules/engines/pixbuf/pixbuf.h
a9611705e0f8eaa9d284d3c21b8a79986c85a68b
[~andy/gtk] / modules / engines / pixbuf / pixbuf.h
1 /* GTK+ Pixbuf Engine
2  * Copyright (C) 1998-2000 Red Hat, Inc.
3  *
4  * This library is free software; you can redistribute it and/or
5  * modify it under the terms of the GNU Library General Public
6  * License as published by the Free Software Foundation; either
7  * version 2 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  * Library General Public License for more details.
13  *
14  * You should have received a copy of the GNU Library General Public
15  * License along with this library; if not, write to the
16  * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
17  * Boston, MA 02111-1307, USA.
18  *
19  * Written by Owen Taylor <otaylor@redhat.com>, based on code by
20  * Carsten Haitzler <raster@rasterman.com>
21  */
22
23 #include <gtk/gtk.h>
24 #include <gdk-pixbuf/gdk-pixbuf.h>
25
26 /* internals */
27
28 typedef struct _ThemeData ThemeData;
29 typedef struct _ThemeImage ThemeImage;
30 typedef struct _ThemeMatchData ThemeMatchData;
31 typedef struct _ThemePixbuf ThemePixbuf;
32
33 enum
34 {
35   TOKEN_IMAGE = G_TOKEN_LAST + 1,
36   TOKEN_FUNCTION,
37   TOKEN_FILE,
38   TOKEN_STRETCH,
39   TOKEN_RECOLORABLE,
40   TOKEN_BORDER,
41   TOKEN_DETAIL,
42   TOKEN_STATE,
43   TOKEN_SHADOW,
44   TOKEN_GAP_SIDE,
45   TOKEN_GAP_FILE,
46   TOKEN_GAP_BORDER,
47   TOKEN_GAP_START_FILE,
48   TOKEN_GAP_START_BORDER,
49   TOKEN_GAP_END_FILE,
50   TOKEN_GAP_END_BORDER,
51   TOKEN_OVERLAY_FILE,
52   TOKEN_OVERLAY_BORDER,
53   TOKEN_OVERLAY_STRETCH,
54   TOKEN_ARROW_DIRECTION,
55   TOKEN_EXPANDER_STYLE,
56   TOKEN_WINDOW_EDGE,
57   TOKEN_D_HLINE,
58   TOKEN_D_VLINE,
59   TOKEN_D_SHADOW,
60   TOKEN_D_POLYGON,
61   TOKEN_D_ARROW,
62   TOKEN_D_DIAMOND,
63   TOKEN_D_OVAL,
64   TOKEN_D_STRING,
65   TOKEN_D_BOX,
66   TOKEN_D_FLAT_BOX,
67   TOKEN_D_CHECK,
68   TOKEN_D_OPTION,
69   TOKEN_D_CROSS,
70   TOKEN_D_RAMP,
71   TOKEN_D_TAB,
72   TOKEN_D_SHADOW_GAP,
73   TOKEN_D_BOX_GAP,
74   TOKEN_D_EXTENSION,
75   TOKEN_D_FOCUS,
76   TOKEN_D_SLIDER,
77   TOKEN_D_ENTRY,
78   TOKEN_D_HANDLE,
79   TOKEN_D_STEPPER,
80   TOKEN_D_EXPANDER,
81   TOKEN_D_RESIZE_GRIP,
82   TOKEN_TRUE,
83   TOKEN_FALSE,
84   TOKEN_TOP,
85   TOKEN_UP,
86   TOKEN_BOTTOM,
87   TOKEN_DOWN,
88   TOKEN_LEFT,
89   TOKEN_RIGHT,
90   TOKEN_NORMAL,
91   TOKEN_ACTIVE,
92   TOKEN_PRELIGHT,
93   TOKEN_SELECTED,
94   TOKEN_INSENSITIVE,
95   TOKEN_NONE,
96   TOKEN_IN,
97   TOKEN_OUT,
98   TOKEN_ETCHED_IN,
99   TOKEN_ETCHED_OUT,
100   TOKEN_ORIENTATION,
101   TOKEN_HORIZONTAL,
102   TOKEN_VERTICAL,
103   TOKEN_COLLAPSED,
104   TOKEN_SEMI_COLLAPSED,
105   TOKEN_SEMI_EXPANDED,
106   TOKEN_EXPANDED,
107   TOKEN_NORTH_WEST,
108   TOKEN_NORTH,
109   TOKEN_NORTH_EAST,
110   TOKEN_WEST,
111   TOKEN_EAST,
112   TOKEN_SOUTH_WEST,
113   TOKEN_SOUTH,
114   TOKEN_SOUTH_EAST
115 };
116
117 typedef enum
118 {
119   COMPONENT_NORTH_WEST = 1 << 0,
120   COMPONENT_NORTH      = 1 << 1,
121   COMPONENT_NORTH_EAST = 1 << 2, 
122   COMPONENT_WEST       = 1 << 3,
123   COMPONENT_CENTER     = 1 << 4,
124   COMPONENT_EAST       = 1 << 5, 
125   COMPONENT_SOUTH_EAST = 1 << 6,
126   COMPONENT_SOUTH      = 1 << 7,
127   COMPONENT_SOUTH_WEST = 1 << 8,
128   COMPONENT_ALL           = 1 << 9
129 } ThemePixbufComponent;
130
131 typedef enum {
132   THEME_MATCH_GAP_SIDE        = 1 << 0,
133   THEME_MATCH_ORIENTATION     = 1 << 1,
134   THEME_MATCH_STATE           = 1 << 2,
135   THEME_MATCH_SHADOW          = 1 << 3,
136   THEME_MATCH_ARROW_DIRECTION = 1 << 4,
137   THEME_MATCH_EXPANDER_STYLE  = 1 << 5,
138   THEME_MATCH_WINDOW_EDGE     = 1 << 6
139 } ThemeMatchFlags;
140
141 typedef enum {
142   THEME_CONSTANT_ROWS = 1 << 0,
143   THEME_CONSTANT_COLS = 1 << 1,
144   THEME_MISSING = 1 << 2
145 } ThemeRenderHints;
146
147 struct _ThemePixbuf
148 {
149   gchar     *filename;
150   GdkPixbuf *pixbuf;
151   gboolean   stretch;
152   gint       border_left;
153   gint       border_right;
154   gint       border_bottom;
155   gint       border_top;
156   guint      hints[3][3];
157 };
158
159 struct _ThemeMatchData
160 {
161   guint            function;    /* Mandatory */
162   gchar           *detail;
163
164   ThemeMatchFlags  flags;
165
166   GtkPositionType  gap_side;
167   GtkOrientation   orientation;
168   GtkStateType     state;
169   GtkShadowType    shadow;
170   GtkArrowType     arrow_direction;
171   GtkExpanderStyle expander_style;
172   GdkWindowEdge    window_edge;
173 };
174
175 struct _ThemeImage
176 {
177   guint           refcount;
178
179   ThemePixbuf    *background;
180   ThemePixbuf    *overlay;
181   ThemePixbuf    *gap_start;
182   ThemePixbuf    *gap;
183   ThemePixbuf    *gap_end;
184   
185   gchar           recolorable;
186
187   ThemeMatchData  match_data;
188 };
189
190
191 G_GNUC_INTERNAL ThemePixbuf *theme_pixbuf_new          (void);
192 G_GNUC_INTERNAL void         theme_pixbuf_destroy      (ThemePixbuf  *theme_pb);
193 G_GNUC_INTERNAL void         theme_pixbuf_set_filename (ThemePixbuf  *theme_pb,
194                                         const char   *filename);
195 G_GNUC_INTERNAL GdkPixbuf *  theme_pixbuf_get_pixbuf   (ThemePixbuf  *theme_pb);
196 G_GNUC_INTERNAL void         theme_pixbuf_set_border   (ThemePixbuf  *theme_pb,
197                                         gint          left,
198                                         gint          right,
199                                         gint          top,
200                                         gint          bottom);
201 G_GNUC_INTERNAL void         theme_pixbuf_set_stretch  (ThemePixbuf  *theme_pb,
202                                         gboolean      stretch);
203 G_GNUC_INTERNAL void         theme_pixbuf_render       (ThemePixbuf  *theme_pb,
204                                         cairo_t      *cr,
205                                         guint         component_mask,
206                                         gboolean      center,
207                                         gint          dest_x,
208                                         gint          dest_y,
209                                         gint          dest_width,
210                                         gint          dest_height);
211
212
213
214 extern GtkStyleClass pixmap_default_class;