Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2023-03-17 11:01:13

0001 #ifndef Fireworks_Core_FWViewContextMenuHandlerBase_h
0002 #define Fireworks_Core_FWViewContextMenuHandlerBase_h
0003 // -*- C++ -*-
0004 //
0005 // Package:     Core
0006 // Class  :     FWViewContextMenuHandlerBase
0007 //
0008 /**\class FWViewContextMenuHandlerBase FWViewContextMenuHandlerBase.h Fireworks/Core/interface/FWViewContextMenuHandlerBase.h
0009 
0010  Description: Base class for handling context menu's from views
0011 
0012  Usage:
0013     <usage>
0014 
0015 */
0016 //
0017 // Original Author:  Chris Jones
0018 //         Created:  Mon Nov  2 13:46:26 CST 2009
0019 //
0020 
0021 // system include files
0022 
0023 // user include files
0024 
0025 // forward declarations
0026 class FWModelId;
0027 class FWModelContextMenuHandler;
0028 
0029 class FWViewContextMenuHandlerBase {
0030 public:
0031   FWViewContextMenuHandlerBase();
0032   virtual ~FWViewContextMenuHandlerBase();
0033 
0034   class MenuEntryAdder {
0035     friend class FWViewContextMenuHandlerBase;
0036     MenuEntryAdder(FWModelContextMenuHandler&);
0037     FWModelContextMenuHandler* m_handler;
0038     // int m_lastIndex;
0039   public:
0040     /**Add an entry by name of iEntryName to the context menu.  Returns the entry index
0041        which simply increments after each 'addEntry' call and starts at 0 */
0042     int addEntry(const char* iEntryName, int idx, bool enable = true);
0043   };
0044 
0045   // ---------- const member functions ---------------------
0046 
0047   // ---------- static member functions --------------------
0048 
0049   // ---------- member functions ---------------------------
0050   void addTo(FWModelContextMenuHandler&, const FWModelId& id);
0051 
0052   /**Called when a menu item was selected
0053     iEntryIndex: the index of the selected menu item.  Same as returned from 'addEntry'
0054     iX, iY: Screen coordinates of where mouse was clicked
0055     */
0056   virtual void select(int iEntryIndex, const FWModelId& id, int iX, int iY) = 0;
0057 
0058   FWViewContextMenuHandlerBase(const FWViewContextMenuHandlerBase&) = delete;  // stop default
0059 
0060   const FWViewContextMenuHandlerBase& operator=(const FWViewContextMenuHandlerBase&) = delete;  // stop default
0061 
0062 private:
0063   ///Called when have to add entries to the context menu
0064   virtual void init(MenuEntryAdder&, const FWModelId& id) = 0;
0065 };
0066 
0067 #endif