00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021 #include "TRootHelpDialog.h"
00022 #include "TGButton.h"
00023 #include "TGTextView.h"
00024
00025
00026 ClassImp(TRootHelpDialog)
00027
00028
00029 TRootHelpDialog::TRootHelpDialog(const TGWindow *main,
00030 const char *title, UInt_t w, UInt_t h) :
00031 TGTransientFrame(gClient->GetRoot(), main, w, h)
00032 {
00033
00034
00035 fView = new TGTextView(this, w, h, kSunkenFrame | kDoubleBorder);
00036 fL1 = new TGLayoutHints(kLHintsExpandX | kLHintsExpandY, 3, 3, 3, 3);
00037 AddFrame(fView, fL1);
00038
00039 fOK = new TGTextButton(this, " &OK ");
00040 fL2 = new TGLayoutHints(kLHintsBottom | kLHintsCenterX, 0, 0, 5, 5);
00041 AddFrame(fOK, fL2);
00042
00043 SetWindowName(title);
00044 SetIconName(title);
00045
00046 MapSubwindows();
00047
00048 Resize(GetDefaultSize());
00049
00050
00051 CenterOnParent();
00052 }
00053
00054
00055 TRootHelpDialog::~TRootHelpDialog()
00056 {
00057
00058
00059 delete fView;
00060 delete fOK;
00061 delete fL1;
00062 delete fL2;
00063 }
00064
00065
00066 void TRootHelpDialog::Popup()
00067 {
00068
00069
00070 MapWindow();
00071 }
00072
00073
00074 void TRootHelpDialog::SetText(const char *helpText)
00075 {
00076
00077
00078 fView->LoadBuffer(helpText);
00079 }
00080
00081
00082 void TRootHelpDialog::AddText(const char *helpText)
00083 {
00084
00085
00086 TGText tt;
00087 tt.LoadBuffer(helpText);
00088 fView->AddText(&tt);
00089 }
00090
00091
00092 void TRootHelpDialog::CloseWindow()
00093 {
00094
00095
00096 DeleteWindow();
00097 }
00098
00099
00100 Bool_t TRootHelpDialog::ProcessMessage(Long_t msg, Long_t, Long_t)
00101 {
00102
00103
00104 switch (GET_MSG(msg)) {
00105 case kC_COMMAND:
00106 switch (GET_SUBMSG(msg)) {
00107 case kCM_BUTTON:
00108
00109 DeleteWindow();
00110 break;
00111 default:
00112 break;
00113 }
00114 default:
00115 break;
00116 }
00117
00118 return kTRUE;
00119 }
00120