Logo ROOT   6.12/07
Reference Guide
TGShutter.h
Go to the documentation of this file.
1 // @(#)root/gui:$Id$
2 // Author: Fons Rademakers 18/9/2000
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_TGShutter
13 #define ROOT_TGShutter
14 
15 
16 //////////////////////////////////////////////////////////////////////////
17 // //
18 // TGShutter, TGShutterItem //
19 // //
20 // A shutter widget contains a set of shutter items that can be //
21 // open and closed like a shutter. //
22 // This widget is usefull to group a large number of options in //
23 // a number of categories. //
24 // //
25 //////////////////////////////////////////////////////////////////////////
26 
27 #include "TGFrame.h"
28 #include "TGCanvas.h"
29 #include "TGWidget.h"
30 
31 
32 class TGButton;
33 class TGCanvas;
34 class TTimer;
35 class TList;
36 
37 
38 
39 class TGShutterItem : public TGVerticalFrame, public TGWidget {
40 
41 friend class TGShutter;
42 
43 protected:
44  TGButton *fButton; // shutter item button
45  TGCanvas *fCanvas; // canvas of shutter item
46  TGFrame *fContainer; // container in canvas containing shutter items
47  TGLayoutHints *fL1, *fL2; // positioning hints
48 
49 private:
50  TGShutterItem(const TGShutterItem&); // not implemented
51  TGShutterItem& operator=(const TGShutterItem&); // not implemented
52 
53 public:
54  TGShutterItem(const TGWindow *p = 0, TGHotString *s = 0, Int_t id = -1,
55  UInt_t options = 0);
56  virtual ~TGShutterItem();
57 
58  TGButton *GetButton() const { return fButton; }
59  TGFrame *GetContainer() const { return fCanvas->GetContainer(); }
60  virtual void Selected() { Emit(" Selected()"); } //*SIGNAL*
61 
62  virtual void SavePrimitive(std::ostream &out, Option_t *option = "");
63 
64  ClassDef(TGShutterItem,0) // Shutter widget item
65 };
66 
67 
68 
69 class TGShutter : public TGCompositeFrame {
70 
71 protected:
72  TTimer *fTimer; // Timer for animation
73  TGShutterItem *fSelectedItem; // Item currently open
74  TGShutterItem *fClosingItem; // Item closing down
75  TList *fTrash; // Items that need to be cleaned up
76  Int_t fHeightIncrement; // Height delta
77  Int_t fClosingHeight; // Closing items current height
78  Int_t fClosingHadScrollbar; // Closing item had a scroll bar
79  UInt_t fDefWidth; // Default width
80  UInt_t fDefHeight; // Default height
81 
82 private:
83  TGShutter(const TGShutter&); // not implemented
84  TGShutter& operator=(const TGShutter&); // not implemented
85 
86 public:
87  TGShutter(const TGWindow *p = 0, UInt_t options = kSunkenFrame);
88  virtual ~TGShutter();
89 
90  virtual void AddItem(TGShutterItem *item);
91  virtual void RemoveItem(const char *name);
92  virtual TGShutterItem *AddPage(const char *item = "Page"); //*MENU*
93  virtual void RemovePage(); //*MENU*
94  virtual void RenamePage(const char *name); //*MENU*
95  virtual Bool_t HandleTimer(TTimer *t);
96  virtual void Layout();
97  virtual void SetLayoutManager(TGLayoutManager*) { }
98  TGShutterItem *GetSelectedItem() const { return fSelectedItem; }
99  TGShutterItem *GetItem(const char *name);
100  virtual void SetSelectedItem(TGShutterItem *item);
101  virtual void SetSelectedItem(const char *name);
102  virtual void EnableItem(const char *name, Bool_t on = kTRUE);
103 
104  virtual TGDimension GetDefaultSize() const;
105  virtual void SetDefaultSize(UInt_t w, UInt_t h);
106 
107  virtual void SavePrimitive(std::ostream &out, Option_t *option = "");
108 
109  virtual Bool_t ProcessMessage(Long_t cmd, Long_t parm1, Long_t parm2);
110  virtual void Selected(TGShutterItem *item) { Emit(" Selected(TGShutterItem*)", item); } //*SIGNAL*
111 
112  ClassDef(TGShutter,0) // Shutter widget
113 };
114 
115 #endif
Int_t fHeightIncrement
Definition: TGShutter.h:76
const char Option_t
Definition: RtypesCore.h:62
virtual void Selected(TGShutterItem *item)
Definition: TGShutter.h:110
TH1 * h
Definition: legend2.C:5
TGShutterItem & operator=(const TGShutterItem &)
int Int_t
Definition: RtypesCore.h:41
bool Bool_t
Definition: RtypesCore.h:59
TGFrame * GetContainer() const
Definition: TGCanvas.h:226
Int_t fClosingHadScrollbar
Definition: TGShutter.h:78
virtual void Layout()
Layout the elements of the composite frame.
Definition: TGFrame.cxx:1239
virtual Bool_t HandleTimer(TTimer *)
Execute action in response of a timer timing out.
Definition: TGWindow.h:108
TGFrame * GetContainer() const
Definition: TGShutter.h:59
#define ClassDef(name, id)
Definition: Rtypes.h:320
TTimer * fTimer
Definition: TGShutter.h:72
TGLayoutHints * fL1
Definition: TGShutter.h:47
virtual ~TGShutterItem()
Clan up shutter item.
Definition: TGShutter.cxx:369
TList * fTrash
Definition: TGShutter.h:75
TGButton * fButton
Definition: TGShutter.h:44
A doubly linked list.
Definition: TList.h:44
UInt_t fDefHeight
Definition: TGShutter.h:80
UInt_t fDefWidth
Definition: TGShutter.h:79
virtual void Selected()
Definition: TGShutter.h:60
virtual TGDimension GetDefaultSize() const
std::cout << fWidth << "x" << fHeight << std::endl;
Definition: TGFrame.h:375
unsigned int UInt_t
Definition: RtypesCore.h:42
Handles synchronous and a-synchronous timer events.
Definition: TTimer.h:51
virtual Bool_t ProcessMessage(Long_t, Long_t, Long_t)
Definition: TGFrame.h:395
TGLayoutHints * fL2
Definition: TGShutter.h:47
virtual void SavePrimitive(std::ostream &out, Option_t *option="")
Save a shutter item widget as a C++ statement(s) on output stream out.
Definition: TGShutter.cxx:383
TGFrame * fContainer
Definition: TGShutter.h:46
long Long_t
Definition: RtypesCore.h:50
TGShutterItem(const TGShutterItem &)
virtual void SetLayoutManager(TGLayoutManager *)
Set the layout manager for the composite frame.
Definition: TGShutter.h:97
Int_t fClosingHeight
Definition: TGShutter.h:77
TGShutterItem * GetSelectedItem() const
Definition: TGShutter.h:98
TGShutterItem * fSelectedItem
Definition: TGShutter.h:73
TGCanvas * fCanvas
Definition: TGShutter.h:45
static constexpr double s
TGShutterItem * fClosingItem
Definition: TGShutter.h:74
TGButton * GetButton() const
Definition: TGShutter.h:58
friend class TGShutter
Definition: TGShutter.h:41
void Emit(const char *signal, const T &arg)
Activate signal with single parameter.
Definition: TQObject.h:165
const Bool_t kTRUE
Definition: RtypesCore.h:87
char name[80]
Definition: TGX11.cxx:109