Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2021-12-14 11:45:01

0001 #ifndef Fireworks_Core_FWSelectionManager_h
0002 #define Fireworks_Core_FWSelectionManager_h
0003 // -*- C++ -*-
0004 //
0005 // Package:     Core
0006 // Class  :     FWSelectionManager
0007 //
0008 /**\class FWSelectionManager FWSelectionManager.h Fireworks/Core/interface/FWSelectionManager.h
0009 
0010    Description: Manages the list of selected Model items
0011 
0012    Usage:
0013     <usage>
0014 
0015  */
0016 //
0017 // Original Author:  Chris Jones
0018 //         Created:  Fri Jan 18 14:40:45 EST 2008
0019 //
0020 
0021 // system include files
0022 #include "sigc++/signal.h"
0023 #include "sigc++/connection.h"
0024 #include <set>
0025 #include <vector>
0026 
0027 // user include files
0028 #include "Fireworks/Core/interface/FWModelId.h"
0029 
0030 // forward declarations
0031 class FWEventItem;
0032 class FWModelChangeManager;
0033 
0034 class FWSelectionManager {
0035   //only an item can set the selection
0036   friend class FWEventItem;
0037 
0038 public:
0039   FWSelectionManager(FWModelChangeManager* iCM);
0040   //virtual ~FWSelectionManager();
0041 
0042   // ---------- const member functions ---------------------
0043   const std::set<FWModelId>& selected() const;
0044 
0045   const std::set<FWEventItem*>& selectedItems() const;
0046   // ---------- static member functions --------------------
0047 
0048   // ---------- member functions ---------------------------
0049   void clearSelection();
0050   void clearItemSelection();
0051   void clearModelSelectionLeaveItem();
0052 
0053   sigc::signal<void(const FWSelectionManager&)> selectionChanged_;
0054   sigc::signal<void(const FWSelectionManager&)> itemSelectionChanged_;
0055 
0056   FWSelectionManager(const FWSelectionManager&) = delete;  // stop default
0057 
0058   const FWSelectionManager& operator=(const FWSelectionManager&) = delete;  // stop default
0059 private:
0060   void finishedAllSelections();
0061   void select(const FWModelId& iId);
0062   void unselect(const FWModelId& iId);
0063   void itemChanged(const FWEventItem*);
0064 
0065   void selectItem(FWEventItem*);
0066   void unselectItem(FWEventItem*);
0067 
0068   // ---------- member data --------------------------------
0069   FWModelChangeManager* m_changeManager;
0070   std::set<FWModelId> m_selection;
0071   std::set<FWModelId> m_newSelection;
0072   bool m_wasChanged;
0073   std::vector<std::pair<int, sigc::connection> > m_itemConnectionCount;
0074   std::set<FWEventItem*> m_itemSelection;
0075 };
0076 
0077 #endif