Logo ROOT   6.21/01
Reference Guide
TGTextEditor.cxx
Go to the documentation of this file.
1 // @(#)root/gui:$Id: ca18aae7f02ae8574b0c5414c78ede465425855d $
2 // Author: Bertrand Bellenot 20/06/06
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  This source is based on Xclass95, a Win95-looking GUI toolkit.
14  Copyright (C) 1996, 1997 David Barth, Ricky Ralston, Hector Peraza.
15 
16  Xclass95 is free software; you can redistribute it and/or
17  modify it under the terms of the GNU Library General Public
18  License as published by the Free Software Foundation; either
19  version 2 of the License, or (at your option) any later version.
20 
21 **************************************************************************/
22 
23 //////////////////////////////////////////////////////////////////////////
24 // //
25 // TGTextEditor //
26 // //
27 // A simple text editor that uses the TGTextEdit widget. //
28 // It provides all functionalities of TGTextEdit as copy, paste, cut, //
29 // search, go to a given line number. In addition, it provides the //
30 // possibilities for compiling, executing or interrupting a running //
31 // macro. //
32 // //
33 // This class can be used in following ways: //
34 // - with file name as argument: //
35 // new TGTextEditor("hsimple.C"); //
36 // - with a TMacro* as argument: //
37 // TMacro *macro = new TMacro("hsimple.C"); //
38 // new TGTextEditor(macro); //
39 // //
40 // Basic Features: //
41 // //
42 // New Document //
43 // //
44 // To create a new blank document, select File menu / New, or click //
45 // the New toolbar button. It will create a new instance of //
46 // TGTextEditor. //
47 // //
48 // Open/Save File //
49 // //
50 // To open a file, select File menu / Open or click on the Open //
51 // toolbar button. This will bring up the standard File Dialog for //
52 // opening files. //
53 // If the current document has not been saved yet, you will be asked //
54 // either to save or abandon the changes. //
55 // To save the file using the same name, select File menu / Save or //
56 // the toolbar Save button. To change the file name use File menu / //
57 // Save As... or corresponding SaveAs button on the toolbar. //
58 // //
59 // Text Selection //
60 // //
61 // You can move the cursor by simply clicking on the desired location //
62 // with the left mouse button. To highlight some text, press the mouse //
63 // and drag the mouse while holding the left button pressed. //
64 // To select a word, double-click on it; //
65 // to select the text line - triple-click on it; //
66 // to select all do quadruple-click. //
67 // //
68 // Cut, Copy, Paste //
69 // //
70 // After selecting some text, you can cut or copy it to the clipboard. //
71 // A subsequent paste operation will insert the contents of the //
72 // clipboard at the current cursor location. //
73 // //
74 // Text Search //
75 // //
76 // The editor uses a standard Search dialog. You can specify a forward //
77 // or backward search direction starting from the current cursor //
78 // location according to the selection made of a case sensitive mode //
79 // or not. The last search can be repeated by pressing F3. //
80 // //
81 // Text Font //
82 // //
83 // You can change the text font by selecting Edit menu / Set Font. //
84 // The Font Dialog pops up and shows the Name, Style, and Size of any //
85 // available font. The selected font sample is shown in the preview //
86 // area. //
87 // //
88 // Executing Macros //
89 // //
90 // You can execute the currently loaded macro in the editor by //
91 // selecting Tools menu / Execute Macro; by clicking on the //
92 // corresponding toolbar button, or by using Ctrl+F5 accelerator keys. //
93 // This is identical to the command ".x macro.C" in the root prompt //
94 // command line. //
95 // //
96 // Compiling Macros //
97 // //
98 // The currently loaded macro can be compiled with ACLiC if you select //
99 // Tools menu / Compile Macro; by clicking on the corresponding //
100 // toolbar button, or by using Ctrl+F7 accelerator keys. //
101 // This is identical to the command ".L macro.C++" in the root prompt //
102 // command line. //
103 // //
104 // Interrupting a Running Macro //
105 // //
106 // You can interrupt a running macro by selecting the Tools menu / //
107 // Interrupt; by clicking on the corresponding toolbar button, or by //
108 // using Shift+F5 accelerator keys. //
109 // //
110 // Interface to CINT Interpreter //
111 // //
112 // Any command entered in the Command combo box will be passed to //
113 // the CINT interpreter. This combo box will keep the commands history //
114 // and will allow you to re-execute the same commands during an editor //
115 // session. //
116 // //
117 // Keyboard Bindings //
118 // //
119 // The following table lists the keyboard shortcuts and accelerator //
120 // keys. //
121 // //
122 // Key: Action: //
123 // ==== ======= //
124 // //
125 // Up Move cursor up. //
126 // Shift+Up Move cursor up and extend selection. //
127 // Down Move cursor down. //
128 // Shift+Down Move cursor down and extend selection. //
129 // Left Move cursor left. //
130 // Shift+Left Move cursor left and extend selection. //
131 // Right Move cursor right. //
132 // Shift+Right Move cursor right and extend selection. //
133 // Home Move cursor to begin of line. //
134 // Shift+Home Move cursor to begin of line and extend selection.//
135 // Ctrl+Home Move cursor to top of page. //
136 // End Move cursor to end of line. //
137 // Shift+End Move cursor to end of line and extend selection. //
138 // Ctrl+End Move cursor to end of page. //
139 // PgUp Move cursor up one page. //
140 // Shift+PgUp Move cursor up one page and extend selection. //
141 // PgDn Move cursor down one page. //
142 // Shift+PgDn Move cursor down one page and extend selection. //
143 // Delete Delete character after cursor, or text selection. //
144 // BackSpace Delete character before cursor, or text selection.//
145 // Ctrl+B Move cursor left. //
146 // Ctrl+D Delete character after cursor, or text selection. //
147 // Ctrl+E Move cursor to end of line. //
148 // Ctrl+H Delete character before cursor, or text selection.//
149 // Ctrl+K Delete characters from current position to the //
150 // end of line. //
151 // Ctrl+U Delete current line. //
152 // //
153 //Begin_Html
154 /*
155 <img src="gif/TGTextEditor.gif">
156 */
157 //End_Html
158 // //
159 //////////////////////////////////////////////////////////////////////////
160 
161 
162 #include "TROOT.h"
163 #include "TApplication.h"
164 #include "TSystem.h"
165 #include "TMacro.h"
166 #include "TInterpreter.h"
167 #include "TGMsgBox.h"
168 #include "TGFileDialog.h"
169 #include "TGFontDialog.h"
170 #include "TGTextEdit.h"
171 #include "TGMenu.h"
172 #include "TGButton.h"
173 #include "TGStatusBar.h"
174 #include "KeySymbols.h"
175 #include "TGToolBar.h"
176 #include "TG3DLine.h"
177 #include "TGLabel.h"
178 #include "TGTextEntry.h"
179 #include "TGTextEditDialogs.h"
180 #include "TGTextEditor.h"
181 #include "TGComboBox.h"
182 #include "TObjString.h"
183 #include "TRootHelpDialog.h"
184 #include "HelpText.h"
185 #ifdef WIN32
186 #include "TWin32SplashThread.h"
187 #endif
188 
189 const char *ed_filetypes[] = {
190  "ROOT Macros", "*.C",
191  "Source files", "*.cxx",
192  "Text files", "*.txt",
193  "All files", "*",
194  0, 0
195 };
196 
203 };
204 
206  { "ed_new.png", "New File", kFALSE, kM_FILE_NEW, 0 },
207  { "ed_open.png", "Open File", kFALSE, kM_FILE_OPEN, 0 },
208  { "ed_save.png", "Save File", kFALSE, kM_FILE_SAVE, 0 },
209  { "ed_saveas.png", "Save File As...", kFALSE, kM_FILE_SAVEAS, 0 },
210  { "", 0, 0, -1, 0 },
211  { "ed_print.png", "Print", kFALSE, kM_FILE_PRINT, 0 },
212  { "", 0, 0, -1, 0 },
213  { "ed_cut.png", "Cut selection", kFALSE, kM_EDIT_CUT, 0 },
214  { "ed_copy.png", "Copy selection", kFALSE, kM_EDIT_COPY, 0 },
215  { "ed_paste.png", "Paste selection", kFALSE, kM_EDIT_PASTE, 0 },
216  { "ed_delete.png", "Delete selection", kFALSE, kM_EDIT_DELETE, 0 },
217  { "", 0, 0, -1, 0 },
218  { "ed_find.png", "Find...", kFALSE, kM_SEARCH_FIND, 0 },
219  { "ed_findnext.png", "Find next", kFALSE, kM_SEARCH_FINDNEXT, 0 },
220  { "ed_goto.png", "Goto...", kFALSE, kM_SEARCH_GOTO, 0 },
221  { "", 0, 0, -1, 0 },
222  { "ed_compile.png", "Compile Macro", kFALSE, kM_TOOLS_COMPILE, 0 },
223  { "ed_execute.png", "Execute Macro", kFALSE, kM_TOOLS_EXECUTE, 0 },
224  { "ed_interrupt.png", "Interrupt", kFALSE, kM_TOOLS_INTERRUPT, 0 },
225  { "", 0, 0, -1, 0 },
226  { "ed_help.png", "Help Contents", kFALSE, kM_HELP_CONTENTS, 0 },
227  { "", 0, 0, -1, 0 },
228  { "ed_quit.png", "Close Editor", kFALSE, kM_FILE_EXIT, 0 },
229  { 0, 0, 0, 0, 0 }
230 };
231 
232 static char *gEPrinter = 0;
233 static char *gEPrintCommand = 0;
234 
236 
237 ////////////////////////////////////////////////////////////////////////////////
238 /// TGTextEditor constructor with file name as first argument.
239 
240 TGTextEditor::TGTextEditor(const char *filename, const TGWindow *p, UInt_t w,
241  UInt_t h) : TGMainFrame(p, w, h)
242 {
243  Build();
244  if (p && p != gClient->GetDefaultRoot()) {
245  // special case for TRootBrowser
246  // remove the command line combo box and its associated label
249  fLabel->UnmapWindow();
252  fToolBar->Layout();
253  }
254  if (filename) {
255  LoadFile(filename);
256  }
257  MapWindow();
258 }
259 
260 ////////////////////////////////////////////////////////////////////////////////
261 /// TGTextEditor constructor with pointer to a TMacro as first argument.
262 
264  TGMainFrame(p, w, h)
265 {
266  TString tmp;
267  Build();
268  if (p && p != gClient->GetDefaultRoot()) {
269  // special case for TRootBrowser
270  // remove the command line combo box and its associated label
272  fLabel->UnmapWindow();
275  fToolBar->Layout();
276  }
277  if (macro) {
278  fMacro = macro;
279  TIter next(macro->GetListOfLines());
280  TObjString *obj;
281  while ((obj = (TObjString*) next())) {
282  fTextEdit->AddLine(obj->GetName());
283  }
284  tmp.Form("TMacro : %s: %ld lines read.",
285  macro->GetName(), fTextEdit->ReturnLineCount());
286  fStatusBar->SetText(tmp.Data(), 0);
287  fFilename = macro->GetName();
288  fFilename += ".C";
289  tmp.Form("TMacro : %s - TGTextEditor", macro->GetName());
290  SetWindowName(tmp.Data());
291  }
292  MapWindow();
293 }
294 
295 ////////////////////////////////////////////////////////////////////////////////
296 /// TGTextEditor destructor.
297 
299 {
300  gApplication->Disconnect("Terminate(Int_t)");
301  if (fTimer) delete fTimer;
302  if (fMenuFile) delete fMenuFile;
303  if (fMenuEdit) delete fMenuEdit;
304  if (fMenuSearch) delete fMenuSearch;
305  if (fMenuTools) delete fMenuTools;
306  if (fMenuHelp) delete fMenuHelp;
307 }
308 
309 ////////////////////////////////////////////////////////////////////////////////
310 /// Delete TGTextEditor Window.
311 
313 {
314  gApplication->Disconnect("Terminate(Int_t)");
315  delete fTimer; fTimer = 0;
316  delete fMenuFile; fMenuFile = 0;
317  delete fMenuEdit; fMenuEdit = 0;
318  delete fMenuSearch; fMenuSearch = 0;
319  delete fMenuTools; fMenuTools = 0;
320  delete fMenuHelp; fMenuHelp = 0;
321  Cleanup();
323 }
324 
325 ////////////////////////////////////////////////////////////////////////////////
326 /// Build TGTextEditor widget.
327 
329 {
333 
335  fMenuFile->AddEntry("&New", kM_FILE_NEW);
337  fMenuFile->AddEntry("&Open...", kM_FILE_OPEN);
338  fMenuFile->AddEntry("&Close", kM_FILE_CLOSE);
339  fMenuFile->AddEntry("&Save", kM_FILE_SAVE);
340  fMenuFile->AddEntry("Save &As...", kM_FILE_SAVEAS);
342  fMenuFile->AddEntry("&Print...", kM_FILE_PRINT);
344  fMenuFile->AddEntry("E&xit", kM_FILE_EXIT);
345 
347  fMenuEdit->AddEntry("Cu&t\tCtrl+X", kM_EDIT_CUT);
348  fMenuEdit->AddEntry("&Copy\tCtrl+C", kM_EDIT_COPY);
349  fMenuEdit->AddEntry("&Paste\tCtrl+V", kM_EDIT_PASTE);
350  fMenuEdit->AddEntry("De&lete\tDel", kM_EDIT_DELETE);
352  fMenuEdit->AddEntry("Select &All\tCtrl+A", kM_EDIT_SELECTALL);
354  fMenuEdit->AddEntry("Set &Font", kM_EDIT_SELFONT);
355 
357  fMenuTools->AddEntry("&Compile Macro\tCtrl+F7", kM_TOOLS_COMPILE);
358  fMenuTools->AddEntry("&Execute Macro\tCtrl+F5", kM_TOOLS_EXECUTE);
359  fMenuTools->AddEntry("&Interrupt\tShift+F5", kM_TOOLS_INTERRUPT);
360 
365 
367  fMenuSearch->AddEntry("&Find...\tCtrl+F", kM_SEARCH_FIND);
368  fMenuSearch->AddEntry("Find &Next\tF3", kM_SEARCH_FINDNEXT);
370  fMenuSearch->AddEntry("&Goto Line...\tCtrl+L", kM_SEARCH_GOTO);
371 
373  fMenuHelp->AddEntry("&Help Topics\tF1", kM_HELP_CONTENTS);
375  fMenuHelp->AddEntry("&About...", kM_HELP_ABOUT);
376 
377  fMenuFile->Associate(this);
378  fMenuEdit->Associate(this);
379  fMenuSearch->Associate(this);
380  fMenuTools->Associate(this);
381  fMenuHelp->Associate(this);
382 
383  fMenuBar = new TGMenuBar(this, 1, 1, kHorizontalFrame);
390  kLHintsRight));
392 
393  //---- toolbar
394 
395  AddFrame(new TGHorizontal3DLine(this),
396  new TGLayoutHints(kLHintsTop | kLHintsExpandX, 0,0,2,2));
397  Int_t i,spacing = 8;
398  fToolBar = new TGToolBar(this, 60, 20, kHorizontalFrame);
400  for (i = 0; fTbData[i].fPixmap; i++) {
401  if (strlen(fTbData[i].fPixmap) == 0) {
402  spacing = 8;
403  continue;
404  }
405  fToolBar->AddButton(this, &fTbData[i], spacing);
406  spacing = 0;
407  }
408  fComboCmd = new TGComboBox(fToolBar, "");
411  fCommand->Associate(this);
414  kLHintsRight, 5, 5, 1, 1));
415 
416  fToolBar->AddFrame(fLabel = new TGLabel(fToolBar, "Command :"),
417  new TGLayoutHints(kLHintsCenterY | kLHintsRight, 5, 5, 1, 1));
419  0, 0, 0, 0));
420  AddFrame(new TGHorizontal3DLine(this),
421  new TGLayoutHints(kLHintsTop | kLHintsExpandX, 0,0,2,2));
422 
427 
428  fTextEdit = new TGTextEdit(this, 10, 10, 1);
429  if (gClient->GetStyle() < 2) {
430  Pixel_t pxl;
431  gClient->GetColorByName("#3399ff", pxl);
432  fTextEdit->SetSelectBack(pxl);
434  }
435  fTextEdit->Associate(this);
437 
438  Int_t parts[] = { 75, 25 };
439  fStatusBar = new TGStatusBar(this);
441  fStatusBar->SetParts(parts, 2);
443 
444  SetClassHints("ROOT", "TGTextEditor");
445  SetWindowName("Untitled - TGTextEditor");
446 
447  fMacro = 0;
448  fFilename = "Untitled";
450 
451  fTextEdit->SetFocus();
454  fTextEdit->Connect("DataChanged()", "TGTextEditor", this, "DataChanged()");
455  fTextEdit->Connect("Closed()", "TGTextEditor", this, "ClearText()");
456  fTextEdit->Connect("Opened()", "TGTextEditor", this, "ClearText()");
457  fTextEdit->Connect("DataDropped(char *)", "TGTextEditor", this, "DataDropped(char *)");
458  fTextEdit->MapWindow();
459 
460  MapSubwindows();
461  Resize(GetDefaultWidth() + 50, GetDefaultHeight() > 500 ? GetDefaultHeight() : 500);
462  Layout();
463 
464  gApplication->Connect("Terminate(Int_t)", "TGTextEditor", this, "ClearText()");
465  gVirtualX->GrabKey(fId, gVirtualX->KeysymToKeycode(kKey_F3), 0, kTRUE);
466 
469 
470  fTimer = new TTimer(this, 250);
471  fTimer->Reset();
472  fTimer->TurnOn();
473 
474  fExiting = kFALSE;
476 }
477 
478 ////////////////////////////////////////////////////////////////////////////////
479 /// Update file information when receiving the signal
480 /// DataDropped from TGTextEdit widget.
481 
482 void TGTextEditor::DataDropped(char *fname)
483 {
484  TString tmp;
485  fFilename = fname;
486  tmp.Form("%s: %ld lines read.", fname, fTextEdit->ReturnLineCount());
487  fStatusBar->SetText(tmp, 0);
488  tmp.Form("%s - TGTextEditor", fname);
489  SetWindowName(tmp.Data());
490 }
491 
492 ////////////////////////////////////////////////////////////////////////////////
493 /// Slot setting the fTextChanged flag to true when the text has been
494 /// modified in fTextEdit
495 
497 {
499 }
500 
501 ////////////////////////////////////////////////////////////////////////////////
502 /// Load a file into the editor. If fname is 0, a TGFileDialog will popup.
503 
504 void TGTextEditor::LoadFile(const char *fname)
505 {
506  TString tmp;
507  TGFileInfo fi;
509  switch (IsSaved()) {
510  case kMBCancel:
511  return;
512  case kMBYes:
513  if (!fFilename.CompareTo("Untitled"))
514  SaveFileAs();
515  else
517  if (fTextChanged) {
518  return;
519  }
520  break;
521  case kMBNo:
522  break;
523  default:
524  return;
525  }
526  if (fname == 0) {
527  new TGFileDialog(fClient->GetDefaultRoot(), this, kFDOpen, &fi);
528  if (fi.fFilename && strlen(fi.fFilename)) {
529  fname = fi.fFilename;
530  }
531  }
532  if (fname) {
533  if (!fTextEdit->LoadFile(fname)) {
534  tmp.Form("Error opening file \"%s\"", fname);
535  new TGMsgBox(fClient->GetRoot(), this, "TGTextEditor",
536  tmp.Data(), kMBIconExclamation, kMBOk);
537  } else {
538  fFilename = fname;
539  tmp.Form("%s: %ld lines read.", fname, fTextEdit->ReturnLineCount());
540  fStatusBar->SetText(tmp.Data(), 0);
541  tmp.Form("%s - TGTextEditor", fname);
542  SetWindowName(tmp.Data());
544  }
545  }
546  fTextEdit->Layout();
547 }
548 
549 ////////////////////////////////////////////////////////////////////////////////
550 /// Save the edited text in the file "fname".
551 
552 void TGTextEditor::SaveFile(const char *fname)
553 {
554  char *p;
555  TString tmp;
556 
557  if (!fTextEdit->SaveFile(fname)) {
558  tmp.Form("Error saving file \"%s\"", fname);
559  new TGMsgBox(fClient->GetRoot(), this, "TGTextEditor",
560  tmp.Data(), kMBIconExclamation, kMBOk);
561  return;
562  }
563  if ((p = (char *)strrchr(fname, '/')) == 0) {
564  p = (char *)fname;
565  } else {
566  ++p;
567  }
568  tmp.Form("%s: %ld lines written.", p, fTextEdit->ReturnLineCount());
569  fStatusBar->SetText(tmp.Data(), 0);
570 
571  tmp.Form("%s - TGTextEditor", p);
572  SetWindowName(tmp.Data());
574 }
575 
576 ////////////////////////////////////////////////////////////////////////////////
577 /// Save the edited text in a file selected with TGFileDialog.
578 /// Shouldn't we create a backup file?
579 
581 {
582  TString workdir = gSystem->WorkingDirectory();
583  static TString dir(".");
584  static Bool_t overwr = kFALSE;
585  TGFileInfo fi;
587  fi.SetIniDir(dir);
588  fi.fOverwrite = overwr;
589  new TGFileDialog(fClient->GetDefaultRoot(), this, kFDSave, &fi);
590  gSystem->ChangeDirectory(workdir.Data());
591  overwr = fi.fOverwrite;
592  if (fi.fFilename && strlen(fi.fFilename)) {
593  SaveFile(fi.fFilename);
594  fFilename = fi.fFilename;
595  return kTRUE;
596  }
597  return kFALSE;
598 }
599 
600 ////////////////////////////////////////////////////////////////////////////////
601 /// Check if file has to be saved in case of modifications.
602 
604 {
605  Int_t ret;
606  TString tmp;
607  Int_t opt = (kMBYes | kMBNo);
608 
609  tmp.Form("The text has been modified. Do you want to save the changes?");
610 
611  if (!fTextChanged) {
612  return kMBNo;
613  } else {
614  if (fParent == gClient->GetDefaultRoot())
615  opt |= kMBCancel;
616  new TGMsgBox(fClient->GetRoot(), this, "TGTextEditor",
617  tmp.Data(), kMBIconExclamation, opt, &ret);
618  return ret;
619  }
620 }
621 
622 ////////////////////////////////////////////////////////////////////////////////
623 /// Open the print dialog and send current buffer to printer.
624 
626 {
627  TString tmp;
628  Int_t ret = 0;
629  if (!gEPrinter) {
630  gEPrinter = StrDup("892_2_cor"); // use gEnv
631  gEPrintCommand = StrDup("xprint");
632  }
633  new TGPrintDialog(fClient->GetDefaultRoot(), this, 400, 150,
634  &gEPrinter, &gEPrintCommand, &ret);
635  if (ret) {
636  fTextEdit->Print();
637  tmp.Form("Printed: %s", fFilename.Data());
638  fStatusBar->SetText(tmp.Data(), 0);
639  }
640 }
641 
642 ////////////////////////////////////////////////////////////////////////////////
643 /// Close TGTextEditor window.
644 
646 {
647  Bool_t reallyClose = kFALSE;
648  if (fExiting) {
649  return;
650  }
651  fExiting = kTRUE;
652  switch (IsSaved()) {
653  case kMBYes:
654  if (!fFilename.CompareTo("Untitled"))
656  else
658  // close the editor only if the text has been saved and the
659  // TGTextEditor is not embedded in the ROOT browser
660  reallyClose = (!fTextChanged || (fParent != gClient->GetDefaultRoot()));
661  break;
662  case kMBCancel:
663  reallyClose = kFALSE;
664  break;
665  case kMBNo:
666  reallyClose = kTRUE;
667  break;
668  }
669  if (reallyClose) {
670  gApplication->Disconnect("Terminate(Int_t)");
672  }
673  fExiting = kFALSE;
674 }
675 
676 ////////////////////////////////////////////////////////////////////////////////
677 /// Keyboard event handler.
678 
680 {
681  char input[10];
682  UInt_t keysym;
683 
684  if (event->fType == kGKeyPress) {
685  gVirtualX->LookupString(event, input, sizeof(input), keysym);
686 
687  switch ((EKeySym)keysym) { // ignore these keys
688  case kKey_Shift:
689  case kKey_Control:
690  case kKey_Meta:
691  case kKey_Alt:
692  case kKey_CapsLock:
693  case kKey_NumLock:
694  case kKey_ScrollLock:
695  return kTRUE;
696  case kKey_F1:
698  kM_HELP_CONTENTS, 0);
699  return kTRUE;
700  case kKey_F3:
701  Search(kTRUE);
702  return kTRUE;
703  default:
704  break;
705  }
706  if (event->fState & kKeyControlMask) { // Ctrl key modifier pressed
707  switch((EKeySym)keysym) {
708  case kKey_F5:
709  ExecuteMacro();
710  return kTRUE;
711  case kKey_F7:
712  CompileMacro();
713  return kTRUE;
714  default:
715  break;
716  }
717  }
718  if (event->fState & kKeyShiftMask) { // Shift key modifier pressed
719  switch((EKeySym)keysym) {
720  case kKey_F5:
721  InterruptMacro();
722  return kTRUE;
723  default:
724  break;
725  }
726  }
727  }
728  return TGMainFrame::HandleKey(event);
729 }
730 
731 ////////////////////////////////////////////////////////////////////////////////
732 /// Clear text edit widget.
733 
735 {
736  fTextEdit->Clear();
737  fMacro = 0;
738  fFilename = "Untitled";
739  SetWindowName("Untitled - TGTextEditor");
740  fStatusBar->SetText("New File", 0);
742 }
743 
744 ////////////////////////////////////////////////////////////////////////////////
745 /// Invokes search dialog, or just search previous string if again is true.
746 
748 {
749  if (again) {
752  }
753  else {
755  }
756 }
757 
758 ////////////////////////////////////////////////////////////////////////////////
759 /// Invokes goto dialog, and go to the specified line.
760 
762 {
763  Long_t ret;
764 
765  new TGGotoDialog(fClient->GetDefaultRoot(), this, 400, 150, &ret);
766 
767  if (ret >= 0)
768  fTextEdit->Goto(ret-1);
769 }
770 
771 ////////////////////////////////////////////////////////////////////////////////
772 /// Save the edited text in a temporary macro, then compile it.
773 
775 {
776  if (fTextEdit->ReturnLineCount() < 3)
777  return;
778  if ((fMacro) || (!fFilename.CompareTo("Untitled"))) {
779  if (!SaveFileAs())
780  return;
781  }
782  char *tmpfile = gSystem->ConcatFileName(gSystem->TempDirectory(),
784  fTextEdit->SaveFile(tmpfile, kFALSE);
785  gSystem->CompileMacro(tmpfile);
786  gSystem->Unlink(tmpfile);
787  delete [] tmpfile;
788 }
789 
790 ////////////////////////////////////////////////////////////////////////////////
791 /// Save the edited text in a temporary macro, execute it, and then delete
792 /// the temporary file.
793 
795 {
796  if (fTextEdit->ReturnLineCount() < 3)
797  return;
798  if (fMacro) {
799  fMacro->Exec();
800  return;
801  }
802  if (fTextChanged) {
803  Int_t ret;
804  new TGMsgBox(fClient->GetRoot(), this, "TGTextEditor",
805  "The text has been modified. Do you want to save the changes?",
807  if (ret == kMBYes) {
808  if (!fFilename.CompareTo("Untitled"))
809  SaveFileAs();
810  else
813  }
814  if (ret == kMBCancel)
815  return;
816  }
817  if (!fFilename.CompareTo("Untitled")) {
818  //if (!SaveFileAs())
819  // return;
820  fFilename += ".C";
821  }
822  gInterpreter->SaveContext();
823  TString savdir = gSystem->WorkingDirectory();
824  TString tmpfile = gSystem->BaseName(fFilename.Data());
825  tmpfile += "_exec";
827  fTextEdit->SaveFile(tmpfile.Data(), kFALSE);
828  gROOT->SetExecutingMacro(kTRUE);
829  gROOT->Macro(tmpfile.Data());
830  gROOT->SetExecutingMacro(kFALSE);
831  if (gInterpreter->IsLoaded(tmpfile.Data()))
832  gInterpreter->UnloadFile(tmpfile.Data());
833  gSystem->Unlink(tmpfile.Data());
834  gSystem->ChangeDirectory(savdir.Data());
835  gInterpreter->Reset();
836 }
837 
838 ////////////////////////////////////////////////////////////////////////////////
839 /// Interrupt execution of a macro.
840 
842 {
843  gROOT->SetInterrupt(kTRUE);
844 }
845 
846 ////////////////////////////////////////////////////////////////////////////////
847 /// Display ROOT splash screen.
848 
850 {
851 #ifdef R__UNIX
852  TString rootx = TROOT::GetBinDir() + "/root -a &";
853  gSystem->Exec(rootx);
854 #else
855 #ifdef WIN32
857 #else
858  char str[32];
859  sprintf(str, "About ROOT %s...", gROOT->GetVersion());
860  TRootHelpDialog *hd = new TRootHelpDialog(this, str, 600, 400);
861  hd->SetText(gHelpAbout);
862  hd->Popup();
863 #endif
864 #endif
865 }
866 
867 ////////////////////////////////////////////////////////////////////////////////
868 /// Handle timer event.
869 
871 {
872  TString tmp;
873  if (t != fTimer) return kTRUE;
874  // check if some text is available in the clipboard
875  if ((gVirtualX->InheritsFrom("TGX11")) &&
876  (gVirtualX->GetPrimarySelectionOwner() == kNone)) {
879  }
880  else {
884  }
885  // check if text is selected in the editor
886  if (fTextEdit->IsMarked()) {
894  }
895  }
896  else {
904  }
905  }
906  // get cursor position
908  tmp.Form("Ln %ld, Ch %ld", pos.fY, pos.fX);
909  fStatusBar->SetText(tmp.Data(), 1);
910  fTimer->Reset();
911  return kTRUE;
912 }
913 
914 ////////////////////////////////////////////////////////////////////////////////
915 /// Handle menu and other command generated by the user.
916 
918 {
919  TRootHelpDialog *hd;
920 
921  switch(GET_MSG(msg)) {
922  case kC_COMMAND:
923  switch(GET_SUBMSG(msg)) {
924  case kCM_BUTTON:
925  case kCM_MENU:
926  switch (parm1) {
927  // "File" menu related events
928  case kM_FILE_NEW:
929  new TGTextEditor();
930  break;
931  case kM_FILE_OPEN:
932  LoadFile();
933  break;
934  case kM_FILE_CLOSE:
935  ClearText();
936  break;
937  case kM_FILE_SAVE:
938  if (!fFilename.CompareTo("Untitled"))
939  SaveFileAs();
940  else
942  break;
943  case kM_FILE_SAVEAS:
944  SaveFileAs();
945  break;
946  case kM_FILE_PRINT:
947  PrintText();
948  break;
949  case kM_FILE_EXIT:
950  CloseWindow();
951  break;
952 
953  // "Edit" menu related events
954  case kM_EDIT_CUT:
955  fTextEdit->Cut();
956  break;
957  case kM_EDIT_COPY:
958  fTextEdit->Copy();
959  break;
960  case kM_EDIT_PASTE:
961  fTextEdit->Paste();
962  break;
963  case kM_EDIT_DELETE:
964  fTextEdit->Delete();
965  break;
966  case kM_EDIT_SELECTALL:
967  fTextEdit->SelectAll();
968  if (fTextEdit->IsMarked()) {
976  }
977  }
978  break;
979  case kM_EDIT_SELFONT:
980  {
981  Int_t count;
982  TString fontname;
984  new TGFontDialog(fClient->GetRoot(), this, &prop);
985  if (prop.fName != "") {
986  fontname.Form("-*-%s-%s-%c-*-*-%d-*-*-*-*-*-*-*",
987  prop.fName.Data(),
988  prop.fBold ? "bold" : "medium",
989  prop.fItalic ? 'i' : 'r',
990  prop.fSize);
991  if (!gVirtualX->ListFonts(fontname, 10, count)) {
992  fontname.Form("-*-%s-%s-%c-*-*-%d-*-*-*-*-*-*-*",
993  prop.fName.Data(),
994  prop.fBold ? "bold" : "medium",
995  prop.fItalic ? 'o' : 'r',
996  prop.fSize);
997  }
998  TGFont *font = fClient->GetFont(fontname);
999  if (font) {
1000  FontStruct_t editorfont = font->GetFontStruct();
1001  fTextEdit->SetFont(editorfont);
1002  fTextEdit->Update();
1003  }
1004  }
1005  }
1006  break;
1007 
1008  // "Tools" menu related events
1009  case kM_TOOLS_COMPILE:
1010  CompileMacro();
1011  break;
1012  case kM_TOOLS_EXECUTE:
1013  ExecuteMacro();
1014  break;
1015  case kM_TOOLS_INTERRUPT:
1016  InterruptMacro();
1017  break;
1018 
1019  // "Search" menu related events
1020  case kM_SEARCH_FIND:
1021  Search(kFALSE);
1022  break;
1023  case kM_SEARCH_FINDNEXT:
1024  Search(kTRUE);
1025  break;
1026  case kM_SEARCH_GOTO:
1027  Goto();
1028  break;
1029 
1030  // "Help" menu related events
1031  case kM_HELP_CONTENTS:
1032  hd = new TRootHelpDialog(this, "Help on Editor...", 600, 400);
1033  hd->SetText(gHelpTextEditor);
1034  hd->Popup();
1035  break;
1036  case kM_HELP_ABOUT:
1037  About();
1038  break;
1039  }
1040  break;
1041  }
1042  break;
1043  case kC_TEXTENTRY:
1044  switch (GET_SUBMSG(msg)) {
1045  case kTE_ENTER:
1046  {
1047  // here copy the string from text buffer to return variable
1048  const char *string = fCommandBuf->GetString();
1049  if(strlen(string) > 1) {
1050  gROOT->ProcessLine(string);
1052  }
1053  }
1054  break;
1055  default:
1056  break;
1057  }
1058  break;
1059 
1060  default:
1061  break;
1062  }
1063  return kTRUE;
1064 }
TGToolBar * fToolBar
Definition: TGTextEditor.h:45
virtual const char * BaseName(const char *pathname)
Base name of a file name. Base name of /user/root is root.
Definition: TSystem.cxx:918
virtual void Print(Option_t *="") const
Send current buffer to printer.
Definition: TGTextEdit.cxx:476
R__EXTERN const char gHelpTextEditor[]
Definition: HelpText.h:24
virtual const char * GetName() const
Returns name of object.
Definition: TNamed.h:47
Handle_t FontStruct_t
Definition: GuiTypes.h:38
TList * GetListOfLines() const
Definition: TMacro.h:51
const TGWindow * fParent
Definition: TGWindow.h:37
virtual void Resize(UInt_t w=0, UInt_t h=0)
Resize the frame.
Definition: TGFrame.cxx:587
virtual TGTextEntry * GetTextEntry() const
Definition: TGComboBox.h:131
void Search(Bool_t ret)
Invokes search dialog, or just search previous string if again is true.
virtual TGButton * GetButton(Int_t id) const
Finds and returns a pointer to the button with the specified identifier id.
Definition: TGToolBar.cxx:156
TGPopupMenu * fMenuFile
Definition: TGTextEditor.h:54
void Goto()
Invokes goto dialog, and go to the specified line.
virtual const char * WorkingDirectory()
Return working directory.
Definition: TSystem.cxx:855
void Reset()
Reset the timer.
Definition: TTimer.cxx:157
void CompileMacro()
Save the edited text in a temporary macro, then compile it.
virtual TString GetDirName(const char *pathname)
Return the directory name in pathname.
Definition: TSystem.cxx:1015
Collectable string class.
Definition: TObjString.h:28
void AddInput(UInt_t emask)
Add events specified in the emask to the events the frame should handle.
Definition: TGFrame.cxx:321
Bool_t fOverwrite
Definition: TGFileDialog.h:65
void ClearText()
Clear text edit widget.
const Mask_t kKeyShiftMask
Definition: GuiTypes.h:194
virtual Bool_t HandleKey(Event_t *event)
Handle keyboard events.
Definition: TGFrame.cxx:1564
virtual TGButton * AddButton(const TGWindow *w, ToolBarData_t *button, Int_t spacing=0)
Add button to toolbar.
Definition: TGToolBar.cxx:91
void SetWindowName(const char *name=0)
Set window name. This is typically done via the window manager.
Definition: TGFrame.cxx:1746
virtual void CloseWindow()
Close TGTextEditor window.
const TGWindow * GetRoot() const
Returns current root (i.e.
Definition: TGClient.cxx:224
TTimer * fTimer
Definition: TGTextEditor.h:43
virtual Bool_t HandleTimer(TTimer *t)
Handle timer event.
virtual void SetSelectBack(Pixel_t p)
set selected text background color
Definition: TGTextView.cxx:177
static Pixel_t GetWhitePixel()
Get white pixel value.
Definition: TGFrame.cxx:691
virtual void DisableEntry(Int_t id)
Disable entry (disabled entries appear in a sunken relieve).
Definition: TGMenu.cxx:1721
const Mask_t kLeaveWindowMask
Definition: GuiTypes.h:167
TGLabel * fLabel
Definition: TGTextEditor.h:47
virtual Bool_t HandleKey(Event_t *event)
Keyboard event handler.
virtual Bool_t ChangeDirectory(const char *path)
Change directory.
Definition: TSystem.cxx:846
virtual Long_t Exec(const char *params=0, Int_t *error=0)
Execute this macro with params, if params is 0, default parameters (set via SetParams) are used...
Definition: TMacro.cxx:266
#define gROOT
Definition: TROOT.h:415
TGTextBuffer * fCommandBuf
Definition: TGTextEditor.h:50
Class supporting a collection of lines with C++ code.
Definition: TMacro.h:31
Basic string class.
Definition: TString.h:131
#define gClient
Definition: TGClient.h:166
TGMenuBar * fMenuBar
Definition: TGTextEditor.h:53
int Int_t
Definition: RtypesCore.h:41
bool Bool_t
Definition: RtypesCore.h:59
Int_t MK_MSG(EWidgetMessageTypes msg, EWidgetMessageTypes submsg)
virtual UInt_t GetDefaultHeight() const
Definition: TGFrame.h:373
virtual void AddEntry(TGHotString *s, Int_t id, void *ud=0, const TGPicture *p=0, TGMenuEntry *before=0)
Add a menu entry.
Definition: TGMenu.cxx:987
#define gInterpreter
Definition: TInterpreter.h:555
virtual void Delete(Option_t *="")
Delete selection.
Definition: TGTextEdit.cxx:531
Bool_t fTextChanged
Definition: TGTextEditor.h:60
virtual Bool_t ProcessMessage(Long_t msg, Long_t parm1, Long_t parm2)
Handle menu and other command generated by the user.
R__EXTERN TApplication * gApplication
Definition: TApplication.h:166
TGLongPosition GetCurrentPos() const
Definition: TGTextEdit.h:122
Bool_t IsMarked() const
Definition: TGTextView.h:130
virtual void AddSeparator(TGMenuEntry *before=0)
Add a menu separator to the menu.
Definition: TGMenu.cxx:1057
virtual void Layout()
Layout the elements of the composite frame.
Definition: TGFrame.cxx:1239
R__EXTERN const char gHelpAbout[]
Definition: HelpText.h:14
virtual void RemoveFrame(TGFrame *f)
Remove frame from composite frame.
Definition: TGFrame.cxx:1131
void DataChanged()
Slot setting the fTextChanged flag to true when the text has been modified in fTextEdit.
TGLayoutHints * fMenuBarLayout
Definition: TGTextEditor.h:51
void SetText(const char *helpText)
Set help text from helpText buffer in TGTextView.
virtual int Unlink(const char *name)
Unlink, i.e.
Definition: TSystem.cxx:1364
TGPopupMenu * fMenuSearch
Definition: TGTextEditor.h:56
ULong_t Pixel_t
Definition: GuiTypes.h:39
const char ** fFileTypes
Definition: TGFileDialog.h:63
virtual int CompileMacro(const char *filename, Option_t *opt="", const char *library_name="", const char *build_dir="", UInt_t dirmode=0)
This method compiles and loads a shared library containing the code from the file "filename"...
Definition: TSystem.cxx:2867
virtual void AddLine(const char *string)
Add a line of text to the view widget.
Definition: TGTextView.cxx:227
const char * GetString() const
Definition: TGTextBuffer.h:47
static char * gEPrintCommand
virtual void SendMessage(const TGWindow *w, Long_t msg, Long_t parm1, Long_t parm2)
Send message (i.e.
Definition: TGFrame.cxx:627
virtual void Update()
update the whole window of text view
Definition: TGTextView.cxx:260
virtual Bool_t LoadFile(const char *fname, long startpos=0, long length=-1)
Load a file in the text view widget.
Definition: TGTextView.cxx:452
void SetClassHints(const char *className, const char *resourceName)
Set the windows class and resource name.
Definition: TGFrame.cxx:1814
virtual const char * TempDirectory() const
Return a user configured or systemwide directory to create temporary files in.
Definition: TSystem.cxx:1465
virtual void SetText(TGString *text, Int_t partidx=0)
Set text in partition partidx in status bar.
virtual EButtonState GetState() const
Definition: TGButton.h:112
Definition: TGMsgBox.h:43
TGTextBuffer * GetBuffer() const
Definition: TGTextEntry.h:127
virtual void EnableEntry(Int_t id)
Enable entry. By default entries are enabled.
Definition: TGMenu.cxx:1702
void ExecuteMacro()
Save the edited text in a temporary macro, execute it, and then delete the temporary file...
Bool_t fExiting
Definition: TGTextEditor.h:59
const Mask_t kKeyPressMask
Definition: GuiTypes.h:158
Bool_t Connect(const char *signal, const char *receiver_class, void *receiver, const char *slot)
Non-static method is used to connect from the signal of this object to the receiver slot...
Definition: TQObject.cxx:867
void About()
Display ROOT splash screen.
virtual void Layout()
Layout the components of view.
virtual UInt_t GetDefaultWidth() const
Definition: TGFrame.h:371
R__EXTERN TSystem * gSystem
Definition: TSystem.h:557
void Popup()
Show help dialog.
EGEventType fType
Definition: GuiTypes.h:174
virtual void Build()
Build TGTextEditor widget.
Int_t GET_SUBMSG(Long_t val)
virtual void SetFont(FontStruct_t font)
Changes text entry font.
Definition: TGTextView.cxx:331
virtual Bool_t SelectAll()
Select all text in the viewer.
Definition: TGTextView.cxx:515
virtual void Associate(const TGWindow *w)
Definition: TGWidget.h:84
virtual void Associate(const TGWindow *w)
Definition: TGMenu.h:219
virtual void CloseWindow()
Close and delete main frame.
Definition: TGFrame.cxx:1728
void LoadFile(const char *fname=0)
Load a file into the editor. If fname is 0, a TGFileDialog will popup.
void Form(const char *fmt,...)
Formats a string using a printf style format descriptor.
Definition: TString.cxx:2289
unsigned int UInt_t
Definition: RtypesCore.h:42
TGStatusBar * fStatusBar
Definition: TGTextEditor.h:44
const Handle_t kNone
Definition: GuiTypes.h:87
void SetIniDir(const char *inidir)
Set directory name.
Handles synchronous and a-synchronous timer events.
Definition: TTimer.h:51
TMacro * fMacro
Definition: TGTextEditor.h:62
void SaveFile(const char *fname)
Save the edited text in the file "fname".
virtual Int_t Exec(const char *shellcmd)
Execute a command.
Definition: TSystem.cxx:647
Bool_t SaveFileAs()
Save the edited text in a file selected with TGFileDialog.
static char * gEPrinter
#define gVirtualX
Definition: TVirtualX.h:345
virtual void Clear(Option_t *="")
Clear text edit widget.
Definition: TGTextEdit.cxx:375
#define h(i)
Definition: RSha256.hxx:106
virtual void SetSelectFore(Pixel_t p)
set selected text color
Definition: TGTextView.cxx:186
char * StrDup(const char *str)
Duplicate the string str.
Definition: TString.cxx:2490
Int_t GET_MSG(Long_t val)
const Bool_t kFALSE
Definition: RtypesCore.h:88
virtual Long_t ReturnLineCount()
Definition: TGTextView.h:105
EKeySym
Definition: KeySymbols.h:25
long Long_t
Definition: RtypesCore.h:50
const Mask_t kEnterWindowMask
Definition: GuiTypes.h:166
virtual UInt_t GetDefaultHeight() const
Definition: TGFrame.h:238
TGPopupMenu * fMenuTools
Definition: TGTextEditor.h:57
virtual void SetFocus()
Definition: TGTextEdit.h:119
virtual Bool_t Search(const char *string, Bool_t direction=kTRUE, Bool_t caseSensitive=kFALSE)
Search for string in the specified direction.
Definition: TGTextEdit.cxx:633
#define ClassImp(name)
Definition: Rtypes.h:365
TGTextEntry * fCommand
Definition: TGTextEditor.h:49
TGLayoutHints * fMenuBarItemLayout
Definition: TGTextEditor.h:52
const Mask_t kStructureNotifyMask
Definition: GuiTypes.h:165
TGPopupMenu * GetMenu() const
Definition: TGTextEdit.h:110
virtual void SetCleanup(Int_t mode=kLocalCleanup)
Turn on automatic cleanup of child frames in dtor.
Definition: TGFrame.cxx:1054
TGComboBox * fComboCmd
Definition: TGTextEditor.h:48
ToolBarData_t fTbData[]
Definition: TGFont.h:149
char * fFilename
Definition: TGFileDialog.h:61
FontStruct_t GetFontStruct() const
Definition: TGFont.h:193
TString fFilename
Definition: TGTextEditor.h:61
void PrintText()
Open the print dialog and send current buffer to printer.
Bool_t Disconnect(const char *signal=0, void *receiver=0, const char *slot=0)
Disconnects signal of this object from slot of receiver.
Definition: TQObject.cxx:1025
int CompareTo(const char *cs, ECaseCompare cmp=kExact) const
Compare a string to char *cs2.
Definition: TString.cxx:418
virtual void AddFrame(TGFrame *f, TGLayoutHints *l=0)
Add frame to the composite frame using the specified layout hints.
Definition: TGFrame.cxx:1099
virtual void MapSubwindows()
Map all sub windows that are part of the composite frame.
Definition: TGFrame.cxx:1146
virtual void Copy(TObject &) const
Copy this to obj.
Definition: TGTextEdit.h:70
const char * ed_filetypes[]
Handle_t fId
Definition: TGObject.h:36
virtual Bool_t Cut()
Cut text.
Definition: TGTextEdit.cxx:441
virtual void UnmapWindow()
Definition: TGFrame.h:253
virtual void ReturnPressed()
Add new entry to combo box when return key pressed inside text entry ReturnPressed signal is emitted...
Definition: TGComboBox.cxx:655
TGTextEdit * fTextEdit
Definition: TGTextEditor.h:46
TGTextEditor(const char *filename=0, const TGWindow *p=0, UInt_t w=900, UInt_t h=600)
TGTextEditor constructor with file name as first argument.
Int_t IsSaved()
Check if file has to be saved in case of modifications.
virtual void MapWindow()
Definition: TGFrame.h:251
TGClient * fClient
Definition: TGObject.h:37
TGPopupMenu * fMenuEdit
Definition: TGTextEditor.h:55
const Mask_t kFocusChangeMask
Definition: GuiTypes.h:168
const TGWindow * GetDefaultRoot() const
Returns the root (i.e.
Definition: TGClient.cxx:234
void InterruptMacro()
Interrupt execution of a macro.
const char * fPixmap
Definition: TGToolBar.h:33
UInt_t fState
Definition: GuiTypes.h:180
ETextEditorCommands
virtual void SetParts(Int_t npart)
Divide the status bar in npart equal sized parts.
virtual void DeleteWindow()
Delete TGTextEditor Window.
virtual Bool_t Paste()
Paste text into widget.
Definition: TGTextEdit.cxx:454
virtual Bool_t Goto(Long_t line, Long_t column=0)
Goto the specified line.
Definition: TGTextEdit.cxx:737
static const TString & GetBinDir()
Get the binary directory in the installation. Static utility function.
Definition: TROOT.cxx:2951
const Mask_t kKeyControlMask
Definition: GuiTypes.h:196
virtual ~TGTextEditor()
TGTextEditor destructor.
virtual Bool_t SaveFile(const char *fname, Bool_t saveas=kFALSE)
Save file.
Definition: TGTextEdit.cxx:387
virtual void Cleanup()
Cleanup and delete all objects contained in this composite frame.
Definition: TGFrame.cxx:949
virtual void DeleteWindow()
Delete window.
Definition: TGFrame.cxx:258
virtual void TurnOn()
Add the timer to the system timer list.
Definition: TTimer.cxx:241
const Bool_t kTRUE
Definition: RtypesCore.h:87
virtual char * ConcatFileName(const char *dir, const char *name)
Concatenate a directory and a file name. User must delete returned string.
Definition: TSystem.cxx:1054
void DataDropped(char *fname)
Update file information when receiving the signal DataDropped from TGTextEdit widget.
virtual void AddPopup(TGHotString *s, TGPopupMenu *menu, TGLayoutHints *l, TGPopupMenu *before=0)
Add popup menu to menu bar.
Definition: TGMenu.cxx:415
TGFont * GetFont(const char *font, Bool_t fixedDefault=kTRUE)
Get a font from the font pool.
Definition: TGClient.cxx:348
TGPopupMenu * fMenuHelp
Definition: TGTextEditor.h:58
Definition: TGMsgBox.h:44
virtual void SetState(EButtonState state, Bool_t emit=kFALSE)
Set button state.
Definition: TGButton.cxx:185
const char * Data() const
Definition: TString.h:364