CSGAction

Macros

Line Code
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127
#ifndef Fireworks_Core_CSGAction_h
#define Fireworks_Core_CSGAction_h
// -*- C++ -*-
//
// Package:     Core
// Class  :     CSGAction
//
/**\class CSGAction CSGAction.h Fireworks/Core/interface/CSGAction.h

   Description: <one line class summary>

   Usage:
    <usage>

 */
//
// Original Author:  Chris Jones
//         Created:  Thu May 29 18:15:56 CDT 2008
//

// system include files
#include <string>
#include <vector>
#include <sigc++/sigc++.h>
#include <TGFrame.h>
#include <TGButton.h>
#include <TGToolBar.h>

// user include files

// forward declarations
class TGMenuBar;
class TString;
class CSGActionSupervisor;
class CSGConnector;
class FWCustomIconsButton;

class CSGAction : public sigc::trackable {
public:
  CSGAction(CSGActionSupervisor* supervisor, const char* name);
  virtual ~CSGAction();

  // ---------- const member functions ---------------------
  const std::string& getName() const;
  const std::string& getToolTip() const;
  TString getSCCombo() const;
  Int_t getKeycode() const;
  Int_t getModcode() const;
  TGPopupMenu* getMenu() const;
  int getMenuEntry() const;
  ToolBarData_t* getToolBarData() const;
  TGToolBar* getToolBar() const;
  virtual Bool_t isEnabled() const;

  // ---------- static member functions --------------------
  static TString keycodeToString(Int_t keycode);

  // ---------- member functions ---------------------------
  void setName(const std::string& name);
  void setMenuLabel(const std::string& label);
  void setToolTip(const std::string& tip);
  void createTextButton(TGCompositeFrame* p,
                        TGLayoutHints* l = nullptr,
                        Int_t id = -1,
                        GContext_t norm = TGButton::GetDefaultGC()(),
                        FontStruct_t font = TGTextButton::GetDefaultFontStruct(),
                        UInt_t option = kRaisedFrame | kDoubleBorder);
  void createCheckButton(TGCompositeFrame* p,
                         TGLayoutHints* l = nullptr,
                         Bool_t state = true,
                         Int_t id = -1,
                         GContext_t norm = TGButton::GetDefaultGC()(),
                         FontStruct_t font = TGTextButton::GetDefaultFontStruct());
  void createPictureButton(TGCompositeFrame* p,
                           const TGPicture* pic,
                           TGLayoutHints* l = nullptr,
                           Int_t id = -1,
                           GContext_t norm = TGButton::GetDefaultGC()(),
                           UInt_t option = kRaisedFrame | kDoubleBorder);
  FWCustomIconsButton* createCustomIconsButton(TGCompositeFrame* p,
                                               const TGPicture* upPic,
                                               const TGPicture* downPic,
                                               const TGPicture* disabledPic,
                                               TGLayoutHints* l = nullptr,
                                               Int_t id = -1,
                                               GContext_t norm = TGButton::GetDefaultGC()(),
                                               UInt_t option = 0);
  void createShortcut(UInt_t key, const char* mod, int windowID);
  void createMenuEntry(TGPopupMenu* menu);
  void enable();
  void disable();

  virtual void globalEnable();
  virtual void globalDisable();

  void addSCToMenu();
  Bool_t resizeMenuEntry();
  void activate() { activated.emit(); }

  sigc::signal<void()> activated;

  CSGAction(const CSGAction&) = delete;  // stop default

  const CSGAction& operator=(const CSGAction&) = delete;  // stop default

private:
  void enableImp();
  void disableImp();
  // ---------- member data --------------------------------
  CSGActionSupervisor* m_supervisor;
  std::string m_name;
  std::string m_toolTip;
  TString m_scCombo;
  std::vector<TGButton*> m_buttons;
  Int_t m_keycode;
  Int_t m_modcode;
  TGPopupMenu* m_menu;
  int m_entry;
  TGToolBar* m_toolBar;
  ToolBarData_t* m_tools;
  CSGConnector* m_connector;
  Bool_t m_enabled;
  Bool_t m_globalEnabled;
  int m_windowID;
};

#endif