![]() |
Main Page Class Hierarchy Alphabetical List Compound List File List Compound Members
![]() |
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,2002 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.30 2002/05/31 05:18:57 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 void layout(); 00059 virtual FXbool doesOverrideRedirect() const; 00060 void drawBorderRectangle(FXDCWindow& dc,FXint x,FXint y,FXint w,FXint h); 00061 void drawRaisedRectangle(FXDCWindow& dc,FXint x,FXint y,FXint w,FXint h); 00062 void drawSunkenRectangle(FXDCWindow& dc,FXint x,FXint y,FXint w,FXint h); 00063 void drawRidgeRectangle(FXDCWindow& dc,FXint x,FXint y,FXint w,FXint h); 00064 void drawGrooveRectangle(FXDCWindow& dc,FXint x,FXint y,FXint w,FXint h); 00065 void drawDoubleRaisedRectangle(FXDCWindow& dc,FXint x,FXint y,FXint w,FXint h); 00066 void drawDoubleSunkenRectangle(FXDCWindow& dc,FXint x,FXint y,FXint w,FXint h); 00067 void drawFrame(FXDCWindow& dc,FXint x,FXint y,FXint w,FXint h); 00068 private: 00069 FXPopup(const FXPopup&); 00070 FXPopup &operator=(const FXPopup&); 00071 #ifdef WIN32 00072 virtual const char* GetClass() const; 00073 #endif 00074 public: 00075 long onPaint(FXObject*,FXSelector,void*); 00076 long onFocusUp(FXObject*,FXSelector,void*); 00077 long onFocusDown(FXObject*,FXSelector,void*); 00078 long onFocusLeft(FXObject*,FXSelector,void*); 00079 long onFocusRight(FXObject*,FXSelector,void*); 00080 long onFocusNext(FXObject*,FXSelector,void*); 00081 long onFocusPrev(FXObject*,FXSelector,void*); 00082 long onEnter(FXObject*,FXSelector,void*); 00083 long onLeave(FXObject*,FXSelector,void*); 00084 long onMotion(FXObject*,FXSelector,void*); 00085 long onMap(FXObject*,FXSelector,void*); 00086 long onButtonPress(FXObject*,FXSelector,void*); 00087 long onButtonRelease(FXObject*,FXSelector,void*); 00088 long onUngrabbed(FXObject*,FXSelector,void*); 00089 long onCmdUnpost(FXObject*,FXSelector,void*); 00090 long onKeyPress(FXObject*,FXSelector,void*); 00091 long onKeyRelease(FXObject*,FXSelector,void*); 00092 long onCmdChoice(FXObject*,FXSelector,void*); 00093 public: 00094 enum { 00095 ID_CHOICE=FXShell::ID_LAST, 00096 ID_LAST=ID_CHOICE+1000 00097 }; 00098 public: 00099 00100 /// Construct popup pane 00101 FXPopup(FXWindow* owner,FXuint opts=POPUP_VERTICAL|FRAME_RAISED|FRAME_THICK,FXint x=0,FXint y=0,FXint w=0,FXint h=0); 00102 00103 /// Return the default width of this window 00104 virtual FXint getDefaultWidth(); 00105 00106 /// Return the default height of this window 00107 virtual FXint getDefaultHeight(); 00108 00109 /// Return a pointer to the prior active popup 00110 FXPopup* getPrevActive() const { return prevActive; } 00111 00112 /// Return a pointer to the next active popup 00113 FXPopup* getNextActive() const { return nextActive; } 00114 00115 /// Move the focus to this window 00116 virtual void setFocus(); 00117 00118 /// Remove the focus from this window 00119 virtual void killFocus(); 00120 00121 /// Show this window 00122 virtual void show(); 00123 00124 /// Hide this window 00125 virtual void hide(); 00126 00127 /// Change frame style 00128 void setFrameStyle(FXuint style); 00129 00130 /// Return frame style 00131 FXuint getFrameStyle() const; 00132 00133 /// Return border width 00134 FXint getBorderWidth() const { return border; } 00135 00136 /// Change highlight color 00137 void setHiliteColor(FXColor clr); 00138 00139 /// Return highlight color 00140 FXColor getHiliteColor() const { return hiliteColor; } 00141 00142 /// Change shadow color 00143 void setShadowColor(FXColor clr); 00144 00145 /// Return shadow color 00146 FXColor getShadowColor() const { return shadowColor; } 00147 00148 /// Change border color 00149 void setBorderColor(FXColor clr); 00150 00151 /// Return border color 00152 FXColor getBorderColor() const { return borderColor; } 00153 00154 /// Change base color 00155 void setBaseColor(FXColor clr); 00156 00157 /// Return base color 00158 FXColor getBaseColor() const { return baseColor; } 00159 00160 /// Popup the menu and grab to the given owner 00161 virtual void popup(FXWindow* grabto,FXint x,FXint y,FXint w=0,FXint h=0); 00162 00163 /// Pop down the menu 00164 virtual void popdown(); 00165 00166 /// Return current grab owner 00167 FXWindow* getGrabOwner() const; 00168 00169 // /// Popup the menu and grab to the given owner 00170 // virtual FXint popup(FXint x,FXint y,FXint w=0,FXint h=0); 00171 // 00172 // /// Pop down the menu 00173 // virtual void popdown(FXint value); 00174 00175 /// Return popup orientation 00176 FXuint getOrientation() const; 00177 00178 /// Change popup orientation 00179 void setOrientation(FXuint orient); 00180 00181 /// Return shrinkwrap mode 00182 FXbool getShrinkWrap() const; 00183 00184 /// Change shrinkwrap mode 00185 void setShrinkWrap(FXbool sw); 00186 00187 virtual FXbool doesSaveUnder() const; 00188 00189 /// Destructor 00190 virtual ~FXPopup(); 00191 }; 00192 00193 } 00194 00195 #endif