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

FXPopup.h
Go to the documentation of this file.
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,2006 by Jeroen van der Zijp. All Rights Reserved. *
7 *********************************************************************************
8 * This library is free software; you can redistribute it and/or *
9 * modify it under the terms of the GNU Lesser General Public *
10 * License as published by the Free Software Foundation; either *
11 * version 2.1 of the License, or (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 GNU *
16 * Lesser General Public License for more details. *
17 * *
18 * You should have received a copy of the GNU Lesser General Public *
19 * License along with this library; if not, write to the Free Software *
20 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. *
21 *********************************************************************************
22 * $Id: FXPopup.h,v 1.35 2006/01/22 17:58:07 fox Exp $ *
23 ********************************************************************************/
24 #ifndef FXPOPUP_H
25 #define FXPOPUP_H
26 
27 #ifndef FXSHELL_H
28 #include "FXShell.h"
29 #endif
30 
31 namespace FX {
32 
33 
34 /// Popup internal orientation
35 enum {
36  POPUP_VERTICAL = 0, /// Vertical orientation
37  POPUP_HORIZONTAL = 0x00020000, /// Horizontal orientation
38  POPUP_SHRINKWRAP = 0x00040000 /// Shrinkwrap to content
39  };
40 
41 
42 
43 /// Popup window
44 class FXAPI FXPopup : public FXShell {
46 private:
47  FXPopup *prevActive; // Popup below this one in stack
48  FXPopup *nextActive; // Popup above this one in stack
49 protected:
50  FXWindow *grabowner; // Window which will get grabbed when outside
51  FXColor baseColor;
52  FXColor hiliteColor;
53  FXColor shadowColor;
54  FXColor borderColor;
55  FXint border;
56 protected:
57  FXPopup();
58  virtual bool doesOverrideRedirect() const;
59  void drawBorderRectangle(FXDCWindow& dc,FXint x,FXint y,FXint w,FXint h);
60  void drawRaisedRectangle(FXDCWindow& dc,FXint x,FXint y,FXint w,FXint h);
61  void drawSunkenRectangle(FXDCWindow& dc,FXint x,FXint y,FXint w,FXint h);
62  void drawRidgeRectangle(FXDCWindow& dc,FXint x,FXint y,FXint w,FXint h);
63  void drawGrooveRectangle(FXDCWindow& dc,FXint x,FXint y,FXint w,FXint h);
64  void drawDoubleRaisedRectangle(FXDCWindow& dc,FXint x,FXint y,FXint w,FXint h);
65  void drawDoubleSunkenRectangle(FXDCWindow& dc,FXint x,FXint y,FXint w,FXint h);
66  void drawFrame(FXDCWindow& dc,FXint x,FXint y,FXint w,FXint h);
67 private:
68  FXPopup(const FXPopup&);
69  FXPopup &operator=(const FXPopup&);
70 #ifdef WIN32
71  virtual const char* GetClass() const;
72 #endif
73 public:
74  long onPaint(FXObject*,FXSelector,void*);
75  long onFocusUp(FXObject*,FXSelector,void*);
76  long onFocusDown(FXObject*,FXSelector,void*);
77  long onFocusLeft(FXObject*,FXSelector,void*);
78  long onFocusRight(FXObject*,FXSelector,void*);
79  long onFocusNext(FXObject*,FXSelector,void*);
80  long onFocusPrev(FXObject*,FXSelector,void*);
81  long onEnter(FXObject*,FXSelector,void*);
82  long onLeave(FXObject*,FXSelector,void*);
83  long onMotion(FXObject*,FXSelector,void*);
84  long onMap(FXObject*,FXSelector,void*);
85  long onButtonPress(FXObject*,FXSelector,void*);
86  long onButtonRelease(FXObject*,FXSelector,void*);
87  long onUngrabbed(FXObject*,FXSelector,void*);
88  long onCmdUnpost(FXObject*,FXSelector,void*);
89  long onKeyPress(FXObject*,FXSelector,void*);
90  long onKeyRelease(FXObject*,FXSelector,void*);
91  long onCmdChoice(FXObject*,FXSelector,void*);
92 public:
93  enum {
94  ID_CHOICE=FXShell::ID_LAST,
95  ID_LAST=ID_CHOICE+1000
96  };
97 public:
98 
99  /// Construct popup pane
101 
102  /// Return the default width of this window
103  virtual FXint getDefaultWidth();
104 
105  /// Return the default height of this window
106  virtual FXint getDefaultHeight();
107 
108  /// Perform layout
109  virtual void layout();
110 
111  /// Return a pointer to the prior active popup
112  FXPopup* getPrevActive() const { return prevActive; }
114  /// Return a pointer to the next active popup
115  FXPopup* getNextActive() const { return nextActive; }
116 
117  /// Move the focus to this window
118  virtual void setFocus();
120  /// Remove the focus from this window
121  virtual void killFocus();
122 
123  /// Show this window
124  virtual void show();
126  /// Hide this window
127  virtual void hide();
128 
129  /// Change frame style
130  void setFrameStyle(FXuint style);
132  /// Return frame style
133  FXuint getFrameStyle() const;
134 
135  /// Return border width
136  FXint getBorderWidth() const { return border; }
138  /// Change highlight color
139  void setHiliteColor(FXColor clr);
140 
141  /// Return highlight color
142  FXColor getHiliteColor() const { return hiliteColor; }
143 
144  /// Change shadow color
145  void setShadowColor(FXColor clr);
146 
147  /// Return shadow color
148  FXColor getShadowColor() const { return shadowColor; }
149 
150  /// Change border color
151  void setBorderColor(FXColor clr);
152 
153  /// Return border color
154  FXColor getBorderColor() const { return borderColor; }
155 
156  /// Change base color
157  void setBaseColor(FXColor clr);
158 
159  /// Return base color
160  FXColor getBaseColor() const { return baseColor; }
161 
162  /// Popup the menu and grab to the given owner
163  virtual void popup(FXWindow* grabto,FXint x,FXint y,FXint w=0,FXint h=0);
164 
165  /// Pop down the menu
166  virtual void popdown();
167 
168  /// Return current grab owner
169  FXWindow* getGrabOwner() const;
170 
171 // /// Popup the menu and grab to the given owner
172 // virtual FXint popup(FXint x,FXint y,FXint w=0,FXint h=0);
173 //
174 // /// Pop down the menu
175 // virtual void popdown(FXint value);
176 
177  /// Return popup orientation
178  FXuint getOrientation() const;
179 
180  /// Change popup orientation
181  void setOrientation(FXuint orient);
182 
183  /// Return shrinkwrap mode
184  FXbool getShrinkWrap() const;
185 
186  /// Change shrinkwrap mode
187  void setShrinkWrap(FXbool sw);
188 
189  virtual bool doesSaveUnder() const;
190 
191  /// Destructor
192  virtual ~FXPopup();
193  };
194 
195 }
196 
197 #endif
Vertical orientation.
Definition: FXPopup.h:39
Base class for all windows.
Definition: FXWindow.h:115
Shrinkwrap to content.
Definition: FXPopup.h:41
Definition: FXWindow.h:241
unsigned int FXuint
Definition: fxdefs.h:396
Popup window.
Definition: FXPopup.h:52
FXuint FXSelector
Association key.
Definition: FXObject.h:53
#define FXAPI
Definition: fxdefs.h:122
FXuchar FXbool
Definition: fxdefs.h:393
Horizontal orientation.
Definition: FXPopup.h:40
FXuint FXColor
Definition: fxdefs.h:454
Definition: FX4Splitter.h:31
int FXint
Definition: fxdefs.h:397
The Shell widget is used as the base class for top level windows, i.e.
Definition: FXShell.h:38
Raised border.
Definition: FXWindow.h:77
Object is the base class for all objects in FOX; in order to receive messages from the user interface...
Definition: FXObject.h:166
Window Device Context.
Definition: FXDCWindow.h:52
Thick border.
Definition: FXWindow.h:78
#define FXDECLARE(classname)
Macro to set up class declaration.
Definition: FXObject.h:92

Copyright © 1997-2005 Jeroen van der Zijp