2002-01-05 23:51:53 -05:00
|
|
|
/* Metacity Theme Rendering */
|
2001-05-31 12:18:40 -04:00
|
|
|
|
|
|
|
/*
|
|
|
|
* Copyright (C) 2001 Havoc Pennington
|
|
|
|
*
|
|
|
|
* This program is free software; you can redistribute it and/or
|
|
|
|
* modify it under the terms of the GNU General Public License as
|
|
|
|
* published by the Free Software Foundation; either version 2 of the
|
|
|
|
* License, or (at your option) any later version.
|
|
|
|
*
|
|
|
|
* This program is distributed in the hope that it will be useful, but
|
|
|
|
* WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
|
|
* General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU General Public License
|
|
|
|
* along with this program; if not, write to the Free Software
|
|
|
|
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
|
|
|
|
* 02111-1307, USA.
|
|
|
|
*/
|
|
|
|
|
|
|
|
#ifndef META_THEME_H
|
|
|
|
#define META_THEME_H
|
|
|
|
|
2002-01-06 12:52:21 -05:00
|
|
|
#include "gradient.h"
|
2002-01-18 22:50:03 -05:00
|
|
|
#include "common.h"
|
2002-01-08 02:23:35 -05:00
|
|
|
#include <gtk/gtkrc.h>
|
2001-05-31 12:18:40 -04:00
|
|
|
|
2002-01-06 22:26:09 -05:00
|
|
|
typedef struct _MetaFrameStyle MetaFrameStyle;
|
2002-01-08 02:23:35 -05:00
|
|
|
typedef struct _MetaFrameStyleSet MetaFrameStyleSet;
|
2002-02-02 00:09:19 -05:00
|
|
|
typedef struct _MetaDrawOp MetaDrawOp;
|
|
|
|
typedef struct _MetaDrawOpList MetaDrawOpList;
|
2002-01-08 02:23:35 -05:00
|
|
|
typedef struct _MetaGradientSpec MetaGradientSpec;
|
|
|
|
typedef struct _MetaColorSpec MetaColorSpec;
|
2002-01-18 22:50:03 -05:00
|
|
|
typedef struct _MetaFrameLayout MetaFrameLayout;
|
|
|
|
typedef struct _MetaFrameGeometry MetaFrameGeometry;
|
2002-01-27 03:21:53 -05:00
|
|
|
typedef struct _MetaTheme MetaTheme;
|
2002-02-02 00:09:19 -05:00
|
|
|
typedef struct _MetaPositionExprEnv MetaPositionExprEnv;
|
2002-02-06 22:07:56 -05:00
|
|
|
typedef struct _MetaDrawInfo MetaDrawInfo;
|
|
|
|
|
|
|
|
#define META_THEME_ERROR (g_quark_from_static_string ("meta-theme-error"))
|
2002-01-18 22:50:03 -05:00
|
|
|
|
2002-01-27 21:09:12 -05:00
|
|
|
typedef enum
|
|
|
|
{
|
2002-02-06 22:07:56 -05:00
|
|
|
META_THEME_ERROR_FRAME_GEOMETRY,
|
|
|
|
META_THEME_ERROR_BAD_CHARACTER,
|
|
|
|
META_THEME_ERROR_BAD_PARENS,
|
|
|
|
META_THEME_ERROR_UNKNOWN_VARIABLE,
|
|
|
|
META_THEME_ERROR_DIVIDE_BY_ZERO,
|
|
|
|
META_THEME_ERROR_MOD_ON_FLOAT,
|
|
|
|
META_THEME_ERROR_FAILED
|
|
|
|
} MetaThemeError;
|
|
|
|
|
2002-01-27 21:09:12 -05:00
|
|
|
|
2002-01-18 22:50:03 -05:00
|
|
|
/* Parameters used to calculate the geometry of the frame */
|
|
|
|
struct _MetaFrameLayout
|
|
|
|
{
|
2002-02-06 22:07:56 -05:00
|
|
|
int refcount;
|
|
|
|
|
2002-01-18 22:50:03 -05:00
|
|
|
/* Size of left/right/bottom sides */
|
|
|
|
int left_width;
|
|
|
|
int right_width;
|
|
|
|
int bottom_height;
|
|
|
|
|
|
|
|
/* Border of blue title region */
|
|
|
|
GtkBorder title_border;
|
|
|
|
|
2002-02-06 22:07:56 -05:00
|
|
|
/* Extra height for inside of title region, above the font height */
|
|
|
|
int title_vertical_pad;
|
|
|
|
|
2002-01-18 22:50:03 -05:00
|
|
|
/* indent of buttons from edges of frame */
|
2002-02-06 22:07:56 -05:00
|
|
|
int right_titlebar_edge;
|
|
|
|
int left_titlebar_edge;
|
2002-01-18 22:50:03 -05:00
|
|
|
|
|
|
|
/* Size of buttons */
|
|
|
|
int button_width;
|
|
|
|
int button_height;
|
|
|
|
|
|
|
|
/* Space around buttons */
|
|
|
|
GtkBorder button_border;
|
2002-02-09 01:54:44 -05:00
|
|
|
|
2002-02-09 12:02:38 -05:00
|
|
|
/* scale factor for title text */
|
|
|
|
double title_scale;
|
|
|
|
|
2002-02-09 01:54:44 -05:00
|
|
|
/* Whether title text will be displayed */
|
|
|
|
guint has_title : 1;
|
2002-01-18 22:50:03 -05:00
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
/* Calculated actual geometry of the frame */
|
|
|
|
struct _MetaFrameGeometry
|
|
|
|
{
|
|
|
|
int left_width;
|
|
|
|
int right_width;
|
|
|
|
int top_height;
|
|
|
|
int bottom_height;
|
|
|
|
|
|
|
|
int width;
|
|
|
|
int height;
|
|
|
|
|
|
|
|
GdkRectangle close_rect;
|
|
|
|
GdkRectangle max_rect;
|
|
|
|
GdkRectangle min_rect;
|
|
|
|
GdkRectangle menu_rect;
|
|
|
|
GdkRectangle title_rect;
|
2002-01-28 00:16:04 -05:00
|
|
|
|
|
|
|
int left_titlebar_edge;
|
|
|
|
int right_titlebar_edge;
|
|
|
|
int top_titlebar_edge;
|
|
|
|
int bottom_titlebar_edge;
|
2002-01-18 22:50:03 -05:00
|
|
|
};
|
|
|
|
|
2001-05-31 12:18:40 -04:00
|
|
|
|
2002-01-08 02:23:35 -05:00
|
|
|
typedef enum
|
2002-01-06 22:26:09 -05:00
|
|
|
{
|
2002-01-08 02:23:35 -05:00
|
|
|
META_COLOR_SPEC_BASIC,
|
|
|
|
META_COLOR_SPEC_GTK,
|
|
|
|
META_COLOR_SPEC_BLEND
|
|
|
|
} MetaColorSpecType;
|
|
|
|
|
2002-01-28 02:30:44 -05:00
|
|
|
typedef enum
|
|
|
|
{
|
|
|
|
META_GTK_COLOR_FG,
|
|
|
|
META_GTK_COLOR_BG,
|
|
|
|
META_GTK_COLOR_LIGHT,
|
|
|
|
META_GTK_COLOR_DARK,
|
|
|
|
META_GTK_COLOR_MID,
|
|
|
|
META_GTK_COLOR_TEXT,
|
|
|
|
META_GTK_COLOR_BASE,
|
2002-02-06 22:07:56 -05:00
|
|
|
META_GTK_COLOR_TEXT_AA,
|
|
|
|
META_GTK_COLOR_LAST
|
2002-01-28 02:30:44 -05:00
|
|
|
} MetaGtkColorComponent;
|
|
|
|
|
2002-01-08 02:23:35 -05:00
|
|
|
struct _MetaColorSpec
|
|
|
|
{
|
|
|
|
MetaColorSpecType type;
|
|
|
|
union
|
|
|
|
{
|
|
|
|
struct {
|
|
|
|
GdkColor color;
|
|
|
|
} basic;
|
|
|
|
struct {
|
2002-01-28 02:30:44 -05:00
|
|
|
MetaGtkColorComponent component;
|
2002-01-08 02:23:35 -05:00
|
|
|
GtkStateType state;
|
|
|
|
} gtk;
|
|
|
|
struct {
|
|
|
|
MetaColorSpec *foreground;
|
|
|
|
MetaColorSpec *background;
|
|
|
|
double alpha;
|
|
|
|
} blend;
|
|
|
|
} data;
|
|
|
|
};
|
|
|
|
|
2002-02-02 00:09:19 -05:00
|
|
|
struct _MetaGradientSpec
|
|
|
|
{
|
|
|
|
MetaGradientType type;
|
|
|
|
GSList *color_specs;
|
|
|
|
};
|
|
|
|
|
2002-02-06 22:07:56 -05:00
|
|
|
struct _MetaDrawInfo
|
|
|
|
{
|
|
|
|
GdkPixbuf *mini_icon;
|
|
|
|
GdkPixbuf *icon;
|
|
|
|
PangoLayout *title_layout;
|
|
|
|
int title_layout_width;
|
|
|
|
int title_layout_height;
|
|
|
|
const MetaFrameGeometry *fgeom;
|
|
|
|
};
|
|
|
|
|
2002-01-27 21:09:12 -05:00
|
|
|
typedef enum
|
|
|
|
{
|
|
|
|
/* Basic drawing */
|
2002-02-02 00:09:19 -05:00
|
|
|
META_DRAW_LINE,
|
|
|
|
META_DRAW_RECTANGLE,
|
|
|
|
META_DRAW_ARC,
|
|
|
|
|
2002-02-06 22:07:56 -05:00
|
|
|
/* Clip to a rectangle */
|
|
|
|
META_DRAW_CLIP,
|
|
|
|
|
2002-02-02 00:09:19 -05:00
|
|
|
/* Texture thingies */
|
|
|
|
META_DRAW_TINT, /* just a filled rectangle with alpha */
|
|
|
|
META_DRAW_GRADIENT,
|
|
|
|
META_DRAW_IMAGE,
|
2002-01-27 21:09:12 -05:00
|
|
|
|
|
|
|
/* GTK theme engine stuff */
|
2002-02-02 00:09:19 -05:00
|
|
|
META_DRAW_GTK_ARROW,
|
|
|
|
META_DRAW_GTK_BOX,
|
2002-02-06 22:07:56 -05:00
|
|
|
META_DRAW_GTK_VLINE,
|
|
|
|
|
|
|
|
/* App's window icon */
|
|
|
|
META_DRAW_ICON,
|
|
|
|
/* App's window title */
|
|
|
|
META_DRAW_TITLE,
|
|
|
|
/* a draw op list */
|
2002-02-09 20:10:33 -05:00
|
|
|
META_DRAW_OP_LIST,
|
|
|
|
/* tiled draw op list */
|
|
|
|
META_DRAW_TILE
|
2002-02-02 00:09:19 -05:00
|
|
|
} MetaDrawType;
|
2002-01-27 21:09:12 -05:00
|
|
|
|
2002-02-02 00:09:19 -05:00
|
|
|
struct _MetaDrawOp
|
2002-01-27 21:09:12 -05:00
|
|
|
{
|
2002-02-02 00:09:19 -05:00
|
|
|
MetaDrawType type;
|
2002-01-27 21:09:12 -05:00
|
|
|
|
|
|
|
/* Positions are strings because they can be expressions */
|
|
|
|
union
|
|
|
|
{
|
|
|
|
struct {
|
|
|
|
MetaColorSpec *color_spec;
|
|
|
|
int dash_on_length;
|
|
|
|
int dash_off_length;
|
|
|
|
int width;
|
|
|
|
char *x1;
|
|
|
|
char *y1;
|
|
|
|
char *x2;
|
|
|
|
char *y2;
|
|
|
|
} line;
|
|
|
|
|
|
|
|
struct {
|
|
|
|
MetaColorSpec *color_spec;
|
|
|
|
gboolean filled;
|
|
|
|
char *x;
|
|
|
|
char *y;
|
|
|
|
char *width;
|
|
|
|
char *height;
|
|
|
|
} rectangle;
|
|
|
|
|
|
|
|
struct {
|
|
|
|
MetaColorSpec *color_spec;
|
|
|
|
gboolean filled;
|
|
|
|
char *x;
|
|
|
|
char *y;
|
|
|
|
char *width;
|
|
|
|
char *height;
|
|
|
|
double start_angle;
|
|
|
|
double extent_angle;
|
|
|
|
} arc;
|
2002-02-06 22:07:56 -05:00
|
|
|
|
|
|
|
struct {
|
|
|
|
char *x;
|
|
|
|
char *y;
|
|
|
|
char *width;
|
|
|
|
char *height;
|
|
|
|
} clip;
|
2002-02-02 00:09:19 -05:00
|
|
|
|
|
|
|
struct {
|
|
|
|
MetaColorSpec *color_spec;
|
|
|
|
double alpha;
|
|
|
|
char *x;
|
|
|
|
char *y;
|
|
|
|
char *width;
|
|
|
|
char *height;
|
|
|
|
} tint;
|
2002-01-27 21:09:12 -05:00
|
|
|
|
|
|
|
struct {
|
2002-02-02 00:09:19 -05:00
|
|
|
MetaGradientSpec *gradient_spec;
|
|
|
|
double alpha;
|
2002-01-27 21:09:12 -05:00
|
|
|
char *x;
|
|
|
|
char *y;
|
|
|
|
char *width;
|
|
|
|
char *height;
|
2002-02-02 00:09:19 -05:00
|
|
|
} gradient;
|
2002-01-27 21:09:12 -05:00
|
|
|
|
2002-02-02 00:09:19 -05:00
|
|
|
struct {
|
2002-02-06 22:43:13 -05:00
|
|
|
MetaColorSpec *colorize_spec;
|
2002-02-02 00:09:19 -05:00
|
|
|
GdkPixbuf *pixbuf;
|
|
|
|
double alpha;
|
|
|
|
char *x;
|
|
|
|
char *y;
|
|
|
|
char *width;
|
|
|
|
char *height;
|
2002-02-06 23:22:57 -05:00
|
|
|
guint32 colorize_cache_pixel;
|
|
|
|
GdkPixbuf *colorize_cache_pixbuf;
|
2002-02-02 00:09:19 -05:00
|
|
|
} image;
|
|
|
|
|
2002-01-27 21:09:12 -05:00
|
|
|
struct {
|
|
|
|
GtkStateType state;
|
|
|
|
GtkShadowType shadow;
|
|
|
|
GtkArrowType arrow;
|
2002-01-28 00:16:04 -05:00
|
|
|
gboolean filled;
|
2002-01-27 21:09:12 -05:00
|
|
|
char *x;
|
|
|
|
char *y;
|
|
|
|
char *width;
|
|
|
|
char *height;
|
|
|
|
} gtk_arrow;
|
|
|
|
|
|
|
|
struct {
|
|
|
|
GtkStateType state;
|
|
|
|
GtkShadowType shadow;
|
|
|
|
char *x;
|
|
|
|
char *y;
|
|
|
|
char *width;
|
|
|
|
char *height;
|
|
|
|
} gtk_box;
|
|
|
|
|
|
|
|
struct {
|
|
|
|
GtkStateType state;
|
|
|
|
char *x;
|
|
|
|
char *y1;
|
|
|
|
char *y2;
|
|
|
|
} gtk_vline;
|
2002-02-06 22:07:56 -05:00
|
|
|
|
|
|
|
struct {
|
|
|
|
double alpha;
|
|
|
|
char *x;
|
|
|
|
char *y;
|
|
|
|
char *width;
|
|
|
|
char *height;
|
|
|
|
} icon;
|
|
|
|
|
|
|
|
struct {
|
|
|
|
MetaColorSpec *color_spec;
|
|
|
|
char *x;
|
|
|
|
char *y;
|
|
|
|
} title;
|
|
|
|
|
|
|
|
struct {
|
|
|
|
MetaDrawOpList *op_list;
|
|
|
|
char *x;
|
|
|
|
char *y;
|
|
|
|
char *width;
|
|
|
|
char *height;
|
|
|
|
} op_list;
|
2002-02-09 20:10:33 -05:00
|
|
|
|
|
|
|
struct {
|
|
|
|
MetaDrawOpList *op_list;
|
|
|
|
char *x;
|
|
|
|
char *y;
|
|
|
|
char *width;
|
|
|
|
char *height;
|
|
|
|
char *tile_xoffset;
|
|
|
|
char *tile_yoffset;
|
|
|
|
char *tile_width;
|
|
|
|
char *tile_height;
|
|
|
|
} tile;
|
2002-01-27 21:09:12 -05:00
|
|
|
|
|
|
|
} data;
|
|
|
|
};
|
|
|
|
|
2002-02-02 00:09:19 -05:00
|
|
|
struct _MetaDrawOpList
|
2002-01-08 02:23:35 -05:00
|
|
|
{
|
2002-02-02 00:09:19 -05:00
|
|
|
int refcount;
|
|
|
|
MetaDrawOp **ops;
|
|
|
|
int n_ops;
|
|
|
|
int n_allocated;
|
2002-01-08 02:23:35 -05:00
|
|
|
};
|
|
|
|
|
|
|
|
typedef enum
|
|
|
|
{
|
2002-01-28 00:16:04 -05:00
|
|
|
META_BUTTON_STATE_NORMAL,
|
2002-01-08 02:23:35 -05:00
|
|
|
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;
|
|
|
|
|
2002-02-06 22:07:56 -05:00
|
|
|
typedef enum
|
|
|
|
{
|
|
|
|
META_MENU_ICON_TYPE_CLOSE,
|
|
|
|
META_MENU_ICON_TYPE_MAXIMIZE,
|
|
|
|
META_MENU_ICON_TYPE_UNMAXIMIZE,
|
|
|
|
META_MENU_ICON_TYPE_MINIMIZE,
|
|
|
|
META_MENU_ICON_TYPE_LAST
|
|
|
|
} MetaMenuIconType;
|
|
|
|
|
2002-01-08 02:23:35 -05:00
|
|
|
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 |
|
|
|
|
*
|
|
|
|
*/
|
2002-01-06 22:26:09 -05:00
|
|
|
|
2002-02-02 00:09:19 -05:00
|
|
|
/* entire frame */
|
2002-01-08 02:23:35 -05:00
|
|
|
META_FRAME_PIECE_ENTIRE_BACKGROUND,
|
2002-02-02 00:09:19 -05:00
|
|
|
/* entire titlebar background */
|
2002-02-06 22:07:56 -05:00
|
|
|
META_FRAME_PIECE_TITLEBAR,
|
2002-02-02 00:09:19 -05:00
|
|
|
/* portion of the titlebar background inside the titlebar
|
|
|
|
* background edges
|
|
|
|
*/
|
|
|
|
META_FRAME_PIECE_TITLEBAR_MIDDLE,
|
|
|
|
/* left end of titlebar */
|
2002-01-08 02:23:35 -05:00
|
|
|
META_FRAME_PIECE_LEFT_TITLEBAR_EDGE,
|
2002-02-02 00:09:19 -05:00
|
|
|
/* right end of titlebar */
|
2002-01-08 02:23:35 -05:00
|
|
|
META_FRAME_PIECE_RIGHT_TITLEBAR_EDGE,
|
2002-02-02 00:09:19 -05:00
|
|
|
/* top edge of titlebar */
|
2002-01-08 02:23:35 -05:00
|
|
|
META_FRAME_PIECE_TOP_TITLEBAR_EDGE,
|
2002-02-02 00:09:19 -05:00
|
|
|
/* bottom edge of titlebar */
|
2002-01-08 02:23:35 -05:00
|
|
|
META_FRAME_PIECE_BOTTOM_TITLEBAR_EDGE,
|
2002-02-02 00:09:19 -05:00
|
|
|
/* render over title background (text area) */
|
2002-02-06 22:07:56 -05:00
|
|
|
META_FRAME_PIECE_TITLE,
|
2002-02-02 00:09:19 -05:00
|
|
|
/* left edge of the frame */
|
2002-01-08 02:23:35 -05:00
|
|
|
META_FRAME_PIECE_LEFT_EDGE,
|
2002-02-02 00:09:19 -05:00
|
|
|
/* right edge of the frame */
|
2002-01-08 02:23:35 -05:00
|
|
|
META_FRAME_PIECE_RIGHT_EDGE,
|
2002-02-02 00:09:19 -05:00
|
|
|
/* bottom edge of the frame */
|
2002-01-08 02:23:35 -05:00
|
|
|
META_FRAME_PIECE_BOTTOM_EDGE,
|
2002-01-27 21:09:12 -05:00
|
|
|
/* place over entire frame, after drawing everything else */
|
|
|
|
META_FRAME_PIECE_OVERLAY,
|
2002-01-08 02:23:35 -05:00
|
|
|
/* Used to get size of the enum */
|
|
|
|
META_FRAME_PIECE_LAST
|
|
|
|
} MetaFramePiece;
|
|
|
|
|
2002-02-06 22:07:56 -05:00
|
|
|
#define N_GTK_STATES 5
|
2002-01-08 02:23:35 -05:00
|
|
|
struct _MetaFrameStyle
|
|
|
|
{
|
2002-01-19 18:59:11 -05:00
|
|
|
int refcount;
|
2002-01-27 21:09:12 -05:00
|
|
|
MetaFrameStyle *parent;
|
2002-02-06 22:07:56 -05:00
|
|
|
MetaDrawOpList *buttons[META_BUTTON_TYPE_LAST][META_BUTTON_STATE_LAST];
|
2002-02-02 00:09:19 -05:00
|
|
|
MetaDrawOpList *pieces[META_FRAME_PIECE_LAST];
|
2002-01-18 22:50:03 -05:00
|
|
|
MetaFrameLayout *layout;
|
2002-01-06 22:26:09 -05:00
|
|
|
};
|
2002-01-05 23:51:53 -05:00
|
|
|
|
2002-01-27 21:09:12 -05:00
|
|
|
/* Kinds of frame...
|
|
|
|
*
|
2002-01-27 03:21:53 -05:00
|
|
|
* normal -> noresize / vert only / horz only / both
|
|
|
|
* focused / unfocused
|
|
|
|
* max -> focused / unfocused
|
|
|
|
* shaded -> focused / unfocused
|
|
|
|
* max/shaded -> focused / unfocused
|
|
|
|
*
|
|
|
|
* so 4 states with 8 sub-states in one, 2 sub-states in the other 3,
|
|
|
|
* meaning 14 total
|
|
|
|
*
|
|
|
|
* 14 window states times 7 or 8 window types. Except some
|
|
|
|
* window types never get a frame so that narrows it down a bit.
|
|
|
|
*
|
|
|
|
*/
|
2002-01-08 02:23:35 -05:00
|
|
|
typedef enum
|
|
|
|
{
|
2002-01-27 21:09:12 -05:00
|
|
|
META_FRAME_STATE_NORMAL,
|
|
|
|
META_FRAME_STATE_MAXIMIZED,
|
|
|
|
META_FRAME_STATE_SHADED,
|
|
|
|
META_FRAME_STATE_MAXIMIZED_AND_SHADED,
|
|
|
|
META_FRAME_STATE_LAST
|
|
|
|
} MetaFrameState;
|
2002-01-19 18:59:11 -05:00
|
|
|
|
2002-01-27 03:21:53 -05:00
|
|
|
typedef enum
|
|
|
|
{
|
2002-01-27 21:09:12 -05:00
|
|
|
META_FRAME_RESIZE_NONE,
|
|
|
|
META_FRAME_RESIZE_VERTICAL,
|
|
|
|
META_FRAME_RESIZE_HORIZONTAL,
|
|
|
|
META_FRAME_RESIZE_BOTH,
|
|
|
|
META_FRAME_RESIZE_LAST
|
|
|
|
} MetaFrameResize;
|
2002-01-27 03:21:53 -05:00
|
|
|
|
|
|
|
typedef enum
|
|
|
|
{
|
2002-01-27 21:09:12 -05:00
|
|
|
META_FRAME_FOCUS_NO,
|
|
|
|
META_FRAME_FOCUS_YES,
|
|
|
|
META_FRAME_FOCUS_LAST
|
|
|
|
} MetaFrameFocus;
|
2002-01-27 03:21:53 -05:00
|
|
|
|
|
|
|
/* One StyleSet per window type (for window types that get a frame) */
|
2002-01-19 18:59:11 -05:00
|
|
|
struct _MetaFrameStyleSet
|
|
|
|
{
|
2002-01-27 21:09:12 -05:00
|
|
|
int refcount;
|
|
|
|
MetaFrameStyleSet *parent;
|
|
|
|
MetaFrameStyle *normal_styles[META_FRAME_RESIZE_LAST][META_FRAME_FOCUS_LAST];
|
|
|
|
MetaFrameStyle *maximized_styles[META_FRAME_FOCUS_LAST];
|
|
|
|
MetaFrameStyle *shaded_styles[META_FRAME_FOCUS_LAST];
|
|
|
|
MetaFrameStyle *maximized_and_shaded_styles[META_FRAME_FOCUS_LAST];
|
2002-01-27 03:21:53 -05:00
|
|
|
};
|
|
|
|
|
|
|
|
struct _MetaTheme
|
|
|
|
{
|
|
|
|
char *name;
|
2002-02-06 22:07:56 -05:00
|
|
|
char *dirname;
|
2002-01-27 03:21:53 -05:00
|
|
|
char *filename;
|
2002-02-06 22:07:56 -05:00
|
|
|
char *readable_name;
|
|
|
|
char *author;
|
|
|
|
char *copyright;
|
|
|
|
char *date;
|
|
|
|
char *description;
|
|
|
|
|
|
|
|
GHashTable *integer_constants;
|
|
|
|
GHashTable *float_constants;
|
|
|
|
GHashTable *images_by_filename;
|
|
|
|
GHashTable *layouts_by_name;
|
|
|
|
GHashTable *draw_op_lists_by_name;
|
2002-01-27 21:09:12 -05:00
|
|
|
GHashTable *styles_by_name;
|
|
|
|
GHashTable *style_sets_by_name;
|
|
|
|
MetaFrameStyleSet *style_sets_by_type[META_FRAME_TYPE_LAST];
|
2002-02-06 22:07:56 -05:00
|
|
|
MetaDrawOpList *menu_icons[META_MENU_ICON_TYPE_LAST][N_GTK_STATES];
|
2002-01-19 18:59:11 -05:00
|
|
|
};
|
2002-01-08 02:23:35 -05:00
|
|
|
|
2002-02-02 00:09:19 -05:00
|
|
|
struct _MetaPositionExprEnv
|
|
|
|
{
|
|
|
|
int x;
|
|
|
|
int y;
|
|
|
|
int width;
|
|
|
|
int height;
|
2002-02-06 22:07:56 -05:00
|
|
|
/* size of an object being drawn, if it has a natural size */
|
2002-02-02 00:09:19 -05:00
|
|
|
int object_width;
|
|
|
|
int object_height;
|
2002-02-06 22:07:56 -05:00
|
|
|
/* global object sizes, always available */
|
|
|
|
int left_width;
|
|
|
|
int right_width;
|
|
|
|
int top_height;
|
|
|
|
int bottom_height;
|
|
|
|
int title_width;
|
|
|
|
int title_height;
|
|
|
|
int mini_icon_width;
|
|
|
|
int mini_icon_height;
|
|
|
|
int icon_width;
|
|
|
|
int icon_height;
|
|
|
|
/* Theme so we can look up constants */
|
|
|
|
MetaTheme *theme;
|
2002-02-02 00:09:19 -05:00
|
|
|
};
|
|
|
|
|
2002-01-18 22:50:03 -05:00
|
|
|
MetaFrameLayout* meta_frame_layout_new (void);
|
2002-02-06 22:07:56 -05:00
|
|
|
MetaFrameLayout* meta_frame_layout_copy (const MetaFrameLayout *src);
|
|
|
|
void meta_frame_layout_ref (MetaFrameLayout *layout);
|
|
|
|
void meta_frame_layout_unref (MetaFrameLayout *layout);
|
2002-01-19 18:59:11 -05:00
|
|
|
void meta_frame_layout_get_borders (const MetaFrameLayout *layout,
|
|
|
|
int text_height,
|
|
|
|
MetaFrameFlags flags,
|
|
|
|
int *top_height,
|
|
|
|
int *bottom_height,
|
|
|
|
int *left_width,
|
|
|
|
int *right_width);
|
2002-01-18 22:50:03 -05:00
|
|
|
void meta_frame_layout_calc_geometry (const MetaFrameLayout *layout,
|
|
|
|
int text_height,
|
|
|
|
MetaFrameFlags flags,
|
|
|
|
int client_width,
|
|
|
|
int client_height,
|
|
|
|
MetaFrameGeometry *fgeom);
|
|
|
|
|
2002-02-06 22:07:56 -05:00
|
|
|
gboolean meta_frame_layout_validate (const MetaFrameLayout *layout,
|
|
|
|
GError **error);
|
|
|
|
|
2002-02-02 00:09:19 -05:00
|
|
|
gboolean meta_parse_position_expression (const char *expr,
|
|
|
|
const MetaPositionExprEnv *env,
|
|
|
|
int *x_return,
|
|
|
|
int *y_return,
|
|
|
|
GError **err);
|
|
|
|
gboolean meta_parse_size_expression (const char *expr,
|
|
|
|
const MetaPositionExprEnv *env,
|
|
|
|
int *val_return,
|
|
|
|
GError **err);
|
2002-01-19 18:59:11 -05:00
|
|
|
|
2002-01-28 02:30:44 -05:00
|
|
|
MetaColorSpec* meta_color_spec_new (MetaColorSpecType type);
|
|
|
|
MetaColorSpec* meta_color_spec_new_from_string (const char *str,
|
|
|
|
GError **err);
|
|
|
|
MetaColorSpec* meta_color_spec_new_gtk (MetaGtkColorComponent component,
|
|
|
|
GtkStateType state);
|
|
|
|
void meta_color_spec_free (MetaColorSpec *spec);
|
|
|
|
void meta_color_spec_render (MetaColorSpec *spec,
|
|
|
|
GtkWidget *widget,
|
|
|
|
GdkColor *color);
|
|
|
|
|
2002-01-08 02:23:35 -05:00
|
|
|
|
2002-02-02 00:09:19 -05:00
|
|
|
MetaDrawOp* meta_draw_op_new (MetaDrawType type);
|
|
|
|
void meta_draw_op_free (MetaDrawOp *op);
|
|
|
|
void meta_draw_op_draw (const MetaDrawOp *op,
|
|
|
|
GtkWidget *widget,
|
|
|
|
GdkDrawable *drawable,
|
|
|
|
const GdkRectangle *clip,
|
2002-02-06 22:07:56 -05:00
|
|
|
const MetaDrawInfo *info,
|
2002-02-02 00:09:19 -05:00
|
|
|
/* logical region being drawn */
|
|
|
|
int x,
|
|
|
|
int y,
|
|
|
|
int width,
|
|
|
|
int height);
|
|
|
|
|
|
|
|
|
|
|
|
MetaDrawOpList* meta_draw_op_list_new (int n_preallocs);
|
|
|
|
void meta_draw_op_list_ref (MetaDrawOpList *op_list);
|
|
|
|
void meta_draw_op_list_unref (MetaDrawOpList *op_list);
|
|
|
|
void meta_draw_op_list_draw (const MetaDrawOpList *op_list,
|
|
|
|
GtkWidget *widget,
|
|
|
|
GdkDrawable *drawable,
|
|
|
|
const GdkRectangle *clip,
|
2002-02-06 22:07:56 -05:00
|
|
|
const MetaDrawInfo *info,
|
2002-02-02 00:09:19 -05:00
|
|
|
int x,
|
|
|
|
int y,
|
|
|
|
int width,
|
|
|
|
int height);
|
|
|
|
void meta_draw_op_list_append (MetaDrawOpList *op_list,
|
|
|
|
MetaDrawOp *op);
|
2002-02-06 22:07:56 -05:00
|
|
|
gboolean meta_draw_op_list_validate (MetaDrawOpList *op_list,
|
|
|
|
GError **error);
|
|
|
|
gboolean meta_draw_op_list_contains (MetaDrawOpList *op_list,
|
|
|
|
MetaDrawOpList *child);
|
2002-01-27 21:09:12 -05:00
|
|
|
|
2002-01-08 02:23:35 -05:00
|
|
|
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);
|
2002-02-06 22:07:56 -05:00
|
|
|
gboolean meta_gradient_spec_validate (MetaGradientSpec *spec,
|
|
|
|
GError **error);
|
2002-01-08 02:23:35 -05:00
|
|
|
|
2001-05-31 12:18:40 -04:00
|
|
|
|
2002-01-27 21:09:12 -05:00
|
|
|
MetaFrameStyle* meta_frame_style_new (MetaFrameStyle *parent);
|
2002-01-19 18:59:11 -05:00
|
|
|
void meta_frame_style_ref (MetaFrameStyle *style);
|
|
|
|
void meta_frame_style_unref (MetaFrameStyle *style);
|
|
|
|
|
2002-02-06 22:07:56 -05:00
|
|
|
void meta_frame_style_draw (MetaFrameStyle *style,
|
|
|
|
GtkWidget *widget,
|
|
|
|
GdkDrawable *drawable,
|
|
|
|
int x_offset,
|
|
|
|
int y_offset,
|
|
|
|
const GdkRectangle *clip,
|
|
|
|
const MetaFrameGeometry *fgeom,
|
|
|
|
int client_width,
|
|
|
|
int client_height,
|
|
|
|
PangoLayout *title_layout,
|
|
|
|
int text_height,
|
|
|
|
MetaButtonState button_states[META_BUTTON_TYPE_LAST],
|
|
|
|
GdkPixbuf *mini_icon,
|
|
|
|
GdkPixbuf *icon);
|
|
|
|
|
|
|
|
|
|
|
|
gboolean meta_frame_style_validate (MetaFrameStyle *style,
|
|
|
|
GError **error);
|
|
|
|
|
|
|
|
MetaFrameStyleSet* meta_frame_style_set_new (MetaFrameStyleSet *parent);
|
|
|
|
void meta_frame_style_set_ref (MetaFrameStyleSet *style_set);
|
|
|
|
void meta_frame_style_set_unref (MetaFrameStyleSet *style_set);
|
|
|
|
|
|
|
|
gboolean meta_frame_style_set_validate (MetaFrameStyleSet *style_set,
|
|
|
|
GError **error);
|
|
|
|
|
|
|
|
MetaTheme* meta_theme_get_current (void);
|
|
|
|
void meta_theme_set_current (const char *name,
|
|
|
|
gboolean force_reload);
|
|
|
|
|
|
|
|
MetaTheme* meta_theme_new (void);
|
|
|
|
void meta_theme_free (MetaTheme *theme);
|
|
|
|
gboolean meta_theme_validate (MetaTheme *theme,
|
|
|
|
GError **error);
|
|
|
|
GdkPixbuf* meta_theme_load_image (MetaTheme *theme,
|
|
|
|
const char *filename,
|
|
|
|
GError **error);
|
|
|
|
|
2002-02-14 21:32:48 -05:00
|
|
|
MetaFrameStyle* meta_theme_get_frame_style (MetaTheme *theme,
|
|
|
|
MetaFrameType type,
|
|
|
|
MetaFrameFlags flags);
|
|
|
|
|
2002-02-09 12:02:38 -05:00
|
|
|
double meta_theme_get_title_scale (MetaTheme *theme,
|
|
|
|
MetaFrameType type,
|
|
|
|
MetaFrameFlags flags);
|
|
|
|
|
2002-02-06 22:07:56 -05:00
|
|
|
void meta_theme_draw_frame (MetaTheme *theme,
|
2002-01-28 00:16:04 -05:00
|
|
|
GtkWidget *widget,
|
|
|
|
GdkDrawable *drawable,
|
2002-02-06 22:07:56 -05:00
|
|
|
const GdkRectangle *clip,
|
2002-01-28 02:30:44 -05:00
|
|
|
int x_offset,
|
|
|
|
int y_offset,
|
2002-02-06 22:07:56 -05:00
|
|
|
MetaFrameType type,
|
2002-01-28 00:16:04 -05:00
|
|
|
MetaFrameFlags flags,
|
|
|
|
int client_width,
|
|
|
|
int client_height,
|
|
|
|
PangoLayout *title_layout,
|
|
|
|
int text_height,
|
2002-02-06 22:07:56 -05:00
|
|
|
MetaButtonState button_states[META_BUTTON_TYPE_LAST],
|
|
|
|
GdkPixbuf *mini_icon,
|
|
|
|
GdkPixbuf *icon);
|
|
|
|
|
|
|
|
void meta_theme_draw_menu_icon (MetaTheme *theme,
|
|
|
|
GtkWidget *widget,
|
|
|
|
GdkDrawable *drawable,
|
|
|
|
const GdkRectangle *clip,
|
|
|
|
int x_offset,
|
|
|
|
int y_offset,
|
|
|
|
int width,
|
|
|
|
int height,
|
|
|
|
MetaMenuIconType type);
|
|
|
|
|
|
|
|
void meta_theme_get_frame_borders (MetaTheme *theme,
|
|
|
|
MetaFrameType type,
|
|
|
|
int text_height,
|
|
|
|
MetaFrameFlags flags,
|
|
|
|
int *top_height,
|
|
|
|
int *bottom_height,
|
|
|
|
int *left_width,
|
|
|
|
int *right_width);
|
|
|
|
void meta_theme_calc_geometry (MetaTheme *theme,
|
|
|
|
MetaFrameType type,
|
|
|
|
int text_height,
|
|
|
|
MetaFrameFlags flags,
|
|
|
|
int client_width,
|
|
|
|
int client_height,
|
|
|
|
MetaFrameGeometry *fgeom);
|
|
|
|
|
|
|
|
|
|
|
|
MetaFrameLayout* meta_theme_lookup_layout (MetaTheme *theme,
|
|
|
|
const char *name);
|
|
|
|
void meta_theme_insert_layout (MetaTheme *theme,
|
|
|
|
const char *name,
|
|
|
|
MetaFrameLayout *layout);
|
|
|
|
MetaDrawOpList* meta_theme_lookup_draw_op_list (MetaTheme *theme,
|
|
|
|
const char *name);
|
|
|
|
void meta_theme_insert_draw_op_list (MetaTheme *theme,
|
|
|
|
const char *name,
|
|
|
|
MetaDrawOpList *op_list);
|
|
|
|
MetaFrameStyle* meta_theme_lookup_style (MetaTheme *theme,
|
|
|
|
const char *name);
|
|
|
|
void meta_theme_insert_style (MetaTheme *theme,
|
|
|
|
const char *name,
|
|
|
|
MetaFrameStyle *style);
|
|
|
|
MetaFrameStyleSet* meta_theme_lookup_style_set (MetaTheme *theme,
|
|
|
|
const char *name);
|
|
|
|
void meta_theme_insert_style_set (MetaTheme *theme,
|
|
|
|
const char *name,
|
|
|
|
MetaFrameStyleSet *style_set);
|
|
|
|
gboolean meta_theme_define_int_constant (MetaTheme *theme,
|
|
|
|
const char *name,
|
|
|
|
int value,
|
|
|
|
GError **error);
|
|
|
|
gboolean meta_theme_lookup_int_constant (MetaTheme *theme,
|
|
|
|
const char *name,
|
|
|
|
int *value);
|
|
|
|
gboolean meta_theme_define_float_constant (MetaTheme *theme,
|
|
|
|
const char *name,
|
|
|
|
double value,
|
|
|
|
GError **error);
|
|
|
|
gboolean meta_theme_lookup_float_constant (MetaTheme *theme,
|
|
|
|
const char *name,
|
|
|
|
double *value);
|
|
|
|
|
|
|
|
char* meta_theme_replace_constants (MetaTheme *theme,
|
|
|
|
const char *expr,
|
|
|
|
GError **err);
|
|
|
|
|
|
|
|
/* random stuff */
|
|
|
|
|
2002-02-09 12:02:38 -05:00
|
|
|
PangoFontDescription* meta_gtk_widget_get_font_desc (GtkWidget *widget,
|
|
|
|
double scale);
|
|
|
|
int meta_pango_font_desc_get_text_height (PangoFontDescription *font_desc,
|
|
|
|
PangoContext *context);
|
|
|
|
|
2002-02-06 22:07:56 -05:00
|
|
|
|
|
|
|
/* Enum converters */
|
|
|
|
MetaGtkColorComponent meta_color_component_from_string (const char *str);
|
|
|
|
const char* meta_color_component_to_string (MetaGtkColorComponent component);
|
|
|
|
MetaButtonState meta_button_state_from_string (const char *str);
|
|
|
|
const char* meta_button_state_to_string (MetaButtonState state);
|
|
|
|
MetaButtonType meta_button_type_from_string (const char *str);
|
|
|
|
const char* meta_button_type_to_string (MetaButtonType type);
|
|
|
|
MetaMenuIconType meta_menu_icon_type_from_string (const char *str);
|
|
|
|
const char* meta_menu_icon_type_to_string (MetaMenuIconType type);
|
|
|
|
MetaFramePiece meta_frame_piece_from_string (const char *str);
|
|
|
|
const char* meta_frame_piece_to_string (MetaFramePiece piece);
|
|
|
|
MetaFrameState meta_frame_state_from_string (const char *str);
|
|
|
|
const char* meta_frame_state_to_string (MetaFrameState state);
|
|
|
|
MetaFrameResize meta_frame_resize_from_string (const char *str);
|
|
|
|
const char* meta_frame_resize_to_string (MetaFrameResize resize);
|
|
|
|
MetaFrameFocus meta_frame_focus_from_string (const char *str);
|
|
|
|
const char* meta_frame_focus_to_string (MetaFrameFocus focus);
|
|
|
|
MetaFrameType meta_frame_type_from_string (const char *str);
|
|
|
|
const char* meta_frame_type_to_string (MetaFrameType type);
|
|
|
|
MetaGradientType meta_gradient_type_from_string (const char *str);
|
|
|
|
const char* meta_gradient_type_to_string (MetaGradientType type);
|
|
|
|
GtkStateType meta_gtk_state_from_string (const char *str);
|
|
|
|
const char* meta_gtk_state_to_string (GtkStateType state);
|
|
|
|
GtkShadowType meta_gtk_shadow_from_string (const char *str);
|
|
|
|
const char* meta_gtk_shadow_to_string (GtkShadowType shadow);
|
|
|
|
GtkArrowType meta_gtk_arrow_from_string (const char *str);
|
|
|
|
const char* meta_gtk_arrow_to_string (GtkArrowType arrow);
|
2002-01-28 02:30:44 -05:00
|
|
|
|
2001-05-31 12:18:40 -04:00
|
|
|
#endif
|