Newer
Older
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
/********************************************************************************
* *
* P o p u p W i n d o w W i d g e t *
* *
*********************************************************************************
* Copyright (C) 1998,2006 by Jeroen van der Zijp. All Rights Reserved. *
*********************************************************************************
* This library is free software; you can redistribute it and/or *
* modify it under the terms of the GNU Lesser General Public *
* License as published by the Free Software Foundation; either *
* version 2.1 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 *
* Lesser General Public License for more details. *
* *
* You should have received a copy of the GNU Lesser General Public *
* License along with this library; if not, write to the Free Software *
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. *
*********************************************************************************
* $Id: FXPopup.h 2344 2006-02-12 21:19:36Z lyle $ *
********************************************************************************/
#ifndef FXPOPUP_H
#define FXPOPUP_H
#ifndef FXSHELL_H
#include "FXShell.h"
#endif
namespace FX {
/// Popup internal orientation
enum {
POPUP_VERTICAL = 0, /// Vertical orientation
POPUP_HORIZONTAL = 0x00020000, /// Horizontal orientation
POPUP_SHRINKWRAP = 0x00040000 /// Shrinkwrap to content
};
/// Popup window
class FXAPI FXPopup : public FXShell {
FXDECLARE(FXPopup)
private:
FXPopup *prevActive; // Popup below this one in stack
FXPopup *nextActive; // Popup above this one in stack
protected:
FXWindow *grabowner; // Window which will get grabbed when outside
FXColor baseColor;
FXColor hiliteColor;
FXColor shadowColor;
FXColor borderColor;
FXint border;
protected:
FXPopup();
virtual bool doesOverrideRedirect() const;
void drawBorderRectangle(FXDCWindow& dc,FXint x,FXint y,FXint w,FXint h);
void drawRaisedRectangle(FXDCWindow& dc,FXint x,FXint y,FXint w,FXint h);
void drawSunkenRectangle(FXDCWindow& dc,FXint x,FXint y,FXint w,FXint h);
void drawRidgeRectangle(FXDCWindow& dc,FXint x,FXint y,FXint w,FXint h);
void drawGrooveRectangle(FXDCWindow& dc,FXint x,FXint y,FXint w,FXint h);
void drawDoubleRaisedRectangle(FXDCWindow& dc,FXint x,FXint y,FXint w,FXint h);
void drawDoubleSunkenRectangle(FXDCWindow& dc,FXint x,FXint y,FXint w,FXint h);
void drawFrame(FXDCWindow& dc,FXint x,FXint y,FXint w,FXint h);
private:
FXPopup(const FXPopup&);
FXPopup &operator=(const FXPopup&);
#ifdef WIN32
virtual const char* GetClass() const;
#endif
public:
long onPaint(FXObject*,FXSelector,void*);
long onFocusUp(FXObject*,FXSelector,void*);
long onFocusDown(FXObject*,FXSelector,void*);
long onFocusLeft(FXObject*,FXSelector,void*);
long onFocusRight(FXObject*,FXSelector,void*);
long onFocusNext(FXObject*,FXSelector,void*);
long onFocusPrev(FXObject*,FXSelector,void*);
long onEnter(FXObject*,FXSelector,void*);
long onLeave(FXObject*,FXSelector,void*);
long onMotion(FXObject*,FXSelector,void*);
long onMap(FXObject*,FXSelector,void*);
long onButtonPress(FXObject*,FXSelector,void*);
long onButtonRelease(FXObject*,FXSelector,void*);
long onUngrabbed(FXObject*,FXSelector,void*);
long onCmdUnpost(FXObject*,FXSelector,void*);
long onKeyPress(FXObject*,FXSelector,void*);
long onKeyRelease(FXObject*,FXSelector,void*);
long onCmdChoice(FXObject*,FXSelector,void*);
public:
enum {
ID_CHOICE=FXShell::ID_LAST,
ID_LAST=ID_CHOICE+1000
};
public:
/// Construct popup pane
FXPopup(FXWindow* owner,FXuint opts=POPUP_VERTICAL|FRAME_RAISED|FRAME_THICK,FXint x=0,FXint y=0,FXint w=0,FXint h=0);
/// Return the default width of this window
virtual FXint getDefaultWidth();
/// Return the default height of this window
virtual FXint getDefaultHeight();
/// Perform layout
virtual void layout();
/// Return a pointer to the prior active popup
FXPopup* getPrevActive() const { return prevActive; }
/// Return a pointer to the next active popup
FXPopup* getNextActive() const { return nextActive; }
/// Move the focus to this window
virtual void setFocus();
/// Remove the focus from this window
virtual void killFocus();
/// Show this window
virtual void show();
/// Hide this window
virtual void hide();
/// Change frame style
void setFrameStyle(FXuint style);
/// Return frame style
FXuint getFrameStyle() const;
/// Return border width
FXint getBorderWidth() const { return border; }
/// Change highlight color
void setHiliteColor(FXColor clr);
/// Return highlight color
FXColor getHiliteColor() const { return hiliteColor; }
/// Change shadow color
void setShadowColor(FXColor clr);
/// Return shadow color
FXColor getShadowColor() const { return shadowColor; }
/// Change border color
void setBorderColor(FXColor clr);
/// Return border color
FXColor getBorderColor() const { return borderColor; }
/// Change base color
void setBaseColor(FXColor clr);
/// Return base color
FXColor getBaseColor() const { return baseColor; }
/// Popup the menu and grab to the given owner
virtual void popup(FXWindow* grabto,FXint x,FXint y,FXint w=0,FXint h=0);
/// Pop down the menu
virtual void popdown();
/// Return current grab owner
FXWindow* getGrabOwner() const;
// /// Popup the menu and grab to the given owner
// virtual FXint popup(FXint x,FXint y,FXint w=0,FXint h=0);
//
// /// Pop down the menu
// virtual void popdown(FXint value);
/// Return popup orientation
FXuint getOrientation() const;
/// Change popup orientation
void setOrientation(FXuint orient);
/// Return shrinkwrap mode
FXbool getShrinkWrap() const;
/// Change shrinkwrap mode
void setShrinkWrap(FXbool sw);
virtual bool doesSaveUnder() const;
/// Destructor
virtual ~FXPopup();
};
}
#endif