Logo ROOT  
Reference Guide
 
Loading...
Searching...
No Matches
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-2021, 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
32class TGButton;
33class TGCanvas;
34class TTimer;
35class TList;
36
37
38
39class TGShutterItem : public TGVerticalFrame, public TGWidget {
40
41friend class TGShutter;
42
43protected:
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
49private:
50 TGShutterItem(const TGShutterItem&) = delete;
52
53public:
54 TGShutterItem(const TGWindow *p = nullptr, TGHotString *s = nullptr, 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
70
71protected:
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
82private:
83 TGShutter(const TGShutter&) = delete;
84 TGShutter& operator=(const TGShutter&) = delete;
85
86public:
87 TGShutter(const TGWindow *p = nullptr, 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();
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
@ kSunkenFrame
Definition GuiTypes.h:383
#define h(i)
Definition RSha256.hxx:106
unsigned int UInt_t
Definition RtypesCore.h:46
long Long_t
Definition RtypesCore.h:54
bool Bool_t
Definition RtypesCore.h:63
const Bool_t kTRUE
Definition RtypesCore.h:91
const char Option_t
Definition RtypesCore.h:66
#define ClassDef(name, id)
Definition Rtypes.h:325
char name[80]
Definition TGX11.cxx:110
TGFrame * GetContainer() const
Definition TGCanvas.h:226
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.
TGFrame * fContainer
Definition TGShutter.h:46
virtual ~TGShutterItem()
Clan up shutter item.
TGCanvas * fCanvas
Definition TGShutter.h:45
TGLayoutHints * fL1
Definition TGShutter.h:47
TGButton * GetButton() const
Definition TGShutter.h:58
TGShutterItem & operator=(const TGShutterItem &)=delete
virtual void Selected()
Definition TGShutter.h:60
TGButton * fButton
Definition TGShutter.h:44
TGShutterItem(const TGShutterItem &)=delete
TGFrame * GetContainer() const
Definition TGShutter.h:59
virtual void AddItem(TGShutterItem *item)
Add shutter item to shutter frame.
Definition TGShutter.cxx:72
virtual void RemovePage()
Remove selected page.
virtual void SetLayoutManager(TGLayoutManager *)
Set the layout manager for the composite frame.
Definition TGShutter.h:97
TGShutterItem * fClosingItem
Definition TGShutter.h:74
TGShutter & operator=(const TGShutter &)=delete
TTimer * fTimer
Definition TGShutter.h:72
virtual void SavePrimitive(std::ostream &out, Option_t *option="")
Save a shutter widget as a C++ statement(s) on output stream out.
TGShutterItem * GetItem(const char *name)
returns a shutter item by name (name is hot string of shutter item)
virtual void Layout()
Layout shutter items.
virtual Bool_t HandleTimer(TTimer *t)
Shutter item animation.
UInt_t fDefHeight
Definition TGShutter.h:80
TGShutterItem * fSelectedItem
Definition TGShutter.h:73
virtual void EnableItem(const char *name, Bool_t on=kTRUE)
Disable/enbale shutter item.
virtual void SetSelectedItem(TGShutterItem *item)
Set item to be the currently open shutter item.
TGShutter(const TGShutter &)=delete
TList * fTrash
Definition TGShutter.h:75
Int_t fHeightIncrement
Definition TGShutter.h:76
virtual void SetDefaultSize(UInt_t w, UInt_t h)
Set the default / minimal size of the widget.
Int_t fClosingHeight
Definition TGShutter.h:77
virtual TGDimension GetDefaultSize() const
Return the default / minimal size of the widget.
virtual void Selected(TGShutterItem *item)
Definition TGShutter.h:110
TGShutterItem * GetSelectedItem() const
Definition TGShutter.h:98
Int_t fClosingHadScrollbar
Definition TGShutter.h:78
virtual TGShutterItem * AddPage(const char *item="Page")
Add new page (shutter item)
virtual ~TGShutter()
Cleanup shutter widget.
Definition TGShutter.cxx:58
virtual Bool_t ProcessMessage(Long_t cmd, Long_t parm1, Long_t parm2)
Handle shutter messages.
virtual void RenamePage(const char *name)
Rename selected page.
UInt_t fDefWidth
Definition TGShutter.h:79
virtual void RemoveItem(const char *name)
Remove item from shutter.
Definition TGShutter.cxx:85
A doubly linked list.
Definition TList.h:44
void Emit(const char *signal, const T &arg)
Activate signal with single parameter.
Definition TQObject.h:164
Handles synchronous and a-synchronous timer events.
Definition TTimer.h:51