Logo ROOT  
Reference Guide
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 
23  kTextLeft = BIT(0),
26  kTextTop = BIT(3),
28  kTextCenterY = BIT(5)
29 };
30 
31 
32 //--- Widget status
33 
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):
53  fMsgWindow(tgw.fMsgWindow), fCommand(tgw.fCommand) { }
54  TGWidget& operator=(const TGWidget& tgw) {
55  if(this!=&tgw) {
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:
63  fWidgetId(-1), fWidgetFlags(0), fMsgWindow(0), 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
TGWindow
ROOT GUI Window base class.
Definition: TGWindow.h:23
kTextTop
@ kTextTop
Definition: TGWidget.h:26
TString::Data
const char * Data() const
Definition: TString.h:369
EWidgetStatus
EWidgetStatus
Definition: TGWidget.h:34
TGWidget
The widget base class.
Definition: TGWidget.h:43
kTextCenterX
@ kTextCenterX
Definition: TGWidget.h:25
kTextCenterY
@ kTextCenterY
Definition: TGWidget.h:28
TGWidget::WantFocus
Bool_t WantFocus() const
Definition: TGWidget.h:71
TString
Basic string class.
Definition: TString.h:136
TString.h
bool
TGWidget::HasFocus
Bool_t HasFocus() const
Definition: TGWidget.h:70
id
XFontStruct * id
Definition: TGX11.cxx:109
TGWidget::GetCommand
const char * GetCommand() const
Definition: TGWidget.h:74
kTextLeft
@ kTextLeft
Definition: TGWidget.h:23
TGWidget::fCommand
TString fCommand
command to be executed
Definition: TGWidget.h:49
TGWidget::SetCommand
virtual void SetCommand(const char *command)
Definition: TGWidget.h:73
WidgetMessageTypes.h
TGWidget::TGWidget
TGWidget(Int_t id)
Definition: TGWidget.h:64
TGWidget::WidgetId
Int_t WidgetId() const
Definition: TGWidget.h:68
TGWidget::fMsgWindow
const TGWindow * fMsgWindow
window which handles widget events
Definition: TGWidget.h:48
TGWidget::Associate
virtual void Associate(const TGWindow *w)
Definition: TGWidget.h:72
GuiTypes.h
TGWidget::fWidgetFlags
Int_t fWidgetFlags
widget status flags (OR of EWidgetStatus)
Definition: TGWidget.h:47
kWidgetIsEnabled
@ kWidgetIsEnabled
Definition: TGWidget.h:37
TGWidget::IsEnabled
Bool_t IsEnabled() const
Definition: TGWidget.h:69
BIT
#define BIT(n)
Definition: Rtypes.h:85
kTextBottom
@ kTextBottom
Definition: TGWidget.h:27
kWidgetHasFocus
@ kWidgetHasFocus
Definition: TGWidget.h:36
TGWidget::~TGWidget
virtual ~TGWidget()
Definition: TGWidget.h:66
TGWidget::fWidgetId
Int_t fWidgetId
the widget id (used for event processing)
Definition: TGWidget.h:46
TGWidget::ClearFlags
Int_t ClearFlags(Int_t flags)
Definition: TGWidget.h:59
TGWidget::TGWidget
TGWidget()
Definition: TGWidget.h:62
ETextJustification
ETextJustification
Definition: TGWidget.h:22
ClassDef
#define ClassDef(name, id)
Definition: Rtypes.h:325
TGWidget::SetFlags
Int_t SetFlags(Int_t flags)
Definition: TGWidget.h:58
kTextRight
@ kTextRight
Definition: TGWidget.h:24
TGWidget::TGWidget
TGWidget(const TGWidget &tgw)
Definition: TGWidget.h:51
kWidgetWantFocus
@ kWidgetWantFocus
Definition: TGWidget.h:35
TGWidget::operator=
TGWidget & operator=(const TGWidget &tgw)
Definition: TGWidget.h:54
int