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,2021 by Jeroen van der Zijp. All Rights Reserved. * 7 ********************************************************************************* 8 * This library is free software; you can redistribute it and/or modify * 9 * it under the terms of the GNU Lesser General Public License as published by * 10 * the Free Software Foundation; either version 3 of the License, or * 11 * (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 * 16 * GNU Lesser General Public License for more details. * 17 * * 18 * You should have received a copy of the GNU Lesser General Public License * 19 * along with this program. If not, see <http://www.gnu.org/licenses/> * 20 ********************************************************************************/ 21 #ifndef FXMENUCASCADE_H 22 #define FXMENUCASCADE_H 23 24 #ifndef FXMENUCAPTION_H 25 #include "FXMenuCaption.h" 26 #endif 27 28 namespace FX { 29 30 31 class FXPopup; 32 33 34 /** 35 * The cascade menu widget is used to bring up a sub menu from a 36 * pull down menu. 37 */ 38 class FXAPI FXMenuCascade : public FXMenuCaption { 39 FXDECLARE(FXMenuCascade) 40 protected: 41 FXPopup *pane; 42 protected: 43 FXMenuCascade(); 44 void drawTriangle(FXDCWindow& dc,FXint l,FXint t,FXint r,FXint b); 45 private: 46 FXMenuCascade(const FXMenuCascade&); 47 FXMenuCascade &operator=(const FXMenuCascade&); 48 public: 49 long onPaint(FXObject*,FXSelector,void*); 50 long onEnter(FXObject*,FXSelector,void*); 51 long onLeave(FXObject*,FXSelector,void*); 52 long onButtonPress(FXObject*,FXSelector,void*); 53 long onButtonRelease(FXObject*,FXSelector,void*); 54 long onKeyPress(FXObject*,FXSelector,void*); 55 long onKeyRelease(FXObject*,FXSelector,void*); 56 long onHotKeyPress(FXObject*,FXSelector,void*); 57 long onHotKeyRelease(FXObject*,FXSelector,void*); 58 long onCmdPost(FXObject*,FXSelector,void*); 59 long onCmdUnpost(FXObject*,FXSelector,void*); 60 public: 61 enum { 62 ID_MENUTIMER=FXMenuCaption::ID_LAST, 63 ID_LAST 64 }; 65 public: 66 67 /// Construct a menu cascade responsible for the given popup menu 68 FXMenuCascade(FXComposite* p,const FXString& text,FXIcon* ic=NULL,FXPopup* pup=NULL,FXuint opts=0); 69 70 /// Create server-side resources 71 virtual void create(); 72 73 /// Detach server-side resources 74 virtual void detach(); 75 76 /// Destroy server-side resources 77 virtual void destroy(); 78 79 /// Yes it can receive the focus 80 virtual FXbool canFocus() const; 81 82 /// Move the focus to this window 83 virtual void setFocus(); 84 85 /// Remove the focus from this window 86 virtual void killFocus(); 87 88 /// Set popup menu to pop up setMenu(FXPopup * pup)89 void setMenu(FXPopup *pup){ pane = pup; } 90 91 /// Return popup menu getMenu()92 FXPopup* getMenu() const { return pane; } 93 94 /// True if this menu or is popup logically contains the mouse 95 virtual FXbool contains(FXint parentx,FXint parenty) const; 96 97 /// Save menu to a stream 98 virtual void save(FXStream& store) const; 99 100 /// Load menu from a stream 101 virtual void load(FXStream& store); 102 103 /// Destructor 104 virtual ~FXMenuCascade(); 105 }; 106 107 } 108 109 #endif 110