~ubuntu-branches/ubuntu/vivid/marco/vivid

« back to all changes in this revision

Viewing changes to src/ui/theme.h

  • Committer: Package Import Robot
  • Author(s): Mike Gabriel
  • Date: 2014-01-21 19:52:39 UTC
  • Revision ID: package-import@ubuntu.com-20140121195239-c4k1v8umdw1u4n29
Tags: upstream-1.6.2
ImportĀ upstreamĀ versionĀ 1.6.2

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/* -*- mode: C; c-file-style: "gnu"; indent-tabs-mode: nil; -*- */
 
2
 
 
3
/* Marco Theme Rendering */
 
4
 
 
5
/* 
 
6
 * Copyright (C) 2001 Havoc Pennington
 
7
 * 
 
8
 * This program is free software; you can redistribute it and/or
 
9
 * modify it under the terms of the GNU General Public License as
 
10
 * published by the Free Software Foundation; either version 2 of the
 
11
 * License, or (at your option) any later version.
 
12
 *
 
13
 * This program is distributed in the hope that it will be useful, but
 
14
 * WITHOUT ANY WARRANTY; without even the implied warranty of
 
15
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 
16
 * General Public License for more details.
 
17
 * 
 
18
 * You should have received a copy of the GNU General Public License
 
19
 * along with this program; if not, write to the Free Software
 
20
 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
 
21
 * 02110-1301, USA.
 
22
 */
 
23
 
 
24
#ifndef META_THEME_H
 
25
#define META_THEME_H
 
26
 
 
27
#include "boxes.h"
 
28
#include "gradient.h"
 
29
#include "common.h"
 
30
#include <gtk/gtk.h>
 
31
 
 
32
typedef struct _MetaFrameStyle MetaFrameStyle;
 
33
typedef struct _MetaFrameStyleSet MetaFrameStyleSet;
 
34
typedef struct _MetaDrawOp MetaDrawOp;
 
35
typedef struct _MetaDrawOpList MetaDrawOpList;
 
36
typedef struct _MetaGradientSpec MetaGradientSpec;
 
37
typedef struct _MetaAlphaGradientSpec MetaAlphaGradientSpec; 
 
38
typedef struct _MetaColorSpec MetaColorSpec;
 
39
typedef struct _MetaFrameLayout MetaFrameLayout;
 
40
typedef struct _MetaButtonSpace MetaButtonSpace;
 
41
typedef struct _MetaFrameGeometry MetaFrameGeometry;
 
42
typedef struct _MetaTheme MetaTheme;
 
43
typedef struct _MetaPositionExprEnv MetaPositionExprEnv;
 
44
typedef struct _MetaDrawInfo MetaDrawInfo;
 
45
 
 
46
#define META_THEME_ERROR (g_quark_from_static_string ("meta-theme-error"))
 
47
 
 
48
typedef enum
 
49
{
 
50
  META_THEME_ERROR_FRAME_GEOMETRY,
 
51
  META_THEME_ERROR_BAD_CHARACTER,
 
52
  META_THEME_ERROR_BAD_PARENS,
 
53
  META_THEME_ERROR_UNKNOWN_VARIABLE,
 
54
  META_THEME_ERROR_DIVIDE_BY_ZERO,
 
55
  META_THEME_ERROR_MOD_ON_FLOAT,
 
56
  META_THEME_ERROR_FAILED
 
57
} MetaThemeError;
 
58
 
 
59
/**
 
60
 * Whether a button's size is calculated from the area around it (aspect
 
61
 * sizing) or is given as a fixed height and width in pixels (fixed sizing).
 
62
 *
 
63
 * \bug This could be done away with; see the comment at the top of
 
64
 * MetaFrameLayout.
 
65
 */
 
66
typedef enum
 
67
{
 
68
  META_BUTTON_SIZING_ASPECT,
 
69
  META_BUTTON_SIZING_FIXED,
 
70
  META_BUTTON_SIZING_LAST
 
71
} MetaButtonSizing;
 
72
 
 
73
/**
 
74
 * Various parameters used to calculate the geometry of a frame.
 
75
 * They are used inside a MetaFrameStyle.
 
76
 * This corresponds closely to the <frame_geometry> tag in a theme file.
 
77
 *
 
78
 * \bug button_sizing isn't really necessary, because we could easily say
 
79
 * that if button_aspect is zero, the height and width are fixed values.
 
80
 * This would also mean that MetaButtonSizing didn't need to exist, and
 
81
 * save code.
 
82
 **/
 
83
struct _MetaFrameLayout
 
84
{
 
85
  /** Reference count. */
 
86
  int refcount;
 
87
  
 
88
  /** Size of left side */
 
89
  int left_width;
 
90
  /** Size of right side */
 
91
  int right_width;
 
92
  /** Size of bottom side */
 
93
  int bottom_height;
 
94
  
 
95
  /** Border of blue title region
 
96
   * \bug (blue?!)
 
97
   **/
 
98
  GtkBorder title_border;
 
99
 
 
100
  /** Extra height for inside of title region, above the font height */
 
101
  int title_vertical_pad;
 
102
  
 
103
  /** Right indent of buttons from edges of frame */
 
104
  int right_titlebar_edge;
 
105
  /** Left indent of buttons from edges of frame */
 
106
  int left_titlebar_edge;
 
107
  
 
108
  /**
 
109
   * Sizing rule of buttons, either META_BUTTON_SIZING_ASPECT
 
110
   * (in which case button_aspect will be honoured, and
 
111
   * button_width and button_height set from it), or
 
112
   * META_BUTTON_SIZING_FIXED (in which case we read the width
 
113
   * and height directly).
 
114
   */
 
115
  MetaButtonSizing button_sizing;
 
116
 
 
117
  /**
 
118
   * Ratio of height/width. Honoured only if
 
119
   * button_sizing==META_BUTTON_SIZING_ASPECT.
 
120
   * Otherwise we figure out the height from the button_border.
 
121
   */
 
122
  double button_aspect;
 
123
  
 
124
  /** Width of a button; set even when we are using aspect sizing */
 
125
  int button_width;
 
126
 
 
127
  /** Height of a button; set even when we are using aspect sizing */
 
128
  int button_height;
 
129
 
 
130
  /** Space around buttons */
 
131
  GtkBorder button_border;
 
132
 
 
133
  /** scale factor for title text */
 
134
  double title_scale;
 
135
  
 
136
  /** Whether title text will be displayed */
 
137
  guint has_title : 1;
 
138
 
 
139
  /** Whether we should hide the buttons */
 
140
  guint hide_buttons : 1;
 
141
 
 
142
  /** Radius of the top left-hand corner; 0 if not rounded */
 
143
  guint top_left_corner_rounded_radius;
 
144
  /** Radius of the top right-hand corner; 0 if not rounded */
 
145
  guint top_right_corner_rounded_radius;
 
146
  /** Radius of the bottom left-hand corner; 0 if not rounded */
 
147
  guint bottom_left_corner_rounded_radius;
 
148
  /** Radius of the bottom right-hand corner; 0 if not rounded */
 
149
  guint bottom_right_corner_rounded_radius;
 
150
};
 
