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

/home/jeroen/FOX/fox/fox-1.7.33/include/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,2012 by Jeroen van der Zijp.   All Rights Reserved.        *
00007 *********************************************************************************
00008 * This library is free software; you can redistribute it and/or modify          *
00009 * it under the terms of the GNU Lesser General Public License as published by   *
00010 * the Free Software Foundation; either version 3 of the License, or             *
00011 * (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                 *
00016 * GNU Lesser General Public License for more details.                           *
00017 *                                                                               *
00018 * You should have received a copy of the GNU Lesser General Public License      *
00019 * along with this program.  If not, see <http://www.gnu.org/licenses/>          *
00020 ********************************************************************************/
00021 #ifndef FXPOPUP_H
00022 #define FXPOPUP_H
00023 
00024 #ifndef FXSHELL_H
00025 #include "FXShell.h"
00026 #endif
00027 
00028 namespace FX {
00029 
00030 
00032 enum {
00033   POPUP_VERTICAL   = 0,               
00034   POPUP_HORIZONTAL = 0x00020000,      
00035   POPUP_SHRINKWRAP = 0x00040000       
00036   };
00037 
00038 
00039 
00052 class FXAPI FXPopup : public FXShell {
00053   FXDECLARE(FXPopup)
00054 private:
00055   FXPopup  *prevActive;         // Popup below this one in stack
00056   FXPopup  *nextActive;         // Popup above this one in stack
00057 protected:
00058   FXWindow *grabowner;          // Window which will get grabbed when outside
00059   FXColor   baseColor;
00060   FXColor   hiliteColor;
00061   FXColor   shadowColor;
00062   FXColor   borderColor;
00063   FXint     border;
00064 protected:
00065   FXPopup();
00066   virtual FXbool doesOverrideRedirect() const;
00067   void drawBorderRectangle(FXDCWindow& dc,FXint x,FXint y,FXint w,FXint h);
00068   void drawRaisedRectangle(FXDCWindow& dc,FXint x,FXint y,FXint w,FXint h);
00069   void drawSunkenRectangle(FXDCWindow& dc,FXint x,FXint y,FXint w,FXint h);
00070   void drawRidgeRectangle(FXDCWindow& dc,FXint x,FXint y,FXint w,FXint h);
00071   void drawGrooveRectangle(FXDCWindow& dc,FXint x,FXint y,FXint w,FXint h);
00072   void drawDoubleRaisedRectangle(FXDCWindow& dc,FXint x,FXint y,FXint w,FXint h);
00073   void drawDoubleSunkenRectangle(FXDCWindow& dc,FXint x,FXint y,FXint w,FXint h);
00074   void drawFrame(FXDCWindow& dc,FXint x,FXint y,FXint w,FXint h);
00075 private:
00076   FXPopup(const FXPopup&);
00077   FXPopup &operator=(const FXPopup&);
00078 #ifdef WIN32
00079   virtual const void* GetClass() const;
00080 #endif
00081 public:
00082   long onPaint(FXObject*,FXSelector,void*);
00083   long onFocusUp(FXObject*,FXSelector,void*);
00084   long onFocusDown(FXObject*,FXSelector,void*);
00085   long onFocusLeft(FXObject*,FXSelector,void*);
00086   long onFocusRight(FXObject*,FXSelector,void*);
00087   long onFocusNext(FXObject*,FXSelector,void*);
00088   long onFocusPrev(FXObject*,FXSelector,void*);
00089   long onEnter(FXObject*,FXSelector,void*);
00090   long onLeave(FXObject*,FXSelector,void*);
00091   long onMotion(FXObject*,FXSelector,void*);
00092   long onMap(FXObject*,FXSelector,void*);
00093   long onLayout(FXObject*,FXSelector,void*);
00094   long onButtonPress(FXObject*,FXSelector,void*);
00095   long onButtonRelease(FXObject*,FXSelector,void*);
00096   long onUngrabbed(FXObject*,FXSelector,void*);
00097   long onCmdUnpost(FXObject*,FXSelector,void*);
00098   long onKeyPress(FXObject*,FXSelector,void*);
00099   long onKeyRelease(FXObject*,FXSelector,void*);
00100   long onCmdChoice(FXObject*,FXSelector,void*);
00101 public:
00102   enum {
00103     ID_CHOICE=FXShell::ID_LAST,
00104     ID_LAST=ID_CHOICE+1000
00105     };
00106 public:
00107 
00109   FXPopup(FXWindow* owner,FXuint opts=POPUP_VERTICAL|FRAME_RAISED|FRAME_THICK,FXint x=0,FXint y=0,FXint w=0,FXint h=0);
00110 
00112   virtual FXint getDefaultWidth();
00113 
00115   virtual FXint getDefaultHeight();
00116 
00118   virtual void layout();
00119 
00121   FXPopup* getPrevActive() const { return prevActive; }
00122 
00124   FXPopup* getNextActive() const { return nextActive; }
00125 
00127   virtual void setFocus();
00128 
00130   virtual void killFocus();
00131 
00133   virtual void show();
00134 
00136   virtual void hide();
00137 
00139   void setFrameStyle(FXuint style);
00140 
00142   FXuint getFrameStyle() const;
00143 
00145   FXint getBorderWidth() const { return border; }
00146 
00148   void setHiliteColor(FXColor clr);
00149 
00151   FXColor getHiliteColor() const { return hiliteColor; }
00152 
00154   void setShadowColor(FXColor clr);
00155 
00157   FXColor getShadowColor() const { return shadowColor; }
00158 
00160   void setBorderColor(FXColor clr);
00161 
00163   FXColor getBorderColor() const { return borderColor; }
00164 
00166   void setBaseColor(FXColor clr);
00167 
00169   FXColor getBaseColor() const { return baseColor; }
00170 
00172   virtual void popup(FXWindow* grabto,FXint x,FXint y,FXint w=0,FXint h=0);
00173 
00175   virtual void popdown();
00176 
00178   FXWindow* getGrabOwner() const;
00179 
00180 //   /// Popup the menu and grab to the given owner
00181 //   virtual FXint popup(FXint x,FXint y,FXint w=0,FXint h=0);
00182 //
00183 //   /// Pop down the menu
00184 //   virtual void popdown(FXint value);
00185 
00187   void setOrientation(FXuint orient);
00188 
00190   FXuint getOrientation() const;
00191 
00193   void setShrinkWrap(FXbool flag);
00194 
00196   FXbool getShrinkWrap() const;
00197 
00199   virtual FXbool doesSaveUnder() const;
00200 
00202   virtual ~FXPopup();
00203   };
00204 
00205 }
00206 
00207 #endif

Copyright © 1997-2011 Jeroen van der Zijp