Public Member Functions | |
Editor (const TGWindow *main, UInt_t w, UInt_t h) | |
virtual | ~Editor () |
void | LoadFile (const char *file) |
void | LoadBuffer (const char *buffer) |
void | AddBuffer (const char *buffer) |
TGTextEdit * | GetEditor () const |
void | SetTitle () |
void | Popup () |
void | CloseWindow () |
void | DoOK () |
void | DoOpen () |
void | DoSave () |
void | DoClose () |
Private Attributes | |
TGTransientFrame * | fMain |
TGTextEdit * | fEdit |
TGTextButton * | fOK |
TGLayoutHints * | fL1 |
TGLayoutHints * | fL2 |
Definition at line 488 of file guitest.C.
Editor::Editor | ( | const TGWindow * | main, | |
UInt_t | w, | |||
UInt_t | h | |||
) |
Definition at line 2438 of file guitest.C.
02439 { 02440 // Create an editor in a dialog. 02441 02442 fMain = new TGTransientFrame(gClient->GetRoot(), main, w, h); 02443 fMain->Connect("CloseWindow()", "Editor", this, "CloseWindow()"); 02444 fMain->DontCallClose(); // to avoid double deletions. 02445 02446 // use hierarchical cleaning 02447 fMain->SetCleanup(kDeepCleanup); 02448 02449 fEdit = new TGTextEdit(fMain, w, h, kSunkenFrame | kDoubleBorder); 02450 fL1 = new TGLayoutHints(kLHintsExpandX | kLHintsExpandY, 3, 3, 3, 3); 02451 fMain->AddFrame(fEdit, fL1); 02452 fEdit->Connect("Opened()", "Editor", this, "DoOpen()"); 02453 fEdit->Connect("Saved()", "Editor", this, "DoSave()"); 02454 fEdit->Connect("Closed()", "Editor", this, "DoClose()"); 02455 02456 // set selected text colors 02457 Pixel_t pxl; 02458 gClient->GetColorByName("#3399ff", pxl); 02459 fEdit->SetSelectBack(pxl); 02460 fEdit->SetSelectFore(TGFrame::GetWhitePixel()); 02461 02462 fOK = new TGTextButton(fMain, " &OK "); 02463 fOK->Connect("Clicked()", "Editor", this, "DoOK()"); 02464 fL2 = new TGLayoutHints(kLHintsBottom | kLHintsCenterX, 0, 0, 5, 5); 02465 fMain->AddFrame(fOK, fL2); 02466 02467 SetTitle(); 02468 02469 fMain->MapSubwindows(); 02470 02471 fMain->Resize(); 02472 02473 // editor covers right half of parent window 02474 fMain->CenterOnParent(kTRUE, TGTransientFrame::kRight); 02475 }
Editor::~Editor | ( | ) | [virtual] |
void Editor::LoadFile | ( | const char * | file | ) |
void Editor::LoadBuffer | ( | const char * | buffer | ) |
Definition at line 2508 of file guitest.C.
Referenced by TestMainFrame::DoButton().
02509 { 02510 // Load a text buffer in the editor. 02511 02512 fEdit->LoadBuffer(buffer); 02513 }
void Editor::AddBuffer | ( | const char * | buffer | ) |
Definition at line 2522 of file guitest.C.
Referenced by TestMainFrame::DoButton().
02523 { 02524 // Add text to the editor. 02525 02526 TGText txt; 02527 txt.LoadBuffer(buffer); 02528 fEdit->AddText(&txt); 02529 }
TGTextEdit* Editor::GetEditor | ( | ) | const [inline] |
void Editor::SetTitle | ( | ) |
Definition at line 2484 of file guitest.C.
Referenced by DoOpen(), DoSave(), and Editor().
02485 { 02486 // Set title in editor window. 02487 02488 TGText *txt = GetEditor()->GetText(); 02489 Bool_t untitled = !strlen(txt->GetFileName()) ? kTRUE : kFALSE; 02490 02491 char title[256]; 02492 if (untitled) 02493 sprintf(title, "ROOT Editor - Untitled"); 02494 else 02495 sprintf(title, "ROOT Editor - %s", txt->GetFileName()); 02496 02497 fMain->SetWindowName(title); 02498 fMain->SetIconName(title); 02499 }
void Editor::Popup | ( | ) |
Definition at line 2501 of file guitest.C.
Referenced by TestMainFrame::DoButton().
02502 { 02503 // Show editor. 02504 02505 fMain->MapWindow(); 02506 }
void Editor::CloseWindow | ( | ) |
void Editor::DoOK | ( | ) |
Definition at line 2538 of file guitest.C.
02539 { 02540 // Handle ok button. 02541 02542 CloseWindow(); 02543 }
void Editor::DoClose | ( | ) |
Definition at line 2555 of file guitest.C.
02556 { 02557 // Handle close button. 02558 02559 CloseWindow(); 02560 }
TGTransientFrame* Editor::fMain [private] |
TGTextEdit* Editor::fEdit [private] |
Definition at line 492 of file guitest.C.
Referenced by AddBuffer(), Editor(), GetEditor(), LoadBuffer(), and LoadFile().
TGTextButton* Editor::fOK [private] |
TGLayoutHints* Editor::fL1 [private] |
TGLayoutHints* Editor::fL2 [private] |