62enum ETestCommandIdentifiers {
116const char *filetypes[] = {
"All files",
"*",
117 "ROOT files",
"*.root",
118 "ROOT macros",
"*.C",
119 "Text files",
"*.[tT][xX][tT]",
122struct shutterData_t {
123 const char *pixmap_name;
124 const char *tip_text;
129shutterData_t histo_data[] = {
130 {
"h1_s.xpm",
"TH1", 1001, 0 },
131 {
"h2_s.xpm",
"TH2", 1002, 0 },
132 {
"h3_s.xpm",
"TH3", 1003, 0 },
133 {
"profile_s.xpm",
"TProfile", 1004, 0 },
137shutterData_t function_data[] = {
138 {
"f1_s.xpm",
"TF1", 2001, 0 },
139 {
"f2_s.xpm",
"TF2", 2002, 0 },
143shutterData_t tree_data[] = {
144 {
"ntuple_s.xpm",
"TNtuple", 3001, 0 },
145 {
"tree_s.xpm",
"TTree", 3002, 0 },
146 {
"chain_s.xpm",
"TChain", 3003, 0 },
151const char *editortxt1 =
152"This is the ROOT text edit widget TGTextEdit. It is not intended as\n"
153"a full developers editor, but it is relatively complete and can ideally\n"
154"be used to edit scripts or to present users editable config files, etc.\n\n"
155"The text edit widget supports standard emacs style ctrl-key navigation\n"
156"in addition to the arrow keys. By default the widget has under the right\n"
157"mouse button a popup menu giving access to several built-in functions.\n\n"
158"Cut, copy and paste between different editor windows and any other\n"
159"standard text handling application is supported.\n\n"
160"Text can be selected with the mouse while holding the left button\n"
161"or with the arrow keys while holding the shift key pressed. Use the\n"
162"middle mouse button to paste text at the current mouse location."
164const char *editortxt2 =
165"Mice with scroll-ball are properly supported.\n\n"
166"This are the currently defined key bindings:\n"
168" Move the cursor one character leftwards.\n"
169" Scroll when cursor is out of frame.\n"
171" Move the cursor one character rightwards.\n"
172" Scroll when cursor is out of frame.\n"
174" Deletes the character on the left side of the text cursor and moves the\n"
175" cursor one position to the left. If a text has been marked by the user"
177const char *editortxt3 =
178" (e.g. by clicking and dragging) the cursor will be put at the beginning\n"
179" of the marked text and the marked text will be removed.\n"
181" Moves the text cursor to the left end of the line. If mark is TRUE text\n"
182" will be marked towards the first position, if not any marked text will\n"
183" be unmarked if the cursor is moved.\n"
185" Moves the text cursor to the right end of the line. If mark is TRUE text\n"
186" will be marked towards the last position, if not any marked text will\n"
187" be unmarked if the cursor is moved.\n"
190const char *editortxt4 =
191" Deletes the character on the right side of the text cursor. If a text\n"
192" has been marked by the user (e.g. by clicking and dragging) the cursor\n"
193" will be put at the beginning of the marked text and the marked text will\n"
195"Shift - Left Arrow\n"
196" Mark text one character leftwards.\n"
197"Shift - Right Arrow\n"
198" Mark text one character rightwards.\n"
200" Select the whole text.\n"
202" Move the cursor one character leftwards."
204const char *editortxt5 =
206" Copy the marked text to the clipboard.\n"
208" Delete the character to the right of the cursor.\n"
210" Move the cursor to the end of the line.\n"
212" Start Search Dialog.\n"
214" Delete the character to the left of the cursor.\n"
216" Delete marked text if any or delete all\n"
217" characters to the right of the cursor.\n"
219" Start GoTo Line Dialog"
221const char *editortxt6 =
223" Delete all characters on the line.\n"
225" Paste the clipboard text into line edit.\n"
227" Cut the marked text, copy to clipboard.\n"
229" Paste the clipboard text into line edit.\n"
232"All other keys with valid ASCII codes insert themselves into the line.";
247 TileFrame *fContainer;
253 TGPopupMenu *fMenuFile, *fMenuTest, *fMenuView, *fMenuHelp;
254 TGPopupMenu *fCascadeMenu, *fCascade1Menu, *fCascade2Menu;
256 TGLayoutHints *fMenuBarLayout, *fMenuBarItemLayout, *fMenuBarHelpLayout;
260 virtual ~TestMainFrame();
265 void HandleMenu(
Int_t id);
266 void HandlePopup() { printf(
"menu popped up\n"); }
267 void HandlePopdown() { printf(
"menu popped down\n"); }
269 void Created() { Emit(
"Created()"); }
270 void Welcome() { printf(
"TestMainFrame has been created. Welcome!\n"); }
281 TGButton *fOkButton, *fCancelButton, *fStartB, *fStopB;
282 TGButton *fBtn1, *fBtn2, *fChk1, *fChk2, *fRad1, *fRad2;
303 virtual ~TestDialog();
310 void DoTab(
Int_t id);
311 void HandleButtons(
Int_t id = -1);
322 TGButton *fTestButton, *fCloseButton;
336 virtual ~TestMsgBox();
363 virtual ~TestSliders();
367 void DoText(const
char *
text);
368 void DoSlider(
Int_t pos = 0);
386 void AddShutterItem(const
char *
name, shutterData_t *data);
390 void HandleButtons();
406 virtual ~TestDirList();
423 void DisplayFile(const
TString &fname);
424 void DisplayDirectory(const
TString &fname);
429 virtual ~TestFileList();
451 virtual ~TestProgress();
485 virtual ~EntryTestDlg();
507 void LoadFile(
const char *
file);
508 void LoadBuffer(
const char *buffer);
509 void AddBuffer(
const char *buffer);
511 TGTextEdit *GetEditor()
const {
return fEdit; }
535 virtual ~TileFrame() {
delete fFrame; }
537 TGFrame *GetFrame()
const {
return fFrame; }
539 void SetCanvas(
TGCanvas *canvas) { fCanvas = canvas; }
543TileFrame::TileFrame(
const TGWindow *p)
549 fFrame->Connect(
"ProcessedEvent(Event_t*)",
"TileFrame",
this,
550 "HandleMouseWheel(Event_t*)");
568 if (!fCanvas)
return;
569 if (fCanvas->GetContainer()->GetHeight())
570 page =
Int_t(
Float_t(fCanvas->GetViewPort()->GetHeight() *
571 fCanvas->GetViewPort()->GetHeight()) /
572 fCanvas->GetContainer()->GetHeight());
577 Int_t newpos = fCanvas->GetVsbPosition() - page;
578 if (newpos < 0) newpos = 0;
579 fCanvas->SetVsbPosition(newpos);
583 Int_t newpos = fCanvas->GetVsbPosition() + page;
584 fCanvas->SetVsbPosition(newpos);
598 fMain->Connect(
"CloseWindow()",
"TestMainFrame",
this,
"CloseWindow()");
604 fMenuDock->SetWindowName(
"GuiTest Menu");
611 fMenuFile->AddEntry(
"&Open...", M_FILE_OPEN);
612 fMenuFile->AddEntry(
"&Save", M_FILE_SAVE);
613 fMenuFile->AddEntry(
"S&ave as...", M_FILE_SAVEAS);
614 fMenuFile->AddEntry(
"&Close", -1);
615 fMenuFile->AddSeparator();
616 fMenuFile->AddEntry(
"&Print", M_FILE_PRINT);
617 fMenuFile->AddEntry(
"P&rint setup...", M_FILE_PRINTSETUP);
618 fMenuFile->AddSeparator();
619 fMenuFile->AddEntry(
"E&xit", M_FILE_EXIT);
621 fMenuFile->DisableEntry(M_FILE_SAVEAS);
622 fMenuFile->HideEntry(M_FILE_PRINT);
625 fCascade2Menu->AddEntry(
"ID = 2&3", M_CASCADE_1);
626 fCascade2Menu->AddEntry(
"ID = 2&4", M_CASCADE_2);
627 fCascade2Menu->AddEntry(
"ID = 2&5", M_CASCADE_3);
630 fCascade1Menu->AddEntry(
"ID = 4&1", 41);
631 fCascade1Menu->AddEntry(
"ID = 4&2", 42);
632 fCascade1Menu->AddEntry(
"ID = 4&3", 43);
633 fCascade1Menu->AddSeparator();
634 fCascade1Menu->AddPopup(
"Cascade&d 2", fCascade2Menu);
637 fCascadeMenu->AddEntry(
"ID = 5&1", 51);
638 fCascadeMenu->AddEntry(
"ID = 5&2", 52);
639 fCascadeMenu->AddEntry(
"ID = 5&3", 53);
640 fCascadeMenu->AddSeparator();
641 fCascadeMenu->AddPopup(
"&Cascaded 1", fCascade1Menu);
644 fMenuTest->AddLabel(
"Test different features...");
645 fMenuTest->AddSeparator();
646 fMenuTest->AddEntry(
"&Dialog...", M_TEST_DLG);
647 fMenuTest->AddEntry(
"&Message Box...", M_TEST_MSGBOX);
648 fMenuTest->AddEntry(
"&Sliders...", M_TEST_SLIDER);
649 fMenuTest->AddEntry(
"Sh&utter...", M_TEST_SHUTTER);
650 fMenuTest->AddEntry(
"&List Directory...", M_TEST_DIRLIST);
651 fMenuTest->AddEntry(
"&File List...", M_TEST_FILELIST);
652 fMenuTest->AddEntry(
"&Progress...", M_TEST_PROGRESS);
653 fMenuTest->AddEntry(
"&Number Entry...", M_TEST_NUMBERENTRY);
654 fMenuTest->AddEntry(
"F&ont Dialog...", M_TEST_FONTDIALOG);
655 fMenuTest->AddSeparator();
656 fMenuTest->AddEntry(
"Add New Menus", M_TEST_NEWMENU);
657 fMenuTest->AddSeparator();
658 fMenuTest->AddPopup(
"&Cascaded menus", fCascadeMenu);
661 fMenuView->AddEntry(
"&Dock", M_VIEW_DOCK);
662 fMenuView->AddEntry(
"&Undock", M_VIEW_UNDOCK);
663 fMenuView->AddSeparator();
664 fMenuView->AddEntry(
"Enable U&ndock", M_VIEW_ENBL_DOCK);
665 fMenuView->AddEntry(
"Enable &Hide", M_VIEW_ENBL_HIDE);
666 fMenuView->DisableEntry(M_VIEW_DOCK);
668 fMenuDock->EnableUndock(
kTRUE);
669 fMenuDock->EnableHide(
kTRUE);
670 fMenuView->CheckEntry(M_VIEW_ENBL_DOCK);
671 fMenuView->CheckEntry(M_VIEW_ENBL_HIDE);
675 fMenuDock->Connect(
"Undocked()",
"TestMainFrame",
this,
"HandleMenu(=M_VIEW_UNDOCK)");
678 fMenuHelp->AddEntry(
"&Contents", M_HELP_CONTENTS);
679 fMenuHelp->AddEntry(
"&Search...", M_HELP_SEARCH);
680 fMenuHelp->AddSeparator();
681 fMenuHelp->AddEntry(
"&About", M_HELP_ABOUT);
684 fMenuNew1->AddEntry(
"Remove New Menus", M_NEW_REMOVEMENU);
687 fMenuNew2->AddEntry(
"Remove New Menus", M_NEW_REMOVEMENU);
691 fMenuFile->Connect(
"Activated(Int_t)",
"TestMainFrame",
this,
692 "HandleMenu(Int_t)");
693 fMenuFile->Connect(
"PoppedUp()",
"TestMainFrame",
this,
"HandlePopup()");
694 fMenuFile->Connect(
"PoppedDown()",
"TestMainFrame",
this,
"HandlePopdown()");
695 fMenuTest->Connect(
"Activated(Int_t)",
"TestMainFrame",
this,
696 "HandleMenu(Int_t)");
697 fMenuView->Connect(
"Activated(Int_t)",
"TestMainFrame",
this,
698 "HandleMenu(Int_t)");
699 fMenuHelp->Connect(
"Activated(Int_t)",
"TestMainFrame",
this,
700 "HandleMenu(Int_t)");
701 fCascadeMenu->Connect(
"Activated(Int_t)",
"TestMainFrame",
this,
702 "HandleMenu(Int_t)");
703 fCascade1Menu->Connect(
"Activated(Int_t)",
"TestMainFrame",
this,
704 "HandleMenu(Int_t)");
705 fCascade2Menu->Connect(
"Activated(Int_t)",
"TestMainFrame",
this,
706 "HandleMenu(Int_t)");
707 fMenuNew1->Connect(
"Activated(Int_t)",
"TestMainFrame",
this,
708 "HandleMenu(Int_t)");
709 fMenuNew2->Connect(
"Activated(Int_t)",
"TestMainFrame",
this,
710 "HandleMenu(Int_t)");
713 fMenuBar->AddPopup(
"&File", fMenuFile, fMenuBarItemLayout);
714 fMenuBar->AddPopup(
"&Test", fMenuTest, fMenuBarItemLayout);
715 fMenuBar->AddPopup(
"&View", fMenuView, fMenuBarItemLayout);
716 fMenuBar->AddPopup(
"&Help", fMenuHelp, fMenuBarHelpLayout);
718 fMenuDock->AddFrame(fMenuBar, fMenuBarLayout);
721 fCanvasWindow =
new TGCanvas(fMain, 400, 240);
722 fContainer =
new TileFrame(fCanvasWindow->GetViewPort());
723 fContainer->SetCanvas(fCanvasWindow);
724 fCanvasWindow->SetContainer(fContainer->GetFrame());
730 for (
int i=0; i < 256; ++i)
731 fCanvasWindow->AddFrame(
new TGFrame(fCanvasWindow->GetContainer(),
742 fTestButton =
new TGTextButton(fStatusFrame,
"&Open editor...", 150);
743 fTestButton->
Connect(
"Clicked()",
"TestMainFrame",
this,
"DoButton()");
748 fTestText->SetToolTipText(
"This is a text entry widget");
749 fTestText->Resize(300, fTestText->GetDefaultHeight());
753 gClient->GetColorByName(
"yellow", yellow);
761 fMain->SetWindowName(
"GuiTest Signal/Slots");
763 fMain->MapSubwindows();
769 Connect(
"Created()",
"TestMainFrame",
this,
"Welcome()");
773TestMainFrame::~TestMainFrame()
782 delete fCascade1Menu;
783 delete fCascade2Menu;
791void TestMainFrame::CloseWindow()
798void TestMainFrame::DoButton()
802 Editor *ed =
new Editor(fMain, 600, 400);
803 ed->LoadBuffer(editortxt1);
804 ed->AddBuffer(editortxt2);
805 ed->AddBuffer(editortxt3);
806 ed->AddBuffer(editortxt4);
807 ed->AddBuffer(editortxt5);
808 ed->AddBuffer(editortxt6);
812void TestMainFrame::HandleMenu(
Int_t id)
824 printf(
"fIniDir = %s\n", fi.
fIniDir);
832 printf(
"M_FILE_SAVE\n");
836 printf(
"M_FILE_PRINT\n");
837 printf(
"Hiding itself, select \"Print Setup...\" to enable again\n");
838 fMenuFile->HideEntry(M_FILE_PRINT);
841 case M_FILE_PRINTSETUP:
842 printf(
"M_FILE_PRINTSETUP\n");
843 printf(
"Enabling \"Print\"\n");
844 fMenuFile->EnableEntry(M_FILE_PRINT);
852 new TestDialog(
gClient->GetRoot(), fMain, 400, 200);
856 new TestMsgBox(
gClient->GetRoot(), fMain, 400, 200);
860 new TestSliders(
gClient->GetRoot(), fMain, 400, 200);
864 new TestShutter(
gClient->GetRoot(), fMain, 400, 200);
868 new TestDirList(
gClient->GetRoot(), fMain, 400, 200);
871 case M_TEST_FILELIST:
872 new TestFileList(
gClient->GetRoot(), fMain, 400, 200);
875 case M_TEST_PROGRESS:
876 new TestProgress(
gClient->GetRoot(), fMain, 600, 300);
879 case M_TEST_NUMBERENTRY:
880 new EntryTestDlg(
gClient->GetRoot(), fMain);
883 case M_TEST_FONTDIALOG:
887 if (prop.
fName !=
"")
888 printf(
"Selected font: %s, size %d, italic %s, bold %s, color 0x%lx, align %u\n",
890 prop.fBold ?
"yes" :
"no", prop.fColor, prop.fAlign);
896 if (fMenuTest->IsEntryChecked(M_TEST_NEWMENU)) {
897 HandleMenu(M_NEW_REMOVEMENU);
900 fMenuTest->CheckEntry(M_TEST_NEWMENU);
902 fMenuBar->AddPopup(
"New 1", fMenuNew1, fMenuBarItemLayout, p);
903 p = fMenuBar->GetPopup(
"Help");
904 fMenuBar->
AddPopup(
"New 2", fMenuNew2, fMenuBarItemLayout, p);
905 fMenuBar->MapSubwindows();
909 fMenuTest->AddEntry(
"Remove New Menus", M_NEW_REMOVEMENU, 0, 0,
e);
913 case M_NEW_REMOVEMENU:
915 fMenuBar->RemovePopup(
"New 1");
916 fMenuBar->RemovePopup(
"New 2");
918 fMenuTest->DeleteEntry(M_NEW_REMOVEMENU);
919 fMenuTest->UnCheckEntry(M_TEST_NEWMENU);
923 case M_VIEW_ENBL_DOCK:
924 fMenuDock->EnableUndock(!fMenuDock->EnableUndock());
925 if (fMenuDock->EnableUndock()) {
926 fMenuView->CheckEntry(M_VIEW_ENBL_DOCK);
927 fMenuView->EnableEntry(M_VIEW_UNDOCK);
929 fMenuView->UnCheckEntry(M_VIEW_ENBL_DOCK);
930 fMenuView->DisableEntry(M_VIEW_UNDOCK);
934 case M_VIEW_ENBL_HIDE:
935 fMenuDock->EnableHide(!fMenuDock->EnableHide());
936 if (fMenuDock->EnableHide()) {
937 fMenuView->CheckEntry(M_VIEW_ENBL_HIDE);
939 fMenuView->UnCheckEntry(M_VIEW_ENBL_HIDE);
944 fMenuDock->DockContainer();
945 fMenuView->EnableEntry(M_VIEW_UNDOCK);
946 fMenuView->DisableEntry(M_VIEW_DOCK);
950 fMenuDock->UndockContainer();
951 fMenuView->EnableEntry(M_VIEW_DOCK);
952 fMenuView->DisableEntry(M_VIEW_UNDOCK);
956 printf(
"Menu item %d selected\n",
id);
969 fMain->Connect(
"CloseWindow()",
"TestDialog",
this,
"DoClose()");
970 fMain->DontCallClose();
978 fOkButton->
Connect(
"Clicked()",
"TestDialog",
this,
"DoOK()");
979 fCancelButton =
new TGTextButton(fFrame1,
"&Cancel", 2);
980 fCancelButton->
Connect(
"Clicked()",
"TestDialog",
this,
"DoCancel()");
987 fFrame1->
AddFrame(fCancelButton, fL1);
990 fMain->AddFrame(fFrame1, fL2);
994 fTab =
new TGTab(fMain, 300, 300);
995 fTab->
Connect(
"Selected(Int_t)",
"TestDialog",
this,
"DoTab(Int_t)");
1008 tf = fTab->
AddTab(
"Tab 2");
1025 for (i = 0; i < 20; i++) {
1027 sprintf(tmp,
"Entry %i", i+1);
1033 fBtn1->
Connect(
"Clicked()",
"TestDialog",
this,
"HandleButtons()");
1034 fBtn2->
Connect(
"Clicked()",
"TestDialog",
this,
"HandleButtons()");
1035 fChk1->
Connect(
"Clicked()",
"TestDialog",
this,
"HandleButtons()");
1036 fChk2->
Connect(
"Clicked()",
"TestDialog",
this,
"HandleButtons()");
1037 fRad1->
Connect(
"Clicked()",
"TestDialog",
this,
"HandleButtons()");
1038 fRad2->
Connect(
"Clicked()",
"TestDialog",
this,
"HandleButtons()");
1045 tf = fTab->
AddTab(
"Tab 3");
1047 fStartB =
new TGTextButton(fF3,
"Start &Filling Hists", 40);
1048 fStopB =
new TGTextButton(fF3,
"&Stop Filling Hists", 41);
1049 fStartB->
Connect(
"Clicked()",
"TestDialog",
this,
"HandleButtons()");
1050 fStopB->
Connect(
"Clicked()",
"TestDialog",
this,
"HandleButtons()");
1071 "HandleEmbeddedCanvas(Int_t,Int_t,Int_t,TObject*)");
1075 gClient->GetColorByName(
"yellow", yellow);
1082 tf = fTab->
AddTab(
"Tab 4");
1085 bt->
Connect(
"Clicked()",
"TestDialog",
this,
"HandleButtons()");
1088 bt->
Connect(
"Clicked()",
"TestDialog",
this,
"HandleButtons()");
1092 fCheckMulti->
Connect(
"Clicked()",
"TestDialog",
this,
"HandleButtons()");
1095 for (i = 0; i < 20; ++i) {
1096 sprintf(tmp,
"Entry %i", i);
1102 fListBox->
Resize(150, 80);
1105 tf = fTab->
AddTab(
"Tab 5");
1116 for (j = 0; j < 4; j++) {
1117 sprintf(buff,
"Module %i", j+1);
1125 tent->
SetFont(
"-adobe-courier-bold-r-*-*-14-*-*-*-*-*-iso8859-1");
1137 bt->
Connect(
"Clicked()",
"TestDialog",
this,
"HandleButtons()");
1141 bt->
Connect(
"Clicked()",
"TestDialog",
this,
"HandleButtons()");
1145 bt->
Connect(
"Clicked()",
"TestDialog",
this,
"HandleButtons()");
1154 fMain->AddFrame(fTab, fL5);
1156 fMain->MapSubwindows();
1160 fMain->CenterOnParent();
1162 fMain->SetWindowName(
"Dialog");
1168TestDialog::~TestDialog()
1172 fMain->DeleteWindow();
1175void TestDialog::FillHistos()
1182 fHpx =
new TH1F(
"hpx",
"This is the px distribution",100,-4,4);
1183 fHpxpy =
new TH2F(
"hpxpy",
"py vs px",40,-4,4,40,-4,4);
1193 while (fFillHistos) {
1196 fHpxpy->
Fill(px,py);
1203 fHpxpy->
Draw(
"cont");
1214void TestDialog::DoClose()
1216 printf(
"\nTerminating dialog: via window manager\n");
1228void TestDialog::CloseWindow()
1235void TestDialog::DoOK()
1238 printf(
"\nTerminating dialog: OK pressed\n");
1260void TestDialog::DoCancel()
1263 printf(
"\nTerminating dialog: Cancel pressed\n");
1273void TestDialog::HandleButtons(
Int_t id)
1282 printf(
"DoButton: id = %d\n",
id);
1285 static int newtab = 0;
1289 fFillHistos =
kTRUE;
1303 sprintf(tmp,
"Entry %i", fLastEntry);
1304 fListBox->
AddEntry(tmp, fLastEntry);
1309 if (fFirstEntry <= fLastEntry) {
1318 if ((s ==
"Tab 3") && (fMain->MustCleanup() !=
kDeepCleanup)) {
1323 delete fEc1; fEc1 = 0;
1324 delete fEc2; fEc2 = 0;
1333 for (
int i = 0 ; i < nt; i++) {
1344 sprintf(tmp,
"New Tab %d", ++newtab);
1363void TestDialog::DoTab(
Int_t id)
1365 printf(
"Tab item %d activated\n",
id);
1374 printf(
"event = %d, x = %d, y = %d, obj = %s::%s\n",
event,
x,
y,
1380 fRedTextGC(
TGButton::GetDefaultGC())
1387 fMain->Connect(
"CloseWindow()",
"TestMsgBox",
this,
"CloseWindow()");
1388 fMain->DontCallClose();
1398 gClient->GetColorByName(
"red", red);
1413 fTestButton->
Connect(
"Clicked()",
"TestMsgBox",
this,
"DoTest()");
1417 gClient->GetColorByName(
"green", green);
1421 fCloseButton->
Connect(
"Clicked()",
"TestMsgBox",
this,
"DoClose()");
1434 f1->AddFrame(fTestButton, fL1);
1435 f1->AddFrame(fCloseButton, fL1);
1436 f1->AddFrame(fPictButton, fL1);
1437 fMain->AddFrame(
f1, fL21);
1464 for (i=0; i<13; ++i) fG1->
AddFrame(fC[i], fL4);
1471 for (i = 0; i < 4; ++i) {
1473 fR[i]->
Connect(
"Clicked()",
"TestMsgBox",
this,
"DoRadio()");
1488 fTbtitle->
AddText(0,
"MsgBox");
1489 fTbmsg->
AddText(0,
"This is a test message box.");
1508 fMain->AddFrame(f2, fL2);
1510 fMain->MapSubwindows();
1514 fMain->CenterOnParent();
1516 fMain->SetWindowName(
"Message Box Test");
1525TestMsgBox::~TestMsgBox()
1529 fMain->DeleteWindow();
1532void TestMsgBox::CloseWindow()
1539void TestMsgBox::DoClose()
1546void TestMsgBox::DoTest()
1550 int i, buttons, retval;
1554 for (i = 0; i < 13; i++)
1556 buttons |= mb_button_id[i];
1558 for (i = 0; i < 4; i++)
1560 icontype = mb_icon[i];
1567 fMain->Disconnect(
"CloseWindow()");
1568 fMain->Connect(
"CloseWindow()",
"TestMsgBox",
this,
"TryToClose()");
1571 icontype, buttons, &retval);
1572 fMain->Disconnect(
"CloseWindow()");
1573 fMain->Connect(
"CloseWindow()",
"TestMsgBox",
this,
"CloseWindow()");
1577void TestMsgBox::TryToClose()
1581 printf(
"Can't close the window '%s' : a message box is still open\n", fMain->GetWindowName());
1584void TestMsgBox::DoRadio()
1591 if (
id >= 21 &&
id <= 24) {
1592 for (
int i = 0; i < 4; i++)
1593 if (fR[i]->WidgetId() !=
id)
1605 fMain->Connect(
"CloseWindow()",
"TestSliders",
this,
"CloseWindow()");
1606 fMain->DontCallClose();
1620 fTeh1->
Connect(
"TextChanged(char*)",
"TestSliders",
this,
"DoText(char*)");
1621 fTev1->
Connect(
"TextChanged(char*)",
"TestSliders",
this,
"DoText(char*)");
1624 fHslider1->
Connect(
"PositionChanged(Int_t)",
"TestSliders",
this,
"DoSlider(Int_t)");
1628 fVslider1->
Connect(
"PositionChanged(Int_t)",
"TestSliders",
this,
"DoSlider(Int_t)");
1631 fVframe1->
Resize(100, 100);
1639 fTeh2->
Connect(
"TextChanged(char*)",
"TestSliders",
this,
"DoText(char*)");
1640 fTev2->
Connect(
"TextChanged(char*)",
"TestSliders",
this,
"DoText(char*)");
1643 fHslider2->
Connect(
"PositionChanged(Int_t)",
"TestSliders",
this,
"DoSlider(Int_t)");
1649 fVslider2->
Connect(
"PositionChanged()",
"TestSliders",
this,
"DoSlider()");
1650 fVframe2->
Resize(100, 100);
1658 fVframe1->
AddFrame(fHslider1, fBly);
1659 fVframe1->
AddFrame(fVslider1, fBly);
1663 fVframe2->
AddFrame(fHslider2, fBly);
1664 fVframe2->
AddFrame(fVslider2, fBly);
1668 fMain->AddFrame(fVframe2, fBfly1);
1669 fMain->AddFrame(fVframe1, fBfly1);
1671 fMain->SetWindowName(
"Slider Test");
1673 fMain->Resize(
size);
1675 fMain->SetWMSize(
size.fWidth,
size.fHeight);
1676 fMain->SetWMSizeHints(
size.fWidth,
size.fHeight,
size.fWidth,
size.fHeight, 0, 0);
1684 fMain->CenterOnParent();
1686 fMain->MapSubwindows();
1692TestSliders::~TestSliders()
1696 fMain->DeleteWindow();
1699void TestSliders::CloseWindow()
1706void TestSliders::DoText(
const char * )
1732void TestSliders::DoSlider(
Int_t pos)
1747 sprintf(buf,
"%d", pos);
1766 else if (
id == VSId1) {
1778 else if (
id == HSId2) {
1790 else if (
id == VSId2) {
1813 fMain->Connect(
"CloseWindow()",
"TestShutter",
this,
"CloseWindow()");
1814 fMain->DontCallClose();
1822 AddShutterItem(
"Histograms", histo_data);
1823 AddShutterItem(
"Functions", function_data);
1824 AddShutterItem(
"Trees", tree_data);
1827 fMain->AddFrame(fShutter, fLayout);
1829 fMain->MapSubwindows();
1830 fMain->Resize(80, 300);
1833 fMain->CenterOnParent();
1835 fMain->SetWindowName(
"Shutter Test");
1841void TestShutter::AddShutterItem(
const char *
name, shutterData_t *data)
1847 static int id = 5001;
1855 for (
int i=0; data[i].pixmap_name != 0; i++) {
1858 printf(
"<TestShutter::AddShutterItem>: missing pixmap \"%s\", using default",
1859 data[i].pixmap_name);
1860 buttonpic = fDefaultPic;
1866 button->
Connect(
"Clicked()",
"TestShutter",
this,
"HandleButtons()");
1868 data[i].button = button;
1874TestShutter::~TestShutter()
1878 gClient->FreePicture(fDefaultPic);
1879 fMain->DeleteWindow();
1882void TestShutter::CloseWindow()
1887void TestShutter::HandleButtons()
1890 printf(
"Shutter button %d\n", btn->
WidgetId());
1900 fMain->Connect(
"CloseWindow()",
"TestDirList",
this,
"CloseWindow()");
1901 fMain->DontCallClose();
1912 fMain->AddFrame(canvas,lo);
1913 fContents->
Connect(
"DoubleClicked(TGListTreeItem*,Int_t)",
"TestDirList",
this,
1914 "OnDoubleClick(TGListTreeItem*,Int_t)");
1915 fContents->
Connect(
"Clicked(TGListTreeItem*,Int_t)",
"TestDirList",
this,
1916 "OnDoubleClick(TGListTreeItem*,Int_t)");
1924 fMain->CenterOnParent();
1926 fMain->SetWindowName(
"List Dir Test");
1928 fMain->MapSubwindows();
1933TestDirList::~TestDirList()
1942void TestDirList::CloseWindow()
1973 TList *files = dir.GetListOfFiles();
1981 fname =
file->GetName();
1982 if (
file->IsDirectory()) {
1983 if ((fname!=
"..") && (fname!=
".")) {
1984 fContents->
AddItem(item,fname);
1986 }
else if (fname.
EndsWith(
".root")) {
1987 fContents->
AddItem(item,fname,fIcon,fIcon);
2002 fMain->Connect(
"CloseWindow()",
"TestDirList",
this,
"CloseWindow()");
2003 fMain->DontCallClose();
2010 fMain->AddFrame(mb, lo);
2015 fMenu->AddEntry(
"&List",
kLVList);
2017 fMenu->AddSeparator();
2018 fMenu->AddEntry(
"&Close", 10);
2019 fMenu->Connect(
"Activated(Int_t)",
"TestFileList",
this,
"DoMenu(Int_t)");
2023 fMain->AddFrame(
lv,lo);
2026 gClient->GetColorByName(
"white", white);
2028 fContents->
Connect(
"DoubleClicked(TGFrame*,Int_t)",
"TestFileList",
this,
2029 "OnDoubleClick(TGLVEntry*,Int_t)");
2032 fMain->CenterOnParent();
2034 fMain->SetWindowName(
"File List Test");
2035 fMain->MapSubwindows();
2037 fContents->SetDefaultHeaders();
2038 fContents->DisplayDirectory();
2039 fContents->AddFile(
"..");
2041 fContents->StopRefreshTimer();
2045TestFileList::~TestFileList()
2053void TestFileList::DoMenu(
Int_t mode)
2064void TestFileList::DisplayFile(
const TString &fname)
2072 fContents->SetColHeaders(
"Name",
"Title");
2077 while ((key=(
TKey*)next())) {
2090void TestFileList::DisplayDirectory(
const TString &fname)
2094 fContents->SetDefaultHeaders();
2096 fContents->ChangeDirectory(fname);
2097 fContents->DisplayDirectory();
2098 fContents->AddFile(
"..");
2116 }
else obj->
Print();
2132 const char* fname = (
const char*)
f->GetUserData();
2135 DisplayObject(fname,
name);
2136 }
else if (
name.EndsWith(
".root")) {
2139 DisplayDirectory(
name);
2146void TestFileList::CloseWindow()
2159 fMain->Connect(
"CloseWindow()",
"TestProgress",
this,
"DoClose()");
2160 fMain->DontCallClose();
2170 fVProg1->SetBarColor(
"purple");
2173 fVProg2->SetBarColor(
"green");
2175 fHframe1->Resize(300, 300);
2180 fHProg1->ShowPosition();
2182 fHProg2->SetBarColor(
"lightblue");
2183 fHProg2->ShowPosition(
kTRUE,
kFALSE,
"%.0f events");
2188 fGO->Connect(
"Clicked()",
"TestProgress",
this,
"DoGo()");
2190 fVframe1->
Resize(300, 300);
2198 fHframe1->AddFrame(fVProg1, fHint1);
2199 fHframe1->AddFrame(fVProg2, fHint1);
2201 fVframe1->
AddFrame(fHProg1, fHint2);
2202 fVframe1->
AddFrame(fHProg2, fHint2);
2203 fVframe1->
AddFrame(fHProg3, fHint2);
2206 fMain->AddFrame(fHframe1, fHint4);
2207 fMain->AddFrame(fVframe1, fHint5);
2209 fMain->SetWindowName(
"Progress Test");
2211 fMain->Resize(
size);
2214 fMain->CenterOnParent();
2216 fMain->MapSubwindows();
2222TestProgress::~TestProgress()
2226 fMain->DeleteWindow();
2229void TestProgress::CloseWindow()
2236void TestProgress::DoClose()
2255void TestProgress::DoGo()
2260 fVProg1->Reset(); fVProg2->Reset();
2261 fHProg1->Reset(); fHProg2->Reset(); fHProg3->Reset();
2262 fVProg2->SetBarColor(
"green");
2263 int cnt1 = 0, cnt2 = 0, cnt3 = 0, cnt4 = 0;
2264 int inc1 = 4, inc2 = 3, inc3 = 2, inc4 = 1;
2265 while (cnt1 < 100 || cnt2 < 100 || cnt3 < 100 || cnt4 <100) {
2268 fVProg1->Increment(inc1);
2272 fVProg2->Increment(inc2);
2274 fVProg2->SetBarColor(
"red");
2278 fHProg1->Increment(inc3);
2282 fHProg2->Increment(inc4);
2283 fHProg3->Increment(inc4);
2296const char *numlabel[] = {
2314 12345, 1.0, 1.00, 1.000, 1.0000, 1.2E-12,
2315 90 * 3600, 120 * 60, 12 * 60, 12 * 3600 + 15 * 60,
2316 19991121, 19991121, (
Double_t) 0xDEADFACEU
2323 fMain->Connect(
"CloseWindow()",
"EntryTestDlg",
this,
"CloseWindow()");
2324 fMain->DontCallClose();
2329 TGGC myGC = *
gClient->GetResourcePool()->GetFrameGC();
2330 TGFont *myfont =
gClient->GetFont(
"-adobe-helvetica-bold-r-*-*-12-*-*-*-*-*-iso8859-1");
2335 fMain->AddFrame(fF1, fL1);
2337 for (
int i = 0; i < 13; i++) {
2340 fNumericEntries[i] =
new TGNumberEntry(fF[i], numinit[i], 12, i + 20,
2342 fF[i]->AddFrame(fNumericEntries[i], fL2);
2344 fF[i]->AddFrame(fLabel[i], fL2);
2348 fMain->AddFrame(fF2, fL3);
2352 fLimits[0]->SetLogStep(
kFALSE);
2357 fLimits[1]->SetLogStep(
kFALSE);
2364 fSetButton->Connect(
"Clicked()",
"EntryTestDlg",
this,
"SetLimits()");
2367 fExitButton->Connect(
"Clicked()",
"EntryTestDlg",
this,
"DoOK()");
2371 fMain->SetWindowName(
"Number Entry Test");
2372 fMain->SetIconName(
"Number Entry Test");
2373 fMain->SetClassHints(
"NumberEntryDlg",
"NumberEntryDlg");
2375 fMain->MapSubwindows();
2377 UInt_t height = fMain->GetDefaultHeight();
2378 fMain->Resize(
width, height);
2379 fMain->CenterOnParent();
2381 fMain->SetWMSize(
width, height);
2382 fMain->SetWMSizeHints(
width, height,
width, height, 0, 0);
2392EntryTestDlg::~EntryTestDlg()
2396 fMain->DeleteWindow();
2399void EntryTestDlg::CloseWindow()
2404void EntryTestDlg::DoOK()
2408 fMain->SendCloseMessage();
2411void EntryTestDlg::SetLimits()
2413 Double_t min = fLimits[0]->GetNumber();
2415 Double_t max = fLimits[1]->GetNumber();
2437 for (
int i = 0; i < 13; i++) {
2438 fNumericEntries[i]->SetFormat(fNumericEntries[i]->GetNumStyle(), attr);
2439 fNumericEntries[i]->SetLimits(lim, min, max);
2449 fMain->Connect(
"CloseWindow()",
"Editor",
this,
"CloseWindow()");
2450 fMain->DontCallClose();
2457 fMain->AddFrame(fEdit, fL1);
2458 fEdit->Connect(
"Opened()",
"Editor",
this,
"DoOpen()");
2459 fEdit->Connect(
"Saved()",
"Editor",
this,
"DoSave()");
2460 fEdit->Connect(
"Closed()",
"Editor",
this,
"DoClose()");
2464 gClient->GetColorByName(
"#3399ff", pxl);
2465 fEdit->SetSelectBack(pxl);
2469 fOK->Connect(
"Clicked()",
"Editor",
this,
"DoOK()");
2471 fMain->AddFrame(fOK, fL2);
2475 fMain->MapSubwindows();
2487 fMain->DeleteWindow();
2490void Editor::SetTitle()
2494 TGText *txt = GetEditor()->GetText();
2499 sprintf(title,
"ROOT Editor - Untitled");
2501 sprintf(title,
"ROOT Editor - %s", txt->
GetFileName());
2503 fMain->SetWindowName(title);
2504 fMain->SetIconName(title);
2514void Editor::LoadBuffer(
const char *buffer)
2518 fEdit->LoadBuffer(buffer);
2521void Editor::LoadFile(
const char *
file)
2525 fEdit->LoadFile(
file);
2528void Editor::AddBuffer(
const char *buffer)
2534 fEdit->AddText(&txt);
2537void Editor::CloseWindow()
2551void Editor::DoOpen()
2556void Editor::DoSave()
2561void Editor::DoClose()
2571 new TestMainFrame(
gClient->GetRoot(), 400, 220);
2576int main(
int argc,
char **argv)
2580 if (
gROOT->IsBatch()) {
2581 fprintf(stderr,
"%s: cannot run in batch mode\n", argv[0]);
const Mask_t kButtonPressMask
const Mask_t kAnyModifier
const Mask_t kPointerMotionMask
const Mask_t kButtonReleaseMask
ULong_t Pixel_t
Pixel value.
#define RQ_OBJECT(sender_class)
size_t size(const MatrixT &matrix)
retrieve the size of a square matrix
R__EXTERN TApplication * gApplication
include TDocParser_001 C image html pict1_TDocParser_001 png width
R__EXTERN void * gTQSender
R__EXTERN TRandom * gRandom
char * StrDup(const char *str)
Duplicate the string str.
R__EXTERN TSystem * gSystem
This class creates the ROOT Application Environment that interfaces to the windowing system eventloop...
virtual void Terminate(Int_t status=0)
Terminate the application by call TSystem::Exit() unless application has been told to return from Run...
virtual void SetFillColor(Color_t fcolor)
Set the fill area color.
static ULong_t RGB2Pixel(Int_t r, Int_t g, Int_t b)
Convert r,g,b to graphics system dependent pixel value.
Describe directory structure in memory.
A ROOT file is a suite of consecutive data records (TKey instances) with a well defined format.
A frame containing two scrollbars (a horizontal and a vertical) and a viewport.
Like a checkbutton but instead of the check mark there is color area with a little down arrow.
A combobox (also known as a drop down listbox) allows the selection of one item out of a list of item...
virtual void AddEntry(TGString *s, Int_t id)
virtual void Select(Int_t id, Bool_t emit=kTRUE)
Make the selected item visible in the combo box window and emit signals according to the second param...
The base class for composite widgets (menu bars, list boxes, etc.).
virtual void SetLayoutManager(TGLayoutManager *l)
Set the layout manager for the composite frame.
virtual void AddFrame(TGFrame *f, TGLayoutHints *l=0)
Add frame to the composite frame using the specified layout hints.
virtual void Layout()
Layout the elements of the composite frame.
virtual void MapSubwindows()
Map all sub windows that are part of the composite frame.
virtual void RemoveAll()
Remove all items from the container.
virtual void SetPagePosition(const TGPosition &pos)
Set page position.
A frame with handles that allow it to be undocked (i.e.
DoubleSlider widgets allow easy selection of a min and a max value out of a range.
virtual Float_t GetMinPosition() const
virtual void SetRange(Float_t min, Float_t max)
virtual void SetPosition(Float_t min, Float_t max)
Dragging the slider will generate the event:
This class creates a file selection dialog.
char * fFilename
selected file name
const char ** fFileTypes
file types used to filter selectable files
char * fIniDir
on input: initial directory, on output: new directory
void SetIniDir(const char *inidir)
Set directory name.
Font selection dialog, allowing to select one in the list of available fonts in the system.
Encapsulate fonts used in the GUI system.
FontStruct_t GetFontStruct() const
FontH_t GetFontHandle() const
A subclasses of TGWindow, and is used as base class for some simple widgets (buttons,...
static Pixel_t GetWhitePixel()
Get white pixel value.
virtual UInt_t GetDefaultWidth() const
virtual UInt_t GetDefaultHeight() const
virtual void DeleteWindow()
Delete window.
virtual void ChangeBackground(Pixel_t back)
Change frame background color.
virtual void Resize(UInt_t w=0, UInt_t h=0)
Resize the frame.
Encapsulate a graphics context used in the low level graphics.
void SetFont(FontH_t v)
Set font.
void SetForeground(Pixel_t v)
Set foreground color.
A composite frame with a border and a title.
virtual TGDimension GetDefaultSize() const
Returns default size.
virtual void SetTitlePos(ETitlePos pos=kLeft)
Concrete class for horizontal slider.
A composite frame that layout their children in horizontal way.
TGHotString is a string with a "hot" character underlined.
virtual void SetSubnames(const char *n1="", const char *n2="", const char *n3="", const char *n4="", const char *n5="", const char *n6="", const char *n7="", const char *n8="", const char *n9="", const char *n10="", const char *n11="", const char *n12="")
Sets new subnames.
void SetUserData(void *userData)
This class handles GUI labels.
This class describes layout hints used by the layout classes.
A listbox is a box, possibly with scrollbar, containing entries.
virtual void Resize(UInt_t w, UInt_t h)
Resize the listbox widget.
virtual void RemoveEntry(Int_t id=-1)
remove entry with id.
virtual void AddEntry(TGString *s, Int_t id)
Add entry with specified string and id to listbox.
virtual void SetMultipleSelections(Bool_t multi=kTRUE)
virtual void Layout()
Layout the listbox components.
virtual const char * GetText() const =0
TGListTreeItem * GetParent() const
virtual void * GetUserData() const =0
virtual void SetUserData(void *, Bool_t=kFALSE)
A list tree is a widget that can contain a number of items arranged in a tree structure.
void AddItem(TGListTreeItem *parent, TGListTreeItem *item)
Add given item to list tree.
A list view is a widget that can contain a number of items arranged in a grid or list.
Defines top level windows that interact with the system Window Manager.
This layout managers does not make use of TGLayoutHints.
TGNumberEntry is a number entry input widget with up/down buttons.
The TGPicture class implements pictures and icons used in the different GUI elements and widgets.
Pixmap_t GetPicture() const
TGFrame * GetContainer() const
A shutter widget contains a set of shutter items that can be open and closed like a shutter.
virtual void AddItem(TGShutterItem *item)
Add shutter item to shutter frame.
Slider widgets allow easy selection of a range.
virtual void SetPosition(Int_t pos)
virtual void SetRange(Int_t min, Int_t max)
TGString wraps a TString and adds some graphics routines like drawing, size of string on screen depen...
Service classes of the tab widget.
const char * GetString() const
A tab widget contains a set of composite frames each with a little tab with a name (like a set of fol...
TGTabElement * GetTabTab(Int_t tabIndex) const
Return the tab element of tab with index tabIndex.
Int_t GetNumberOfTabs() const
Return number of tabs.
virtual void RemoveTab(Int_t tabIndex=-1, Bool_t storeRemoved=kTRUE)
Remove container and tab of tab with index tabIndex.
virtual TGCompositeFrame * AddTab(TGString *text)
Add a tab to the tab widget.
A text buffer is used in several widgets, like TGTextEntry, TGFileDialog, etc.
void AddText(Int_t pos, const char *text)
const char * GetString() const
Yield an action as soon as it is clicked.
A TGTextEdit is a specialization of TGTextView.
A TGTextEntry is a one line text input widget.
Int_t GetCursorPosition() const
void Deselect()
Deselects all text (i.e.
virtual void SetCursorPosition(Int_t pos)
Set the cursor position to newPos.
virtual void SetFont(TGFont *font, Bool_t local=kTRUE)
Changes text font specified by pointer to TGFont object.
A TGText is a multi line text buffer.
Bool_t LoadBuffer(const char *txtbuf)
Load a 0 terminated buffer. Lines will be split at ' '.
const char * GetFileName() const
This is a layout manager for the TGListView widget.
Defines transient windows that typically are used for dialogs windows.
Concrete class for vertical slider.
A composite frame that layout their children in vertical way.
ROOT GUI Window base class.
1-D histogram with a float per channel (see TH1 documentation)}
virtual Int_t Fill(Double_t x)
Increment bin with abscissa X by 1.
virtual void Draw(Option_t *option="")
Draw this histogram with options.
2-D histogram with a float per channel (see TH1 documentation)}
Int_t Fill(Double_t)
Invalid Fill method.
Book space in a file, create I/O buffers, to fill them, (un)compress them.
virtual const char * GetClassName() const
virtual const char * GetTitle() const
Returns title (title can contain 32x32 xpm thumbnail/icon).
virtual const char * GetName() const
Returns name of object.
Mother of all ROOT objects.
virtual Bool_t IsFolder() const
Returns kTRUE in case object contains browsable objects (like containers or lists of other objects).
virtual const char * GetName() const
Returns name of object.
virtual void Browse(TBrowser *b)
Browse object. May be overridden for another default action.
void SetBit(UInt_t f, Bool_t set)
Set or unset the user status bits as specified in f.
virtual Bool_t InheritsFrom(const char *classname) const
Returns kTRUE if object inherits from class "classname".
virtual void Print(Option_t *option="") const
This method must be overridden when a class wants to print itself.
void SetBorderMode(Short_t bordermode) override
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.
virtual void Rannor(Float_t &a, Float_t &b)
Return 2 numbers distributed following a gaussian with mean=0 and sigma=1.
This class creates a TGCanvas in which a TCanvas is created.
TCanvas * GetCanvas() const
Bool_t EndsWith(const char *pat, ECaseCompare cmp=kExact) const
Return true if string ends with the specified string.
const char * Data() const
Describes an Operating System directory for the browser.
A TSystemFile describes an operating system file.
virtual const char * PrependPathName(const char *dir, TString &name)
Concatenate a directory and a file name.
virtual Bool_t ChangeDirectory(const char *path)
Change directory.
virtual void Sleep(UInt_t milliSec)
Sleep milliSec milli seconds.
virtual const char * WorkingDirectory()
Return working directory.
virtual Bool_t ProcessEvents()
Process pending events (GUI, timers, sockets).
static void SingleShot(Int_t milliSec, const char *receiver_class, void *receiver, const char *method)
This static function calls a slot after a given time interval.
static TVirtualPadEditor * GetPadEditor(Bool_t load=kTRUE)
Returns the pad editor dialog. Static method.
static void Terminate()
Close the global pad editor. Static method.
Bool_t fItalic
italic flag