summaryrefslogtreecommitdiff
path: root/gtk/gtkstyle.h
blob: c0ec33736c65fe2530d87937513b9b331e52bb7d (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
215
216
217
/* GTK - The GIMP Toolkit
 * Copyright (C) 1995-1997 Peter Mattis, Spencer Kimball and Josh MacDonald
 *
 * This library is free software; you can redistribute it and/or
 * modify it under the terms of the GNU Library General Public
 * License as published by the Free Software Foundation; either
 * version 2 of the License, or (at your option) any later version.
 *
 * This library 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
 * Library General Public License for more details.
 *
 * You should have received a copy of the GNU Library General Public
 * License along with this library; if not, write to the Free
 * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
 */
#ifndef __GTK_STYLE_H__
#define __GTK_STYLE_H__


#include <gdk/gdk.h>
#include <gtk/gtkenums.h>


#ifdef __cplusplus
extern "C" {
#endif /* __cplusplus */


typedef struct _GtkStyle       GtkStyle;
typedef struct _GtkStyleClass  GtkStyleClass;

/* This is used for having dynamic style changing stuff */
/* fg, bg, light, dark, mid, text, base */
#define GTK_STYLE_NUM_STYLECOLORS() 7*5

struct _GtkStyle
{
  GdkColor fg[5];
  GdkColor bg[5];
  GdkColor light[5];
  GdkColor dark[5];
  GdkColor mid[5];
  GdkColor text[5];
  GdkColor base[5];

  GdkColor black;
  GdkColor white;
  GdkFont *font;

  GdkGC *fg_gc[5];
  GdkGC *bg_gc[5];
  GdkGC *light_gc[5];
  GdkGC *dark_gc[5];
  GdkGC *mid_gc[5];
  GdkGC *text_gc[5];
  GdkGC *base_gc[5];
  GdkGC *black_gc;
  GdkGC *white_gc;

  GdkPixmap *bg_pixmap[5];

  gint ref_count;
  gint attach_count;

  gint depth;
  GdkColormap *colormap;

  GtkStyleClass *klass;
};

struct _GtkStyleClass
{
  gint xthickness;
  gint ythickness;

  void (*draw_hline)   (GtkStyle      *style,
			GdkWindow     *window,
			GtkStateType   state_type,
			gint           x1,
			gint           x2,
			gint           y);
  void (*draw_vline)   (GtkStyle      *style,
			GdkWindow     *window,
			GtkStateType   state_type,
			gint           y1,
			gint           y2,
			gint           x);
  void (*draw_shadow)  (GtkStyle      *style,
			GdkWindow     *window,
			GtkStateType   state_type,
			GtkShadowType  shadow_type,
			gint           x,
			gint           y,
			gint           width,
			gint           height);
  void (*draw_polygon) (GtkStyle      *style,
			GdkWindow     *window,
			GtkStateType   state_type,
			GtkShadowType  shadow_type,
			GdkPoint      *point,
			gint           npoints,
			gint           fill);
  void (*draw_arrow)   (GtkStyle      *style,
			GdkWindow     *window,
			GtkStateType   state_type,
			GtkShadowType  shadow_type,
			GtkArrowType   arrow_type,
			gint           fill,
			gint           x,
			gint           y,
			gint           width,
			gint           height);
  void (*draw_diamond) (GtkStyle      *style,
			GdkWindow     *window,
			GtkStateType   state_type,
			GtkShadowType  shadow_type,
			gint           x,
			gint           y,
			gint           width,
			gint           height);
  void (*draw_oval)    (GtkStyle      *style,
			GdkWindow     *window,
			GtkStateType   state_type,
			GtkShadowType  shadow_type,
			gint           x,
			gint           y,
			gint           width,
			gint           height);
  void (*draw_string)  (GtkStyle      *style,
			GdkWindow     *window,
			GtkStateType   state_type,
			gint           x,
			gint           y,
			const gchar   *string);
};


GtkStyle* gtk_style_new            (void);
GtkStyle* gtk_style_attach         (GtkStyle     *style,
				    GdkWindow    *window);
void      gtk_style_detach         (GtkStyle     *style);
GtkStyle *gtk_style_ref            (GtkStyle     *style);
void      gtk_style_unref          (GtkStyle     *style);
void      gtk_style_set_background (GtkStyle     *style,
				    GdkWindow    *window,
				    GtkStateType  state_type);


void gtk_draw_hline   (GtkStyle      *style,
		       GdkWindow     *window,
		       GtkStateType   state_type,
		       gint           x1,
		       gint           x2,
		       gint           y);
void gtk_draw_vline   (GtkStyle      *style,
		       GdkWindow     *window,
		       GtkStateType   state_type,
		       gint           y1,
		       gint           y2,
		       gint           x);
void gtk_draw_shadow  (GtkStyle      *style,
		       GdkWindow     *window,
		       GtkStateType   state_type,
		       GtkShadowType  shadow_type,
		       gint           x,
		       gint           y,
		       gint           width,
		       gint           height);
void gtk_draw_polygon (GtkStyle      *style,
		       GdkWindow     *window,
		       GtkStateType   state_type,
		       GtkShadowType  shadow_type,
		       GdkPoint      *points,
		       gint           npoints,
		       gint           fill);
void gtk_draw_arrow   (GtkStyle      *style,
		       GdkWindow     *window,
		       GtkStateType   state_type,
		       GtkShadowType  shadow_type,
		       GtkArrowType   arrow_type,
		       gint           fill,
		       gint           x,
		       gint           y,
		       gint           width,
		       gint           height);
void gtk_draw_diamond (GtkStyle      *style,
		       GdkWindow     *window,
		       GtkStateType   state_type,
		       GtkShadowType  shadow_type,
		       gint           x,
		       gint           y,
		       gint           width,
		       gint           height);
void gtk_draw_oval    (GtkStyle      *style,
		       GdkWindow     *window,
		       GtkStateType   state_type,
		       GtkShadowType  shadow_type,
		       gint           x,
		       gint           y,
		       gint           width,
		       gint           height);
void gtk_draw_string  (GtkStyle      *style,
		       GdkWindow     *window,
		       GtkStateType   state_type,
		       gint           x,
		       gint           y,
		       const gchar   *string);


#ifdef __cplusplus
}
#endif /* __cplusplus */


#endif /* __GTK_STYLE_H__ */