151
 
 
152
/**
 
153
 * The computed size of a button (really just a way of tying its
 
154
 * visible and clickable areas together).
 
155
 * The reason for two different rectangles here is Fitts' law & maximized
 
156
 * windows; see bug #97703 for more details.
 
157
 */
 
158
struct _MetaButtonSpace
 
159
{
 
160
  /** The screen area where the button's image is drawn */
 
161
  GdkRectangle visible;
 
162
  /** The screen area where the button can be activated by clicking */
 
163
  GdkRectangle clickable;
 
164
};
 
165
 
 
166
/**
 
167
 * Calculated actual geometry of the frame
 
168
 */
 
169
struct _MetaFrameGeometry
 
170
{
 
171
  int left_width;
 
172
  int right_width;
 
173
  int top_height;
 
174
  int bottom_height;
 
175
 
 
176
  int width;
 
177
  int height;  
 
178
 
 
179
  GdkRectangle title_rect;
 
180
 
 
181
  int left_titlebar_edge;
 
182
  int right_titlebar_edge;
 
183
  int top_titlebar_edge;
 
184
  int bottom_titlebar_edge;
 
185
 
 
186
  /* used for a memset hack */
 
187
#define ADDRESS_OF_BUTTON_RECTS(fgeom) (((char*)(fgeom)) + G_STRUCT_OFFSET (MetaFrameGeometry, close_rect))
 
188
#define LENGTH_OF_BUTTON_RECTS (G_STRUCT_OFFSET (MetaFrameGeometry, right_right_background) + sizeof (GdkRectangle) - G_STRUCT_OFFSET (MetaFrameGeometry, close_rect))
 
189
  
 
190
  /* The button rects (if changed adjust memset hack) */
 
191
  MetaButtonSpace close_rect;
 
192
  MetaButtonSpace max_rect;
 
193
  MetaButtonSpace min_rect;
 
194
  MetaButtonSpace menu_rect;
 
195
  MetaButtonSpace shade_rect;
 
196
  MetaButtonSpace above_rect;
 
197
  MetaButtonSpace stick_rect;
 
198
  MetaButtonSpace unshade_rect;
 
199
  MetaButtonSpace unabove_rect;
 
200
  MetaButtonSpace unstick_rect;
 
201
 
 
202
#define MAX_MIDDLE_BACKGROUNDS (MAX_BUTTONS_PER_CORNER - 2)
 
203
  GdkRectangle left_single_background;
 
204
  GdkRectangle left_left_background;
 
205
  GdkRectangle left_middle_backgrounds[MAX_MIDDLE_BACKGROUNDS];
 
206
  GdkRectangle left_right_background;
 
207
  GdkRectangle right_single_background;
 
208
  GdkRectangle right_left_background;
 
209
  GdkRectangle right_middle_backgrounds[MAX_MIDDLE_BACKGROUNDS];
 
210
  GdkRectangle right_right_background;
 
211
  /* End of button rects (if changed adjust memset hack) */
 
212
  
 
213
  /* Round corners */
 
214
  guint top_left_corner_rounded_radius;
 
215
  guint top_right_corner_rounded_radius;
 
216
  guint bottom_left_corner_rounded_radius;
 
217
  guint bottom_right_corner_rounded_radius;
 
218
};
 
219
 
 
220
typedef enum
 
221
{
 
222
  META_IMAGE_FILL_SCALE, /* default, needs to be all-bits-zero for g_new0 */
 
223
  META_IMAGE_FILL_TILE
 
224
} MetaImageFillType;
 
225
 
 
226
typedef enum
 
227
{
 
228
  META_COLOR_SPEC_BASIC,
 
229
  META_COLOR_SPEC_GTK,
 
230
  META_COLOR_SPEC_BLEND,
 
231
  META_COLOR_SPEC_SHADE
 
232
} MetaColorSpecType;
 
233
 
 
234
typedef enum
 
235
{
 
236
  META_GTK_COLOR_FG,
 
237
  META_GTK_COLOR_BG,
 
238
  META_GTK_COLOR_LIGHT,
 
239
  META_GTK_COLOR_DARK,
 
240
  META_GTK_COLOR_MID,
 
241
  META_GTK_COLOR_TEXT,
 
242
  META_GTK_COLOR_BASE,
 
243
  META_GTK_COLOR_TEXT_AA,
 
244
  META_GTK_COLOR_LAST
 
245
} MetaGtkColorComponent;
 
246
 
 
247
struct _MetaColorSpec
 
248
{
 
249
  MetaColorSpecType type;
 
250
  union
 
251
  {
 
252
    struct {
 
253
      GdkColor color;
 
254
    } basic;
 
255
    struct {
 
256
      MetaGtkColorComponent component;
 
257
      GtkStateType state;
 
258
    } gtk;
 
259
    struct {
 
260
      MetaColorSpec *foreground;
 
261
      MetaColorSpec *background;
 
262
      double alpha;
 
263
 
 
264
      GdkColor color;
 
265
    } blend;
 
266
    struct {
 
267
      MetaColorSpec *base;
 
268
      double factor;
 
269
 
 
270
      GdkColor color;
 
271
    } shade;
 
272
  } data;
 
273
};
 
274
 
 
275
struct _MetaGradientSpec
 
276
{
 
277
  MetaGradientType type;
 
278
  GSList *color_specs;
 
279
};
 
280
 
 
281
struct _MetaAlphaGradientSpec
 
282
{
 
283
  MetaGradientType type;
 
284
  unsigned char *alphas;
 
285
  int n_alphas;
 
286
};
 
287
 
 
288
struct _MetaDrawInfo
 
289
{
 
290
  GdkPixbuf   *mini_icon;
 
291
  GdkPixbuf   *icon;
 
292
  PangoLayout *title_layout;
 
293
  int title_layout_width;
 
294
  int title_layout_height;
 
295
  const MetaFrameGeometry *fgeom;
 
296
};
 
297
 
 
298
/**
 
299
 * A drawing operation in our simple vector drawing language.
 
300
 */
 
301
typedef enum
 
