Logo ROOT  
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-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#include "TGFrame.h"
17#include "TGCanvas.h"
18#include "TGWidget.h"
19
20class TGButton;
21class TGCanvas;
22class TTimer;
23class TList;
24
25class TGShutterItem : public TGVerticalFrame, public TGWidget {
26
27friend class TGShutter;
28
29protected:
30 TGButton *fButton; ///< shutter item button
31 TGCanvas *fCanvas; ///< canvas of shutter item
32 TGFrame *fContainer; ///< container in canvas containing shutter items
33 TGLayoutHints *fL1, *fL2; ///< positioning hints
34
35private:
36 TGShutterItem(const TGShutterItem&) = delete;
38
39public:
40 TGShutterItem(const TGWindow *p = nullptr, TGHotString *s = nullptr, Int_t id = -1,
41 UInt_t options = 0);
42 virtual ~TGShutterItem();
43
44 TGButton *GetButton() const { return fButton; }
45 TGFrame *GetContainer() const { return fCanvas->GetContainer(); }
46 virtual void Selected() { Emit(" Selected()"); } //*SIGNAL*
47
48 void SavePrimitive(std::ostream &out, Option_t *option = "") override;
49
50 ClassDefOverride(TGShutterItem,0) // Shutter widget item
51};
52
53
54
56
57protected:
58 TTimer *fTimer; ///< Timer for animation
59 TGShutterItem *fSelectedItem; ///< Item currently open
60 TGShutterItem *fClosingItem; ///< Item closing down
61 TList *fTrash; ///< Items that need to be cleaned up
62 Int_t fHeightIncrement; ///< Height delta
63 Int_t fClosingHeight; ///< Closing items current height
64 Int_t fClosingHadScrollbar; ///< Closing item had a scroll bar
65 UInt_t fDefWidth; ///< Default width
66 UInt_t fDefHeight; ///< Default height
67
68private:
69 TGShutter(const TGShutter&) = delete;
70 TGShutter& operator=(const TGShutter&) = delete;
71
72public:
73 TGShutter(const TGWindow *p = nullptr, UInt_t options = kSunkenFrame);
74 virtual ~TGShutter();
75
76 virtual void AddItem(TGShutterItem *item);
77 virtual void RemoveItem(const char *name);
78 virtual TGShutterItem *AddPage(const char *item = "Page"); //*MENU*
79 virtual void RemovePage(); //*MENU*
80 virtual void RenamePage(const char *name); //*MENU*
81 Bool_t HandleTimer(TTimer *t) override;
82 void Layout() override;
85 TGShutterItem *GetItem(const char *name);
86 virtual void SetSelectedItem(TGShutterItem *item);
87 virtual void SetSelectedItem(const char *name);
88 virtual void EnableItem(const char *name, Bool_t on = kTRUE);
89
90 TGDimension GetDefaultSize() const override;
91 virtual void SetDefaultSize(UInt_t w, UInt_t h);
92
93 void SavePrimitive(std::ostream &out, Option_t *option = "") override;
94
95 Bool_t ProcessMessage(Longptr_t cmd, Longptr_t parm1, Longptr_t parm2) override;
96 virtual void Selected(TGShutterItem *item) { Emit(" Selected(TGShutterItem*)", item); } //*SIGNAL*
97
98 ClassDefOverride(TGShutter,0) // Shutter widget
99};
100
101#endif
@ kSunkenFrame
Definition: GuiTypes.h:383
#define h(i)
Definition: RSha256.hxx:106
bool Bool_t
Definition: RtypesCore.h:63
long Longptr_t
Definition: RtypesCore.h:82
unsigned int UInt_t
Definition: RtypesCore.h:46
const Bool_t kTRUE
Definition: RtypesCore.h:100
const char Option_t
Definition: RtypesCore.h:66
#define ClassDefOverride(name, id)
Definition: Rtypes.h:339
winID h TVirtualViewer3D TVirtualGLPainter p
Option_t Option_t option
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void on
char name[80]
Definition: TGX11.cxx:110
A button abstract base class.
Definition: TGButton.h:68
A frame containing two scrollbars (a horizontal and a vertical) and a viewport.
Definition: TGCanvas.h:192
TGFrame * GetContainer() const
Definition: TGCanvas.h:216
The base class for composite widgets (menu bars, list boxes, etc.).
Definition: TGFrame.h:287
A subclasses of TGWindow, and is used as base class for some simple widgets (buttons,...
Definition: TGFrame.h:80
TGHotString is a string with a "hot" character underlined.
Definition: TGString.h:42
This class describes layout hints used by the layout classes.
Definition: TGLayout.h:50
Frame layout manager.
Definition: TGLayout.h:135
void SavePrimitive(std::ostream &out, Option_t *option="") override
Save a shutter item widget as a C++ statement(s) on output stream out.
Definition: TGShutter.cxx:385
TGLayoutHints * fL2
positioning hints
Definition: TGShutter.h:33
TGFrame * fContainer
container in canvas containing shutter items
Definition: TGShutter.h:32
virtual ~TGShutterItem()
Clan up shutter item.
Definition: TGShutter.cxx:371
TGCanvas * fCanvas
canvas of shutter item
Definition: TGShutter.h:31
TGLayoutHints * fL1
Definition: TGShutter.h:33
TGButton * GetButton() const
Definition: TGShutter.h:44
TGShutterItem & operator=(const TGShutterItem &)=delete
virtual void Selected()
Definition: TGShutter.h:46
TGButton * fButton
shutter item button
Definition: TGShutter.h:30
TGShutterItem(const TGShutterItem &)=delete
TGFrame * GetContainer() const
Definition: TGShutter.h:45
A shutter widget contains a set of shutter items that can be open and closed like a shutter.
Definition: TGShutter.h:55
virtual void AddItem(TGShutterItem *item)
Add shutter item to shutter frame.
Definition: TGShutter.cxx:73
virtual void RemovePage()
Remove selected page.
Definition: TGShutter.cxx:121
TGShutterItem * fClosingItem
Item closing down.
Definition: TGShutter.h:60
TGDimension GetDefaultSize() const override
Return the default / minimal size of the widget.
Definition: TGShutter.cxx:322
TGShutter & operator=(const TGShutter &)=delete
TTimer * fTimer
Timer for animation.
Definition: TGShutter.h:58
Bool_t ProcessMessage(Longptr_t cmd, Longptr_t parm1, Longptr_t parm2) override
Handle shutter messages.
Definition: TGShutter.cxx:158
TGShutterItem * GetItem(const char *name)
returns a shutter item by name (name is hot string of shutter item)
Definition: TGShutter.cxx:302
void SavePrimitive(std::ostream &out, Option_t *option="") override
Save a shutter widget as a C++ statement(s) on output stream out.
Definition: TGShutter.cxx:439
UInt_t fDefHeight
Default height.
Definition: TGShutter.h:66
TGShutterItem * fSelectedItem
Item currently open.
Definition: TGShutter.h:59
void SetLayoutManager(TGLayoutManager *) override
Set the layout manager for the composite frame.
Definition: TGShutter.h:83
virtual void EnableItem(const char *name, Bool_t on=kTRUE)
Disable/enbale shutter item.
Definition: TGShutter.cxx:289
virtual void SetSelectedItem(TGShutterItem *item)
Set item to be the currently open shutter item.
Definition: TGShutter.cxx:267
TGShutter(const TGShutter &)=delete
TList * fTrash
Items that need to be cleaned up.
Definition: TGShutter.h:61
Int_t fHeightIncrement
Height delta.
Definition: TGShutter.h:62
virtual void SetDefaultSize(UInt_t w, UInt_t h)
Set the default / minimal size of the widget.
Definition: TGShutter.cxx:332
void Layout() override
Layout shutter items.
Definition: TGShutter.cxx:218
Int_t fClosingHeight
Closing items current height.
Definition: TGShutter.h:63
virtual void Selected(TGShutterItem *item)
Definition: TGShutter.h:96
TGShutterItem * GetSelectedItem() const
Definition: TGShutter.h:84
Int_t fClosingHadScrollbar
Closing item had a scroll bar.
Definition: TGShutter.h:64
virtual TGShutterItem * AddPage(const char *item="Page")
Add new page (shutter item)
Definition: TGShutter.cxx:145
virtual ~TGShutter()
Cleanup shutter widget.
Definition: TGShutter.cxx:59
virtual void RenamePage(const char *name)
Rename selected page.
Definition: TGShutter.cxx:133
UInt_t fDefWidth
Default width.
Definition: TGShutter.h:65
Bool_t HandleTimer(TTimer *t) override
Shutter item animation.
Definition: TGShutter.cxx:198
virtual void RemoveItem(const char *name)
Remove item from shutter.
Definition: TGShutter.cxx:86
A composite frame that layout their children in vertical way.
Definition: TGFrame.h:374
The widget base class.
Definition: TGWidget.h:43
ROOT GUI Window base class.
Definition: TGWindow.h:23
A doubly linked list.
Definition: TList.h:38
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
static constexpr double s