ROOT
master
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
#include "
GuiTypes.h
"
17
#include "
WidgetMessageTypes.h
"
18
#include "
TString.h
"
19
20
//--- Text justification modes
21
22
enum
ETextJustification
{
23
kTextLeft
=
BIT
(0),
24
kTextRight
=
BIT
(1),
25
kTextCenterX
=
BIT
(2),
26
kTextTop
=
BIT
(3),
27
kTextBottom
=
BIT
(4),
28
kTextCenterY
=
BIT
(5)
29
};
30
31
32
//--- Widget status
33
34
enum
EWidgetStatus
{
35
kWidgetWantFocus
=
BIT
(0),
36
kWidgetHasFocus
=
BIT
(1),
37
kWidgetIsEnabled
=
BIT
(2)
38
};
39
40
41
class
TGWindow
;
42
43
class
TGWidget
{
44
45
protected
:
46
Int_t
fWidgetId
;
///< the widget id (used for event processing)
47
Int_t
fWidgetFlags
;
///< widget status flags (OR of EWidgetStatus)
48
const
TGWindow
*
fMsgWindow
;
///< window which handles widget events
49
TString
fCommand
;
///< command to be executed
50
51
TGWidget
(
const
TGWidget
& tgw):
52
fWidgetId
(tgw.
fWidgetId
),
fWidgetFlags
(tgw.
fWidgetFlags
),
53
fMsgWindow
(tgw.
fMsgWindow
),
fCommand
(tgw.
fCommand
) { }
54
TGWidget
&
operator=
(
const
TGWidget
& tgw) {
55
if
(
this
!=&tgw) {
56
fWidgetId
=tgw.
fWidgetId
;
fWidgetFlags
=tgw.
fWidgetFlags
;
57
fMsgWindow
=tgw.
fMsgWindow
;
fCommand
=tgw.
fCommand
; }
return
*
this
; }
58
Int_t
SetFlags
(
Int_t
flags) {
return
fWidgetFlags
|= flags; }
59
Int_t
ClearFlags
(
Int_t
flags) {
return
fWidgetFlags
&= ~flags; }
60
61
public
:
62
TGWidget
():
63
fWidgetId
(-1),
fWidgetFlags
(0),
fMsgWindow
(nullptr),
fCommand
() { }
64
TGWidget
(
Int_t
id
):
65
fWidgetId
(
id
),
fWidgetFlags
(0),
fMsgWindow
(nullptr),
fCommand
() { }
66
virtual
~TGWidget
() { }
67
68
Int_t
WidgetId
()
const
{
return
fWidgetId
; }
69
Bool_t
IsEnabled
()
const
{
return
(
Bool_t
)((
fWidgetFlags
&
kWidgetIsEnabled
) != 0); }
70
Bool_t
HasFocus
()
const
{
return
(
Bool_t
)((
fWidgetFlags
&
kWidgetHasFocus
) != 0); }
71
Bool_t
WantFocus
()
const
{
return
(
Bool_t
)((
fWidgetFlags
&
kWidgetWantFocus
) != 0); }
72
virtual
void
Associate
(
const
TGWindow
*
w
) {
fMsgWindow
=
w
; }
73
virtual
void
SetCommand
(
const
char
*command) {
fCommand
= command; }
74
const
char
*
GetCommand
()
const
{
return
fCommand
.
Data
(); }
75
76
ClassDef
(
TGWidget
,0)
// Widget base class
77
};
78
79
#endif
GuiTypes.h
ClassDef
#define ClassDef(name, id)
Definition
Rtypes.h:342
BIT
#define BIT(n)
Definition
Rtypes.h:90
ETextJustification
ETextJustification
Definition
TGWidget.h:22
kTextCenterX
@ kTextCenterX
Definition
TGWidget.h:25
kTextLeft
@ kTextLeft
Definition
TGWidget.h:23
kTextBottom
@ kTextBottom
Definition
TGWidget.h:27
kTextTop
@ kTextTop
Definition
TGWidget.h:26
kTextRight
@ kTextRight
Definition
TGWidget.h:24
kTextCenterY
@ kTextCenterY
Definition
TGWidget.h:28
EWidgetStatus
EWidgetStatus
Definition
TGWidget.h:34
kWidgetIsEnabled
@ kWidgetIsEnabled
Definition
TGWidget.h:37
kWidgetWantFocus
@ kWidgetWantFocus
Definition
TGWidget.h:35
kWidgetHasFocus
@ kWidgetHasFocus
Definition
TGWidget.h:36
w
winID w
Definition
TGWin32VirtualGLProxy.cxx:39
id
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize id
Definition
TGWin32VirtualXProxy.cxx:94
TString.h
WidgetMessageTypes.h
TGWidget
The widget base class.
Definition
TGWidget.h:43
TGWidget::fWidgetId
Int_t fWidgetId
the widget id (used for event processing)
Definition
TGWidget.h:46
TGWidget::Associate
virtual void Associate(const TGWindow *w)
Definition
TGWidget.h:72
TGWidget::TGWidget
TGWidget(Int_t id)
Definition
TGWidget.h:64
TGWidget::fCommand
TString fCommand
command to be executed
Definition
TGWidget.h:49
TGWidget::GetCommand
const char * GetCommand() const
Definition
TGWidget.h:74
TGWidget::HasFocus
Bool_t HasFocus() const
Definition
TGWidget.h:70
TGWidget::ClearFlags
Int_t ClearFlags(Int_t flags)
Definition
TGWidget.h:59
TGWidget::~TGWidget
virtual ~TGWidget()
Definition
TGWidget.h:66
TGWidget::fWidgetFlags
Int_t fWidgetFlags
widget status flags (OR of EWidgetStatus)
Definition
TGWidget.h:47
TGWidget::SetFlags
Int_t SetFlags(Int_t flags)
Definition
TGWidget.h:58
TGWidget::TGWidget
TGWidget()
Definition
TGWidget.h:62
TGWidget::fMsgWindow
const TGWindow * fMsgWindow
window which handles widget events
Definition
TGWidget.h:48
TGWidget::IsEnabled
Bool_t IsEnabled() const
Definition
TGWidget.h:69
TGWidget::operator=
TGWidget & operator=(const TGWidget &tgw)
Definition
TGWidget.h:54
TGWidget::TGWidget
TGWidget(const TGWidget &tgw)
Definition
TGWidget.h:51
TGWidget::SetCommand
virtual void SetCommand(const char *command)
Definition
TGWidget.h:73
TGWidget::WidgetId
Int_t WidgetId() const
Definition
TGWidget.h:68
TGWidget::WantFocus
Bool_t WantFocus() const
Definition
TGWidget.h:71
TGWindow
ROOT GUI Window base class.
Definition
TGWindow.h:23
TString
Basic string class.
Definition
TString.h:139
TString::Data
const char * Data() const
Definition
TString.h:376
bool
int
gui
gui
inc
TGWidget.h
ROOT master - Reference Guide Generated on Sat Nov 16 2024 09:38:04 (GVA Time) using Doxygen 1.9.8