302
{
 
303
  /** Basic drawing-- line */
 
304
  META_DRAW_LINE,
 
305
  /** Basic drawing-- rectangle */
 
306
  META_DRAW_RECTANGLE,
 
307
  /** Basic drawing-- arc */
 
308
  META_DRAW_ARC,
 
309
 
 
310
  /** Clip to a rectangle */
 
311
  META_DRAW_CLIP,
 
312
  
 
313
  /* Texture thingies */
 
314
 
 
315
  /** Just a filled rectangle with alpha */
 
316
  META_DRAW_TINT,
 
317
  META_DRAW_GRADIENT,
 
318
  META_DRAW_IMAGE,
 
319
  
 
320
  /** GTK theme engine stuff */
 
321
  META_DRAW_GTK_ARROW,
 
322
  META_DRAW_GTK_BOX,
 
323
  META_DRAW_GTK_VLINE,
 
324
 
 
325
  /** App's window icon */
 
326
  META_DRAW_ICON,
 
327
  /** App's window title */
 
328
  META_DRAW_TITLE,
 
329
  /** a draw op list */
 
330
  META_DRAW_OP_LIST,
 
331
  /** tiled draw op list */
 
332
  META_DRAW_TILE
 
333
} MetaDrawType;
 
334
 
 
335
typedef enum
 
336
{
 
337
  POS_TOKEN_INT,
 
338
  POS_TOKEN_DOUBLE,
 
339
  POS_TOKEN_OPERATOR,
 
340
  POS_TOKEN_VARIABLE,
 
341
  POS_TOKEN_OPEN_PAREN,
 
342
  POS_TOKEN_CLOSE_PAREN
 
343
} PosTokenType;
 
344
 
 
345
typedef enum
 
346
{
 
347
  POS_OP_NONE,
 
348
  POS_OP_ADD,
 
349
  POS_OP_SUBTRACT,
 
350
  POS_OP_MULTIPLY,
 
351
  POS_OP_DIVIDE,
 
352
  POS_OP_MOD,
 
353
  POS_OP_MAX,
 
354
  POS_OP_MIN
 
355
} PosOperatorType;
 
356
 
 
357
/**
 
358
 * A token, as output by the tokeniser.
 
359
 *
 
360
 * \ingroup tokenizer
 
361
 */
 
362
typedef struct
 
363
{
 
364
  PosTokenType type;
 
365
 
 
366
  union
 
367
  {
 
368
    struct {
 
369
      int val;
 
370
    } i;
 
371
 
 
372
    struct {
 
373
      double val;
 
374
    } d;
 
375
 
 
376
    struct {
 
377
      PosOperatorType op;
 
378
    } o;
 
379
 
 
380
    struct {
 
381
      char *name;
 
382
      GQuark name_quark;
 
383
    } v;
 
384
 
 
385
  } d;
 
386
} PosToken;
 
387
 
 
388
/**
 
389
 * A computed expression in our simple vector drawing language.
 
390
 * While it appears to take the form of a tree, this is actually
 
391
 * merely a list; concerns such as precedence of operators are
 
392
 * currently recomputed on every recalculation.
 
393
 *
 
394
 * Created by meta_draw_spec_new(), destroyed by meta_draw_spec_free().
 
395
 * pos_eval() fills this with ...FIXME. Are tokens a tree or a list?
 
396
 * \ingroup parser
 
397
 */
 
398
typedef struct _MetaDrawSpec
 
399
{
 
400
  /**
 
401
   * If this spec is constant, this is the value of the constant;
 
402
   * otherwise it is zero.
 
403
   */
 
404
  int value;
 
405
  
 
406
  /** A list of tokens in the expression. */
 
407
  PosToken *tokens;
 
408
 
 
409
  /** How many tokens are in the tokens list. */
 
410
  int n_tokens;
 
411
 
 
412
  /** Does the expression contain any variables? */
 
413
  gboolean constant : 1;
 
414
} MetaDrawSpec;
 
415
 
 
416
/**
 
417
 * A single drawing operation in our simple vector drawing language.
 
418
 */
 
419
struct _MetaDrawOp
 
420
{
 
421
  MetaDrawType type;
 
422
 
 
423
  /* Positions are strings because they can be expressions */
 
424
  union
 
425
  {
 
426
    struct {
 
427
      MetaColorSpec *color_spec;
 
428
      int dash_on_length;
 
429
      int dash_off_length;
 
430
      int width;
 
431
      MetaDrawSpec *x1;
 
432
      MetaDrawSpec *y1;
 
433
      MetaDrawSpec *x2;
 
434
      MetaDrawSpec *y2;
 
435
    } line;
 
436
 
 
437
    struct {
 
438
      MetaColorSpec *color_spec;
 
439
      gboolean filled;
 
440
      MetaDrawSpec *x;
 
441
      MetaDrawSpec *y;
 
442
      MetaDrawSpec *width;
 
443
      MetaDrawSpec *height;
 
444
    } rectangle;
 
445
 
 
446
    struct {
 
447
      MetaColorSpec *color_spec;
 
448
      gboolean filled;
 
449
      MetaDrawSpec *x;
 
450
      MetaDrawSpec *y;
 
451
      MetaDrawSpec *width;
 
452
      MetaDrawSpec *height;
 
453
      double start_angle;
 
454
      double extent_angle;
 
455
    } arc;
 
456
 
 
457
    struct {
 
458
      MetaDrawSpec *x;
 
459
      MetaDrawSpec *y;
 
460
      MetaDrawSpec *width;
 
461
      MetaDrawSpec *height;
 
462
    } clip;
 
463
    
 
464
    struct {
 
465
      MetaColorSpec *color_spec;
 
466
      MetaAlphaGradientSpec *alpha_spec;
 
467
      MetaDrawSpec *x;
 
468
      MetaDrawSpec *y;
 
469
      MetaDrawSpec *width;
 
470
      MetaDrawSpec *height;
 
471
    } tint;
 
472
 
 
473
    struct {
 
474
      MetaGradientSpec *gradient_spec;
 
475
      MetaAlphaGradientSpec *alpha_spec;
 
476
      MetaDrawSpec *x;
 
477
      MetaDrawSpec *y;
 
478
      MetaDrawSpec *width;
 
479
      MetaDrawSpec *height;
 
480
    } gradient;
 
481
 
 
482
    struct {
 
483
      MetaColorSpec *colorize_spec;
 
484
      MetaAlphaGradientSpec *alpha_spec;
 
485
      GdkPixbuf *pixbuf;
 
486
      MetaDrawSpec *x;
 
487
      MetaDrawSpec *y;
 
488
      MetaDrawSpec *width;
 
489
      MetaDrawSpec *height;
 
490
 
 
491
      guint32 colorize_cache_pixel;
 
492
      GdkPixbuf *colorize_cache_pixbuf;
 
493
      MetaImageFillType fill_type;
 
494
      unsigned int vertical_stripes : 1;
 
495
      unsigned int horizontal_stripes : 1;
 
496
    } image;
 
497
    
 
498
    struct {
 
499
      GtkStateType state;
 
500
      GtkShadowType shadow;
 
501
      GtkArrowType arrow;
 
502
      gboolean filled;
 
503
 
 
504
      MetaDrawSpec *x;
 
505
      MetaDrawSpec *y;
 
506
      MetaDrawSpec *width;
 
507
      MetaDrawSpec *height;
 
508
    } gtk_arrow;
 
509
 
 
510
    struct {
 
511
      GtkStateType state;
 
512
      GtkShadowType shadow;
 
513
      MetaDrawSpec *x;
 
514
      MetaDrawSpec *y;
 
515
      MetaDrawSpec *width;
 
516
      MetaDrawSpec *height;
 
517
    } gtk_box;
 
518
 
 
519
    struct {
 
520
      GtkStateType state;
 
521
      MetaDrawSpec *x;
 
522
      MetaDrawSpec *y1;
 
523
      MetaDrawSpec *y2;  
 
524
    } gtk_vline;
 
525
 
 
526
    struct {
 
527
      MetaAlphaGradientSpec *alpha_spec;
 
528
      MetaDrawSpec *x;
 
529
      MetaDrawSpec *y;
 
530
      MetaDrawSpec *width;
 
531
      MetaDrawSpec *height;
 
532
      MetaImageFillType fill_type;
 
533
    } icon;
 
534
 
 
535
    struct {
 
536
      MetaColorSpec *color_spec;
 
537
      MetaDrawSpec *x;
 
538
      MetaDrawSpec *y;
 
539
    } title;
 
540
 
 
541
    struct {
 
542
      MetaDrawOpList *op_list;
 
543
      MetaDrawSpec *x;
 
544
      MetaDrawSpec *y;
 
545
      MetaDrawSpec *width;
 
546
      MetaDrawSpec *height;
 
547
    } op_list;
 
548
 
 
549
    struct {
 
550
      MetaDrawOpList *op_list;
 
551
      MetaDrawSpec *x;
 
552
      MetaDrawSpec *y;
 
553
      MetaDrawSpec *width;
 
554
      MetaDrawSpec *height;
 
555
      MetaDrawSpec *tile_xoffset;
 
556
      MetaDrawSpec *tile_yoffset;
 
557
      MetaDrawSpec *tile_width;
 
558
      MetaDrawSpec *tile_height;
 
559
    } tile;
 
560
    
 
561
  } data;
 
562
};
 
