ROOT  6.06/09
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 #ifndef ROOT_TGFrame
28 #include "TGFrame.h"
29 #endif
30 #ifndef ROOT_TGCanvas
31 #include "TGCanvas.h"
32 #endif
33 #ifndef ROOT_TGWidget
34 #include "TGWidget.h"
35 #endif
36 
37 
38 class TGButton;
39 class TGCanvas;
40 class TTimer;
41 class TList;
42 
43 
44 
45 class TGShutterItem : public TGVerticalFrame, public TGWidget {
46 
47 friend class TGShutter;
48 
49 protected:
50  TGButton *fButton; // shutter item button
51  TGCanvas *fCanvas; // canvas of shutter item
52  TGFrame *fContainer; // container in canvas containing shutter items
53  TGLayoutHints *fL1, *fL2; // positioning hints
54 
55 private:
56  TGShutterItem(const TGShutterItem&); // not implemented
57  TGShutterItem& operator=(const TGShutterItem&); // not implemented
58 
59 public:
60  TGShutterItem(const TGWindow *p = 0, TGHotString *s = 0, Int_t id = -1,
61  UInt_t options = 0);
62  virtual ~TGShutterItem();
63 
64  TGButton *GetButton() const { return fButton; }
65  TGFrame *GetContainer() const { return fCanvas->GetContainer(); }
66  virtual void Selected() { Emit(" Selected()"); } //*SIGNAL*
67 
68  virtual void SavePrimitive(std::ostream &out, Option_t *option = "");
69 
70  ClassDef(TGShutterItem,0) // Shutter widget item
71 };
72 
73 
74 
75 class TGShutter : public TGCompositeFrame {
76 
77 protected:
78  TTimer *fTimer; // Timer for animation
79  TGShutterItem *fSelectedItem; // Item currently open
80  TGShutterItem *fClosingItem; // Item closing down
81  TList *fTrash; // Items that need to be cleaned up
82  Int_t fHeightIncrement; // Height delta
83  Int_t fClosingHeight; // Closing items current height
84  Int_t fClosingHadScrollbar; // Closing item had a scroll bar
85  UInt_t fDefWidth; // Default width
86  UInt_t fDefHeight; // Default height
87 
88 private:
89  TGShutter(const TGShutter&); // not implemented
90  TGShutter& operator=(const TGShutter&); // not implemented
91 
92 public:
93  TGShutter(const TGWindow *p = 0, UInt_t options = kSunkenFrame);
94  virtual ~TGShutter();
95 
96  virtual void AddItem(TGShutterItem *item);
97  virtual void RemoveItem(const char *name);
98  virtual TGShutterItem *AddPage(const char *item = "Page"); //*MENU*
99  virtual void RemovePage(); //*MENU*
100  virtual void RenamePage(const char *name); //*MENU*
101  virtual Bool_t HandleTimer(TTimer *t);
102  virtual void Layout();
105  TGShutterItem *GetItem(const char *name);
106  virtual void SetSelectedItem(TGShutterItem *item);
107  virtual void SetSelectedItem(const char *name);
108  virtual void EnableItem(const char *name, Bool_t on = kTRUE);
109 
110  virtual TGDimension GetDefaultSize() const;
111  virtual void SetDefaultSize(UInt_t w, UInt_t h);
112 
113  virtual void SavePrimitive(std::ostream &out, Option_t *option = "");
114 
115  virtual Bool_t ProcessMessage(Long_t cmd, Long_t parm1, Long_t parm2);
116  virtual void Selected(TGShutterItem *item) { Emit(" Selected(TGShutterItem*)", item); } //*SIGNAL*
117 
118  ClassDef(TGShutter,0) // Shutter widget
119 };
120 
121 #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:82
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:116
TH1 * h
Definition: legend2.C:5
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
Int_t fClosingHadScrollbar
Definition: TGShutter.h:84
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
#define ClassDef(name, id)
Definition: Rtypes.h:254
virtual TGDimension GetDefaultSize() const
Return the default / minimal size of the widget.
Definition: TGShutter.cxx:320
TTimer * fTimer
Definition: TGShutter.h:78
virtual ~TGShutter()
Cleanup shutter widget.
Definition: TGShutter.cxx:57
TGButton * GetButton() const
Definition: TGShutter.h:64
TGLayoutHints * fL1
Definition: TGShutter.h:53
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:81
TGButton * fButton
Definition: TGShutter.h:50
char * out
Definition: TBase64.cxx:29
void Emit(const char *signal)
Acitvate signal without args.
Definition: TQObject.cxx:559
virtual TGShutterItem * AddPage(const char *item="Page")
Add new page (shutter item)
Definition: TGShutter.cxx:143
A doubly linked list.
Definition: TList.h:47
UInt_t fDefHeight
Definition: TGShutter.h:86
TGFrame * GetContainer() const
Definition: TGShutter.h:65
UInt_t fDefWidth
Definition: TGShutter.h:85
virtual void Selected()
Definition: TGShutter.h:66
unsigned int UInt_t
Definition: RtypesCore.h:42
TGFrame * GetContainer() const
Definition: TGCanvas.h:228
Handles synchronous and a-synchronous timer events.
Definition: TTimer.h:57
TGLayoutHints * fL2
Definition: TGShutter.h:53
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:52
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 &)
TGShutterItem * GetSelectedItem() const
Definition: TGShutter.h:104
virtual void SetLayoutManager(TGLayoutManager *)
Set the layout manager for the composite frame.
Definition: TGShutter.h:103
Int_t fClosingHeight
Definition: TGShutter.h:83
TGShutterItem * fSelectedItem
Definition: TGShutter.h:79
TGCanvas * fCanvas
Definition: TGShutter.h:51
TGShutterItem * fClosingItem
Definition: TGShutter.h:80
#define name(a, b)
Definition: linkTestLib0.cpp:5
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
const Bool_t kTRUE
Definition: Rtypes.h:91