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
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
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
@ kSunkenFrame
Definition GuiTypes.h:384
@ kDoubleBorder
Definition GuiTypes.h:386
#define h(i)
Definition RSha256.hxx:106
long Longptr_t
Integer large enough to hold a pointer (platform-dependent).
Definition RtypesCore.h:89
unsigned int UInt_t
Unsigned integer 4 bytes (unsigned int).
Definition RtypesCore.h:60
bool Bool_t
Boolean (0=false, 1=true) (bool).
Definition RtypesCore.h:77
constexpr Bool_t kTRUE
Definition RtypesCore.h:107
#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:318
virtual void AddFrame(TGFrame *f, TGLayoutHints *l=nullptr)
Add frame to the composite frame using the specified layout hints.
Definition TGFrame.cxx:1109
void MapSubwindows() override
Map all sub windows that are part of the composite frame.
Definition TGFrame.cxx:1156
void Resize(UInt_t w=0, UInt_t h=0) override
Resize the frame.
Definition TGFrame.cxx:597
void MapWindow() override
map window
Definition TGFrame.h:206
virtual void DeleteWindow()
Delete window.
Definition TGFrame.cxx:268
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:1793
void SetWindowName(const char *name=nullptr) override
Set window name. This is typically done via the window manager.
Definition TGFrame.cxx:1780
Yield an action as soon as it is clicked.
Definition TGButton.h:142
A TGTextView is a text viewer widget.
Definition TGTextView.h:22
A TGText is a multi line text buffer.
Definition TGText.h:57
TGTransientFrame(const TGTransientFrame &)=delete
virtual void CenterOnParent(Bool_t croot=kTRUE, EPlacement pos=kCenter)
Position transient frame centered relative to the parent frame.
Definition TGFrame.cxx:1949
ROOT GUI Window base class.
Definition TGWindow.h:23
void SetText(const char *helpText)
Set help text from helpText buffer in TGTextView.
TGTextView * fView
text view
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.
~TRootHelpDialog() override
Delete help text dialog.
void AddText(const char *helpText)
Add help text from helpText buffer to already existing text in TGTextView.
TGTextButton * fOK
OK button.
int main(int argc, char **argv)
Definition hadd.cxx:631
auto * tt
Definition textangle.C:16