2 // Category: interfaces
5 //===================================================
7 //--------TG4Editor.cxx--------------------------//
8 //------- A service class for GUI--------------//
10 //=================================================
12 #include "TG4Editor.h"
15 #include <TGTextEdit.h>
21 TG4Editor::TG4Editor(const TGWindow* main, UInt_t w, UInt_t h) :
22 TGTransientFrame(gClient->GetRoot(), main, w, h)
26 fEdit = new TGTextEdit(this, w, h, kSunkenFrame | kDoubleBorder);
27 fL1 = new TGLayoutHints(kLHintsExpandX | kLHintsExpandY, 3, 3, 3, 3);
30 fOK = new TGTextButton(this, " &OK ");
31 fL2 = new TGLayoutHints(kLHintsBottom | kLHintsCenterX, 0, 0, 5, 5);
38 Resize(GetDefaultSize());
40 // position relative to the parent's window
43 gVirtualX->TranslateCoordinates(main->GetId(), GetParent()->GetId(),
44 ((TGFrame *) main)->GetWidth() - (fWidth >> 1),
45 (((TGFrame *) main)->GetHeight() - fHeight) >> 1,
48 SetWMPosition(ax, ay);
51 TG4Editor::~TG4Editor()
53 // Delete editor accessories
61 void TG4Editor::SetTitle()
63 // Set title in editor window.
65 TGText* txt = GetEditor()->GetText();
66 Bool_t untitled = !strlen(txt->GetFileName()) ? kTRUE : kFALSE;
70 sprintf(title, "Status Report");
72 //sprintf(title, "Editor - %s", txt->GetFileName());
78 void TG4Editor::Popup()
85 void TG4Editor::LoadBuffer(const char* buffer)
87 // Load a text buffer in the editor.
89 fEdit->LoadBuffer(buffer);
92 void TG4Editor::LoadFile(const char* file)
94 // Load a file in the editor.
96 fEdit->LoadFile(file);
99 void TG4Editor::CloseWindow()
101 // Called when closed via window manager action.
106 Bool_t TG4Editor::ProcessMessage(Long_t msg, Long_t, Long_t)
108 // Process Help Menu.
111 switch (GET_MSG(msg)) {
113 switch (GET_SUBMSG(msg)) {
115 // Only one button and one action...
123 switch (GET_SUBMSG(msg)) {