CMS 3D CMS Logo

/data/refman/pasoursint/CMSSW_5_3_6/src/Fireworks/Core/interface/FWSelectionManager.h

Go to the documentation of this file.
00001 #ifndef Fireworks_Core_FWSelectionManager_h
00002 #define Fireworks_Core_FWSelectionManager_h
00003 // -*- C++ -*-
00004 //
00005 // Package:     Core
00006 // Class  :     FWSelectionManager
00007 //
00016 //
00017 // Original Author:  Chris Jones
00018 //         Created:  Fri Jan 18 14:40:45 EST 2008
00019 // $Id: FWSelectionManager.h,v 1.7 2009/11/20 17:53:58 chrjones Exp $
00020 //
00021 
00022 // system include files
00023 #include "sigc++/signal.h"
00024 #include "sigc++/connection.h"
00025 #include <set>
00026 #include <vector>
00027 
00028 // user include files
00029 #include "Fireworks/Core/interface/FWModelId.h"
00030 
00031 // forward declarations
00032 class FWEventItem;
00033 class FWModelChangeManager;
00034 
00035 class FWSelectionManager
00036 {
00037    //only an item can set the selection
00038    friend class FWEventItem;
00039 public:
00040    FWSelectionManager(FWModelChangeManager* iCM);
00041    //virtual ~FWSelectionManager();
00042 
00043    // ---------- const member functions ---------------------
00044    const std::set<FWModelId>& selected() const;
00045 
00046    const std::set<FWEventItem*>& selectedItems() const;
00047    // ---------- static member functions --------------------
00048 
00049    // ---------- member functions ---------------------------
00050    void clearSelection();
00051    void clearItemSelection();
00052    void clearModelSelectionLeaveItem();
00053 
00054    sigc::signal<void, const FWSelectionManager&> selectionChanged_;
00055    sigc::signal<void, const FWSelectionManager&> itemSelectionChanged_;
00056 
00057 private:
00058    void finishedAllSelections();
00059    void select(const FWModelId& iId);
00060    void unselect(const FWModelId& iId);
00061    void itemChanged(const FWEventItem*);
00062 
00063    void selectItem(FWEventItem*);
00064    void unselectItem(FWEventItem*);
00065    
00066    FWSelectionManager(const FWSelectionManager&);    // stop default
00067 
00068    const FWSelectionManager& operator=(const FWSelectionManager&);    // stop default
00069 
00070    // ---------- member data --------------------------------
00071    FWModelChangeManager* m_changeManager;
00072    std::set<FWModelId> m_selection;
00073    std::set<FWModelId> m_newSelection;
00074    bool m_wasChanged;
00075    std::vector<std::pair<int,sigc::connection> > m_itemConnectionCount;
00076    std::set<FWEventItem*> m_itemSelection;
00077 };
00078 
00079 
00080 #endif