563
 
 
564
/**
 
565
 * A list of MetaDrawOp objects. Maintains a reference count.
 
566
 * Grows as necessary and allows the allocation of unused spaces
 
567
 * to keep reallocations to a minimum.
 
568
 *
 
569
 * \bug Do we really win anything from not using the equivalent
 
570
 * GLib structures?
 
571
 */
 
572
struct _MetaDrawOpList
 
573
{
 
574
  int refcount;
 
575
  MetaDrawOp **ops;
 
576
  int n_ops;
 
577
  int n_allocated;
 
578
};
 
579
 
 
580
typedef enum
 
581
{
 
582
  META_BUTTON_STATE_NORMAL,
 
583
  META_BUTTON_STATE_PRESSED,
 
584
  META_BUTTON_STATE_PRELIGHT,
 
585
  META_BUTTON_STATE_LAST
 
586
} MetaButtonState;
 
587
 
 
588
typedef enum
 
589
{
 
590
  /* Ordered so that background is drawn first */
 
591
  META_BUTTON_TYPE_LEFT_LEFT_BACKGROUND,
 
592
  META_BUTTON_TYPE_LEFT_MIDDLE_BACKGROUND,
 
593
  META_BUTTON_TYPE_LEFT_RIGHT_BACKGROUND,
 
594
  META_BUTTON_TYPE_RIGHT_LEFT_BACKGROUND,
 
595
  META_BUTTON_TYPE_RIGHT_MIDDLE_BACKGROUND,
 
596
  META_BUTTON_TYPE_RIGHT_RIGHT_BACKGROUND,
 
597
  META_BUTTON_TYPE_CLOSE,
 
598
  META_BUTTON_TYPE_MAXIMIZE,
 
599
  META_BUTTON_TYPE_MINIMIZE,
 
600
  META_BUTTON_TYPE_MENU,
 
601
  META_BUTTON_TYPE_SHADE,
 
602
  META_BUTTON_TYPE_ABOVE,
 
603
  META_BUTTON_TYPE_STICK,
 
604
  META_BUTTON_TYPE_UNSHADE,
 
605
  META_BUTTON_TYPE_UNABOVE,
 
606
  META_BUTTON_TYPE_UNSTICK,
 
607
  META_BUTTON_TYPE_LAST
 
608
} MetaButtonType;
 
609
 
 
610
typedef enum
 
611
{
 
612
  META_MENU_ICON_TYPE_CLOSE,
 
613
  META_MENU_ICON_TYPE_MAXIMIZE,
 
614
  META_MENU_ICON_TYPE_UNMAXIMIZE,
 
615
  META_MENU_ICON_TYPE_MINIMIZE,
 
616
  META_MENU_ICON_TYPE_LAST
 
617
} MetaMenuIconType;
 
618
 
 
619
typedef enum
 
620
{
 
621
  /* Listed in the order in which the textures are drawn.
 
622
   * (though this only matters for overlaps of course.)
 
623
   * Buttons are drawn after the frame textures.
 
624
   *
 
625
   * On the corners, horizontal pieces are arbitrarily given the
 
626
   * corner area:
 
627
   *
 
628
   *   =====                 |====
 
629
   *   |                     |
 
630
   *   |       rather than   |
 
631
   *
 
632
   */
 
633
  
 
634
  /* entire frame */
 
635
  META_FRAME_PIECE_ENTIRE_BACKGROUND,
 
636
  /* entire titlebar background */
 
637
  META_FRAME_PIECE_TITLEBAR,
 
638
  /* portion of the titlebar background inside the titlebar
 
639
   * background edges
 
640
   */
 
641
  META_FRAME_PIECE_TITLEBAR_MIDDLE,
 
642
  /* left end of titlebar */
 
643
  META_FRAME_PIECE_LEFT_TITLEBAR_EDGE,
 
644
  /* right end of titlebar */
 
645
  META_FRAME_PIECE_RIGHT_TITLEBAR_EDGE,
 
646
  /* top edge of titlebar */
 
647
  META_FRAME_PIECE_TOP_TITLEBAR_EDGE,
 
648
  /* bottom edge of titlebar */
 
649
  META_FRAME_PIECE_BOTTOM_TITLEBAR_EDGE,
 
650
  /* render over title background (text area) */
 
651
  META_FRAME_PIECE_TITLE,
 
652
  /* left edge of the frame */
 
653
  META_FRAME_PIECE_LEFT_EDGE,
 
654
  /* right edge of the frame */
 
655
  META_FRAME_PIECE_RIGHT_EDGE,
 
656
  /* bottom edge of the frame */
 
657
  META_FRAME_PIECE_BOTTOM_EDGE,
 
658
  /* place over entire frame, after drawing everything else */
 
659
  META_FRAME_PIECE_OVERLAY,
 
660
  /* Used to get size of the enum */
 
661
  META_FRAME_PIECE_LAST
 
662
} MetaFramePiece;
 
