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