Logo ROOT  
Reference Guide
 
Loading...
Searching...
No Matches
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/** \class TRootHelpDialog
14 \ingroup guiwidgets
15
16A TRootHelpDialog is used to display help text (or any text in a
17dialog window). There is on OK button to popdown the dialog.
18
19*/
20
21
22#include "TRootHelpDialog.h"
23#include "TGButton.h"
24#include "TGTextView.h"
25
26
28
29////////////////////////////////////////////////////////////////////////////////
30/// Create a help text dialog.
31
33 const char *title, UInt_t w, UInt_t h) :
34 TGTransientFrame(gClient->GetRoot(), main, w, h)
35{
39
40 fOK = new TGTextButton(this, " &OK ");
41 fL2 = new TGLayoutHints(kLHintsBottom | kLHintsCenterX, 0, 0, 5, 5);
43
44 SetWindowName(title);
45 SetIconName(title);
46
48
50
51 // position relative to the parent's window
53}
54
55////////////////////////////////////////////////////////////////////////////////
56/// Delete help text dialog.
57
59{
60 delete fView;
61 delete fOK;
62 delete fL1;
63 delete fL2;
64}
65
66////////////////////////////////////////////////////////////////////////////////
67/// Show help dialog.
68
70{
71 MapWindow();
72}
73
74////////////////////////////////////////////////////////////////////////////////
75/// Set help text from helpText buffer in TGTextView.
76
77void TRootHelpDialog::SetText(const char *helpText)
78{
79 fView->LoadBuffer(helpText);
80}
81
82////////////////////////////////////////////////////////////////////////////////
83/// Add help text from helpText buffer to already existing text in TGTextView.
84
85void TRootHelpDialog::AddText(const char *helpText)
86{
87 TGText tt;
88 tt.LoadBuffer(helpText);
89 fView->AddText(&tt);
90}
91
92////////////////////////////////////////////////////////////////////////////////
93/// Called when closed via window manager action.
94
96{
98}
99
100////////////////////////////////////////////////////////////////////////////////
101/// Process OK button.
102
104{
105 switch (GET_MSG(msg)) {
106 case kC_COMMAND:
107 switch (GET_SUBMSG(msg)) {
108 case kCM_BUTTON:
109 // Only one button and one action...
110 DeleteWindow();
111 break;
112 default:
113 break;
114 }
115 default:
116 break;
117 }
118
119 return kTRUE;
120}
121
@ kSunkenFrame
Definition GuiTypes.h:383
@ kDoubleBorder
Definition GuiTypes.h:385
int main()
Definition Prototype.cxx:12
#define h(i)
Definition RSha256.hxx:106
long Longptr_t
Definition RtypesCore.h:82
constexpr Bool_t kTRUE
Definition RtypesCore.h:100
#define ClassImp(name)
Definition Rtypes.h:377
#define gClient
Definition TGClient.h:157
@ kLHintsExpandY
Definition TGLayout.h:31
@ kLHintsCenterX
Definition TGLayout.h:25
@ kLHintsBottom
Definition TGLayout.h:29
@ kLHintsExpandX
Definition TGLayout.h:30
Int_t GET_MSG(Long_t val)
@ kC_COMMAND
@ kCM_BUTTON
Int_t GET_SUBMSG(Long_t val)
TGDimension GetDefaultSize() const override
std::cout << fWidth << "x" << fHeight << std::endl;
Definition TGFrame.h:316
virtual void AddFrame(TGFrame *f, TGLayoutHints *l=nullptr)
Add frame to the composite frame using the specified layout hints.
Definition TGFrame.cxx:1117
void MapSubwindows() override
Map all sub windows that are part of the composite frame.
Definition TGFrame.cxx:1164
void Resize(UInt_t w=0, UInt_t h=0) override
Resize the frame.
Definition TGFrame.cxx:605
void MapWindow() override
map window
Definition TGFrame.h:204
virtual void DeleteWindow()
Delete window.
Definition TGFrame.cxx:276
This class describes layout hints used by the layout classes.
Definition TGLayout.h:50
void SetIconName(const char *name)
Set window icon name. This is typically done via the window manager.
Definition TGFrame.cxx:1801
void SetWindowName(const char *name=nullptr) override
Set window name. This is typically done via the window manager.
Definition TGFrame.cxx:1788
Yield an action as soon as it is clicked.
Definition TGButton.h:142
A TGTextView is a text viewer widget.
Definition TGTextView.h:22
virtual Bool_t LoadBuffer(const char *txtbuf)
Load text from a text buffer. Return false in case of failure.
virtual void AddText(TGText *text)
Add text to the view widget.
A TGText is a multi line text buffer.
Definition TGText.h:57
Bool_t LoadBuffer(const char *txtbuf)
Load a 0 terminated buffer. Lines will be split at ' '.
Definition TGText.cxx:513
Defines transient windows that typically are used for dialogs windows.
Definition TGFrame.h:498
virtual void CenterOnParent(Bool_t croot=kTRUE, EPlacement pos=kCenter)
Position transient frame centered relative to the parent frame.
Definition TGFrame.cxx:1957
ROOT GUI Window base class.
Definition TGWindow.h:23
A TRootHelpDialog is used to display help text (or any text in a dialog window).
void SetText(const char *helpText)
Set help text from helpText buffer in TGTextView.
TGTextView * fView
text view
virtual ~TRootHelpDialog()
Delete help text dialog.
Bool_t ProcessMessage(Longptr_t msg, Longptr_t parm1, Longptr_t parm2) override
Process OK button.
TRootHelpDialog(const TRootHelpDialog &)=delete
void Popup()
Show help dialog.
TGLayoutHints * fL1
layout of TGTextView
TGLayoutHints * fL2
layout of OK button
void CloseWindow() override
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
OK button.
auto * tt
Definition textangle.C:16