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

FXPopup.h

00001 /******************************************************************************** 00002 * * 00003 * P o p u p W i n d o w W i d g e t * 00004 * * 00005 ********************************************************************************* 00006 * Copyright (C) 1998,2004 by Jeroen van der Zijp. All Rights Reserved. * 00007 ********************************************************************************* 00008 * This library is free software; you can redistribute it and/or * 00009 * modify it under the terms of the GNU Lesser General Public * 00010 * License as published by the Free Software Foundation; either * 00011 * version 2.1 of the License, or (at your option) any later version. * 00012 * * 00013 * This library is distributed in the hope that it will be useful, * 00014 * but WITHOUT ANY WARRANTY; without even the implied warranty of * 00015 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * 00016 * Lesser General Public License for more details. * 00017 * * 00018 * You should have received a copy of the GNU Lesser General Public * 00019 * License along with this library; if not, write to the Free Software * 00020 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. * 00021 ********************************************************************************* 00022 * $Id: FXPopup.h,v 1.32 2004/02/08 17:17:34 fox Exp $ * 00023 ********************************************************************************/ 00024 #ifndef FXPOPUP_H 00025 #define FXPOPUP_H 00026 00027 #ifndef FXSHELL_H 00028 #include "FXShell.h" 00029 #endif 00030 00031 namespace FX { 00032 00033 00034 /// Popup internal orientation 00035 enum { 00036 POPUP_VERTICAL = 0, /// Vertical orientation 00037 POPUP_HORIZONTAL = 0x00020000, /// Horizontal orientation 00038 POPUP_SHRINKWRAP = 0x00040000 /// Shrinkwrap to content 00039 }; 00040 00041 00042 00043 /// Popup window 00044 class FXAPI FXPopup : public FXShell { 00045 FXDECLARE(FXPopup) 00046 private: 00047 FXPopup *prevActive; // Popup below this one in stack 00048 FXPopup *nextActive; // Popup above this one in stack 00049 protected: 00050 FXWindow *grabowner; // Window which will get grabbed when outside 00051 FXColor baseColor; 00052 FXColor hiliteColor; 00053 FXColor shadowColor; 00054 FXColor borderColor; 00055 FXint border; 00056 protected: 00057 FXPopup(); 00058 virtual FXbool doesOverrideRedirect() const; 00059 void drawBorderRectangle(FXDCWindow& dc,FXint x,FXint y,FXint w,FXint h); 00060 void drawRaisedRectangle(FXDCWindow& dc,FXint x,FXint y,FXint w,FXint h); 00061 void drawSunkenRectangle(FXDCWindow& dc,FXint x,FXint y,FXint w,FXint h); 00062 void drawRidgeRectangle(FXDCWindow& dc,FXint x,FXint y,FXint w,FXint h); 00063 void drawGrooveRectangle(FXDCWindow& dc,FXint x,FXint y,FXint w,FXint h); 00064 void drawDoubleRaisedRectangle(FXDCWindow& dc,FXint x,FXint y,FXint w,FXint h); 00065 void drawDoubleSunkenRectangle(FXDCWindow& dc,FXint x,FXint y,FXint w,FXint h); 00066 void drawFrame(FXDCWindow& dc,FXint x,FXint y,FXint w,FXint h); 00067 private: 00068 FXPopup(const FXPopup&); 00069 FXPopup &operator=(const FXPopup&); 00070 #ifdef WIN32 00071 virtual const char* GetClass() const; 00072 #endif 00073 public: 00074 long onPaint(FXObject*,FXSelector,void*); 00075 long onFocusUp(FXObject*,FXSelector,void*); 00076 long onFocusDown(FXObject*,FXSelector,void*); 00077 long onFocusLeft(FXObject*,FXSelector,void*); 00078 long onFocusRight(FXObject*,FXSelector,void*); 00079 long onFocusNext(FXObject*,FXSelector,void*); 00080 long onFocusPrev(FXObject*,FXSelector,void*); 00081 long onEnter(FXObject*,FXSelector,void*); 00082 long onLeave(FXObject*,FXSelector,void*); 00083 long onMotion(FXObject*,FXSelector,void*); 00084 long onMap(FXObject*,FXSelector,void*); 00085 long onButtonPress(FXObject*,FXSelector,void*); 00086 long onButtonRelease(FXObject*,FXSelector,void*); 00087 long onUngrabbed(FXObject*,FXSelector,void*); 00088 long onCmdUnpost(FXObject*,FXSelector,void*); 00089 long onKeyPress(FXObject*,FXSelector,void*); 00090 long onKeyRelease(FXObject*,FXSelector,void*); 00091 long onCmdChoice(FXObject*,FXSelector,void*); 00092 public: 00093 enum { 00094 ID_CHOICE=FXShell::ID_LAST, 00095 ID_LAST=ID_CHOICE+1000 00096 }; 00097 public: 00098 00099 /// Construct popup pane 00100 FXPopup(FXWindow* owner,FXuint opts=POPUP_VERTICAL|FRAME_RAISED|FRAME_THICK,FXint x=0,FXint y=0,FXint w=0,FXint h=0); 00101 00102 /// Return the default width of this window 00103 virtual FXint getDefaultWidth(); 00104 00105 /// Return the default height of this window 00106 virtual FXint getDefaultHeight(); 00107 00108 /// Perform layout 00109 virtual void layout(); 00110 00111 /// Return a pointer to the prior active popup 00112 FXPopup* getPrevActive() const { return prevActive; } 00113 00114 /// Return a pointer to the next active popup 00115 FXPopup* getNextActive() const { return nextActive; } 00116 00117 /// Move the focus to this window 00118 virtual void setFocus(); 00119 00120 /// Remove the focus from this window 00121 virtual void killFocus(); 00122 00123 /// Show this window 00124 virtual void show(); 00125 00126 /// Hide this window 00127 virtual void hide(); 00128 00129 /// Change frame style 00130 void setFrameStyle(FXuint style); 00131 00132 /// Return frame style 00133 FXuint getFrameStyle() const; 00134 00135 /// Return border width 00136 FXint getBorderWidth() const { return border; } 00137 00138 /// Change highlight color 00139 void setHiliteColor(FXColor clr); 00140 00141 /// Return highlight color 00142 FXColor getHiliteColor() const { return hiliteColor; } 00143 00144 /// Change shadow color 00145 void setShadowColor(FXColor clr); 00146 00147 /// Return shadow color 00148 FXColor getShadowColor() const { return shadowColor; } 00149 00150 /// Change border color 00151 void setBorderColor(FXColor clr); 00152 00153 /// Return border color 00154 FXColor getBorderColor() const { return borderColor; } 00155 00156 /// Change base color 00157 void setBaseColor(FXColor clr); 00158 00159 /// Return base color 00160 FXColor getBaseColor() const { return baseColor; } 00161 00162 /// Popup the menu and grab to the given owner 00163 virtual void popup(FXWindow* grabto,FXint x,FXint y,FXint w=0,FXint h=0); 00164 00165 /// Pop down the menu 00166 virtual void popdown(); 00167 00168 /// Return current grab owner 00169 FXWindow* getGrabOwner() const; 00170 00171 // /// Popup the menu and grab to the given owner 00172 // virtual FXint popup(FXint x,FXint y,FXint w=0,FXint h=0); 00173 // 00174 // /// Pop down the menu 00175 // virtual void popdown(FXint value); 00176 00177 /// Return popup orientation 00178 FXuint getOrientation() const; 00179 00180 /// Change popup orientation 00181 void setOrientation(FXuint orient); 00182 00183 /// Return shrinkwrap mode 00184 FXbool getShrinkWrap() const; 00185 00186 /// Change shrinkwrap mode 00187 void setShrinkWrap(FXbool sw); 00188 00189 virtual FXbool doesSaveUnder() const; 00190 00191 /// Destructor 00192 virtual ~FXPopup(); 00193 }; 00194 00195 } 00196 00197 #endif

Copyright © 1997-2004 Jeroen van der Zijp