1 /******************************************************************************** 2 * * 3 * M e n u C a s c a d e W i d g e t * 4 * * 5 ********************************************************************************* 6 * Copyright (C) 1997,2005 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: FXMenuCascade.h,v 1.22 2005/01/16 16:06:06 fox Exp $ * 23 ********************************************************************************/ 24 #ifndef FXMENUCASCADE_H 25 #define FXMENUCASCADE_H 26 27 #ifndef FXMENUCAPTION_H 28 #include "FXMenuCaption.h" 29 #endif 30 31 namespace FX { 32 33 34 class FXPopup; 35 36 37 /** 38 * The cascade menu widget is used to bring up a sub menu from a 39 * pull down menu. 40 */ 41 class FXAPI FXMenuCascade : public FXMenuCaption { 42 FXDECLARE(FXMenuCascade) 43 protected: 44 FXPopup *pane; 45 protected: 46 FXMenuCascade(); 47 void drawTriangle(FXDCWindow& dc,FXint l,FXint t,FXint r,FXint b); 48 private: 49 FXMenuCascade(const FXMenuCascade&); 50 FXMenuCascade &operator=(const FXMenuCascade&); 51 public: 52 long onPaint(FXObject*,FXSelector,void*); 53 long onEnter(FXObject*,FXSelector,void*); 54 long onLeave(FXObject*,FXSelector,void*); 55 long onButtonPress(FXObject*,FXSelector,void*); 56 long onButtonRelease(FXObject*,FXSelector,void*); 57 long onKeyPress(FXObject*,FXSelector,void*); 58 long onKeyRelease(FXObject*,FXSelector,void*); 59 long onHotKeyPress(FXObject*,FXSelector,void*); 60 long onHotKeyRelease(FXObject*,FXSelector,void*); 61 long onCmdPost(FXObject*,FXSelector,void*); 62 long onCmdUnpost(FXObject*,FXSelector,void*); 63 public: 64 enum { 65 ID_MENUTIMER=FXMenuCaption::ID_LAST, 66 ID_LAST 67 }; 68 public: 69 70 /// Construct a menu cascade responsible for the given popup menu 71 FXMenuCascade(FXComposite* p,const FXString& text,FXIcon* ic=NULL,FXPopup* pup=NULL,FXuint opts=0); 72 73 /// Create server-side resources 74 virtual void create(); 75 76 /// Detach server-side resources 77 virtual void detach(); 78 79 /// Destroy server-side resources 80 virtual void destroy(); 81 82 /// Yes it can receive the focus 83 virtual FXbool canFocus() const; 84 85 /// Move the focus to this window 86 virtual void setFocus(); 87 88 /// Remove the focus from this window 89 virtual void killFocus(); 90 91 /// Set popup menu to pop up setMenu(FXPopup * pup)92 void setMenu(FXPopup *pup){ pane = pup; } 93 94 /// Return popup menu getMenu()95 FXPopup* getMenu() const { return pane; } 96 97 /// True if this menu or is popup logically contains the mouse 98 virtual FXbool contains(FXint parentx,FXint parenty) const; 99 100 /// Save menu to a stream 101 virtual void save(FXStream& store) const; 102 103 /// Load menu from a stream 104 virtual void load(FXStream& store); 105 106 /// Destructor 107 virtual ~FXMenuCascade(); 108 }; 109 110 } 111 112 #endif 113