663
 
 
664
#define N_GTK_STATES 5
 
665
 
 
666
/**
 
667
 * How to draw a frame in a particular state (say, a focussed, non-maximised,
 
668
 * resizable frame). This corresponds closely to the <frame_style> tag
 
669
 * in a theme file.
 
670
 */
 
671
struct _MetaFrameStyle
 
672
{
 
673
  /** Reference count. */
 
674
  int refcount;
 
675
  /**
 
676
   * Parent style.
 
677
   * Settings which are unspecified here will be taken from there.
 
678
   */
 
679
  MetaFrameStyle *parent;
 
680
  /** Operations for drawing each kind of button in each state. */
 
681
  MetaDrawOpList *buttons[META_BUTTON_TYPE_LAST][META_BUTTON_STATE_LAST];
 
682
  /** Operations for drawing each piece of the frame. */
 
683
  MetaDrawOpList *pieces[META_FRAME_PIECE_LAST];
 
684
  /**
 
685
   * Details such as the height and width of each edge, the corner rounding,
 
686
   * and the aspect ratio of the buttons.
 
687
   */
 
688
  MetaFrameLayout *layout;
 
689
  /**
 
690
   * Background colour of the window. Only present in theme formats
 
691
   * 2 and above. Can be NULL to use the standard GTK theme engine.
 
692
   */
 
693
  MetaColorSpec *window_background_color;
 
694
  /**
 
695
   * Transparency of the window background. 0=transparent; 255=opaque.
 
696
   */
 
697
  guint8 window_background_alpha;
 
698
};
 
699
 
 
700
/* Kinds of frame...
 
701
 * 
 
702
 *  normal ->   noresize / vert only / horz only / both
 
703
 *              focused / unfocused
 
704
 *  max    ->   focused / unfocused
 
705
 *  shaded ->   focused / unfocused
 
706
 *  max/shaded -> focused / unfocused
 
707
 *
 
708
 *  so 4 states with 8 sub-states in one, 2 sub-states in the other 3,
 
709
 *  meaning 14 total
 
710
 *
 
711
 * 14 window states times 7 or 8 window types. Except some
 
712
 * window types never get a frame so that narrows it down a bit.
 
713
 * 
 
714
 */
 
715
typedef enum
 
716
{
 
717
  META_FRAME_STATE_NORMAL,
 
718
  META_FRAME_STATE_MAXIMIZED,
 
719
  META_FRAME_STATE_SHADED,
 
720
  META_FRAME_STATE_MAXIMIZED_AND_SHADED,
 
721
  META_FRAME_STATE_LAST
 
722
} MetaFrameState;
 
723
 
 
724
typedef enum
 
725
{
 
726
  META_FRAME_RESIZE_NONE,
 
727
  META_FRAME_RESIZE_VERTICAL,
 
728
  META_FRAME_RESIZE_HORIZONTAL,
 
729
  META_FRAME_RESIZE_BOTH,
 
730
  META_FRAME_RESIZE_LAST
 
731
} MetaFrameResize;
 
732
 
 
733
typedef enum
 
734
{
 
735
  META_FRAME_FOCUS_NO,
 
736
  META_FRAME_FOCUS_YES,
 
737
  META_FRAME_FOCUS_LAST
 
738
} MetaFrameFocus;
 
739
 
 
740
/**
 
741
 * How to draw frames at different times: when it's maximised or not, shaded
 
742
 * or not, when it's focussed or not, and (for non-maximised windows), when
 
743
 * it can be horizontally or vertically resized, both, or neither.
 
744
 * Not all window types actually get a frame.
 
745
 *
 
746
 * A theme contains one of these objects for each type of window (each
 
747
 * MetaFrameType), that is, normal, dialogue (modal and non-modal), etc.
 
748
 *
 
749
 * This corresponds closely to the <frame_style_set> tag in a theme file.
 
750
 */
 
751
struct _MetaFrameStyleSet
 
752
{
 
753
  int refcount;
 
754
  MetaFrameStyleSet *parent;
 
755
  MetaFrameStyle *normal_styles[META_FRAME_RESIZE_LAST][META_FRAME_FOCUS_LAST];
 
756
  MetaFrameStyle *maximized_styles[META_FRAME_FOCUS_LAST];
 
757
  MetaFrameStyle *shaded_styles[META_FRAME_RESIZE_LAST][META_FRAME_FOCUS_LAST];
 
758
  MetaFrameStyle *maximized_and_shaded_styles[META_FRAME_FOCUS_LAST];
 
759
};
 
760
 
 
761
/**
 
762
 * A theme. This is a singleton class which groups all settings from a theme
 
763
 * on disk together.
 
764
 *
 
765
 * \bug It is rather useless to keep the metadata fields in core, I think.
 
766
 */
 
767
struct _MetaTheme
 
768
{
 
769
  /** Name of the theme (on disk), e.g. "Crux" */
 
770
  char *name;
 
771
  /** Path to the files associated with the theme */
 
772
  char *dirname;
 
773
  /**
 
774
   * Filename of the XML theme file.
 
775
   * \bug Kept lying around for no discernable reason.
 
776
   */
 
777
  char *filename;
 
778
  /** Metadata: Human-readable name of the theme. */
 
779
  char *readable_name;
 
780
  /** Metadata: Author of the theme. */
 
781
  char *author;
 
782
  /** Metadata: Copyright holder. */
 
783
  char *copyright;
 
784
  /** Metadata: Date of the theme. */
 
785
  char *date;
 
786
  /** Metadata: Description of the theme. */
 
787
  char *description;
 
788
  /** Version of the theme format. Older versions cannot use the features
 
789
   * of newer versions even if they think they can (this is to allow forward
 
790
   * and backward compatibility.
 
791
   */
 
792
  guint format_version;
 
793
 
 
794
  /** Symbol table of integer constants. */
 
795
  GHashTable *integer_constants;
 
796
  /** Symbol table of float constants. */
 
797
  GHashTable *float_constants;
 
798
  /**
 
799
   * Symbol table of colour constants (hex triples, and triples
 
800
   * plus alpha).
 
801
   * */
 
802
  GHashTable *color_constants;
 
803
  GHashTable *images_by_filename;
 
804
  GHashTable *layouts_by_name;
 
805
  GHashTable *draw_op_lists_by_name;
 
806
  GHashTable *styles_by_name;
 
807
  GHashTable *style_sets_by_name;
 
808
  MetaFrameStyleSet *style_sets_by_type[META_FRAME_TYPE_LAST];
 
809
 
 
810
  GQuark quark_width;
 
811
  GQuark quark_height;
 
812
  GQuark quark_object_width;
 
813
  GQuark quark_object_height;
 
814
  GQuark quark_left_width;
 
815
  GQuark quark_right_width;
 
816
  GQuark quark_top_height;
 
817
  GQuark quark_bottom_height;
 
818
  GQuark quark_mini_icon_width;
 
819
  GQuark quark_mini_icon_height;
 
820
  GQuark quark_icon_width;
 
821
  GQuark quark_icon_height;
 
822
  GQuark quark_title_width;
 
823
  GQuark quark_title_height;
 
824
};
 
