Logo ROOT  
Reference Guide
TGToolBar.h
Go to the documentation of this file.
1 // @(#)root/gui:$Id$
2 // Author: Fons Rademakers 25/02/98
3 
4 /*************************************************************************
5  * Copyright (C) 1995-2021, Rene Brun and Fons Rademakers. *
6  * All rights reserved. *
7  * *
8  * For the licensing terms see $ROOTSYS/LICENSE. *
9  * For the list of contributors see $ROOTSYS/README/CREDITS. *
10  *************************************************************************/
11 
12 #ifndef ROOT_TGToolBar
13 #define ROOT_TGToolBar
14 
15 
16 #include "TGFrame.h"
17 
18 class TGButton;
19 class TGPictureButton;
20 class TList;
21 class TMap;
22 
23 struct ToolBarData_t {
24  const char *fPixmap;
25  const char *fTipText;
29 };
30 
31 
32 
33 class TGToolBar : public TGCompositeFrame {
34 
35 protected:
36  TList *fPictures; ///< list of pictures that should be freed
37  TList *fTrash; ///< list of buttons and layout hints to be deleted
38  TMap *fMapOfButtons; ///< map of button/id pairs in this group
39 
40 private:
41  TGToolBar(const TGToolBar&) = delete;
42  TGToolBar& operator=(const TGToolBar&) = delete;
43 
44 public:
45  TGToolBar(const TGWindow *p = nullptr, UInt_t w = 1, UInt_t h = 1,
46  UInt_t options = kHorizontalFrame,
48  virtual ~TGToolBar();
49 
50  virtual TGButton *AddButton(const TGWindow *w, ToolBarData_t *button, Int_t spacing = 0);
51  virtual TGButton *AddButton(const TGWindow *w, TGPictureButton *button, Int_t spacing = 0);
52 
53  virtual void ChangeIcon(ToolBarData_t *button, const char *new_icon);
54  virtual void Cleanup();
55  virtual TGButton *GetButton(Int_t id) const;
56  virtual Long_t GetId(TGButton *button) const;
57  virtual void SetId(TGButton *button, Long_t id);
58 
59  virtual void ButtonPressed();
60  virtual void ButtonReleased();
61  virtual void ButtonClicked();
62 
63  virtual void Pressed(Int_t id) { Emit("Pressed(Int_t)",id); } //*SIGNAL*
64  virtual void Released(Int_t id) { Emit("Released(Int_t)",id);} //*SIGNAL*
65  virtual void Clicked(Int_t id) { Emit("Clicked(Int_t)",id); } //*SIGNAL*
66 
67  virtual void SavePrimitive(std::ostream &out, Option_t *option = "");
68 
69  ClassDef(TGToolBar,0) //A bar containing picture buttons
70 };
71 
72 #endif
TGToolBar::SetId
virtual void SetId(TGButton *button, Long_t id)
changes id for button.
Definition: TGToolBar.cxx:172
TGWindow
ROOT GUI Window base class.
Definition: TGWindow.h:23
ToolBarData_t::fPixmap
const char * fPixmap
Definition: TGToolBar.h:24
Option_t
const char Option_t
Definition: RtypesCore.h:66
TGToolBar::TGToolBar
TGToolBar(const TGToolBar &)=delete
Pixel_t
ULong_t Pixel_t
Pixel value.
Definition: GuiTypes.h:40
TGToolBar::fMapOfButtons
TMap * fMapOfButtons
map of button/id pairs in this group
Definition: TGToolBar.h:38
TGToolBar::Pressed
virtual void Pressed(Int_t id)
Definition: TGToolBar.h:63
TGToolBar
A toolbar is a composite frame that contains TGPictureButtons.
Definition: TGToolBar.h:33
TGToolBar::fTrash
TList * fTrash
list of buttons and layout hints to be deleted
Definition: TGToolBar.h:37
TGFrame::GetDefaultFrameBackground
static Pixel_t GetDefaultFrameBackground()
Get default frame background.
Definition: TGFrame.cxx:683
TGObject::GetId
Handle_t GetId() const
Definition: TGObject.h:37
bool
TGToolBar::Cleanup
virtual void Cleanup()
Cleanup and delete all objects contained in this composite frame.
Definition: TGToolBar.cxx:214
ToolBarData_t::fButton
TGButton * fButton
Definition: TGToolBar.h:28
ToolBarData_t::fTipText
const char * fTipText
Definition: TGToolBar.h:25
TGToolBar::fPictures
TList * fPictures
list of pictures that should be freed
Definition: TGToolBar.h:36
TGToolBar::SavePrimitive
virtual void SavePrimitive(std::ostream &out, Option_t *option="")
Save an horizontal slider as a C++ statement(s) on output stream out.
Definition: TGToolBar.cxx:271
TGToolBar::operator=
TGToolBar & operator=(const TGToolBar &)=delete
TGToolBar::ButtonClicked
virtual void ButtonClicked()
This slot is activated when one of the buttons in the group emits the Clicked() signal.
Definition: TGToolBar.cxx:257
h
#define h(i)
Definition: RSha256.hxx:106
TGFrame.h
TGToolBar::~TGToolBar
virtual ~TGToolBar()
Delete toolbar and its buttons and layout hints.
Definition: TGToolBar.cxx:65
Long_t
long Long_t
Definition: RtypesCore.h:54
TGToolBar::ButtonPressed
virtual void ButtonPressed()
This slot is activated when one of the buttons in the group emits the Pressed() signal.
Definition: TGToolBar.cxx:227
unsigned int
kHorizontalFrame
@ kHorizontalFrame
Definition: GuiTypes.h:382
TGToolBar::Released
virtual void Released(Int_t id)
Definition: TGToolBar.h:64
TGPictureButton
Yield an action as soon as it is clicked.
Definition: TGButton.h:228
ToolBarData_t
Definition: TGToolBar.h:23
TGToolBar::ChangeIcon
virtual void ChangeIcon(ToolBarData_t *button, const char *new_icon)
Change the icon of a toolbar button.
Definition: TGToolBar.cxx:196
TGToolBar::ButtonReleased
virtual void ButtonReleased()
This slot is activated when one of the buttons in the group emits the Released() signal.
Definition: TGToolBar.cxx:242
ClassDef
#define ClassDef(name, id)
Definition: Rtypes.h:325
TGToolBar::AddButton
virtual TGButton * AddButton(const TGWindow *w, ToolBarData_t *button, Int_t spacing=0)
Add button to toolbar.
Definition: TGToolBar.cxx:92
ToolBarData_t::fStayDown
Bool_t fStayDown
Definition: TGToolBar.h:26
ToolBarData_t::fId
Int_t fId
Definition: TGToolBar.h:27
TGButton
A button abstract base class.
Definition: TGButton.h:68
TGCompositeFrame
The base class for composite widgets (menu bars, list boxes, etc.).
Definition: TGFrame.h:287
TGToolBar::Clicked
virtual void Clicked(Int_t id)
Definition: TGToolBar.h:65
TGToolBar::GetButton
virtual TGButton * GetButton(Int_t id) const
Finds and returns a pointer to the button with the specified identifier id.
Definition: TGToolBar.cxx:157
TList
A doubly linked list.
Definition: TList.h:44
TQObject::Emit
void Emit(const char *signal, const T &arg)
Activate signal with single parameter.
Definition: TQObject.h:164
int
TMap
TMap implements an associative array of (key,value) pairs using a THashTable for efficient retrieval ...
Definition: TMap.h:40