ROOT  6.06/09
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 #ifndef ROOT_TGFrame
26 #include "TGFrame.h"
27 #endif
28 
29 class TGButton;
30 class TGPictureButton;
31 class TList;
32 class TMap;
33 
34 struct ToolBarData_t {
35  const char *fPixmap;
36  const char *fTipText;
40 };
41 
42 
43 
44 class TGToolBar : public TGCompositeFrame {
45 
46 protected:
47  TList *fPictures; // list of pictures that should be freed
48  TList *fTrash; // list of buttons and layout hints to be deleted
49  TMap *fMapOfButtons; // map of button/id pairs in this group
50 
51 private:
52  TGToolBar(const TGToolBar&); // not implemented
53  TGToolBar& operator=(const TGToolBar&); // not implemented
54 
55 public:
56  TGToolBar(const TGWindow *p = 0, UInt_t w = 1, UInt_t h = 1,
57  UInt_t options = kHorizontalFrame,
59  virtual ~TGToolBar();
60 
61  virtual TGButton *AddButton(const TGWindow *w, ToolBarData_t *button, Int_t spacing = 0);
62  virtual TGButton *AddButton(const TGWindow *w, TGPictureButton *button, Int_t spacing = 0);
63 
64  virtual void ChangeIcon(ToolBarData_t *button, const char *new_icon);
65  virtual void Cleanup();
66  virtual TGButton *GetButton(Int_t id) const;
67  virtual Long_t GetId(TGButton *button) const;
68  virtual void SetId(TGButton *button, Long_t id);
69 
70  virtual void ButtonPressed();
71  virtual void ButtonReleased();
72  virtual void ButtonClicked();
73 
74  virtual void Pressed(Int_t id) { Emit("Pressed(Int_t)",id); } //*SIGNAL*
75  virtual void Released(Int_t id) { Emit("Released(Int_t)",id);} //*SIGNAL*
76  virtual void Clicked(Int_t id) { Emit("Clicked(Int_t)",id); } //*SIGNAL*
77 
78  virtual void SavePrimitive(std::ostream &out, Option_t *option = "");
79 
80  ClassDef(TGToolBar,0) //A bar containing picture buttons
81 };
82 
83 #endif
virtual void Clicked(Int_t id)
Definition: TGToolBar.h:76
TGButton * fButton
Definition: TGToolBar.h:39
TMap * fMapOfButtons
Definition: TGToolBar.h:49
virtual void ChangeIcon(ToolBarData_t *button, const char *new_icon)
Change the icon of a toolbar button.
Definition: TGToolBar.cxx:195
const char Option_t
Definition: RtypesCore.h:62
virtual TGButton * AddButton(const TGWindow *w, ToolBarData_t *button, Int_t spacing=0)
Add button to toolbar.
Definition: TGToolBar.cxx:91
TH1 * h
Definition: legend2.C:5
Bool_t fStayDown
Definition: TGToolBar.h:37
virtual TGButton * GetButton(Int_t id) const
Finds and returns a pointer to the button with the specified identifier id.
Definition: TGToolBar.cxx:156
int Int_t
Definition: RtypesCore.h:41
bool Bool_t
Definition: RtypesCore.h:59
virtual void Cleanup()
Cleanup and delete all objects contained in this composite frame.
Definition: TGToolBar.cxx:213
virtual void Pressed(Int_t id)
Definition: TGToolBar.h:74
virtual void ButtonReleased()
This slot is activated when one of the buttons in the group emits the Released() signal.
Definition: TGToolBar.cxx:241
TList * fPictures
Definition: TGToolBar.h:47
TList * fTrash
Definition: TGToolBar.h:48
#define ClassDef(name, id)
Definition: Rtypes.h:254
ULong_t Pixel_t
Definition: GuiTypes.h:41
virtual void SetId(TGButton *button, Long_t id)
changes id for button.
Definition: TGToolBar.cxx:171
static Pixel_t GetDefaultFrameBackground()
Get default frame background.
Definition: TGFrame.cxx:665
virtual void ButtonClicked()
This slot is activated when one of the buttons in the group emits the Clicked() signal.
Definition: TGToolBar.cxx:256
char * out
Definition: TBase64.cxx:29
void Emit(const char *signal)
Acitvate signal without args.
Definition: TQObject.cxx:559
A doubly linked list.
Definition: TList.h:47
unsigned int UInt_t
Definition: RtypesCore.h:42
TGToolBar(const TGToolBar &)
virtual ~TGToolBar()
Delete toolbar and its buttons and layout hints.
Definition: TGToolBar.cxx:64
virtual void Released(Int_t id)
Definition: TGToolBar.h:75
long Long_t
Definition: RtypesCore.h:50
TMap implements an associative array of (key,value) pairs using a THashTable for efficient retrieval ...
Definition: TMap.h:44
const char * fTipText
Definition: TGToolBar.h:36
TGToolBar & operator=(const TGToolBar &)
const char * fPixmap
Definition: TGToolBar.h:35
virtual void ButtonPressed()
This slot is activated when one of the buttons in the group emits the Pressed() signal.
Definition: TGToolBar.cxx:226
Handle_t GetId() const
Definition: TGObject.h:52
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