825
 
 
826
struct _MetaPositionExprEnv
 
827
{
 
828
  MetaRectangle rect;
 
829
  /* size of an object being drawn, if it has a natural size */
 
830
  int object_width;
 
831
  int object_height;
 
832
  /* global object sizes, always available */
 
833
  int left_width;
 
834
  int right_width;
 
835
  int top_height;
 
836
  int bottom_height;
 
837
  int title_width;
 
838
  int title_height;
 
839
  int mini_icon_width;
 
840
  int mini_icon_height;
 
841
  int icon_width;
 
842
  int icon_height;
 
843
  /* Theme so we can look up constants */
 
844
  MetaTheme *theme;
 
845
};
 
846
 
 
847
MetaFrameLayout* meta_frame_layout_new           (void);
 
848
MetaFrameLayout* meta_frame_layout_copy          (const MetaFrameLayout *src);
 
849
void             meta_frame_layout_ref           (MetaFrameLayout       *layout);
 
850
void             meta_frame_layout_unref         (MetaFrameLayout       *layout);
 
851
void             meta_frame_layout_get_borders   (const MetaFrameLayout *layout,
 
852
                                                  int                    text_height,
 
853
                                                  MetaFrameFlags         flags,
 
854
                                                  int                   *top_height,
 
855
                                                  int                   *bottom_height,
 
856
                                                  int                   *left_width,
 
857
                                                  int                   *right_width);
 
858
void             meta_frame_layout_calc_geometry (const MetaFrameLayout  *layout,
 
859
                                                  int                     text_height,
 
860
                                                  MetaFrameFlags          flags,
 
861
                                                  int                     client_width,
 
862
                                                  int                     client_height,
 
863
                                                  const MetaButtonLayout *button_layout,
 
864
                                                  MetaFrameGeometry      *fgeom,
 
865
                                                  MetaTheme              *theme);
 
866
 
 
867
gboolean         meta_frame_layout_validate      (const MetaFrameLayout *layout,
 
868
                                                  GError               **error);
 
869
 
 
870
gboolean meta_parse_position_expression (MetaDrawSpec               *spec,
 
871
                                         const MetaPositionExprEnv  *env,
 
872
                                         int                        *x_return,
 
873
                                         int                        *y_return,
 
874
                                         GError                    **err);
 
875
gboolean meta_parse_size_expression     (MetaDrawSpec               *spec,
 
876
                                         const MetaPositionExprEnv  *env,
 
877
                                         int                        *val_return,
 
878
                                         GError                    **err);
 
879
 
 
880
MetaDrawSpec* meta_draw_spec_new (MetaTheme  *theme,
 
881
                                  const char *expr,
 
882
                                  GError    **error);
 
883
void          meta_draw_spec_free (MetaDrawSpec *spec);
 
884
 
 
885
MetaColorSpec* meta_color_spec_new             (MetaColorSpecType  type);
 
886
MetaColorSpec* meta_color_spec_new_from_string (const char        *str,
 
887
                                                GError           **err);
 
888
MetaColorSpec* meta_color_spec_new_gtk         (MetaGtkColorComponent component,
 
889
                                                GtkStateType          state);
 
890
void           meta_color_spec_free            (MetaColorSpec     *spec);
 
891
void           meta_color_spec_render          (MetaColorSpec     *spec,
 
892
                                                GtkWidget         *widget,
 
893
                                                GdkColor          *color);
 
894
 
 
895
 
 
896
MetaDrawOp*    meta_draw_op_new  (MetaDrawType        type);
 
897
void           meta_draw_op_free (MetaDrawOp          *op);
 
898
void           meta_draw_op_draw (const MetaDrawOp    *op,
 
899
                                  GtkWidget           *widget,
 
900
                                  GdkDrawable         *drawable,
 
901
                                  const GdkRectangle  *clip,
 
902
                                  const MetaDrawInfo  *info,
 
903
                                  /* logical region being drawn */
 
904
                                  MetaRectangle        logical_region);
 
905
 
 
906
void           meta_draw_op_draw_with_style (const MetaDrawOp    *op,
 
907
                                             GtkStyle            *style_gtk,
 
908
                                             GtkWidget           *widget,
 
909
                                             GdkDrawable         *drawable,
 
910
                                             const GdkRectangle  *clip,
 
911
                                             const MetaDrawInfo  *info,
 
912
                                             /* logical region being drawn */
 
913
                                             MetaRectangle        logical_region);
 
914
 
 
915
MetaDrawOpList* meta_draw_op_list_new   (int                   n_preallocs);
 
916
void            meta_draw_op_list_ref   (MetaDrawOpList       *op_list);
 
917
void            meta_draw_op_list_unref (MetaDrawOpList       *op_list);
 
918
void            meta_draw_op_list_draw  (const MetaDrawOpList *op_list,
 
919
                                         GtkWidget            *widget,
 
920
                                         GdkDrawable          *drawable,
 
921
                                         const GdkRectangle   *clip,
 
922
                                         const MetaDrawInfo   *info,
 
923
                                         MetaRectangle         rect);
 
924
void            meta_draw_op_list_draw_with_style  (const MetaDrawOpList *op_list,
 
925
                                                    GtkStyle             *style_gtk,
 
926
                                                    GtkWidget            *widget,
 
927
                                                    GdkDrawable          *drawable,
 
928
                                                    const GdkRectangle   *clip,
 
929
                                                    const MetaDrawInfo   *info,
 
930
                                                    MetaRectangle         rect);
 
931
void           meta_draw_op_list_append (MetaDrawOpList       *op_list,
 
932
                                         MetaDrawOp           *op);
 
933
gboolean       meta_draw_op_list_validate (MetaDrawOpList    *op_list,
 
934
                                           GError           **error);
 
935
gboolean       meta_draw_op_list_contains (MetaDrawOpList    *op_list,
 
936
                                           MetaDrawOpList    *child);
 
937
 
 
938
MetaGradientSpec* meta_gradient_spec_new    (MetaGradientType        type);
 
939
void              meta_gradient_spec_free   (MetaGradientSpec       *desc);
 
940
GdkPixbuf*        meta_gradient_spec_render (const MetaGradientSpec *desc,
 
941
                                             GtkWidget              *widget,
 
942
                                             int                     width,
 
943
                                             int                     height);
 
944
gboolean          meta_gradient_spec_validate (MetaGradientSpec     *spec,
 
945
                                               GError              **error);
 
946
 
 
947
MetaAlphaGradientSpec* meta_alpha_gradient_spec_new  (MetaGradientType       type,
 
948
                                                      int                    n_alphas);
 
