aboutsummaryrefslogtreecommitdiffstats
path: root/matchbox2/mb-wm-theme.h
blob: fb4b6f5514d42ed309572c8eb4c081aa9468a6a7 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
/*
 *  Matchbox Window Manager II - A lightweight window manager not for the
 *                               desktop.
 *
 *  Authored By Matthew Allum <mallum@o-hand.com>
 *
 *  Copyright (c) 2005 OpenedHand Ltd - http://o-hand.com
 *
 *  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, 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.
 *
 */

#ifndef _HAVE_MB_WM_THEME_H
#define _HAVE_MB_WM_THEME_H

#include <matchbox2/mb-wm-config.h>
#include <matchbox2/mb-wm.h>

#define MB_WM_THEME(c) ((MBWMTheme*)(c))
#define MB_WM_THEME_CLASS(c) ((MBWMThemeClass*)(c))
#define MB_WM_TYPE_THEME (mb_wm_theme_class_type ())

#define MB_WM_THEME_PNG(c) ((MBWMThemePng*)(c))
#define MB_WM_THEME_PNG_CLASS(c) ((MBWMThemePngClass*)(c))
#define MB_WM_TYPE_THEME_PNG (mb_wm_theme_png_class_type ())

enum MBWMThemeCaps
{
  MBWMThemeCapsFrameMainButtonActionAccept = (1<<0),
  MBWMThemeCapsFrameDlgButtonActionAccept  = (1<<1),
  MBWMThemeCapsFrameMainButtonActionHelp   = (1<<2),
  MBWMThemeCapsFrameDlgButtonActionHelp    = (1<<3),
  MBWMThemeCapsFrameMainButtonActionCustom = (1<<4),
  MBWMThemeCapsFrameDlgButtonActionCustom  = (1<<5),
};


struct MBWMThemeClass
{
  MBWMObjectClass               parent;

  void (*paint_decor)           (MBWMTheme              *theme,
				 MBWMDecor              *decor);

  void (*paint_button)          (MBWMTheme              *theme,
				 MBWMDecorButton        *button);

  void (*decor_dimensions)      (MBWMTheme              *theme,
				 MBWindowManagerClient  *client,
				 int                    *north,
				 int                    *south,
				 int                    *west,
				 int                    *east);

  void (*button_size)           (MBWMTheme              *theme,
				 MBWMDecor              *decor,
				 MBWMDecorButtonType     type,
				 int                    *width,
				 int                    *height);

  void (*button_position)       (MBWMTheme              *theme,
				 MBWMDecor              *decor,
				 MBWMDecorButtonType     type,
				 int                    *x,
				 int                    *y);

  MBWMDecor* (*create_decor)    (MBWMTheme             *theme,
			         MBWindowManagerClient *client,
			         MBWMDecorType          type);

  void  (*resize_decor)         (MBWMTheme             *theme,
			         MBWMDecor             *decor);
};

struct MBWMTheme
{
  MBWMObject             parent;

  MBWindowManager       *wm;
  MBWMThemeCaps          caps;
  char                  *path;
  MBWMList              *xml_clients;

  Bool                   compositing;
  Bool                   shaped;
  MBWMColor              color_lowlight;
  MBWMColor              color_shadow;
  MBWMCompMgrShadowType  shadow_type;
};

int
mb_wm_theme_class_type ();

MBWMTheme *
mb_wm_theme_new (MBWindowManager * wm,  const char * theme_path);

void
mb_wm_theme_paint_decor (MBWMTheme *theme,
			 MBWMDecor *decor);

void
mb_wm_theme_paint_button (MBWMTheme       *theme,
			  MBWMDecorButton *button);

Bool
mb_wm_theme_supports (MBWMTheme     *theme,
		      MBWMThemeCaps  capability);

void
mb_wm_theme_get_decor_dimensions (MBWMTheme             *theme,
				  MBWindowManagerClient *client,
				  int                   *north,
				  int                   *south,
				  int                   *west,
				  int                   *east);

void
mb_wm_theme_get_button_size (MBWMTheme             *theme,
			     MBWMDecor             *decor,
			     MBWMDecorButtonType    type,
			     int                   *width,
			     int                   *height);

void
mb_wm_theme_get_button_position (MBWMTheme             *theme,
				 MBWMDecor             *decor,
				 MBWMDecorButtonType    type,
				 int                   *x,
				 int                   *y);

Bool
mb_wm_theme_is_button_press_activated (MBWMTheme              *theme,
				       MBWMDecor              *decor,
				       MBWMDecorButtonType    type);

MBWMDecor *
mb_wm_theme_create_decor (MBWMTheme             *theme,
			  MBWindowManagerClient *client,
			  MBWMDecorType          type);

void
mb_wm_theme_resize_decor (MBWMTheme             *theme,
			  MBWMDecor             *decor);

Bool
mb_wm_theme_get_client_geometry (MBWMTheme             * theme,
				 MBWindowManagerClient * client,
				 MBGeometry            * geom);

MBWMClientLayoutHints
mb_wm_theme_get_client_layout_hints (MBWMTheme             * theme,
				     MBWindowManagerClient * client);

Bool
mb_wm_theme_is_client_shaped (MBWMTheme             * theme,
			      MBWindowManagerClient * client);

void
mb_wm_theme_get_lowlight_color (MBWMTheme             * theme,
				unsigned int          * red,
				unsigned int          * green,
				unsigned int          * blue,
				unsigned int          * alpha);

void
mb_wm_theme_get_shadow_color (MBWMTheme             * theme,
			      unsigned int          * red,
			      unsigned int          * green,
			      unsigned int          * blue,
			      unsigned int          * alpha);


MBWMCompMgrShadowType
mb_wm_theme_get_shadow_type (MBWMTheme * theme);

Bool
mb_wm_theme_use_compositing_mgr (MBWMTheme * theme);

typedef unsigned int (*MBWMThemeCustomClientTypeFunc) (const char *type_name,
						       void       *user_data);

void
mb_wm_theme_set_custom_client_type_func (MBWMThemeCustomClientTypeFunc  func,
					 void                      *user_data);

typedef unsigned int (*MBWMThemeCustomButtonTypeFunc) (const char *type_name,
						       void       *user_data);

void
mb_wm_theme_set_custom_button_type_func (MBWMThemeCustomButtonTypeFunc  func,
					 void                      *user_data);

typedef unsigned int (*MBWMThemeCustomThemeTypeFunc) (const char *type_name,
						      void       *user_data);

void
mb_wm_theme_set_custom_theme_type_func (MBWMThemeCustomThemeTypeFunc  func,
					 void                      *user_data);


typedef MBWMTheme * (*MBWMThemeCustomThemeAllocFunc) (int theme_type, ...);

void
mb_wm_theme_set_custom_theme_alloc_func (MBWMThemeCustomThemeAllocFunc  func);

#endif