Logo ROOT   6.21/01
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*) { }
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
virtual void SetDefaultSize(UInt_t w, UInt_t h)
Set the default / minimal size of the widget.
Definition: TGShutter.cxx:330
virtual Bool_t ProcessMessage(Long_t cmd, Long_t parm1, Long_t parm2)
Handle shutter messages.
Definition: TGShutter.cxx:156
virtual void RemovePage()
Remove selected page.
Definition: TGShutter.cxx:119
Int_t fHeightIncrement
Definition: TGShutter.h:76
virtual void EnableItem(const char *name, Bool_t on=kTRUE)
Disable/enbale shutter item.
Definition: TGShutter.cxx:287
const char Option_t
Definition: RtypesCore.h:62
virtual void Selected(TGShutterItem *item)
Definition: TGShutter.h:110
TGShutterItem & operator=(const TGShutterItem &)
int Int_t
Definition: RtypesCore.h:41
bool Bool_t
Definition: RtypesCore.h:59
virtual Bool_t HandleTimer(TTimer *t)
Shutter item animation.
Definition: TGShutter.cxx:196
virtual TGDimension GetDefaultSize() const
Return the default / minimal size of the widget.
Definition: TGShutter.cxx:320
TGFrame * GetContainer() const
Definition: TGCanvas.h:226
Int_t fClosingHadScrollbar
Definition: TGShutter.h:78
virtual void SetSelectedItem(TGShutterItem *item)
Set item to be the currently open shutter item.
Definition: TGShutter.cxx:265
virtual void AddItem(TGShutterItem *item)
Add shutter item to shutter frame.
Definition: TGShutter.cxx:71
TGFrame * GetContainer() const
Definition: TGShutter.h:59
#define ClassDef(name, id)
Definition: Rtypes.h:326
TTimer * fTimer
Definition: TGShutter.h:72
virtual ~TGShutter()
Cleanup shutter widget.
Definition: TGShutter.cxx:57
TGLayoutHints * fL1
Definition: TGShutter.h:47
virtual void RemoveItem(const char *name)
Remove item from shutter.
Definition: TGShutter.cxx:84
virtual ~TGShutterItem()
Clan up shutter item.
Definition: TGShutter.cxx:369
TGShutterItem * GetItem(const char *name)
returns a shutter item by name (name is hot string of shutter item)
Definition: TGShutter.cxx:300
TList * fTrash
Definition: TGShutter.h:75
TGButton * fButton
Definition: TGShutter.h:44
static constexpr double s
virtual TGShutterItem * AddPage(const char *item="Page")
Add new page (shutter item)
Definition: TGShutter.cxx:143
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
unsigned int UInt_t
Definition: RtypesCore.h:42
Handles synchronous and a-synchronous timer events.
Definition: TTimer.h:51
TGLayoutHints * fL2
Definition: TGShutter.h:47
#define h(i)
Definition: RSha256.hxx:106
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
TGShutter(const TGShutter &)
virtual void Layout()
Layout shutter items.
Definition: TGShutter.cxx:216
TGShutter & operator=(const TGShutter &)
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
TGShutterItem * fClosingItem
Definition: TGShutter.h:74
virtual void SavePrimitive(std::ostream &out, Option_t *option="")
Save a shutter widget as a C++ statement(s) on output stream out.
Definition: TGShutter.cxx:437
virtual void RenamePage(const char *name)
Rename selected page.
Definition: TGShutter.cxx:131
TGButton * GetButton() const
Definition: TGShutter.h:58
void Emit(const char *signal, const T &arg)
Activate signal with single parameter.
Definition: TQObject.h:164
const Bool_t kTRUE
Definition: RtypesCore.h:87
char name[80]
Definition: TGX11.cxx:109