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

FXMenuCascade.h

Go to the documentation of this file.
00001 /********************************************************************************
00002 *                                                                               *
00003 *                        M e n u C a s c a d e   W i d g e t                    *
00004 *                                                                               *
00005 *********************************************************************************
00006 * Copyright (C) 1997,2009 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 * $Id: FXMenuCascade.h,v 1.29 2009/01/06 13:07:25 fox Exp $                     *
00022 ********************************************************************************/
00023 #ifndef FXMENUCASCADE_H
00024 #define FXMENUCASCADE_H
00025 
00026 #ifndef FXMENUCAPTION_H
00027 #include "FXMenuCaption.h"
00028 #endif
00029 
00030 namespace FX {
00031 
00032 
00033 class FXPopup;
00034 
00035 
00036 /**
00037 * The cascade menu widget is used to bring up a sub menu from a
00038 * pull down menu.
00039 */
00040 class FXAPI FXMenuCascade : public FXMenuCaption {
00041   FXDECLARE(FXMenuCascade)
00042 protected:
00043   FXPopup *pane;
00044 protected:
00045   FXMenuCascade();
00046   void drawTriangle(FXDCWindow& dc,FXint l,FXint t,FXint r,FXint b);
00047 private:
00048   FXMenuCascade(const FXMenuCascade&);
00049   FXMenuCascade &operator=(const FXMenuCascade&);
00050 public:
00051   long onPaint(FXObject*,FXSelector,void*);
00052   long onEnter(FXObject*,FXSelector,void*);
00053   long onLeave(FXObject*,FXSelector,void*);
00054   long onButtonPress(FXObject*,FXSelector,void*);
00055   long onButtonRelease(FXObject*,FXSelector,void*);
00056   long onKeyPress(FXObject*,FXSelector,void*);
00057   long onKeyRelease(FXObject*,FXSelector,void*);
00058   long onHotKeyPress(FXObject*,FXSelector,void*);
00059   long onHotKeyRelease(FXObject*,FXSelector,void*);
00060   long onCmdPost(FXObject*,FXSelector,void*);
00061   long onCmdUnpost(FXObject*,FXSelector,void*);
00062 public:
00063   enum {
00064     ID_MENUTIMER=FXMenuCaption::ID_LAST,
00065     ID_LAST
00066     };
00067 public:
00068 
00069   /// Construct a menu cascade responsible for the given popup menu
00070   FXMenuCascade(FXComposite* p,const FXString& text,FXIcon* ic=NULL,FXPopup* pup=NULL,FXuint opts=0);
00071 
00072   /// Create server-side resources
00073   virtual void create();
00074 
00075   /// Detach server-side resources
00076   virtual void detach();
00077 
00078   /// Destroy server-side resources
00079   virtual void destroy();
00080 
00081   /// Yes it can receive the focus
00082   virtual FXbool canFocus() const;
00083 
00084   /// Move the focus to this window
00085   virtual void setFocus();
00086 
00087   /// Remove the focus from this window
00088   virtual void killFocus();
00089 
00090   /// Set popup menu to pop up
00091   void setMenu(FXPopup *pup){ pane = pup; }
00092 
00093   /// Return popup menu
00094   FXPopup* getMenu() const { return pane; }
00095 
00096   /// True if this menu or is popup logically contains the mouse
00097   virtual FXbool contains(FXint parentx,FXint parenty) const;
00098 
00099   /// Save menu to a stream
00100   virtual void save(FXStream& store) const;
00101 
00102   /// Load menu from a stream
00103   virtual void load(FXStream& store);
00104 
00105   /// Destructor
00106   virtual ~FXMenuCascade();
00107   };
00108 
00109 }
00110 
00111 #endif

Copyright © 1997-2009 Jeroen van der Zijp