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_P_H
29 #define FONTFORGE_GWIDGET_P_H
30 
31 #include "gwidget.h"
32 
33 struct wfuncs {
34     int placeholder;
35 };
36 
37 /* this is the thing that hangs off of the GWindow that contains all the widget*/
38 /*  info */
39 typedef struct gwidgetdata {
40     struct wfuncs *funcs;
41     GWindow w;
42     struct gwidgetdata *next;			/* siblings */
43     int (*e_h)(GWindow, GEvent *);		/* User's event function for window, our eh will call it */
44     GIC *gic;
45     unsigned int has_focus: 1;
46     /*unsigned int visible: 1;*/		/* this is in the window structure */
47     unsigned int enabled: 1;
48     unsigned int iscontainer: 1;
49     unsigned int istoplevel: 1;
50     unsigned int contains_focus: 1;		/* only for top level widgets */
51     unsigned int ispalette: 1;			/* only for top level widgets */
52     unsigned int positioned_yet: 1;		/* only for top level palettes*/
53     unsigned int isdocked: 1;			/* only for top level palettes*/
54 } GWidgetD;
55 
56 typedef struct gwidgetcontainerdata /* : GWidgetD */{
57     struct wfuncs *funcs;
58     GWindow w;
59     struct gwidgetdata *next;			/* siblings */
60     int (*e_h)(GWindow, GEvent *);		/* User's event function for window, our eh will call it */
61     GIC *gic;
62     unsigned int has_focus: 1;
63     /*unsigned int visible: 1;*/		/* this is in the window structure */
64     unsigned int enabled: 1;
65     unsigned int iscontainer: 1;
66     unsigned int istoplevel: 1;
67     unsigned int contains_focus: 1;		/* only for top level widgets */
68     unsigned int ispalette: 1;			/* only for top level widgets */
69     unsigned int positioned_yet: 1;		/* only for top level palettes*/
70     unsigned int isdocked: 1;			/* only for top level palettes*/
71     unsigned int isnestedkey: 1;		/* is this a nested key event*/
72     unsigned int programmove: 10;
73     /* ******************* */
74     struct ggadget *gadgets;
75     struct gwidgetdata *widgets;		/* children */
76     /*struct ggadget *gdef, *gcancel;*/
77     struct ggadget *grabgadget;
78     struct ggadget *lastddgadget;
79     struct ggadget *lastwiggle;
80 } GContainerD;
81 
82 typedef struct gtopleveldata /* : GContainerD */{
83     struct wfuncs *funcs;
84     GWindow w;
85     struct gwidgetdata *next;			/* siblings */
86     int (*e_h)(GWindow, GEvent *);		/* User's event function for window, our eh will call it */
87     GIC *gic;
88     unsigned int has_focus: 1;
89     /*unsigned int visible: 1;*/		/* this is in the window structure */
90     unsigned int enabled: 1;
91     unsigned int iscontainer: 1;
92     unsigned int istoplevel: 1;
93     unsigned int contains_focus: 1;
94     unsigned int ispalette: 1;
95     unsigned int positioned_yet: 1;		/* only for top level palettes*/
96     unsigned int isdocked: 1;			/* only for top level palettes*/
97     unsigned int isnestedkey: 1;		/* is this a nested key event*/
98     unsigned int programmove: 10;
99     struct ggadget *gadgets;
100     struct gwidgetdata *widgets;		/* children */
101     struct ggadget *grabgadget;
102     struct ggadget *lastddgadget;
103     struct ggadget *lastwiggle;
104     /* ******************* */
105     struct ggadget *popupowner;			/* Our gadget which owns the */
106 		/*  current popup. It needs all events until popup vanishes */
107     struct ggadget *gdef, *gcancel, *gmenubar;
108     struct ggadget *gfocus;
109     int (*handle_key)(GWindow top, GWindow ew, GEvent *);	/* All key events are handled by top level window */
110     struct gtopleveldata *palettes, *nextp, *owner;
111     int16 owner_off_x, owner_off_y;		/* Offset of palette from owner*/
112 } GTopLevelD;
113 
114 GWidgetD *_GWidget_ChangeInternalFocus(GWidget gw,GWidgetD *to,struct ggadget *gto);
115 void _GWidget_RestorePixmap(GWindow gw, GWindow ours, GRect *rect);
116 GWindow _GWidget_GetPixmap(GWindow gw,GRect *rect);
117 
118 #endif /* FONTFORGE_GWIDGET_P_H */
119