| 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 <[email protected]>, based on code by |
| 20 |
* Carsten Haitzler <[email protected]> |
| 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 |
TOKEN_DIRECTION, |
| 116 |
TOKEN_LTR, |
| 117 |
TOKEN_RTL |
| 118 |
}; |
| 119 |
|
| 120 |
typedef enum |
| 121 |
{ |
| 122 |
COMPONENT_NORTH_WEST = 1 << 0, |
| 123 |
COMPONENT_NORTH = 1 << 1, |
| 124 |
COMPONENT_NORTH_EAST = 1 << 2, |
| 125 |
COMPONENT_WEST = 1 << 3, |
| 126 |
COMPONENT_CENTER = 1 << 4, |
| 127 |
COMPONENT_EAST = 1 << 5, |
| 128 |
COMPONENT_SOUTH_EAST = 1 << 6, |
| 129 |
COMPONENT_SOUTH = 1 << 7, |
| 130 |
COMPONENT_SOUTH_WEST = 1 << 8, |
| 131 |
COMPONENT_ALL = 1 << 9 |
| 132 |
} ThemePixbufComponent; |
| 133 |
|
| 134 |
typedef enum { |
| 135 |
THEME_MATCH_GAP_SIDE = 1 << 0, |
| 136 |
THEME_MATCH_ORIENTATION = 1 << 1, |
| 137 |
THEME_MATCH_STATE = 1 << 2, |
| 138 |
THEME_MATCH_SHADOW = 1 << 3, |
| 139 |
THEME_MATCH_ARROW_DIRECTION = 1 << 4, |
| 140 |
THEME_MATCH_EXPANDER_STYLE = 1 << 5, |
| 141 |
THEME_MATCH_WINDOW_EDGE = 1 << 6, |
| 142 |
THEME_MATCH_DIRECTION = 1 << 7 |
| 143 |
} ThemeMatchFlags; |
| 144 |
|
| 145 |
typedef enum { |
| 146 |
THEME_CONSTANT_ROWS = 1 << 0, |
| 147 |
THEME_CONSTANT_COLS = 1 << 1, |
| 148 |
THEME_MISSING = 1 << 2 |
| 149 |
} ThemeRenderHints; |
| 150 |
|
| 151 |
struct _ThemePixbuf |
| 152 |
{ |
| 153 |
gchar *filename; |
| 154 |
GdkPixbuf *pixbuf; |
| 155 |
gboolean stretch; |
| 156 |
gint border_left; |
| 157 |
gint border_right; |
| 158 |
gint border_bottom; |
| 159 |
gint border_top; |
| 160 |
guint hints[3][3]; |
| 161 |
}; |
| 162 |
|
| 163 |
struct _ThemeMatchData |
| 164 |
{ |
| 165 |
guint function; /* Mandatory */ |
| 166 |
gchar *detail; |
| 167 |
|
| 168 |
ThemeMatchFlags flags; |
| 169 |
|
| 170 |
GtkPositionType gap_side; |
| 171 |
GtkOrientation orientation; |
| 172 |
GtkStateType state; |
| 173 |
GtkShadowType shadow; |
| 174 |
GtkArrowType arrow_direction; |
| 175 |
GtkExpanderStyle expander_style; |
| 176 |
GdkWindowEdge window_edge; |
| 177 |
GtkTextDirection direction; |
| 178 |
}; |
| 179 |
|
| 180 |
struct _ThemeImage |
| 181 |
{ |
| 182 |
guint refcount; |
| 183 |
|
| 184 |
ThemePixbuf *background; |
| 185 |
ThemePixbuf *overlay; |
| 186 |
ThemePixbuf *gap_start; |
| 187 |
ThemePixbuf *gap; |
| 188 |
ThemePixbuf *gap_end; |
| 189 |
|
| 190 |
gchar recolorable; |
| 191 |
|
| 192 |
ThemeMatchData match_data; |
| 193 |
}; |
| 194 |
|
| 195 |
|
| 196 |
G_GNUC_INTERNAL ThemePixbuf *theme_pixbuf_new (void); |
| 197 |
G_GNUC_INTERNAL void theme_pixbuf_destroy (ThemePixbuf *theme_pb); |
| 198 |
G_GNUC_INTERNAL void theme_clear_pixbuf (ThemePixbuf **theme_pb); |
| 199 |
G_GNUC_INTERNAL void theme_pixbuf_set_filename (ThemePixbuf *theme_pb, |
| 200 |
const char *filename); |
| 201 |
G_GNUC_INTERNAL GdkPixbuf * theme_pixbuf_get_pixbuf (ThemePixbuf *theme_pb); |
| 202 |
G_GNUC_INTERNAL void theme_pixbuf_set_border (ThemePixbuf *theme_pb, |
| 203 |
gint left, |
| 204 |
gint right, |
| 205 |
gint top, |
| 206 |
gint bottom); |
| 207 |
G_GNUC_INTERNAL void theme_pixbuf_set_stretch (ThemePixbuf *theme_pb, |
| 208 |
gboolean stretch); |
| 209 |
G_GNUC_INTERNAL void theme_pixbuf_render (ThemePixbuf *theme_pb, |
| 210 |
GdkWindow *window, |
| 211 |
GdkBitmap *mask, |
| 212 |
GdkRectangle *clip_rect, |
| 213 |
guint component_mask, |
| 214 |
gboolean center, |
| 215 |
gint dest_x, |
| 216 |
gint dest_y, |
| 217 |
gint dest_width, |
| 218 |
gint dest_height); |
| 219 |
|
| 220 |
|
| 221 |
|
| 222 |
extern GtkStyleClass pixmap_default_class; |