Logo ROOT  
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
28 kTextCenterY = BIT(5)
29};
30
31
32//--- Widget status
33
38};
39
40
41class TGWindow;
42
43class TGWidget {
44
45protected:
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):
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
61public:
63 fWidgetId(-1), fWidgetFlags(0), fMsgWindow(nullptr), fCommand() { }
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
#define ClassDef(name, id)
Definition Rtypes.h:337
#define BIT(n)
Definition Rtypes.h:85
ETextJustification
Definition TGWidget.h:22
@ kTextCenterX
Definition TGWidget.h:25
@ kTextLeft
Definition TGWidget.h:23
@ kTextBottom
Definition TGWidget.h:27
@ kTextTop
Definition TGWidget.h:26
@ kTextRight
Definition TGWidget.h:24
@ kTextCenterY
Definition TGWidget.h:28
EWidgetStatus
Definition TGWidget.h:34
@ kWidgetIsEnabled
Definition TGWidget.h:37
@ kWidgetWantFocus
Definition TGWidget.h:35
@ kWidgetHasFocus
Definition TGWidget.h:36
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize id
The widget base class.
Definition TGWidget.h:43
Int_t fWidgetId
the widget id (used for event processing)
Definition TGWidget.h:46
virtual void Associate(const TGWindow *w)
Definition TGWidget.h:72
TGWidget(Int_t id)
Definition TGWidget.h:64
TString fCommand
command to be executed
Definition TGWidget.h:49
const char * GetCommand() const
Definition TGWidget.h:74
Bool_t HasFocus() const
Definition TGWidget.h:70
Int_t ClearFlags(Int_t flags)
Definition TGWidget.h:59
virtual ~TGWidget()
Definition TGWidget.h:66
Int_t fWidgetFlags
widget status flags (OR of EWidgetStatus)
Definition TGWidget.h:47
Int_t SetFlags(Int_t flags)
Definition TGWidget.h:58
TGWidget()
Definition TGWidget.h:62
const TGWindow * fMsgWindow
window which handles widget events
Definition TGWidget.h:48
Bool_t IsEnabled() const
Definition TGWidget.h:69
TGWidget & operator=(const TGWidget &tgw)
Definition TGWidget.h:54
TGWidget(const TGWidget &tgw)
Definition TGWidget.h:51
virtual void SetCommand(const char *command)
Definition TGWidget.h:73
Int_t WidgetId() const
Definition TGWidget.h:68
Bool_t WantFocus() const
Definition TGWidget.h:71
ROOT GUI Window base class.
Definition TGWindow.h:23
Basic string class.
Definition TString.h:139
const char * Data() const
Definition TString.h:380