File indexing completed on 2024-04-06 12:11:30
0001 #ifndef Fireworks_Core_CSGAction_h
0002 #define Fireworks_Core_CSGAction_h
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012
0013
0014
0015
0016
0017
0018
0019
0020
0021
0022 #include <string>
0023 #include <vector>
0024 #include <sigc++/sigc++.h>
0025 #include <TGFrame.h>
0026 #include <TGButton.h>
0027 #include <TGToolBar.h>
0028
0029
0030
0031
0032 class TGMenuBar;
0033 class TString;
0034 class CSGActionSupervisor;
0035 class CSGConnector;
0036 class FWCustomIconsButton;
0037
0038 class CSGAction : public sigc::trackable {
0039 public:
0040 CSGAction(CSGActionSupervisor* supervisor, const char* name);
0041 virtual ~CSGAction();
0042
0043
0044 const std::string& getName() const;
0045 const std::string& getToolTip() const;
0046 TString getSCCombo() const;
0047 Int_t getKeycode() const;
0048 Int_t getModcode() const;
0049 TGPopupMenu* getMenu() const;
0050 int getMenuEntry() const;
0051 ToolBarData_t* getToolBarData() const;
0052 TGToolBar* getToolBar() const;
0053 virtual Bool_t isEnabled() const;
0054
0055
0056 static TString keycodeToString(Int_t keycode);
0057
0058
0059 void setName(const std::string& name);
0060 void setMenuLabel(const std::string& label);
0061 void setToolTip(const std::string& tip);
0062 void createTextButton(TGCompositeFrame* p,
0063 TGLayoutHints* l = nullptr,
0064 Int_t id = -1,
0065 GContext_t norm = TGButton::GetDefaultGC()(),
0066 FontStruct_t font = TGTextButton::GetDefaultFontStruct(),
0067 UInt_t option = kRaisedFrame | kDoubleBorder);
0068 void createCheckButton(TGCompositeFrame* p,
0069 TGLayoutHints* l = nullptr,
0070 Bool_t state = true,
0071 Int_t id = -1,
0072 GContext_t norm = TGButton::GetDefaultGC()(),
0073 FontStruct_t font = TGTextButton::GetDefaultFontStruct());
0074 void createPictureButton(TGCompositeFrame* p,
0075 const TGPicture* pic,
0076 TGLayoutHints* l = nullptr,
0077 Int_t id = -1,
0078 GContext_t norm = TGButton::GetDefaultGC()(),
0079 UInt_t option = kRaisedFrame | kDoubleBorder);
0080 FWCustomIconsButton* createCustomIconsButton(TGCompositeFrame* p,
0081 const TGPicture* upPic,
0082 const TGPicture* downPic,
0083 const TGPicture* disabledPic,
0084 TGLayoutHints* l = nullptr,
0085 Int_t id = -1,
0086 GContext_t norm = TGButton::GetDefaultGC()(),
0087 UInt_t option = 0);
0088 void createShortcut(UInt_t key, const char* mod, int windowID);
0089 void createMenuEntry(TGPopupMenu* menu);
0090 void enable();
0091 void disable();
0092
0093 virtual void globalEnable();
0094 virtual void globalDisable();
0095
0096 void addSCToMenu();
0097 Bool_t resizeMenuEntry();
0098 void activate() { activated.emit(); }
0099
0100 sigc::signal<void()> activated;
0101
0102 CSGAction(const CSGAction&) = delete;
0103
0104 const CSGAction& operator=(const CSGAction&) = delete;
0105
0106 private:
0107 void enableImp();
0108 void disableImp();
0109
0110 CSGActionSupervisor* m_supervisor;
0111 std::string m_name;
0112 std::string m_toolTip;
0113 TString m_scCombo;
0114 std::vector<TGButton*> m_buttons;
0115 Int_t m_keycode;
0116 Int_t m_modcode;
0117 TGPopupMenu* m_menu;
0118 int m_entry;
0119 TGToolBar* m_toolBar;
0120 ToolBarData_t* m_tools;
0121 CSGConnector* m_connector;
0122 Bool_t m_enabled;
0123 Bool_t m_globalEnabled;
0124 int m_windowID;
0125 };
0126
0127 #endif