Debian Codegraph @

inc/gresource.h

raw symbols SCIP
1 /* Copyright (C) 2000-2012 by George Williams */
2 /*
3 * Redistribution and use in source and binary forms, with or without
4 * modification, are permitted provided that the following conditions are met:
5
6 * Redistributions of source code must retain the above copyright notice, this
7 * list of conditions and the following disclaimer.
8
9 * Redistributions in binary form must reproduce the above copyright notice,
10 * this list of conditions and the following disclaimer in the documentation
11 * and/or other materials provided with the distribution.
12
13 * The name of the author may not be used to endorse or promote products
14 * derived from this software without specific prior written permission.
15
16 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED
17 * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
18 * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO
19 * EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
20 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
21 * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
22 * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
23 * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
24 * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
25 * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26 */
27
28 #ifndef FONTFORGE_GRESOURCE_H
29 #define FONTFORGE_GRESOURCE_H
30
31 #include "gimage.h"
32
33 #include <iconv.h>
34
35 typedef struct ggadgetcreatedata GGadgetCreateData;
36 typedef struct _PangoFontDescription PangoFontDescription;
37
38 enum border_type { bt_none, bt_box, bt_raised, bt_lowered, bt_engraved,
39 bt_embossed, bt_double };
40 enum border_shape { bs_rect, bs_roundrect, bs_elipse, bs_diamond };
41 enum box_flags {
42 box_foreground_border_inner = 1, /* 1 point line */
43 box_foreground_border_outer = 2, /* 1 point line */
44 box_active_border_inner = 4, /* 1 point line */
45 box_foreground_shadow_outer = 8, /* 1 point line, bottom&right */
46 box_do_depressed_background = 0x10,
47 box_draw_default = 0x20, /* if a default button draw a depressed rect around button */
48 box_generate_colors = 0x40, /* use border_brightest to compute other border cols */
49 box_gradient_bg = 0x80,
50 box_flag_mask = 0xFF
51 };
52 typedef struct gbox {
53 unsigned char border_type;
54 unsigned char border_shape;
55 unsigned char border_width; /* In points */
56 unsigned char padding; /* In points */
57 unsigned char rr_radius; /* In points */
58 unsigned char flags;
59 Color border_brightest; /* used for left upper part of elipse */
60 Color border_brighter;
61 Color border_darkest; /* used for right lower part of elipse */
62 Color border_darker;
63 Color main_background;
64 Color main_foreground;
65 Color disabled_background;
66 Color disabled_foreground;
67 Color active_border;
68 Color depressed_background;
69 Color gradient_bg_end;
70 Color border_inner;
71 Color border_outer;
72 } GBox;
73
74 #define GBOX_EMPTY { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ,0 ,0 ,0 ,0 }
75
76 enum font_style { fs_none, fs_italic=1, fs_smallcaps=2, fs_condensed=4, fs_extended=8, fs_vertical=16 };
77 enum font_type { ft_unknown, ft_serif, ft_sans, ft_mono, ft_cursive, ft_max };
78
79 typedef struct {
80 const char *utf8_family_name; /* may be more than one */
81 int16_t point_size; /* negative values are in pixels */
82 int16_t weight;
83 enum font_style style;
84 } FontRequest;
85
86 typedef struct font_instance {
87 FontRequest rq; /* identification of this instance */
88 PangoFontDescription *pango_fd;
89 PangoFontDescription *pangoc_fd;
90 } FontInstance, GFont;
91
92 enum res_type { rt_int, rt_double, rt_bool/* int */, rt_color, rt_string, rt_image, rt_font, rt_stringlong, rt_coloralpha };
93
94 struct gimage_cache_bucket;
95
96 typedef struct gresimage {
97 const char *ini_name;
98 struct gimage_cache_bucket *bucket;
99 } GResImage;
100
101 typedef struct gresfont {
102 GFont *fi;
103 const char *rstr;
104 uint8_t can_free_name;
105 } GResFont;
106
107 /* Locate and override the "windows-cjk-workaround" font alias, because the
108 native Pango alias "system-ui" doesn't support CJK scripts on Windows */
109 void fix_CJK_UI_font(GResFont* font);
110
111 #define GRESIMAGE_INIT(defstr) { (defstr), NULL }
112 #define GRESFONT_INIT(defstr) { NULL, (defstr), false }
113
114 GImage *GResImageGetImage(GResImage *);
115
116 typedef struct gresstruct {
117 const char *resname;
118 enum res_type type;
119 void *val;
120 void *(*cvt)(char *,void *); /* converts a string into a whatever */
121 int found;
122 } GResStruct;
123
124 #define GRESSTRUCT_EMPTY { NULL, 0, NULL, NULL, 0 }
125
126 struct resed {
127 const char *name, *resname;
128 enum res_type type;
129 void *val;
130 char *popup;
131 void *(*cvt)(char *,void *);
132 union { int ival; double dval; char *sval; GResFont fontval; GResImage imageval; } orig;
133 int cid;
134 int found;
135 };
136
137 #define RESED_EMPTY { NULL, NULL, 0, NULL, NULL, NULL, { 0 }, 0, 0 }
138
139 typedef struct gresinfo {
140 struct gresinfo *next;
141 struct gresinfo *inherits_from;
142 struct gresinfo *seealso1, *seealso2;
143 GBox *boxdata;
144 GResFont *font;
145 GGadgetCreateData *examples;
146 struct resed *extras;
147 char *name;
148 char *initialcomment;
149 char *resname;
150 char *progname;
151 uint8_t is_button; /* Activate default button border flag */
152 uint8_t is_initialized;
153 uint32_t override_mask;
154 GBox overrides;
155 GBox orig_state;
156 void (*refresh)(void); /* Called when user OKs the resource editor dlg */
157 int (*initialize)(struct gresinfo *);
158 void *reserved_for_future_use2;
159 } GResInfo;
160
161 extern char *GResourceProgramName;
162
163 int ResStrToFontRequest(const char *resname, FontRequest *rq);
164
165 void GResourceSetProg(const char *prog);
166 void GResourceAddResourceFile(const char *filename,const char *prog,int warn);
167 void GResourceAddResourceString(const char *string,const char *prog);
168
169 #endif /* FONTFORGE_GRESOURCE_H */