Debian Codegraph @

inc/gwidget.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_GWIDGET_H
29 #define FONTFORGE_GWIDGET_H
30
31 #include "gdraw.h"
32 #include "ggadget.h"
33 #include "gprogress.h"
34
35 #include <stdarg.h>
36
37 struct ggadget;
38 struct ggadgetcreatedata;
39 struct gtimer;
40
41 typedef GWindow GWidget;
42
43 typedef struct gwidgetcreatedata {
44 GRect r;
45 struct ggadgetcreatedata *gcd;
46 struct gwidgetcreatedata *wcd;
47 unichar_t *title;
48 unsigned int trap_input: 1;
49 unsigned int tab_navigation: 1;
50 unsigned int arrow_navigation: 1;
51 unsigned int do_default: 1;
52 unsigned int do_cancel: 1;
53 Color fore, back;
54 void (*e_h)(GWindow, GEvent *); /* User's event function for window, our eh will call it */
55 } GWidgetData;
56
57 typedef struct gwidgetcreatordata {
58 GWidget *(*creator)(GWidget *parent, GWidgetData *, void *data);
59 GWidgetData wd;
60 void *data;
61 } GWidgetCreateData;
62
63 extern GWindow GWidgetCreateTopWindow(GDisplay *gdisp, GRect *pos, int (*eh)(GWindow,GEvent *), void *user_data, GWindowAttrs *wattrs);
64 extern GWindow GWidgetCreateSubWindow(GWindow w, GRect *pos, int (*eh)(GWindow,GEvent *), void *user_data, GWindowAttrs *wattrs);
65
66 GWindow GWindowGetCurrentFocusTopWindow(void);
67 GWindow GWidgetGetCurrentFocusWindow(void);
68 GWindow GWidgetGetPreviousFocusTopWindow(void);
69 struct ggadget *GWindowGetCurrentFocusGadget(void);
70 struct ggadget *GWindowGetFocusGadgetOfWindow(GWindow gw);
71 void GWindowClearFocusGadgetOfWindow(GWindow gw);
72 void GWidgetIndicateFocusGadget(struct ggadget *g);
73 void GWidgetNextFocus(GWindow);
74 void GWidgetPrevFocus(GWindow);
75
76 struct ggadget *GWidgetGetControl(GWindow gw, int cid);
77 struct ggadget *_GWidgetGetGadgets(GWindow gw);
78 GWindow GWidgetGetParent(GWindow gw);
79 GWindow GWidgetGetTopWidget(GWindow gw);
80 extern GDrawEH GWidgetGetEH(GWindow w);
81 extern void GWidgetSetEH(GWindow w,GDrawEH e_h);
82 extern void GWidgetFlowGadgets(GWindow gw);
83 extern void GWidgetToDesiredSize(GWindow gw);
84
85 /* Built in dialogs */
86 char *GWidgetOpenFile8(const char *title, const char *defaultfile,
87 const char *initial_filter, char **mimetypes,GFileChooserFilterType filter);
88 char *GWidgetOpenFileWPath8(const char *title, const char *defaultfile,
89 const char *initial_filter, char **mimetypes,GFileChooserFilterType filter, const char* const* path);
90 char *GWidgetSaveAsFileWithGadget8(const char *title, const char *defaultfile,
91 const char *initial_filter, char **mimetypes,
92 GFileChooserFilterType filter,
93 GFileChooserInputFilenameFuncType filenamefunc,
94 GGadgetCreateData *optional_gcd);
95 char *GWidgetSaveAsFile8(const char *title, const char *defaultfile,
96 const char *initial_filter, char **mimetypes,GFileChooserFilterType filter );
97 int GWidgetAsk8(const char *title, const char **answers,
98 int def, int cancel,const char *question,...);
99 int GWidgetAskCentered8(const char *title,
100 const char ** answers, int def, int cancel,const char *question,...);
101 char *GWidgetAskString8(const char *title,
102 const char *def,const char *question,...);
103 char *GWidgetAskPassword8(const char *title,
104 const char *def,const char *question,...);
105 void GWidgetPostNotice8(const char *title,const char *statement,...);
106 void _GWidgetPostNotice8(const char *title,const char *statement,va_list ap,int timeout);
107 void GWidgetPostNoticeTimeout8(int timeout, const char *title,const char *statement,...);
108 int GWidgetPostNoticeActive8(const char *title);
109 void GWidgetError8(const char *title,const char *statement,...);
110
111 int GWidgetChoices8(const char *title, const char **choices,int cnt, int def,
112 const char *question,...);
113 int GWidgetChoicesB8(char *title, const char **choices, int cnt, int def,
114 char *buts[2], const char *question,...);
115 int GWidgetChoicesBM8(const char *title, const char **choices, char *sel,
116 int cnt, char *buts[2], const char *question,...);
117
118 extern struct hslrgb GWidgetColor(const char *title,struct hslrgb *defcol,struct hslrgb *fontcols);
119 extern struct hslrgba GWidgetColorA(const char *title,struct hslrgba *defcol,struct hslrgba *fontcols);
120
121 #define gwwv_choose_multiple GWidgetChoicesBM8
122 #define gwwv_choose_with_buttons GWidgetChoicesB8
123 #define gwwv_choose GWidgetChoices8
124 #define gwwv_ask_string GWidgetAskString8
125 #define gwwv_ask_password GWidgetAskPassword8
126 #define gwwv_ask GWidgetAsk8
127 #define gwwv_ask_centered GWidgetAskCentered8
128 #define gwwv_post_error GWidgetError8
129 #define gwwv_post_notice GWidgetPostNotice8
130 #define gwwv_post_notice_timeout GWidgetPostNoticeTimeout8
131 #define gwwv_open_filename(tit,def,filter,filtfunc) GWidgetOpenFile8(tit,def,filter,NULL,filtfunc)
132 #define gwwv_open_filename_with_path(tit,def,filter,filtfunc,path) GWidgetOpenFileWPath8(tit,def,filter,NULL,filtfunc,path)
133 #define gwwv_save_filename(tit,def,filter) GWidgetSaveAsFile8(tit,def,filter,NULL,NULL)
134 #define gwwv_save_filename_with_gadget(tit,def,filter,gcd) GWidgetSaveAsFileWithGadget8(tit,def,filter,NULL,NULL,NULL,gcd)
135
136 extern GIC *GWidgetCreateInputContext(GWindow w,enum gic_style def_style);
137 extern GIC *GWidgetGetInputContext(GWindow w);
138
139
140 #endif /* FONTFORGE_GWIDGET_H */