Logo ROOT   6.30.04
Reference Guide
 All Namespaces Files Pages
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