Main Page   Class Hierarchy   Alphabetical List   Compound List   File List   Compound Members

FXPopup.h
1 /********************************************************************************
2 * *
3 * P o p u p W i n d o w W i d g e t *
4 * *
5 *********************************************************************************
6 * Copyright (C) 1998,2022 by Jeroen van der Zijp. All Rights Reserved. *
7 *********************************************************************************
8 * This library is free software; you can redistribute it and/or modify *
9 * it under the terms of the GNU Lesser General Public License as published by *
10 * the Free Software Foundation; either version 3 of the License, or *
11 * (at your option) any later version. *
12 * *
13 * This library is distributed in the hope that it will be useful, *
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of *
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
16 * GNU Lesser General Public License for more details. *
17 * *
18 * You should have received a copy of the GNU Lesser General Public License *
19 * along with this program. If not, see <http://www.gnu.org/licenses/> *
20 ********************************************************************************/
21 #ifndef FXPOPUP_H
22 #define FXPOPUP_H
23 
24 #ifndef FXSHELL_H
25 #include "FXShell.h"
26 #endif
27 
28 namespace FX {
29 
30 
32 enum {
33  POPUP_VERTICAL = 0,
34  POPUP_HORIZONTAL = 0x00020000,
35  POPUP_SHRINKWRAP = 0x00040000
36  };
37 
38 
51 class FXAPI FXPopup : public FXShell {
52  FXDECLARE(FXPopup)
53 private:
54  FXPopup *prevActive; // Popup below this one in stack
55  FXPopup *nextActive; // Popup above this one in stack
56 protected:
57  FXWindow *grabowner; // Window which will get grabbed when outside
58  FXColor baseColor;
59  FXColor hiliteColor;
60  FXColor shadowColor;
61  FXColor borderColor;
62  FXint border;
63 protected:
64  FXPopup();
65  virtual FXbool doesOverrideRedirect() const;
66  void drawBorderRectangle(FXDCWindow& dc,FXint x,FXint y,FXint w,FXint h);
67  void drawRaisedRectangle(FXDCWindow& dc,FXint x,FXint y,FXint w,FXint h);
68  void drawSunkenRectangle(FXDCWindow& dc,FXint x,FXint y,FXint w,FXint h);
69  void drawRidgeRectangle(FXDCWindow& dc,FXint x,FXint y,FXint w,FXint h);
70  void drawGrooveRectangle(FXDCWindow& dc,FXint x,FXint y,FXint w,FXint h);
71  void drawDoubleRaisedRectangle(FXDCWindow& dc,FXint x,FXint y,FXint w,FXint h);
72  void drawDoubleSunkenRectangle(FXDCWindow& dc,FXint x,FXint y,FXint w,FXint h);
73  void drawFrame(FXDCWindow& dc,FXint x,FXint y,FXint w,FXint h);
74 private:
75  FXPopup(const FXPopup&);
76  FXPopup &operator=(const FXPopup&);
77 #ifdef WIN32
78  virtual const void* GetClass() const;
79 #endif
80 public:
81  long onPaint(FXObject*,FXSelector,void*);
82  long onFocusUp(FXObject*,FXSelector,void*);
83  long onFocusDown(FXObject*,FXSelector,void*);
84  long onFocusLeft(FXObject*,FXSelector,void*);
85  long onFocusRight(FXObject*,FXSelector,void*);
86  long onFocusNext(FXObject*,FXSelector,void*);
87  long onFocusPrev(FXObject*,FXSelector,void*);
88  long onEnter(FXObject*,FXSelector,void*);
89  long onLeave(FXObject*,FXSelector,void*);
90  long onMotion(FXObject*,FXSelector,void*);
91  long onMap(FXObject*,FXSelector,void*);
92  long onLayout(FXObject*,FXSelector,void*);
93  long onButtonPress(FXObject*,FXSelector,void*);
94  long onButtonRelease(FXObject*,FXSelector,void*);
95  long onUngrabbed(FXObject*,FXSelector,void*);
96  long onCmdUnpost(FXObject*,FXSelector,void*);
97  long onKeyPress(FXObject*,FXSelector,void*);
98  long onKeyRelease(FXObject*,FXSelector,void*);
99  long onCmdChoice(FXObject*,FXSelector,void*);
100 public:
101  enum {
102  ID_CHOICE=FXShell::ID_LAST,
103  ID_LAST=ID_CHOICE+1000
104  };
105 public:
106 
108  FXPopup(FXWindow* owner,FXuint opts=POPUP_VERTICAL|FRAME_RAISED|FRAME_THICK,FXint x=0,FXint y=0,FXint w=0,FXint h=0);
109 
111  virtual FXint getDefaultWidth();
112 
114  virtual FXint getDefaultHeight();
115 
117  virtual void layout();
118 
120  FXPopup* getPrevActive() const { return prevActive; }
121 
123  FXPopup* getNextActive() const { return nextActive; }
124 
126  virtual void setFocus();
127 
129  virtual void killFocus();
130 
132  virtual void show();
133 
135  virtual void hide();
136 
138  void setFrameStyle(FXuint style);
139 
141  FXuint getFrameStyle() const;
142 
144  FXint getBorderWidth() const { return border; }
145 
147  void setHiliteColor(FXColor clr);
148 
150  FXColor getHiliteColor() const { return hiliteColor; }
151 
153  void setShadowColor(FXColor clr);
154 
156  FXColor getShadowColor() const { return shadowColor; }
157 
159  void setBorderColor(FXColor clr);
160 
162  FXColor getBorderColor() const { return borderColor; }
163 
165  void setBaseColor(FXColor clr);
166 
168  FXColor getBaseColor() const { return baseColor; }
169 
171  virtual void popup(FXWindow* grabto,FXint x,FXint y,FXint w=0,FXint h=0);
172 
174  virtual void popdown();
175 
177  FXWindow* getGrabOwner();
178 
179 // /// Popup the menu and grab to the given owner
180 // virtual FXint popup(FXint x,FXint y,FXint w=0,FXint h=0);
181 //
182 // /// Pop down the menu
183 // virtual void popdown(FXint value);
184 
186  void setOrientation(FXuint orient);
187 
189  FXuint getOrientation() const;
190 
192  void setShrinkWrap(FXbool flag);
193 
195  FXbool getShrinkWrap() const;
196 
198  virtual FXbool doesSaveUnder() const;
199 
201  virtual ~FXPopup();
202  };
203 
204 }
205 
206 #endif
Window is the base class for all widgets in FOX.
Definition: FXWindow.h:130
Popup window is used as a container for transitional controls such as menu panes and other ephemeral ...
Definition: FXPopup.h:51
FXColor getHiliteColor() const
Return highlight color.
Definition: FXPopup.h:150
FXColor getBorderColor() const
Return border color.
Definition: FXPopup.h:162
FXColor getShadowColor() const
Return shadow color.
Definition: FXPopup.h:156
Definition: FX4Splitter.h:28
The Shell widget is used as the base class for top level windows, i.e.
Definition: FXShell.h:35
Object is the base class for all objects in FOX; in order to receive messages from the user interface...
Definition: FXObject.h:134
Window Device Context.
Definition: FXDCWindow.h:48
FXColor getBaseColor() const
Return base color.
Definition: FXPopup.h:168
FXint getBorderWidth() const
Return border width.
Definition: FXPopup.h:144
FXPopup * getNextActive() const
Return a pointer to the next active popup.
Definition: FXPopup.h:123
FXPopup * getPrevActive() const
Return a pointer to the prior active popup.
Definition: FXPopup.h:120

Copyright © 1997-2022 Jeroen van der Zijp