1
/* -*- mode: C; c-file-style: "gnu"; indent-tabs-mode: nil; -*- */
3
/* Metacity Theme Rendering */
6
* Copyright (C) 2001 Havoc Pennington
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.
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.
18
* You should have received a copy of the GNU General Public License
19
* along with this program; if not, see <http://www.gnu.org/licenses/>.
22
#ifndef META_THEME_PRIVATE_H
23
#define META_THEME_PRIVATE_H
25
#include <meta/boxes.h>
26
#include <meta/theme.h>
27
#include <meta/common.h>
31
* MetaStyleInfo: (skip)
34
typedef struct _MetaStyleInfo MetaStyleInfo;
36
* MetaFrameLayout: (skip)
39
typedef struct _MetaFrameLayout MetaFrameLayout;
41
* MetaButtonSpace: (skip)
44
typedef struct _MetaButtonSpace MetaButtonSpace;
46
* MetaFrameGeometry: (skip)
49
typedef struct _MetaFrameGeometry MetaFrameGeometry;
52
* Various parameters used to calculate the geometry of a frame.
54
struct _MetaFrameLayout
56
/** Invisible border required by the theme */
57
GtkBorder invisible_border;
58
/** Border/padding of the entire frame */
59
GtkBorder frame_border;
60
/** Border/padding of the titlebar region */
61
GtkBorder titlebar_border;
62
/** Border/padding of titlebar buttons */
63
GtkBorder button_border;
65
/** Margin of title */
66
GtkBorder title_margin;
67
/** Margin of titlebar buttons */
68
GtkBorder button_margin;
70
/** Min size of titlebar region */
71
GtkRequisition titlebar_min_size;
72
/** Min size of titlebar buttons */
73
GtkRequisition button_min_size;
75
/** Size of images in buttons */
78
/** Space between titlebar elements */
79
guint titlebar_spacing;
81
/** scale factor for title text */
84
/** Whether title text will be displayed */
87
/** Whether we should hide the buttons */
88
guint hide_buttons : 1;
90
/** Radius of the top left-hand corner; 0 if not rounded */
91
guint top_left_corner_rounded_radius;
92
/** Radius of the top right-hand corner; 0 if not rounded */
93
guint top_right_corner_rounded_radius;
94
/** Radius of the bottom left-hand corner; 0 if not rounded */
95
guint bottom_left_corner_rounded_radius;
96
/** Radius of the bottom right-hand corner; 0 if not rounded */
97
guint bottom_right_corner_rounded_radius;
101
* The computed size of a button (really just a way of tying its
102
* visible and clickable areas together).
103
* The reason for two different rectangles here is Fitts' law & maximized
104
* windows; see bug #97703 for more details.
106
struct _MetaButtonSpace
108
/** The screen area where the button's image is drawn */
109
GdkRectangle visible;
110
/** The screen area where the button can be activated by clicking */
111
GdkRectangle clickable;
115
* Calculated actual geometry of the frame
117
struct _MetaFrameGeometry
119
MetaFrameBorders borders;
124
GdkRectangle title_rect;
126
GtkBorder content_border;
128
/* used for a memset hack */
129
#define ADDRESS_OF_BUTTON_RECTS(fgeom) (((char*)(fgeom)) + G_STRUCT_OFFSET (MetaFrameGeometry, close_rect))
130
#define LENGTH_OF_BUTTON_RECTS (G_STRUCT_OFFSET (MetaFrameGeometry, appmenu_rect) + sizeof (MetaButtonSpace) - G_STRUCT_OFFSET (MetaFrameGeometry, close_rect))
132
/* The button rects (if changed adjust memset hack) */
133
MetaButtonSpace close_rect;
134
MetaButtonSpace max_rect;
135
MetaButtonSpace min_rect;
136
MetaButtonSpace menu_rect;
137
MetaButtonSpace appmenu_rect;
138
/* End of button rects (if changed adjust memset hack) */
140
/* Saved button layout */
141
MetaButtonLayout button_layout;
146
guint top_left_corner_rounded_radius;
147
guint top_right_corner_rounded_radius;
148
guint bottom_left_corner_rounded_radius;
149
guint bottom_right_corner_rounded_radius;
154
META_BUTTON_STATE_NORMAL,
155
META_BUTTON_STATE_PRESSED,
156
META_BUTTON_STATE_PRELIGHT,
157
META_BUTTON_STATE_LAST
162
META_BUTTON_TYPE_CLOSE,
163
META_BUTTON_TYPE_MAXIMIZE,
164
META_BUTTON_TYPE_MINIMIZE,
165
META_BUTTON_TYPE_MENU,
166
META_BUTTON_TYPE_APPMENU,
167
META_BUTTON_TYPE_LAST
172
META_STYLE_ELEMENT_WINDOW,
173
META_STYLE_ELEMENT_FRAME,
174
META_STYLE_ELEMENT_TITLEBAR,
175
META_STYLE_ELEMENT_TITLE,
176
META_STYLE_ELEMENT_BUTTON,
177
META_STYLE_ELEMENT_IMAGE,
178
META_STYLE_ELEMENT_LAST
181
struct _MetaStyleInfo
185
GtkStyleContext *styles[META_STYLE_ELEMENT_LAST];
190
* normal -> focused / unfocused
191
* max -> focused / unfocused
192
* shaded -> focused / unfocused
193
* max/shaded -> focused / unfocused
195
* so 4 states with 2 sub-states each, meaning 8 total
197
* 8 window states times 7 or 8 window types. Except some
198
* window types never get a frame so that narrows it down a bit.
203
META_FRAME_STATE_NORMAL,
204
META_FRAME_STATE_MAXIMIZED,
205
META_FRAME_STATE_TILED_LEFT,
206
META_FRAME_STATE_TILED_RIGHT,
207
META_FRAME_STATE_SHADED,
208
META_FRAME_STATE_MAXIMIZED_AND_SHADED,
209
META_FRAME_STATE_TILED_LEFT_AND_SHADED,
210
META_FRAME_STATE_TILED_RIGHT_AND_SHADED,
211
META_FRAME_STATE_LAST
217
META_FRAME_FOCUS_YES,
218
META_FRAME_FOCUS_LAST
222
* A theme. This is a singleton class which groups all settings from a theme
227
MetaFrameLayout *layouts[META_FRAME_TYPE_LAST];
230
void meta_frame_layout_apply_scale (const MetaFrameLayout *layout,
231
PangoFontDescription *font_desc);
233
MetaFrameLayout* meta_theme_get_frame_layout (MetaTheme *theme,
236
MetaStyleInfo * meta_theme_create_style_info (GdkScreen *screen,
237
const gchar *variant);
238
MetaStyleInfo * meta_style_info_ref (MetaStyleInfo *style);
239
void meta_style_info_unref (MetaStyleInfo *style_info);
241
void meta_style_info_set_flags (MetaStyleInfo *style_info,
242
MetaFrameFlags flags);
244
PangoFontDescription * meta_style_info_create_font_desc (MetaStyleInfo *style_info);
246
void meta_theme_draw_frame (MetaTheme *theme,
247
MetaStyleInfo *style_info,
250
MetaFrameFlags flags,
253
PangoLayout *title_layout,
255
const MetaButtonLayout *button_layout,
256
MetaButtonState button_states[META_BUTTON_TYPE_LAST],
257
cairo_surface_t *mini_icon);
259
void meta_theme_get_frame_borders (MetaTheme *theme,
260
MetaStyleInfo *style_info,
263
MetaFrameFlags flags,
264
MetaFrameBorders *borders);
266
void meta_theme_calc_geometry (MetaTheme *theme,
267
MetaStyleInfo *style_info,
270
MetaFrameFlags flags,
273
const MetaButtonLayout *button_layout,
274
MetaFrameGeometry *fgeom);
278
int meta_pango_font_desc_get_text_height (const PangoFontDescription *font_desc,
279
PangoContext *context);
280
int meta_theme_get_window_scaling_factor (void);
282
#endif /* META_THEME_PRIVATE_H */