CMS 3D CMS Logo

/data/refman/pasoursint/CMSSW_4_1_8_patch13/src/Fireworks/Core/interface/CSGAction.h

Go to the documentation of this file.
00001 #ifndef Fireworks_Core_CSGAction_h
00002 #define Fireworks_Core_CSGAction_h
00003 // -*- C++ -*-
00004 //
00005 // Package:     Core
00006 // Class  :     CSGAction
00007 //
00016 //
00017 // Original Author:  Chris Jones
00018 //         Created:  Thu May 29 18:15:56 CDT 2008
00019 // $Id: CSGAction.h,v 1.15 2009/08/27 18:54:09 amraktad Exp $
00020 //
00021 
00022 // system include files
00023 #include <string>
00024 #include <vector>
00025 #include <sigc++/sigc++.h>
00026 #include <TGFrame.h>
00027 #include <TGButton.h>
00028 #include <TGToolBar.h>
00029 
00030 // user include files
00031 
00032 // forward declarations
00033 class TGMenuBar;
00034 class TString;
00035 class CSGActionSupervisor;
00036 class CSGConnector;
00037 class FWCustomIconsButton;
00038 
00039 class CSGAction : public sigc::trackable {
00040 
00041 public:
00042    CSGAction(CSGActionSupervisor *supervisor, const char *name);
00043    virtual ~CSGAction();
00044 
00045    // ---------- const member functions ---------------------
00046    const std::string& getName() const;
00047    const std::string& getToolTip() const;
00048    TString getSCCombo() const;
00049    Int_t getKeycode() const;
00050    Int_t getModcode() const;
00051    TGPopupMenu *getMenu() const;
00052    int getMenuEntry() const;
00053    ToolBarData_t *getToolBarData() const;
00054    TGToolBar *getToolBar() const;
00055    virtual Bool_t isEnabled() const;
00056 
00057    // ---------- static member functions --------------------
00058    static TString keycodeToString(Int_t keycode);
00059 
00060    // ---------- member functions ---------------------------
00061    void setName(const std::string& name);
00062    void setMenuLabel(const std::string& label);
00063    void setToolTip(const std::string& tip);
00064    void createTextButton(TGCompositeFrame* p, TGLayoutHints* l = 0, Int_t id = -1, GContext_t norm = TGButton::GetDefaultGC() (), FontStruct_t font = TGTextButton::GetDefaultFontStruct(), UInt_t option = kRaisedFrame|kDoubleBorder);
00065    void createCheckButton(TGCompositeFrame* p, TGLayoutHints* l = 0, Bool_t state = true, Int_t id = -1, GContext_t norm = TGButton::GetDefaultGC() (), FontStruct_t font = TGTextButton::GetDefaultFontStruct());
00066    void createPictureButton(TGCompositeFrame* p, const TGPicture* pic, TGLayoutHints* l = 0, Int_t id = -1, GContext_t norm = TGButton::GetDefaultGC() (), UInt_t option = kRaisedFrame|kDoubleBorder);
00067    FWCustomIconsButton* createCustomIconsButton(TGCompositeFrame* p,
00068                                                 const TGPicture* upPic,
00069                                                 const TGPicture* downPic,
00070                                                 const TGPicture* disabledPic,
00071                                                 TGLayoutHints* l = 0,
00072                                                 Int_t id = -1,
00073                                                 GContext_t norm = TGButton::GetDefaultGC() (),
00074                                                 UInt_t option = 0);
00075    void createShortcut(UInt_t key, const char *mod, int windowID);
00076    void createMenuEntry(TGPopupMenu *menu);
00077    void enable();
00078    void disable();
00079 
00080    virtual void globalEnable();
00081    virtual void globalDisable();
00082 
00083    void addSCToMenu();
00084    Bool_t resizeMenuEntry();
00085    void activate(){
00086       activated.emit();
00087    }
00088 
00089    sigc::signal<void> activated;
00090 
00091 private:
00092    CSGAction(const CSGAction&); // stop default
00093 
00094    const CSGAction& operator=(const CSGAction&); // stop default
00095 
00096    void enableImp();
00097    void disableImp();
00098    // ---------- member data --------------------------------
00099    CSGActionSupervisor *m_supervisor;
00100    std::string m_name;
00101    std::string m_toolTip;
00102    TString m_scCombo;
00103    std::vector<TGButton*> m_buttons;
00104    Int_t m_keycode;
00105    Int_t m_modcode;
00106    TGPopupMenu *m_menu;
00107    int m_entry;
00108    TGToolBar *m_toolBar;
00109    ToolBarData_t *m_tools;
00110    CSGConnector  *m_connector;
00111    Bool_t m_enabled;
00112    Bool_t m_globalEnabled;
00113    int m_windowID;
00114 };
00115 
00116 
00117 #endif