ROOT
v6-24
Reference Guide
Loading...
Searching...
No Matches
TGWidget.h
Go to the documentation of this file.
1
// @(#)root/gui:$Id$
2
// Author: Fons Rademakers 05/01/98
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_TGWidget
13
#define ROOT_TGWidget
14
15
16
//////////////////////////////////////////////////////////////////////////
17
// //
18
// TGWidget //
19
// //
20
// The widget base class. It is light weight (all inline service //
21
// methods) and is typically used as mixin class (via multiple //
22
// inheritance), see for example TGButton. //
23
// //
24
//////////////////////////////////////////////////////////////////////////
25
26
#include "
GuiTypes.h
"
27
#include "
WidgetMessageTypes.h
"
28
#include "
TString.h
"
29
30
//--- Text justification modes
31
32
enum
ETextJustification
{
33
kTextLeft
=
BIT
(0),
34
kTextRight
=
BIT
(1),
35
kTextCenterX
=
BIT
(2),
36
kTextTop
=
BIT
(3),
37
kTextBottom
=
BIT
(4),
38
kTextCenterY
=
BIT
(5)
39
};
40
41
42
//--- Widget status
43
44
enum
EWidgetStatus
{
45
kWidgetWantFocus
=
BIT
(0),
46
kWidgetHasFocus
=
BIT
(1),
47
kWidgetIsEnabled
=
BIT
(2)
48
};
49
50
51
class
TGWindow
;
52
53
class
TGWidget
{
54
55
protected
:
56
Int_t
fWidgetId
;
// the widget id (used for event processing)
57
Int_t
fWidgetFlags
;
// widget status flags (OR of EWidgetStatus)
58
const
TGWindow
*
fMsgWindow
;
// window which handles widget events
59
TString
fCommand
;
// command to be executed
60
61
TGWidget
(
const
TGWidget
& tgw):
62
fWidgetId
(tgw.
fWidgetId
),
fWidgetFlags
(tgw.
fWidgetFlags
),
63
fMsgWindow
(tgw.
fMsgWindow
),
fCommand
(tgw.
fCommand
) { }
64
TGWidget
&
operator=
(
const
TGWidget
& tgw) {
65
if
(
this
!=&tgw) {
66
fWidgetId
=tgw.
fWidgetId
;
fWidgetFlags
=tgw.
fWidgetFlags
;
67
fMsgWindow
=tgw.
fMsgWindow
;
fCommand
=tgw.
fCommand
; }
return
*
this
; }
68
Int_t
SetFlags
(
Int_t
flags) {
return
fWidgetFlags
|= flags; }
69
Int_t
ClearFlags
(
Int_t
flags) {
return
fWidgetFlags
&= ~flags; }
70
71
public
:
72
TGWidget
():
73
fWidgetId
(-1),
fWidgetFlags
(0),
fMsgWindow
(0),
fCommand
() { }
74
TGWidget
(
Int_t
id
):
75
fWidgetId
(
id
),
fWidgetFlags
(0),
fMsgWindow
(0),
fCommand
() { }
76
virtual
~TGWidget
() { }
77
78
Int_t
WidgetId
()
const
{
return
fWidgetId
; }
79
Bool_t
IsEnabled
()
const
{
return
(
Bool_t
)((
fWidgetFlags
&
kWidgetIsEnabled
) != 0); }
80
Bool_t
HasFocus
()
const
{
return
(
Bool_t
)((
fWidgetFlags
&
kWidgetHasFocus
) != 0); }
81
Bool_t
WantFocus
()
const
{
return
(
Bool_t
)((
fWidgetFlags
&
kWidgetWantFocus
) != 0); }
82
virtual
void
Associate
(
const
TGWindow
*w) {
fMsgWindow
= w; }
83
virtual
void
SetCommand
(
const
char
*command) {
fCommand
= command; }
84
const
char
*
GetCommand
()
const
{
return
fCommand
.
Data
(); }
85
86
ClassDef
(
TGWidget
,0)
// Widget base class
87
};
88
89
#endif
GuiTypes.h
ClassDef
#define ClassDef(name, id)
Definition
Rtypes.h:325
BIT
#define BIT(n)
Definition
Rtypes.h:85
ETextJustification
ETextJustification
Definition
TGWidget.h:32
kTextCenterX
@ kTextCenterX
Definition
TGWidget.h:35
kTextLeft
@ kTextLeft
Definition
TGWidget.h:33
kTextBottom
@ kTextBottom
Definition
TGWidget.h:37
kTextTop
@ kTextTop
Definition
TGWidget.h:36
kTextRight
@ kTextRight
Definition
TGWidget.h:34
kTextCenterY
@ kTextCenterY
Definition
TGWidget.h:38
EWidgetStatus
EWidgetStatus
Definition
TGWidget.h:44
kWidgetIsEnabled
@ kWidgetIsEnabled
Definition
TGWidget.h:47
kWidgetWantFocus
@ kWidgetWantFocus
Definition
TGWidget.h:45
kWidgetHasFocus
@ kWidgetHasFocus
Definition
TGWidget.h:46
id
XFontStruct * id
Definition
TGX11.cxx:109
TString.h
WidgetMessageTypes.h
TGWidget
Definition
TGWidget.h:53
TGWidget::fWidgetId
Int_t fWidgetId
Definition
TGWidget.h:56
TGWidget::Associate
virtual void Associate(const TGWindow *w)
Definition
TGWidget.h:82
TGWidget::TGWidget
TGWidget(Int_t id)
Definition
TGWidget.h:74
TGWidget::fCommand
TString fCommand
Definition
TGWidget.h:59
TGWidget::GetCommand
const char * GetCommand() const
Definition
TGWidget.h:84
TGWidget::HasFocus
Bool_t HasFocus() const
Definition
TGWidget.h:80
TGWidget::ClearFlags
Int_t ClearFlags(Int_t flags)
Definition
TGWidget.h:69
TGWidget::~TGWidget
virtual ~TGWidget()
Definition
TGWidget.h:76
TGWidget::fWidgetFlags
Int_t fWidgetFlags
Definition
TGWidget.h:57
TGWidget::SetFlags
Int_t SetFlags(Int_t flags)
Definition
TGWidget.h:68
TGWidget::TGWidget
TGWidget()
Definition
TGWidget.h:72
TGWidget::fMsgWindow
const TGWindow * fMsgWindow
Definition
TGWidget.h:58
TGWidget::IsEnabled
Bool_t IsEnabled() const
Definition
TGWidget.h:79
TGWidget::operator=
TGWidget & operator=(const TGWidget &tgw)
Definition
TGWidget.h:64
TGWidget::TGWidget
TGWidget(const TGWidget &tgw)
Definition
TGWidget.h:61
TGWidget::SetCommand
virtual void SetCommand(const char *command)
Definition
TGWidget.h:83
TGWidget::WidgetId
Int_t WidgetId() const
Definition
TGWidget.h:78
TGWidget::WantFocus
Bool_t WantFocus() const
Definition
TGWidget.h:81
TGWindow
Definition
TGWindow.h:31
TString
Basic string class.
Definition
TString.h:136
TString::Data
const char * Data() const
Definition
TString.h:369
bool
int
gui
gui
inc
TGWidget.h
ROOT v6-24 - Reference Guide Generated on Fri May 26 2023 16:13:22 (GVA Time) using Doxygen 1.9.8