949
void                   meta_alpha_gradient_spec_free (MetaAlphaGradientSpec *spec);
 
950
 
 
951
 
 
952
MetaFrameStyle* meta_frame_style_new   (MetaFrameStyle *parent);
 
953
void            meta_frame_style_ref   (MetaFrameStyle *style);
 
954
void            meta_frame_style_unref (MetaFrameStyle *style);
 
955
 
 
956
void meta_frame_style_draw (MetaFrameStyle          *style,
 
957
                            GtkWidget               *widget,
 
958
                            GdkDrawable             *drawable,
 
959
                            int                      x_offset,
 
960
                            int                      y_offset,
 
961
                            const GdkRectangle      *clip,
 
962
                            const MetaFrameGeometry *fgeom,
 
963
                            int                      client_width,
 
964
                            int                      client_height,
 
965
                            PangoLayout             *title_layout,
 
966
                            int                      text_height,
 
967
                            MetaButtonState          button_states[META_BUTTON_TYPE_LAST],
 
968
                            GdkPixbuf               *mini_icon,
 
969
                            GdkPixbuf               *icon);
 
970
 
 
971
 
 
972
void meta_frame_style_draw_with_style (MetaFrameStyle          *style,
 
973
                                       GtkStyle                *style_gtk,
 
974
                                       GtkWidget               *widget,
 
975
                                       GdkDrawable             *drawable,
 
976
                                       int                      x_offset,
 
977
                                       int                      y_offset,
 
978
                                       const GdkRectangle      *clip,
 
979
                                       const MetaFrameGeometry *fgeom,
 
980
                                       int                      client_width,
 
981
                                       int                      client_height,
 
982
                                       PangoLayout             *title_layout,
 
983
                                       int                      text_height,
 
984
                                       MetaButtonState          button_states[META_BUTTON_TYPE_LAST],
 
985
                                       GdkPixbuf               *mini_icon,
 
986
                                       GdkPixbuf               *icon);
 
987
 
 
988
 
 
989
gboolean       meta_frame_style_validate (MetaFrameStyle    *style,
 
990
                                          guint              current_theme_version,
 
991
                                          GError           **error);
 
992
 
 
993
MetaFrameStyleSet* meta_frame_style_set_new   (MetaFrameStyleSet *parent);
 
994
void               meta_frame_style_set_ref   (MetaFrameStyleSet *style_set);
 
995
void               meta_frame_style_set_unref (MetaFrameStyleSet *style_set);
 
996
 
 
997
gboolean       meta_frame_style_set_validate  (MetaFrameStyleSet *style_set,
 
998
                                               GError           **error);
 
999
 
 
1000
MetaTheme* meta_theme_get_current (void);
 
1001
void       meta_theme_set_current (const char *name,
 
1002
                                   gboolean    force_reload);
 
1003
 
 
1004
MetaTheme* meta_theme_new      (void);
 
1005
void       meta_theme_free     (MetaTheme *theme);
 
1006
gboolean   meta_theme_validate (MetaTheme *theme,
 
1007
                                GError   **error);
 
1008
GdkPixbuf* meta_theme_load_image (MetaTheme  *theme,
 
1009
                                  const char *filename,
 
1010
                                  guint       size_of_theme_icons,
 
1011
                                  GError    **error);
 
1012
 
 
1013
MetaFrameStyle* meta_theme_get_frame_style (MetaTheme     *theme,
 
1014
                                            MetaFrameType  type,
 
1015
                                            MetaFrameFlags flags);
 
1016
 
 
1017
double meta_theme_get_title_scale (MetaTheme     *theme,
 
1018
                                   MetaFrameType  type,
 
1019
                                   MetaFrameFlags flags);
 
1020
 
 
1021
void meta_theme_draw_frame (MetaTheme              *theme,
 
1022
                            GtkWidget              *widget,
 
1023
                            GdkDrawable            *drawable,
 
1024
                            const GdkRectangle     *clip,
 
1025
                            int                     x_offset,
 
1026
                            int                     y_offset,
 
1027
                            MetaFrameType           type,
 
1028
                            MetaFrameFlags          flags,
 
1029
                            int                     client_width,
 
1030
                            int                     client_height,
 
1031
                            PangoLayout            *title_layout,
 
1032
                            int                     text_height,
 
1033
                            const MetaButtonLayout *button_layout,
 
1034
                            MetaButtonState         button_states[META_BUTTON_TYPE_LAST],
 
1035
                            GdkPixbuf              *mini_icon,
 
1036
                            GdkPixbuf              *icon);
 
1037
 
 
1038
void meta_theme_draw_frame_by_name (MetaTheme              *theme,
 
1039
                                    GtkWidget              *widget,
 
1040
                                    GdkDrawable            *drawable,
 
1041
                                    const GdkRectangle     *clip,
 
1042
                                    int                     x_offset,
 
1043
                                    int                     y_offset,
 
1044
                                    const gchar             *style_name,
 
1045
                                    MetaFrameFlags          flags,
 
1046
                                    int                     client_width,
 
1047
                                    int                     client_height,
 
1048
                                    PangoLayout            *title_layout,
 
1049
                                    int                     text_height,
 
1050
                                    const MetaButtonLayout *button_layout,
 
1051
                                    MetaButtonState         button_states[META_BUTTON_TYPE_LAST],
 
1052
                                    GdkPixbuf              *mini_icon,
 
1053
                                    GdkPixbuf              *icon);
 
1054
 
 
1055
void meta_theme_draw_frame_with_style (MetaTheme              *theme,
 
1056
                                       GtkStyle               *style_gtk,
 
1057
                                       GtkWidget              *widget,
 
1058
                                       GdkDrawable            *drawable,
 
1059
                                       const GdkRectangle     *clip,
 
1060
                                       int                     x_offset,
 
1061
                                       int                     y_offset,
 
1062
                                       MetaFrameType           type,
 
1063
                                       MetaFrameFlags          flags,
 
1064
                                       int                     client_width,
 
1065
                                       int                     client_height,
 
1066
                                       PangoLayout            *title_layout,
 
1067
                                       int                     text_height,
 
1068
                                       const MetaButtonLayout *button_layout,
 
1069
                                       MetaButtonState         button_states[META_BUTTON_TYPE_LAST],
 
1070
                                       GdkPixbuf              *mini_icon,
 
1071
                                       GdkPixbuf              *icon);
 
1072
 
 
1073
void meta_theme_get_frame_borders (MetaTheme         *theme,
 
1074
                                   MetaFrameType      type,
 
1075
                                   int                text_height,
 
1076
                                   MetaFrameFlags     flags,
 
1077
                                   int               *top_height,
 
1078
                                   int               *bottom_height,
 
1079
                                   int               *left_width,
 
1080
                                   int               *right_width);
 
