Logo ROOT  
Reference Guide
TRootHelpDialog.cxx
Go to the documentation of this file.
1// @(#)root/gui:$Id$
2// Author: Fons Rademakers 24/02/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//////////////////////////////////////////////////////////////////////////
13// //
14// TRootHelpDialog //
15// //
16// A TRootHelpDialog is used to display help text (or any text in a //
17// dialog window). There is on OK button to popdown the dialog. //
18// //
19//////////////////////////////////////////////////////////////////////////
20
21#include "TRootHelpDialog.h"
22#include "TGButton.h"
23#include "TGTextView.h"
24
25
27
28////////////////////////////////////////////////////////////////////////////////
29/// Create a help text dialog.
30
32 const char *title, UInt_t w, UInt_t h) :
33 TGTransientFrame(gClient->GetRoot(), main, w, h)
34{
35 fView = new TGTextView(this, w, h, kSunkenFrame | kDoubleBorder);
38
39 fOK = new TGTextButton(this, " &OK ");
40 fL2 = new TGLayoutHints(kLHintsBottom | kLHintsCenterX, 0, 0, 5, 5);
42
43 SetWindowName(title);
44 SetIconName(title);
45
47
49
50 // position relative to the parent's window
52}
53
54////////////////////////////////////////////////////////////////////////////////
55/// Delete help text dialog.
56
58{
59 delete fView;
60 delete fOK;
61 delete fL1;
62 delete fL2;
63}
64
65////////////////////////////////////////////////////////////////////////////////
66/// Show help dialog.
67
69{
70 MapWindow();
71}
72
73////////////////////////////////////////////////////////////////////////////////
74/// Set help text from helpText buffer in TGTextView.
75
76void TRootHelpDialog::SetText(const char *helpText)
77{
78 fView->LoadBuffer(helpText);
79}
80
81////////////////////////////////////////////////////////////////////////////////
82/// Add help text from helpText buffer to already existing text in TGTextView.
83
84void TRootHelpDialog::AddText(const char *helpText)
85{
86 TGText tt;
87 tt.LoadBuffer(helpText);
88 fView->AddText(&tt);
89}
90
91////////////////////////////////////////////////////////////////////////////////
92/// Called when closed via window manager action.
93
95{
97}
98
99////////////////////////////////////////////////////////////////////////////////
100/// Process OK button.
101
103{
104 switch (GET_MSG(msg)) {
105 case kC_COMMAND:
106 switch (GET_SUBMSG(msg)) {
107 case kCM_BUTTON:
108 // Only one button and one action...
109 DeleteWindow();
110 break;
111 default:
112 break;
113 }
114 default:
115 break;
116 }
117
118 return kTRUE;
119}
120
#define h(i)
Definition: RSha256.hxx:106
unsigned int UInt_t
Definition: RtypesCore.h:42
long Long_t
Definition: RtypesCore.h:50
bool Bool_t
Definition: RtypesCore.h:59
const Bool_t kTRUE
Definition: RtypesCore.h:87
#define ClassImp(name)
Definition: Rtypes.h:365
#define gClient
Definition: TGClient.h:166
@ kSunkenFrame
Definition: TGFrame.h:61
@ kDoubleBorder
Definition: TGFrame.h:63
@ kLHintsExpandY
Definition: TGLayout.h:38
@ kLHintsCenterX
Definition: TGLayout.h:32
@ kLHintsBottom
Definition: TGLayout.h:36
@ kLHintsExpandX
Definition: TGLayout.h:37
Int_t GET_MSG(Long_t val)
@ kC_COMMAND
@ kCM_BUTTON
Int_t GET_SUBMSG(Long_t val)
virtual void AddFrame(TGFrame *f, TGLayoutHints *l=0)
Add frame to the composite frame using the specified layout hints.
Definition: TGFrame.cxx:1099
virtual TGDimension GetDefaultSize() const
std::cout << fWidth << "x" << fHeight << std::endl;
Definition: TGFrame.h:375
virtual void MapSubwindows()
Map all sub windows that are part of the composite frame.
Definition: TGFrame.cxx:1146
virtual void DeleteWindow()
Delete window.
Definition: TGFrame.cxx:258
virtual void Resize(UInt_t w=0, UInt_t h=0)
Resize the frame.
Definition: TGFrame.cxx:587
virtual void MapWindow()
Definition: TGFrame.h:251
void SetIconName(const char *name)
Set window icon name. This is typically done via the window manager.
Definition: TGFrame.cxx:1759
void SetWindowName(const char *name=0)
Set window name. This is typically done via the window manager.
Definition: TGFrame.cxx:1746
virtual Bool_t LoadBuffer(const char *txtbuf)
Load text from a text buffer. Return false in case of failure.
Definition: TGTextView.cxx:469
virtual void AddText(TGText *text)
Add text to the view widget.
Definition: TGTextView.cxx:206
Definition: TGText.h:67
virtual void CenterOnParent(Bool_t croot=kTRUE, EPlacement pos=kCenter)
Position transient frame centered relative to the parent frame.
Definition: TGFrame.cxx:1913
void SetText(const char *helpText)
Set help text from helpText buffer in TGTextView.
TGTextView * fView
virtual ~TRootHelpDialog()
Delete help text dialog.
TRootHelpDialog(const TRootHelpDialog &)
void Popup()
Show help dialog.
TGLayoutHints * fL1
TGLayoutHints * fL2
Bool_t ProcessMessage(Long_t msg, Long_t parm1, Long_t parm2)
Process OK button.
void CloseWindow()
Called when closed via window manager action.
void AddText(const char *helpText)
Add help text from helpText buffer to already existing text in TGTextView.
TGTextButton * fOK
int main(int argc, char **argv)
auto * tt
Definition: textangle.C:16