![]() |
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.26 2002/01/18 22:42:54 jeroen Exp $ * 00023 ********************************************************************************/ 00024 #ifndef FXPOPUP_H 00025 #define FXPOPUP_H 00026 00027 #ifndef FXSHELL_H 00028 #include "FXShell.h" 00029 #endif 00030 00031 00032 00033 /// Popup internal orientation 00034 enum { 00035 POPUP_VERTICAL = 0, /// Vertical orientation 00036 POPUP_HORIZONTAL = 0x00020000, /// Horizontal orientation 00037 POPUP_SHRINKWRAP = 0x00040000 /// Shrinkwrap to content 00038 }; 00039 00040 00041 00042 /// Popup window 00043 class FXAPI FXPopup : public FXShell { 00044 FXDECLARE(FXPopup) 00045 protected: 00046 FXWindow *grabowner; // Window which will get grabbed when outside 00047 FXColor baseColor; 00048 FXColor hiliteColor; 00049 FXColor shadowColor; 00050 FXColor borderColor; 00051 FXint border; 00052 protected: 00053 FXPopup(){} 00054 virtual void layout(); 00055 virtual FXbool doesOverrideRedirect() const; 00056 void drawBorderRectangle(FXDCWindow& dc,FXint x,FXint y,FXint w,FXint h); 00057 void drawRaisedRectangle(FXDCWindow& dc,FXint x,FXint y,FXint w,FXint h); 00058 void drawSunkenRectangle(FXDCWindow& dc,FXint x,FXint y,FXint w,FXint h); 00059 void drawRidgeRectangle(FXDCWindow& dc,FXint x,FXint y,FXint w,FXint h); 00060 void drawGrooveRectangle(FXDCWindow& dc,FXint x,FXint y,FXint w,FXint h); 00061 void drawDoubleRaisedRectangle(FXDCWindow& dc,FXint x,FXint y,FXint w,FXint h); 00062 void drawDoubleSunkenRectangle(FXDCWindow& dc,FXint x,FXint y,FXint w,FXint h); 00063 void drawFrame(FXDCWindow& dc,FXint x,FXint y,FXint w,FXint h); 00064 private: 00065 FXPopup(const FXPopup&); 00066 FXPopup &operator=(const FXPopup&); 00067 #ifdef WIN32 00068 virtual const char* GetClass() const; 00069 #endif 00070 public: 00071 long onPaint(FXObject*,FXSelector,void*); 00072 long onFocusUp(FXObject*,FXSelector,void*); 00073 long onFocusDown(FXObject*,FXSelector,void*); 00074 long onFocusLeft(FXObject*,FXSelector,void*); 00075 long onFocusRight(FXObject*,FXSelector,void*); 00076 long onFocusNext(FXObject*,FXSelector,void*); 00077 long onFocusPrev(FXObject*,FXSelector,void*); 00078 long onEnter(FXObject*,FXSelector,void*); 00079 long onLeave(FXObject*,FXSelector,void*); 00080 long onMotion(FXObject*,FXSelector,void*); 00081 long onMap(FXObject*,FXSelector,void*); 00082 long onButtonPress(FXObject*,FXSelector,void*); 00083 long onButtonRelease(FXObject*,FXSelector,void*); 00084 long onUngrabbed(FXObject*,FXSelector,void*); 00085 long onCmdUnpost(FXObject*,FXSelector,void*); 00086 long onKeyPress(FXObject*,FXSelector,void*); 00087 long onKeyRelease(FXObject*,FXSelector,void*); 00088 long onCmdChoice(FXObject*,FXSelector,void*); 00089 public: 00090 enum { 00091 ID_CHOICE=FXShell::ID_LAST, 00092 ID_LAST=ID_CHOICE+1000 00093 }; 00094 public: 00095 00096 /// Construct popup pane 00097 FXPopup(FXWindow* owner,FXuint opts=POPUP_VERTICAL|FRAME_RAISED|FRAME_THICK,FXint x=0,FXint y=0,FXint w=0,FXint h=0); 00098 00099 /// Return the default width of this window 00100 virtual FXint getDefaultWidth(); 00101 00102 /// Return the default height of this window 00103 virtual FXint getDefaultHeight(); 00104 00105 /// Move the focus to this window 00106 virtual void setFocus(); 00107 00108 /// Remove the focus from this window 00109 virtual void killFocus(); 00110 00111 /// Change frame style 00112 void setFrameStyle(FXuint style); 00113 00114 /// Return frame style 00115 FXuint getFrameStyle() const; 00116 00117 /// Return border width 00118 FXint getBorderWidth() const { return border; } 00119 00120 /// Change highlight color 00121 void setHiliteColor(FXColor clr); 00122 00123 /// Return highlight color 00124 FXColor getHiliteColor() const { return hiliteColor; } 00125 00126 /// Change shadow color 00127 void setShadowColor(FXColor clr); 00128 00129 /// Return shadow color 00130 FXColor getShadowColor() const { return shadowColor; } 00131 00132 /// Change border color 00133 void setBorderColor(FXColor clr); 00134 00135 /// Return border color 00136 FXColor getBorderColor() const { return borderColor; } 00137 00138 /// Change base color 00139 void setBaseColor(FXColor clr); 00140 00141 /// Return base color 00142 FXColor getBaseColor() const { return baseColor; } 00143 00144 /// Popup the menu and grab to the given owner 00145 virtual void popup(FXWindow* grabto,FXint x,FXint y,FXint w=0,FXint h=0); 00146 00147 /// Pop down the menu 00148 virtual void popdown(); 00149 00150 /// Return current grab owner 00151 FXWindow* getGrabOwner() const; 00152 00153 // /// Popup the menu and grab to the given owner 00154 // virtual FXint popup(FXint x,FXint y,FXint w=0,FXint h=0); 00155 // 00156 // /// Pop down the menu 00157 // virtual void popdown(FXint value); 00158 00159 /// Return popup orientation 00160 FXuint getOrientation() const; 00161 00162 /// Change popup orientation 00163 void setOrientation(FXuint orient); 00164 00165 /// Return shrinkwrap mode 00166 FXbool getShrinkWrap() const; 00167 00168 /// Change shrinkwrap mode 00169 void setShrinkWrap(FXbool sw); 00170 00171 virtual FXbool doesSaveUnder() const; 00172 00173 /// Destructor 00174 virtual ~FXPopup(); 00175 }; 00176 00177 00178 #endif