ROOT
6.07/01
Reference Guide
ROOT Home Page
Main Page
Tutorials
User's Classes
Namespaces
All Classes
Files
Release Notes
File List
File Members
All
Classes
Namespaces
Files
Functions
Variables
Typedefs
Enumerations
Enumerator
Properties
Friends
Macros
Groups
Pages
gui
gui
inc
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
#ifndef ROOT_GuiTypes
27
#include "
GuiTypes.h
"
28
#endif
29
#ifndef ROOT_TGString
30
#include "
TGString.h
"
31
#endif
32
#ifndef ROOT_WidgetMessageTypes
33
#include "
WidgetMessageTypes.h
"
34
#endif
35
36
37
//--- Text justification modes
38
39
enum
ETextJustification
{
40
kTextLeft
=
BIT
(0),
41
kTextRight
=
BIT
(1),
42
kTextCenterX
=
BIT
(2),
43
kTextTop
=
BIT
(3),
44
kTextBottom
=
BIT
(4),
45
kTextCenterY
=
BIT
(5)
46
};
47
48
49
//--- Widget status
50
51
enum
EWidgetStatus
{
52
kWidgetWantFocus
=
BIT
(0),
53
kWidgetHasFocus
=
BIT
(1),
54
kWidgetIsEnabled
=
BIT
(2)
55
};
56
57
58
class
TGWindow
;
59
60
61
class
TGWidget
{
62
63
protected
:
64
Int_t
fWidgetId
;
// the widget id (used for event processing)
65
Int_t
fWidgetFlags
;
// widget status flags (OR of EWidgetStatus)
66
const
TGWindow
*
fMsgWindow
;
// window which handles widget events
67
TString
fCommand
;
// command to be executed
68
69
TGWidget
(
const
TGWidget
& tgw):
70
fWidgetId
(tgw.
fWidgetId
),
fWidgetFlags
(tgw.
fWidgetFlags
),
71
fMsgWindow
(tgw.
fMsgWindow
),
fCommand
(tgw.
fCommand
) { }
72
TGWidget
&
operator=
(
const
TGWidget
& tgw) {
73
if
(
this
!=&tgw) {
74
fWidgetId
=tgw.
fWidgetId
;
fWidgetFlags
=tgw.
fWidgetFlags
;
75
fMsgWindow
=tgw.
fMsgWindow
;
fCommand
=tgw.
fCommand
; }
return
*
this
; }
76
Int_t
SetFlags
(
Int_t
flags) {
return
fWidgetFlags
|= flags; }
77
Int_t
ClearFlags
(
Int_t
flags) {
return
fWidgetFlags
&= ~flags; }
78
79
public
:
80
TGWidget
():
81
fWidgetId
(-1),
fWidgetFlags
(0),
fMsgWindow
(0),
fCommand
() { }
82
TGWidget
(
Int_t
id
):
83
fWidgetId
(id),
fWidgetFlags
(0),
fMsgWindow
(0),
fCommand
() { }
84
virtual
~TGWidget
() { }
85
86
Int_t
WidgetId
()
const
{
return
fWidgetId
; }
87
Bool_t
IsEnabled
()
const
{
return
(
Bool_t
)((
fWidgetFlags
&
kWidgetIsEnabled
) != 0); }
88
Bool_t
HasFocus
()
const
{
return
(
Bool_t
)((
fWidgetFlags
&
kWidgetHasFocus
) != 0); }
89
Bool_t
WantFocus
()
const
{
return
(
Bool_t
)((
fWidgetFlags
&
kWidgetWantFocus
) != 0); }
90
virtual
void
Associate
(
const
TGWindow
*
w
) {
fMsgWindow
=
w
; }
91
virtual
void
SetCommand
(
const
char
*command) {
fCommand
= command; }
92
const
char
*
GetCommand
()
const
{
return
fCommand
.
Data
(); }
93
94
ClassDef
(
TGWidget
,0)
// Widget base class
95
};
96
97
#endif
TGWidget::HasFocus
Bool_t HasFocus() const
Definition:
TGWidget.h:88
TGWidget::GetCommand
const char * GetCommand() const
Definition:
TGWidget.h:92
kTextCenterX
Definition:
TGWidget.h:42
TGWidget::TGWidget
TGWidget(Int_t id)
Definition:
TGWidget.h:82
TGWidget::TGWidget
TGWidget(const TGWidget &tgw)
Definition:
TGWidget.h:69
WidgetMessageTypes.h
BIT
#define BIT(n)
Definition:
Rtypes.h:120
TGWidget::operator=
TGWidget & operator=(const TGWidget &tgw)
Definition:
TGWidget.h:72
TGWidget::SetFlags
Int_t SetFlags(Int_t flags)
Definition:
TGWidget.h:76
TGWidget::IsEnabled
Bool_t IsEnabled() const
Definition:
TGWidget.h:87
TString
Basic string class.
Definition:
TString.h:137
Int_t
int Int_t
Definition:
RtypesCore.h:41
Bool_t
bool Bool_t
Definition:
RtypesCore.h:59
ETextJustification
ETextJustification
Definition:
TGWidget.h:39
TGWidget::fWidgetId
Int_t fWidgetId
Definition:
TGWidget.h:64
TString::Data
const char * Data() const
Definition:
TString.h:349
ClassDef
#define ClassDef(name, id)
Definition:
Rtypes.h:254
TGWidget::SetCommand
virtual void SetCommand(const char *command)
Definition:
TGWidget.h:91
kTextRight
Definition:
TGWidget.h:41
TGWidget::~TGWidget
virtual ~TGWidget()
Definition:
TGWidget.h:84
TGWidget::WantFocus
Bool_t WantFocus() const
Definition:
TGWidget.h:89
TGWidget::fMsgWindow
const TGWindow * fMsgWindow
Definition:
TGWidget.h:66
TGWindow
Definition:
TGWindow.h:38
TGWidget::fCommand
TString fCommand
Definition:
TGWidget.h:67
TGWidget::ClearFlags
Int_t ClearFlags(Int_t flags)
Definition:
TGWidget.h:77
kTextTop
Definition:
TGWidget.h:43
kTextCenterY
Definition:
TGWidget.h:45
TGWidget::Associate
virtual void Associate(const TGWindow *w)
Definition:
TGWidget.h:90
kTextBottom
Definition:
TGWidget.h:44
qtexample.w
tuple w
Definition:
qtexample.py:51
kWidgetHasFocus
Definition:
TGWidget.h:53
kWidgetIsEnabled
Definition:
TGWidget.h:54
kWidgetWantFocus
Definition:
TGWidget.h:52
GuiTypes.h
TGWidget::WidgetId
Int_t WidgetId() const
Definition:
TGWidget.h:86
TGString.h
TGWidget
Definition:
TGWidget.h:61
kTextLeft
Definition:
TGWidget.h:40
EWidgetStatus
EWidgetStatus
Definition:
TGWidget.h:51
TGWidget::fWidgetFlags
Int_t fWidgetFlags
Definition:
TGWidget.h:65
TGWidget::TGWidget
TGWidget()
Definition:
TGWidget.h:80