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-2000, 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 //////////////////////////////////////////////////////////////////////////
17 // //
18 // TGToolBar //
19 // //
20 // A toolbar is a composite frame that contains TGPictureButtons. //
21 // Often used in combination with a TGHorizontal3DLine. //
22 // //
23 //////////////////////////////////////////////////////////////////////////
24 
25 #include "TGFrame.h"
26 
27 class TGButton;
28 class TGPictureButton;
29 class TList;
30 class TMap;
31 
32 struct ToolBarData_t {
33  const char *fPixmap;
34  const char *fTipText;
38 };
39 
40 
41 
42 class TGToolBar : public TGCompositeFrame {
43 
44 protected:
45  TList *fPictures; // list of pictures that should be freed
46  TList *fTrash; // list of buttons and layout hints to be deleted
47  TMap *fMapOfButtons; // map of button/id pairs in this group
48 
49 private:
50  TGToolBar(const TGToolBar&); // not implemented
51  TGToolBar& operator=(const TGToolBar&); // not implemented
52 
53 public:
54  TGToolBar(const TGWindow *p = 0, UInt_t w = 1, UInt_t h = 1,
55  UInt_t options = kHorizontalFrame,
57  virtual ~TGToolBar();
58 
59  virtual TGButton *AddButton(const TGWindow *w, ToolBarData_t *button, Int_t spacing = 0);
60  virtual TGButton *AddButton(const TGWindow *w, TGPictureButton *button, Int_t spacing = 0);
61 
62  virtual void ChangeIcon(ToolBarData_t *button, const char *new_icon);
63  virtual void Cleanup();
64  virtual TGButton *GetButton(Int_t id) const;
65  virtual Long_t GetId(TGButton *button) const;
66  virtual void SetId(TGButton *button, Long_t id);
67 
68  virtual void ButtonPressed();
69  virtual void ButtonReleased();
70  virtual void ButtonClicked();
71 
72  virtual void Pressed(Int_t id) { Emit("Pressed(Int_t)",id); } //*SIGNAL*
73  virtual void Released(Int_t id) { Emit("Released(Int_t)",id);} //*SIGNAL*
74  virtual void Clicked(Int_t id) { Emit("Clicked(Int_t)",id); } //*SIGNAL*
75 
76  virtual void SavePrimitive(std::ostream &out, Option_t *option = "");
77 
78  ClassDef(TGToolBar,0) //A bar containing picture buttons
79 };
80 
81 #endif
TGToolBar::SetId
virtual void SetId(TGButton *button, Long_t id)
changes id for button.
Definition: TGToolBar.cxx:171
TGWindow
Definition: TGWindow.h:31
ToolBarData_t::fPixmap
const char * fPixmap
Definition: TGToolBar.h:33
Option_t
const char Option_t
Definition: RtypesCore.h:66
Pixel_t
ULong_t Pixel_t
Definition: GuiTypes.h:39
TGToolBar::fMapOfButtons
TMap * fMapOfButtons
Definition: TGToolBar.h:47
TGToolBar::Pressed
virtual void Pressed(Int_t id)
Definition: TGToolBar.h:72
TGToolBar
Definition: TGToolBar.h:42
TGToolBar::fTrash
TList * fTrash
Definition: TGToolBar.h:46
TGFrame::GetDefaultFrameBackground
static Pixel_t GetDefaultFrameBackground()
Get default frame background.
Definition: TGFrame.cxx:668
TGToolBar::operator=
TGToolBar & operator=(const TGToolBar &)
TGObject::GetId
Handle_t GetId() const
Definition: TGObject.h:47
bool
TGToolBar::Cleanup
virtual void Cleanup()
Cleanup and delete all objects contained in this composite frame.
Definition: TGToolBar.cxx:213
ToolBarData_t::fButton
TGButton * fButton
Definition: TGToolBar.h:37
ToolBarData_t::fTipText
const char * fTipText
Definition: TGToolBar.h:34
TGToolBar::fPictures
TList * fPictures
Definition: TGToolBar.h:45
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:270
TGToolBar::ButtonClicked
virtual void ButtonClicked()
This slot is activated when one of the buttons in the group emits the Clicked() signal.
Definition: TGToolBar.cxx:256
h
#define h(i)
Definition: RSha256.hxx:106
TGToolBar::TGToolBar
TGToolBar(const TGToolBar &)
TGFrame.h
TGToolBar::~TGToolBar
virtual ~TGToolBar()
Delete toolbar and its buttons and layout hints.
Definition: TGToolBar.cxx:64
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:226
unsigned int
kHorizontalFrame
@ kHorizontalFrame
Definition: GuiTypes.h:382
TGToolBar::Released
virtual void Released(Int_t id)
Definition: TGToolBar.h:73
TGPictureButton
Definition: TGButton.h:228
ToolBarData_t
Definition: TGToolBar.h:32
TGToolBar::ChangeIcon
virtual void ChangeIcon(ToolBarData_t *button, const char *new_icon)
Change the icon of a toolbar button.
Definition: TGToolBar.cxx:195
TGToolBar::ButtonReleased
virtual void ButtonReleased()
This slot is activated when one of the buttons in the group emits the Released() signal.
Definition: TGToolBar.cxx:241
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:91
ToolBarData_t::fStayDown
Bool_t fStayDown
Definition: TGToolBar.h:35
ToolBarData_t::fId
Int_t fId
Definition: TGToolBar.h:36
TGButton
Definition: TGButton.h:68
TGCompositeFrame
Definition: TGFrame.h:324
TGToolBar::Clicked
virtual void Clicked(Int_t id)
Definition: TGToolBar.h:74
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:156
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