diff options
author | Havoc Pennington <hp@pobox.com> | 2002-01-08 07:23:35 +0000 |
---|---|---|
committer | Havoc Pennington <hp@src.gnome.org> | 2002-01-08 07:23:35 +0000 |
commit | 402c0b5036b26a202a888ebd6314a50a4190e589 (patch) | |
tree | cc454963a9bfe4cccd51515e3beac757eebba008 /src/theme.h | |
parent | 9ed27d3dcb87fbbdf6991bb4b23dbf1d24039efb (diff) | |
download | metacity-402c0b5036b26a202a888ebd6314a50a4190e589.tar.gz metacity-402c0b5036b26a202a888ebd6314a50a4190e589.tar.bz2 |
add code to save ACLOCAL_FLAGS
2002-01-08 Havoc Pennington <hp@pobox.com>
* configure.in (ACLOCAL): add code to save ACLOCAL_FLAGS
* src/frames.c (meta_frames_expose_event): max dither
* src/testgradient.c (render_simple): change dither mode to MAX
to avoid banding
* src/theme.c: lose the gradient cache, and put in some initial
data types for the theme format
Diffstat (limited to 'src/theme.h')
-rw-r--r-- | src/theme.h | 203 |
1 files changed, 192 insertions, 11 deletions
diff --git a/src/theme.h b/src/theme.h index 78a9675..b14142a 100644 --- a/src/theme.h +++ b/src/theme.h @@ -24,23 +24,204 @@ #include "frames.h" #include "gradient.h" +#include <gtk/gtkrc.h> -/* theme.[hc] is basically responsible for drawing parts of the UI using - * theme data - */ typedef struct _MetaFrameStyle MetaFrameStyle; +typedef struct _MetaFrameStyleSet MetaFrameStyleSet; +typedef struct _MetaTextureSpec MetaTextureSpec; +typedef struct _MetaGradientSpec MetaGradientSpec; +typedef struct _MetaColorSpec MetaColorSpec; -struct _MetaFrameStyle +typedef enum { - MetaGradientDescription *title_gradient; - + META_COLOR_SPEC_BASIC, + META_COLOR_SPEC_GTK, + META_COLOR_SPEC_BLEND +} MetaColorSpecType; + +struct _MetaColorSpec +{ + MetaColorSpecType type; + union + { + struct { + GdkColor color; + } basic; + struct { + GtkRcFlags component; + GtkStateType state; + } gtk; + struct { + MetaColorSpec *foreground; + MetaColorSpec *background; + double alpha; + } blend; + } data; +}; + +struct _MetaGradientSpec +{ + MetaGradientType type; + GSList *color_specs; +}; + +typedef enum +{ + META_TEXTURE_SOLID, + META_TEXTURE_GRADIENT, + META_TEXTURE_IMAGE +} MetaTextureType; + +struct _MetaTextureSpec +{ + MetaTextureType type; + + union + { + struct { + MetaColorSpec *color_spec; + } solid; + struct { + MetaGradientSpec *gradient_spec; + } gradient; + struct { + GdkPixbuf *pixbuf; + } image; + } data; +}; + +typedef enum +{ + META_BUTTON_STATE_UNFOCUSED, + META_BUTTON_STATE_FOCUSED, + META_BUTTON_STATE_INSENSITIVE, + META_BUTTON_STATE_PRESSED, + META_BUTTON_STATE_PRELIGHT, + META_BUTTON_STATE_LAST +} MetaButtonState; + +typedef enum +{ + META_BUTTON_TYPE_CLOSE, + META_BUTTON_TYPE_MAXIMIZE, + META_BUTTON_TYPE_MINIMIZE, + META_BUTTON_TYPE_MENU, + META_BUTTON_TYPE_LAST +} MetaButtonType; + +typedef enum +{ + /* Listed in the order in which the textures are drawn. + * (though this only matters for overlaps of course.) + * Buttons are drawn after the frame textures. + * + * On the corners, horizontal pieces are arbitrarily given the + * corner area: + * + * ===== |==== + * | | + * | rather than | + * + */ + /* place over entire frame, scaled both */ + META_FRAME_PIECE_ENTIRE_BACKGROUND, + /* place over entire titlebar background, scaled both */ + META_FRAME_PIECE_TITLEBAR_BACKGROUND, + /* place on left end of titlebar, scaled vert */ + META_FRAME_PIECE_LEFT_TITLEBAR_EDGE, + /* place on right end of titlebar, scaled vert */ + META_FRAME_PIECE_RIGHT_TITLEBAR_EDGE, + /* place on top edge of titlebar, scaled horiz */ + META_FRAME_PIECE_TOP_TITLEBAR_EDGE, + /* place on bottom edge of titlebar, scaled horiz */ + META_FRAME_PIECE_BOTTOM_TITLEBAR_EDGE, + /* place on left end of top edge of titlebar, unscaled */ + META_FRAME_PIECE_LEFT_END_OF_TOP_TITLEBAR_EDGE, + /* place on right end of top edge of titlebar, unscaled */ + META_FRAME_PIECE_RIGHT_END_OF_TOP_TITLEBAR_EDGE, + /* place on left end of bottom edge of titlebar, unscaled */ + META_FRAME_PIECE_LEFT_END_OF_BOTTOM_TITLEBAR_EDGE, + /* place on right end of bottom edge of titlebar, unscaled */ + META_FRAME_PIECE_RIGHT_END_OF_BOTTOM_TITLEBAR_EDGE, + /* place on top end of left titlebar edge, unscaled */ + META_FRAME_PIECE_TOP_END_OF_LEFT_TITLEBAR_EDGE, + /* place on bottom end of left titlebar edge, unscaled */ + META_FRAME_PIECE_BOTTOM_END_OF_LEFT_TITLEBAR_EDGE, + /* place on top end of right titlebar edge, unscaled */ + META_FRAME_PIECE_TOP_END_OF_RIGHT_TITLEBAR_EDGE, + /* place on bottom end of right titlebar edge, unscaled */ + META_FRAME_PIECE_BOTTOM_END_OF_RIGHT_TITLEBAR_EDGE, + /* render over title background (text area), scaled both */ + META_FRAME_PIECE_TITLE_BACKGROUND, + /* render over left side of TITLE_BACKGROUND, scaled vert */ + META_FRAME_PIECE_LEFT_TITLE_BACKGROUND, + /* render over right side of TITLE_BACKGROUND, scaled vert */ + META_FRAME_PIECE_RIGHT_TITLE_BACKGROUND, + /* place on left edge of the frame, scaled vert */ + META_FRAME_PIECE_LEFT_EDGE, + /* place on right edge of the frame, scaled vert */ + META_FRAME_PIECE_RIGHT_EDGE, + /* place on bottom edge of the frame, scaled horiz */ + META_FRAME_PIECE_BOTTOM_EDGE, + /* place on top end of left edge of the frame, unscaled */ + META_FRAME_PIECE_TOP_END_OF_LEFT_EDGE, + /* place on bottom end of left edge of the frame, unscaled */ + META_FRAME_PIECE_BOTTOM_END_OF_LEFT_EDGE, + /* place on top end of right edge of the frame, unscaled */ + META_FRAME_PIECE_TOP_END_OF_RIGHT_EDGE, + /* place on bottom end of right edge of the frame, unscaled */ + META_FRAME_PIECE_BOTTOM_END_OF_RIGHT_EDGE, + /* place on left end of bottom edge of the frame, unscaled */ + META_FRAME_PIECE_LEFT_END_OF_BOTTOM_EDGE, + /* place on right end of bottom edge of the frame, unscaled */ + META_FRAME_PIECE_RIGHT_END_OF_BOTTOM_EDGE, + /* Used to get size of the enum */ + META_FRAME_PIECE_LAST +} MetaFramePiece; + +struct _MetaFrameStyle +{ + MetaTextureSpec *button_icons[META_BUTTON_TYPE_LAST][META_BUTTON_STATE_LAST]; + MetaTextureSpec *button_backgrounds[META_BUTTON_TYPE_LAST][META_BUTTON_STATE_LAST]; + MetaTextureSpec *pieces[META_FRAME_PIECE_LAST]; }; -GdkPixbuf* meta_theme_get_gradient (MetaGradientType type, - const GdkColor *color_one, - const GdkColor *color_two, - int width, - int height); +typedef enum +{ + META_TEXTURE_DRAW_UNSCALED, + META_TEXTURE_DRAW_SCALED_VERTICALLY, + META_TEXTURE_DRAW_SCALED_HORIZONTALLY, + META_TEXTURE_DRAW_SCALED_BOTH +} MetaTextureDrawMode; + +MetaColorSpec* meta_color_spec_new (MetaColorSpecType type); +void meta_color_spec_free (MetaColorSpec *spec); +void meta_color_spec_render (MetaColorSpec *spec, + GtkWidget *widget, + GdkColor *color); + +MetaGradientSpec* meta_gradient_spec_new (MetaGradientType type); +void meta_gradient_spec_free (MetaGradientSpec *desc); +GdkPixbuf* meta_gradient_spec_render (const MetaGradientSpec *desc, + GtkWidget *widget, + int width, + int height); + +MetaTextureSpec* meta_texture_spec_new (MetaTextureType type); +void meta_texture_spec_free (MetaTextureSpec *desc); +void meta_texture_spec_draw (const MetaTextureSpec *desc, + GtkWidget *widget, + GdkDrawable *drawable, + const GdkRectangle *clip, + MetaTextureDrawMode mode, + /* logical region being drawn, + * scale to this area if in SCALED + * mode + */ + int x, + int y, + int width, + int height); #endif |