1081
void meta_theme_calc_geometry (MetaTheme              *theme,
 
1082
                               MetaFrameType           type,
 
1083
                               int                     text_height,
 
1084
                               MetaFrameFlags          flags,
 
1085
                               int                     client_width,
 
1086
                               int                     client_height,
 
1087
                               const MetaButtonLayout *button_layout,
 
1088
                               MetaFrameGeometry      *fgeom);
 
1089
                                   
 
1090
MetaFrameLayout*   meta_theme_lookup_layout       (MetaTheme         *theme,
 
1091
                                                   const char        *name);
 
1092
void               meta_theme_insert_layout       (MetaTheme         *theme,
 
1093
                                                   const char        *name,
 
1094
                                                   MetaFrameLayout   *layout);
 
1095
MetaDrawOpList*    meta_theme_lookup_draw_op_list (MetaTheme         *theme,
 
1096
                                                   const char        *name);
 
1097
void               meta_theme_insert_draw_op_list (MetaTheme         *theme,
 
1098
                                                   const char        *name,
 
1099
                                                   MetaDrawOpList    *op_list);
 
1100
MetaFrameStyle*    meta_theme_lookup_style        (MetaTheme         *theme,
 
1101
                                                   const char        *name);
 
1102
void               meta_theme_insert_style        (MetaTheme         *theme,
 
1103
                                                   const char        *name,
 
1104
                                                   MetaFrameStyle    *style);
 
1105
MetaFrameStyleSet* meta_theme_lookup_style_set    (MetaTheme         *theme,
 
1106
                                                   const char        *name);
 
1107
void               meta_theme_insert_style_set    (MetaTheme         *theme,
 
1108
                                                   const char        *name,
 
1109
                                                   MetaFrameStyleSet *style_set);
 
1110
gboolean meta_theme_define_int_constant   (MetaTheme   *theme,
 
1111
                                           const char  *name,
 
1112
                                           int          value,
 
1113
                                           GError     **error);
 
1114
gboolean meta_theme_lookup_int_constant   (MetaTheme   *theme,
 
1115
                                           const char  *name,
 
1116
                                           int         *value);
 
1117
gboolean meta_theme_define_float_constant (MetaTheme   *theme,
 
1118
                                           const char  *name,
 
1119
                                           double       value,
 
1120
                                           GError     **error);
 
1121
gboolean meta_theme_lookup_float_constant (MetaTheme   *theme,
 
1122
                                           const char  *name,
 
1123
                                           double      *value);
 
1124
 
 
1125
gboolean meta_theme_define_color_constant (MetaTheme   *theme,
 
1126
                                           const char  *name,
 
1127
                                           const char  *value,
 
1128
                                           GError     **error);
 
1129
gboolean meta_theme_lookup_color_constant (MetaTheme   *theme,
 
1130
                                           const char  *name,
 
1131
                                           char       **value);
 
1132
 
 
1133
gboolean     meta_theme_replace_constants     (MetaTheme    *theme,
 
1134
                                               PosToken     *tokens,
 
1135
                                               int           n_tokens,
 
1136
                                               GError      **err);
 
1137
 
 
1138
/* random stuff */
 
1139
 
 
1140
PangoFontDescription* meta_gtk_widget_get_font_desc        (GtkWidget            *widget,
 
1141
                                                            double                scale,
 
1142
                                                            const PangoFontDescription *override);
 
1143
int                   meta_pango_font_desc_get_text_height (const PangoFontDescription *font_desc,
 
1144
                                                            PangoContext         *context);
 
1145
 
 
1146
 
 
1147
/* Enum converters */
 
1148
MetaGtkColorComponent meta_color_component_from_string (const char            *str);
 
1149
const char*           meta_color_component_to_string   (MetaGtkColorComponent  component);
 
1150
MetaButtonState       meta_button_state_from_string    (const char            *str);
 
1151
const char*           meta_button_state_to_string      (MetaButtonState        state);
 
1152
MetaButtonType        meta_button_type_from_string     (const char            *str,
 
1153
                                                        MetaTheme             *theme);
 
1154
const char*           meta_button_type_to_string       (MetaButtonType         type);
 
1155
MetaFramePiece        meta_frame_piece_from_string     (const char            *str);
 
1156
const char*           meta_frame_piece_to_string       (MetaFramePiece         piece);
 
1157
MetaFrameState        meta_frame_state_from_string     (const char            *str);
 
1158
const char*           meta_frame_state_to_string       (MetaFrameState         state);
 
1159
MetaFrameResize       meta_frame_resize_from_string    (const char            *str);
 
1160
const char*           meta_frame_resize_to_string      (MetaFrameResize        resize);
 
1161
MetaFrameFocus        meta_frame_focus_from_string     (const char            *str);
 
1162
const char*           meta_frame_focus_to_string       (MetaFrameFocus         focus);
 
1163
MetaFrameType         meta_frame_type_from_string      (const char            *str);
 
1164
const char*           meta_frame_type_to_string        (MetaFrameType          type);
 
1165
MetaGradientType      meta_gradient_type_from_string   (const char            *str);
 
1166
const char*           meta_gradient_type_to_string     (MetaGradientType       type);
 
1167
GtkStateType          meta_gtk_state_from_string       (const char            *str);
 
1168
const char*           meta_gtk_state_to_string         (GtkStateType           state);
 
1169
GtkShadowType         meta_gtk_shadow_from_string      (const char            *str);
 
1170
const char*           meta_gtk_shadow_to_string        (GtkShadowType          shadow);
 
1171
GtkArrowType          meta_gtk_arrow_from_string       (const char            *str);
 
1172
const char*           meta_gtk_arrow_to_string         (GtkArrowType           arrow);
 
1173
MetaImageFillType     meta_image_fill_type_from_string (const char            *str);
 
1174
const char*           meta_image_fill_type_to_string   (MetaImageFillType      fill_type);
 
1175
 
 
1176
guint meta_theme_earliest_version_with_button (MetaButtonType type);
 
1177
 
 
1178
 
 
1179
#define META_THEME_ALLOWS(theme, feature) (theme->format_version >= feature)
 
1180
 
 
1181
/* What version of the theme file format were various features introduced in? */
 
1182
#define META_THEME_SHADE_STICK_ABOVE_BUTTONS 2
 
1183
#define META_THEME_UBIQUITOUS_CONSTANTS 2
 
1184
#define META_THEME_VARIED_ROUND_CORNERS 2
 
1185
#define META_THEME_IMAGES_FROM_ICON_THEMES 2
 
1186
#define META_THEME_UNRESIZABLE_SHADED_STYLES 2
 
1187
#define META_THEME_DEGREES_IN_ARCS 2
 
1188
#define META_THEME_HIDDEN_BUTTONS 2
 
1189
#define META_THEME_COLOR_CONSTANTS 2
 
1190
#define META_THEME_FRAME_BACKGROUNDS 2
 
1191
 
 
1192
#endif