It is now possible to run this entire test program in the interpreter. Do either:
#include <stdlib.h>
enum ETestCommandIdentifiers {
M_FILE_OPEN,
M_FILE_SAVE,
M_FILE_SAVEAS,
M_FILE_PRINT,
M_FILE_PRINTSETUP,
M_FILE_EXIT,
M_TEST_DLG,
M_TEST_MSGBOX,
M_TEST_SLIDER,
M_TEST_SHUTTER,
M_TEST_DIRLIST,
M_TEST_FILELIST,
M_TEST_PROGRESS,
M_TEST_NUMBERENTRY,
M_TEST_FONTDIALOG,
M_TEST_NEWMENU,
M_VIEW_ENBL_DOCK,
M_VIEW_ENBL_HIDE,
M_VIEW_DOCK,
M_VIEW_UNDOCK,
M_HELP_CONTENTS,
M_HELP_SEARCH,
M_HELP_ABOUT,
M_CASCADE_1,
M_CASCADE_2,
M_CASCADE_3,
M_NEW_REMOVEMENU,
VId1,
HId1,
VId2,
HId2,
VSId1,
HSId1,
VSId2,
HSId2
};
const char *filetypes[] = { "All files", "*",
"ROOT files", "*.root",
"ROOT macros", "*.C",
"Text files", "*.[tT][xX][tT]",
0, 0 };
struct shutterData_t {
const char *pixmap_name;
const char *tip_text;
};
shutterData_t histo_data[] = {
{ "h1_s.xpm", "TH1", 1001, 0 },
{ "h2_s.xpm", "TH2", 1002, 0 },
{ "h3_s.xpm", "TH3", 1003, 0 },
{ "profile_s.xpm", "TProfile", 1004, 0 },
{ 0, 0, 0, 0 }
};
shutterData_t function_data[] = {
{ "f1_s.xpm", "TF1", 2001, 0 },
{ "f2_s.xpm", "TF2", 2002, 0 },
{ 0, 0, 0, 0 }
};
shutterData_t tree_data[] = {
{ "ntuple_s.xpm", "TNtuple", 3001, 0 },
{ "tree_s.xpm", "TTree", 3002, 0 },
{ "chain_s.xpm", "TChain", 3003, 0 },
{ 0, 0, 0, 0 }
};
const char *editortxt1 =
"This is the ROOT text edit widget TGTextEdit. It is not intended as\n"
"a full developers editor, but it is relatively complete and can ideally\n"
"be used to edit scripts or to present users editable config files, etc.\n\n"
"The text edit widget supports standard emacs style ctrl-key navigation\n"
"in addition to the arrow keys. By default the widget has under the right\n"
"mouse button a popup menu giving access to several built-in functions.\n\n"
"Cut, copy and paste between different editor windows and any other\n"
"standard text handling application is supported.\n\n"
"Text can be selected with the mouse while holding the left button\n"
"or with the arrow keys while holding the shift key pressed. Use the\n"
"middle mouse button to paste text at the current mouse location."
;
const char *editortxt2 =
"Mice with scroll-ball are properly supported.\n\n"
"This are the currently defined key bindings:\n"
"Left Arrow\n"
" Move the cursor one character leftwards.\n"
" Scroll when cursor is out of frame.\n"
"Right Arrow\n"
" Move the cursor one character rightwards.\n"
" Scroll when cursor is out of frame.\n"
"Backspace\n"
" Deletes the character on the left side of the text cursor and moves the\n"
" cursor one position to the left. If a text has been marked by the user"
;
const char *editortxt3 =
" (e.g. by clicking and dragging) the cursor will be put at the beginning\n"
" of the marked text and the marked text will be removed.\n"
"Home\n"
" Moves the text cursor to the left end of the line. If mark is TRUE text\n"
" will be marked towards the first position, if not any marked text will\n"
" be unmarked if the cursor is moved.\n"
"End\n"
" Moves the text cursor to the right end of the line. If mark is TRUE text\n"
" will be marked towards the last position, if not any marked text will\n"
" be unmarked if the cursor is moved.\n"
"Delete"
;
const char *editortxt4 =
" Deletes the character on the right side of the text cursor. If a text\n"
" has been marked by the user (e.g. by clicking and dragging) the cursor\n"
" will be put at the beginning of the marked text and the marked text will\n"
" be removed.\n"
"Shift - Left Arrow\n"
" Mark text one character leftwards.\n"
"Shift - Right Arrow\n"
" Mark text one character rightwards.\n"
"Control-A\n"
" Select the whole text.\n"
"Control-B\n"
" Move the cursor one character leftwards."
;
const char *editortxt5 =
"Control-C\n"
" Copy the marked text to the clipboard.\n"
"Control-D\n"
" Delete the character to the right of the cursor.\n"
"Control-E\n"
" Move the cursor to the end of the line.\n"
"Control-F\n"
" Start Search Dialog.\n"
"Control-H\n"
" Delete the character to the left of the cursor.\n"
"Control-K\n"
" Delete marked text if any or delete all\n"
" characters to the right of the cursor.\n"
"Control-L\n"
" Start GoTo Line Dialog"
;
const char *editortxt6 =
"Control-U\n"
" Delete all characters on the line.\n"
"Control-V\n"
" Paste the clipboard text into line edit.\n"
"Control-X\n"
" Cut the marked text, copy to clipboard.\n"
"Control-Y\n"
" Paste the clipboard text into line edit.\n"
"Control-Z\n"
" Undo action.\n\n"
"All other keys with valid ASCII codes insert themselves into the line.";
class TileFrame;
class TestMainFrame {
private:
TileFrame *fContainer;
TGPopupMenu *fMenuFile, *fMenuTest, *fMenuView, *fMenuHelp;
TGPopupMenu *fCascadeMenu, *fCascade1Menu, *fCascade2Menu;
TGLayoutHints *fMenuBarLayout, *fMenuBarItemLayout, *fMenuBarHelpLayout;
public:
virtual ~TestMainFrame();
void CloseWindow();
void DoButton();
void HandleMenu(
Int_t id);
void HandlePopup() { printf("menu popped up\n"); }
void HandlePopdown() { printf("menu popped down\n"); }
void Created() { Emit("Created()"); }
void Welcome() { printf("TestMainFrame has been created. Welcome!\n"); }
};
class TestDialog {
private:
TGButton *fOkButton, *fCancelButton, *fStartB, *fStopB;
TGButton *fBtn1, *fBtn2, *fChk1, *fChk2, *fRad1, *fRad2;
void FillHistos();
public:
virtual ~TestDialog();
void DoClose();
void CloseWindow();
void DoOK();
void DoCancel();
void HandleButtons(
Int_t id = -1);
};
class TestMsgBox {
private:
public:
UInt_t options = kVerticalFrame);
virtual ~TestMsgBox();
void TryToClose();
void CloseWindow();
void DoClose();
void DoRadio();
void DoTest();
};
class TestSliders {
private:
public:
virtual ~TestSliders();
void CloseWindow();
void DoText(const char *text);
void DoSlider(
Int_t pos = 0);
};
class TestShutter {
private:
public:
~TestShutter();
void AddShutterItem(const char *name, shutterData_t *data);
void CloseWindow();
void HandleButtons();
};
class TestDirList {
protected:
public:
virtual ~TestDirList();
void CloseWindow();
};
class TestFileList {
protected:
void DisplayFile(const
TString &fname);
void DisplayDirectory(const
TString &fname);
public:
virtual ~TestFileList();
void DoMenu(Int_t);
void CloseWindow();
};
class TestProgress {
private:
public:
virtual ~TestProgress();
void CloseWindow();
void DoClose();
void DoGo();
};
class EntryTestDlg {
private:
public:
virtual ~EntryTestDlg();
void CloseWindow();
void SetLimits();
void DoOK();
};
class Editor {
private:
public:
virtual ~Editor();
void LoadFile(const char *file);
void LoadBuffer(const char *buffer);
void AddBuffer(const char *buffer);
void SetTitle();
void Popup();
void CloseWindow();
void DoOK();
void DoOpen();
void DoSave();
void DoClose();
};
class TileFrame {
private:
public:
virtual ~TileFrame() { delete fFrame; }
TGFrame *GetFrame()
const {
return fFrame; }
void SetCanvas(
TGCanvas *canvas) { fCanvas = canvas; }
void HandleMouseWheel(
Event_t *event);
};
{
fFrame->Connect("ProcessedEvent(Event_t*)", "TileFrame", this,
"HandleMouseWheel(Event_t*)");
fCanvas = 0;
}
void TileFrame::HandleMouseWheel(
Event_t *event)
{
return;
if (!fCanvas) return;
if (fCanvas->GetContainer()->GetHeight())
fCanvas->GetViewPort()->GetHeight()) /
fCanvas->GetContainer()->GetHeight());
}
Int_t newpos = fCanvas->GetVsbPosition() - page;
if (newpos < 0) newpos = 0;
fCanvas->SetVsbPosition(newpos);
}
Int_t newpos = fCanvas->GetVsbPosition() + page;
fCanvas->SetVsbPosition(newpos);
}
}
{
fMain->Connect("CloseWindow()", "TestMainFrame", this, "CloseWindow()");
fMenuDock->SetWindowName("GuiTest Menu");
fMenuFile->
AddEntry(
"&Open...", M_FILE_OPEN);
fMenuFile->AddEntry("&Save", M_FILE_SAVE);
fMenuFile->AddEntry("S&ave as...", M_FILE_SAVEAS);
fMenuFile->AddEntry("&Close", -1);
fMenuFile->AddSeparator();
fMenuFile->AddEntry("&Print", M_FILE_PRINT);
fMenuFile->AddEntry("P&rint setup...", M_FILE_PRINTSETUP);
fMenuFile->AddSeparator();
fMenuFile->AddEntry("E&xit", M_FILE_EXIT);
fMenuFile->DisableEntry(M_FILE_SAVEAS);
fMenuFile->HideEntry(M_FILE_PRINT);
fCascade2Menu->
AddEntry(
"ID = 2&3", M_CASCADE_1);
fCascade2Menu->AddEntry("ID = 2&4", M_CASCADE_2);
fCascade2Menu->AddEntry("ID = 2&5", M_CASCADE_3);
fCascade1Menu->
AddEntry(
"ID = 4&1", 41);
fCascade1Menu->AddEntry("ID = 4&2", 42);
fCascade1Menu->AddEntry("ID = 4&3", 43);
fCascade1Menu->AddSeparator();
fCascade1Menu->AddPopup("Cascade&d 2", fCascade2Menu);
fCascadeMenu->AddEntry("ID = 5&2", 52);
fCascadeMenu->AddEntry("ID = 5&3", 53);
fCascadeMenu->AddSeparator();
fCascadeMenu->AddPopup("&Cascaded 1", fCascade1Menu);
fMenuTest->
AddLabel(
"Test different features...");
fMenuTest->AddSeparator();
fMenuTest->AddEntry("&Dialog...", M_TEST_DLG);
fMenuTest->AddEntry("&Message Box...", M_TEST_MSGBOX);
fMenuTest->AddEntry("&Sliders...", M_TEST_SLIDER);
fMenuTest->AddEntry("Sh&utter...", M_TEST_SHUTTER);
fMenuTest->AddEntry("&List Directory...", M_TEST_DIRLIST);
fMenuTest->AddEntry("&File List...", M_TEST_FILELIST);
fMenuTest->AddEntry("&Progress...", M_TEST_PROGRESS);
fMenuTest->AddEntry("&Number Entry...", M_TEST_NUMBERENTRY);
fMenuTest->AddEntry("F&ont Dialog...", M_TEST_FONTDIALOG);
fMenuTest->AddSeparator();
fMenuTest->AddEntry("Add New Menus", M_TEST_NEWMENU);
fMenuTest->AddSeparator();
fMenuTest->AddPopup("&Cascaded menus", fCascadeMenu);
fMenuView->
AddEntry(
"&Dock", M_VIEW_DOCK);
fMenuView->AddEntry("&Undock", M_VIEW_UNDOCK);
fMenuView->AddSeparator();
fMenuView->AddEntry("Enable U&ndock", M_VIEW_ENBL_DOCK);
fMenuView->AddEntry("Enable &Hide", M_VIEW_ENBL_HIDE);
fMenuView->DisableEntry(M_VIEW_DOCK);
fMenuDock->EnableUndock(
kTRUE);
fMenuDock->EnableHide(
kTRUE);
fMenuView->CheckEntry(M_VIEW_ENBL_DOCK);
fMenuView->CheckEntry(M_VIEW_ENBL_HIDE);
fMenuDock->Connect("Undocked()", "TestMainFrame", this, "HandleMenu(=M_VIEW_UNDOCK)");
fMenuHelp->
AddEntry(
"&Contents", M_HELP_CONTENTS);
fMenuHelp->AddEntry("&Search...", M_HELP_SEARCH);
fMenuHelp->AddSeparator();
fMenuHelp->AddEntry("&About", M_HELP_ABOUT);
fMenuNew1->AddEntry("Remove New Menus", M_NEW_REMOVEMENU);
fMenuNew2->AddEntry("Remove New Menus", M_NEW_REMOVEMENU);
fMenuFile->Connect("Activated(Int_t)", "TestMainFrame", this,
"HandleMenu(Int_t)");
fMenuFile->Connect("PoppedUp()", "TestMainFrame", this, "HandlePopup()");
fMenuFile->Connect("PoppedDown()", "TestMainFrame", this, "HandlePopdown()");
fMenuTest->Connect("Activated(Int_t)", "TestMainFrame", this,
"HandleMenu(Int_t)");
fMenuView->Connect("Activated(Int_t)", "TestMainFrame", this,
"HandleMenu(Int_t)");
fMenuHelp->Connect("Activated(Int_t)", "TestMainFrame", this,
"HandleMenu(Int_t)");
fCascadeMenu->Connect("Activated(Int_t)", "TestMainFrame", this,
"HandleMenu(Int_t)");
fCascade1Menu->Connect("Activated(Int_t)", "TestMainFrame", this,
"HandleMenu(Int_t)");
fCascade2Menu->Connect("Activated(Int_t)", "TestMainFrame", this,
"HandleMenu(Int_t)");
fMenuNew1->Connect("Activated(Int_t)", "TestMainFrame", this,
"HandleMenu(Int_t)");
fMenuNew2->Connect("Activated(Int_t)", "TestMainFrame", this,
"HandleMenu(Int_t)");
fMenuBar->AddPopup("&File", fMenuFile, fMenuBarItemLayout);
fMenuBar->AddPopup("&Test", fMenuTest, fMenuBarItemLayout);
fMenuBar->AddPopup("&View", fMenuView, fMenuBarItemLayout);
fMenuBar->AddPopup("&Help", fMenuHelp, fMenuBarHelpLayout);
fMenuDock->AddFrame(fMenuBar, fMenuBarLayout);
fCanvasWindow =
new TGCanvas(fMain, 400, 240);
fContainer = new TileFrame(fCanvasWindow->GetViewPort());
fContainer->SetCanvas(fCanvasWindow);
fCanvasWindow->SetContainer(fContainer->GetFrame());
for (int i=0; i < 256; ++i)
fCanvasWindow->AddFrame(
new TGFrame(fCanvasWindow->GetContainer(),
0, 0, 2, 2));
fTestButton =
new TGTextButton(fStatusFrame,
"&Open editor...", 150);
fTestButton->
Connect(
"Clicked()",
"TestMainFrame",
this,
"DoButton()");
fTestText->SetToolTipText("This is a text entry widget");
fTestText->Resize(300, fTestText->GetDefaultHeight());
10, 2, 2, 2));
gClient->GetColorByName(
"yellow", yellow);
0, 0, 1, 0));
fMain->SetWindowName("GuiTest Signal/Slots");
fMain->MapSubwindows();
fMain->Resize();
fMain->MapWindow();
fMain->Print();
Connect("Created()", "TestMainFrame", this, "Welcome()");
Created();
}
TestMainFrame::~TestMainFrame()
{
delete fMenuFile;
delete fMenuTest;
delete fMenuView;
delete fMenuHelp;
delete fCascadeMenu;
delete fCascade1Menu;
delete fCascade2Menu;
delete fMenuNew1;
delete fMenuNew2;
delete fContainer;
delete fMain;
}
void TestMainFrame::CloseWindow()
{
}
void TestMainFrame::DoButton()
{
Editor *ed = new Editor(fMain, 600, 400);
ed->LoadBuffer(editortxt1);
ed->AddBuffer(editortxt2);
ed->AddBuffer(editortxt3);
ed->AddBuffer(editortxt4);
ed->AddBuffer(editortxt5);
ed->AddBuffer(editortxt6);
ed->Popup();
}
void TestMainFrame::HandleMenu(
Int_t id)
{
switch (id) {
case M_FILE_OPEN:
{
printf(
"fIniDir = %s\n", fi.
fIniDir);
}
break;
case M_FILE_SAVE:
printf("M_FILE_SAVE\n");
break;
case M_FILE_PRINT:
printf("M_FILE_PRINT\n");
printf("Hiding itself, select \"Print Setup...\" to enable again\n");
fMenuFile->HideEntry(M_FILE_PRINT);
break;
case M_FILE_PRINTSETUP:
printf("M_FILE_PRINTSETUP\n");
printf("Enabling \"Print\"\n");
fMenuFile->EnableEntry(M_FILE_PRINT);
break;
case M_FILE_EXIT:
CloseWindow();
break;
case M_TEST_DLG:
new TestDialog(
gClient->GetRoot(), fMain, 400, 200);
break;
case M_TEST_MSGBOX:
new TestMsgBox(
gClient->GetRoot(), fMain, 400, 200);
break;
case M_TEST_SLIDER:
new TestSliders(
gClient->GetRoot(), fMain, 400, 200);
break;
case M_TEST_SHUTTER:
new TestShutter(
gClient->GetRoot(), fMain, 400, 200);
break;
case M_TEST_DIRLIST:
new TestDirList(
gClient->GetRoot(), fMain, 400, 200);
break;
case M_TEST_FILELIST:
new TestFileList(
gClient->GetRoot(), fMain, 400, 200);
break;
case M_TEST_PROGRESS:
new TestProgress(
gClient->GetRoot(), fMain, 600, 300);
break;
case M_TEST_NUMBERENTRY:
new EntryTestDlg(
gClient->GetRoot(), fMain);
break;
case M_TEST_FONTDIALOG:
{
printf("Selected font: %s, size %d, italic %s, bold %s, color 0x%lx, align %u\n",
}
break;
case M_TEST_NEWMENU:
{
if (fMenuTest->IsEntryChecked(M_TEST_NEWMENU)) {
HandleMenu(M_NEW_REMOVEMENU);
return;
}
fMenuTest->CheckEntry(M_TEST_NEWMENU);
fMenuBar->AddPopup("New 1", fMenuNew1, fMenuBarItemLayout, p);
p = fMenuBar->GetPopup("Help");
fMenuBar->
AddPopup(
"New 2", fMenuNew2, fMenuBarItemLayout, p);
fMenuBar->MapSubwindows();
fMenuBar->Layout();
fMenuTest->AddEntry("Remove New Menus", M_NEW_REMOVEMENU, 0, 0, e);
}
break;
case M_NEW_REMOVEMENU:
{
fMenuBar->RemovePopup("New 1");
fMenuBar->RemovePopup("New 2");
fMenuBar->Layout();
fMenuTest->DeleteEntry(M_NEW_REMOVEMENU);
fMenuTest->UnCheckEntry(M_TEST_NEWMENU);
}
break;
case M_VIEW_ENBL_DOCK:
fMenuDock->EnableUndock(!fMenuDock->EnableUndock());
if (fMenuDock->EnableUndock()) {
fMenuView->CheckEntry(M_VIEW_ENBL_DOCK);
fMenuView->EnableEntry(M_VIEW_UNDOCK);
} else {
fMenuView->UnCheckEntry(M_VIEW_ENBL_DOCK);
fMenuView->DisableEntry(M_VIEW_UNDOCK);
}
break;
case M_VIEW_ENBL_HIDE:
fMenuDock->EnableHide(!fMenuDock->EnableHide());
if (fMenuDock->EnableHide()) {
fMenuView->CheckEntry(M_VIEW_ENBL_HIDE);
} else {
fMenuView->UnCheckEntry(M_VIEW_ENBL_HIDE);
}
break;
case M_VIEW_DOCK:
fMenuDock->DockContainer();
fMenuView->EnableEntry(M_VIEW_UNDOCK);
fMenuView->DisableEntry(M_VIEW_DOCK);
break;
case M_VIEW_UNDOCK:
fMenuDock->UndockContainer();
fMenuView->EnableEntry(M_VIEW_DOCK);
fMenuView->DisableEntry(M_VIEW_UNDOCK);
break;
default:
printf("Menu item %d selected\n", id);
break;
}
}
{
fMain->Connect("CloseWindow()", "TestDialog", this, "DoClose()");
fMain->DontCallClose();
fOkButton->
Connect(
"Clicked()",
"TestDialog",
this,
"DoOK()");
fCancelButton->
Connect(
"Clicked()",
"TestDialog",
this,
"DoCancel()");
2, 2, 2, 2);
fMain->AddFrame(fFrame1, fL2);
fTab =
new TGTab(fMain, 300, 300);
fTab->
Connect(
"Selected(Int_t)",
"TestDialog",
this,
"DoTab(Int_t)");
200, 2, 2, 2);
int i;
char tmp[20];
for (i = 0; i < 20; i++) {
sprintf(tmp, "Entry %i", i+1);
}
fBtn1->
Connect(
"Clicked()",
"TestDialog",
this,
"HandleButtons()");
fBtn2->
Connect(
"Clicked()",
"TestDialog",
this,
"HandleButtons()");
fChk1->
Connect(
"Clicked()",
"TestDialog",
this,
"HandleButtons()");
fChk2->
Connect(
"Clicked()",
"TestDialog",
this,
"HandleButtons()");
fRad1->
Connect(
"Clicked()",
"TestDialog",
this,
"HandleButtons()");
fRad2->
Connect(
"Clicked()",
"TestDialog",
this,
"HandleButtons()");
fHpx = 0;
fHpxpy = 0;
fStartB =
new TGTextButton(fF3,
"Start &Filling Hists", 40);
fStartB->
Connect(
"Clicked()",
"TestDialog",
this,
"HandleButtons()");
fStopB->
Connect(
"Clicked()",
"TestDialog",
this,
"HandleButtons()");
"TestDialog", this,
"HandleEmbeddedCanvas(Int_t,Int_t,Int_t,TObject*)");
gClient->GetColorByName(
"yellow", yellow);
bt->
Connect(
"Clicked()",
"TestDialog",
this,
"HandleButtons()");
bt->
Connect(
"Clicked()",
"TestDialog",
this,
"HandleButtons()");
fCheckMulti->
Connect(
"Clicked()",
"TestDialog",
this,
"HandleButtons()");
for (i = 0; i < 20; ++i) {
sprintf(tmp, "Entry %i", i);
}
fFirstEntry = 0;
fLastEntry = 20;
char buff[100];
int j;
for (j = 0; j < 4; j++) {
sprintf(buff, "Module %i", j+1);
tent->
SetFont(
"-adobe-courier-bold-r-*-*-14-*-*-*-*-*-iso8859-1");
}
bt->
Connect(
"Clicked()",
"TestDialog",
this,
"HandleButtons()");
bt->
Connect(
"Clicked()",
"TestDialog",
this,
"HandleButtons()");
bt->
Connect(
"Clicked()",
"TestDialog",
this,
"HandleButtons()");
fMain->AddFrame(fTab, fL5);
fMain->MapSubwindows();
fMain->Resize();
fMain->CenterOnParent();
fMain->SetWindowName("Dialog");
fMain->MapWindow();
}
TestDialog::~TestDialog()
{
fMain->DeleteWindow();
}
void TestDialog::FillHistos()
{
if (!fHpx) {
fHpx =
new TH1F(
"hpx",
"This is the px distribution",100,-4,4);
fHpxpy =
new TH2F(
"hpxpy",
"py vs px",40,-4,4,40,-4,4);
cnt = 0;
}
float px, py;
while (fFillHistos) {
cnt++;
if (!(cnt % kUPDATE)) {
if (cnt == kUPDATE) {
}
}
}
}
void TestDialog::DoClose()
{
printf("\nTerminating dialog: via window manager\n");
if (fFillHistos) {
} else
CloseWindow();
}
void TestDialog::CloseWindow()
{
delete this;
}
void TestDialog::DoOK()
{
printf("\nTerminating dialog: OK pressed\n");
}
void TestDialog::DoCancel()
{
printf("\nTerminating dialog: Cancel pressed\n");
}
void TestDialog::HandleButtons(
Int_t id)
{
if (id == -1) {
}
printf("DoButton: id = %d\n", id);
char tmp[20];
static int newtab = 0;
switch (id) {
case 40:
FillHistos();
break;
case 41:
break;
case 61:
break;
case 62:
break;
case 90:
fLastEntry++;
sprintf(tmp, "Entry %i", fLastEntry);
break;
case 91:
if (fFirstEntry <= fLastEntry) {
fFirstEntry++;
}
break;
case 101:
{
if ((s ==
"Tab 3") && (fMain->MustCleanup() !=
kDeepCleanup)) {
delete fEc1; fEc1 = 0;
delete fEc2; fEc2 = 0;
}
}
break;
case 102:
{
for (int i = 0 ; i < nt; i++) {
if (s == "Tab 5") {
break;
}
}
}
break;
case 103:
sprintf(tmp, "New Tab %d", ++newtab);
break;
case 81:
break;
case 82:
break;
case 92:
break;
default:
break;
}
}
void TestDialog::DoTab(
Int_t id)
{
printf("Tab item %d activated\n", id);
}
{
printf("event = %d, x = %d, y = %d, obj = %s::%s\n", event, x, y,
}
{
fMain->Connect("CloseWindow()", "TestMsgBox", this, "CloseWindow()");
fMain->DontCallClose();
gClient->GetColorByName(
"red", red);
int i;
fMain->ChangeOptions((fMain->GetOptions() & ~kVerticalFrame) |
kHorizontalFrame);
fTestButton =
new TGTextButton(f1,
"&Test", 1, fRedTextGC());
fTestButton->
Connect(
"Clicked()",
"TestMsgBox",
this,
"DoTest()");
gClient->GetColorByName(
"green", green);
fCloseButton->
Connect(
"Clicked()",
"TestMsgBox",
this,
"DoClose()");
2, 2, 3, 0);
2, 5, 0, 2);
2, 5, 10, 0);
fMain->AddFrame(f1, fL21);
2, 2, 2, 2);
0, 0, 5, 0);
for (i=0; i<13; ++i) fG1->
AddFrame(fC[i], fL4);
for (i = 0; i < 4; ++i) {
fR[i]->
Connect(
"Clicked()",
"TestMsgBox",
this,
"DoRadio()");
}
fTbmsg->
AddText(0,
"This is a test message box.");
3, 5, 0, 0);
0, 2, 0, 0);
fMain->AddFrame(f2, fL2);
fMain->MapSubwindows();
fMain->Resize();
fMain->CenterOnParent();
fMain->SetWindowName("Message Box Test");
fMain->MapWindow();
}
TestMsgBox::~TestMsgBox()
{
fMain->DeleteWindow();
}
void TestMsgBox::CloseWindow()
{
delete this;
}
void TestMsgBox::DoClose()
{
CloseWindow();
}
void TestMsgBox::DoTest()
{
int i, buttons, retval;
buttons = 0;
for (i = 0; i < 13; i++)
buttons |= mb_button_id[i];
for (i = 0; i < 4; i++)
icontype = mb_icon[i];
break;
}
fMain->Disconnect("CloseWindow()");
fMain->Connect("CloseWindow()", "TestMsgBox", this, "TryToClose()");
icontype, buttons, &retval);
fMain->Connect("CloseWindow()", "TestMsgBox", this, "CloseWindow()");
}
void TestMsgBox::TryToClose()
{
printf("Can't close the window '%s' : a message box is still open\n", fMain->GetWindowName());
}
void TestMsgBox::DoRadio()
{
if (id >= 21 && id <= 24) {
for (int i = 0; i < 4; i++)
if (fR[i]->WidgetId() != id)
}
}
{
fMain->Connect("CloseWindow()", "TestSliders", this, "CloseWindow()");
fMain->DontCallClose();
fMain->ChangeOptions((fMain->GetOptions() & ~kVerticalFrame) |
kHorizontalFrame);
fTeh1->
Connect(
"TextChanged(char*)",
"TestSliders",
this,
"DoText(char*)");
fTev1->
Connect(
"TextChanged(char*)",
"TestSliders",
this,
"DoText(char*)");
fHslider1->
Connect(
"PositionChanged(Int_t)",
"TestSliders",
this,
"DoSlider(Int_t)");
fVslider1->
Connect(
"PositionChanged(Int_t)",
"TestSliders",
this,
"DoSlider(Int_t)");
fTeh2->
Connect(
"TextChanged(char*)",
"TestSliders",
this,
"DoText(char*)");
fTev2->
Connect(
"TextChanged(char*)",
"TestSliders",
this,
"DoText(char*)");
fHslider2->
Connect(
"PositionChanged(Int_t)",
"TestSliders",
this,
"DoSlider(Int_t)");
fVslider2->
Connect(
"PositionChanged()",
"TestSliders",
this,
"DoSlider()");
fMain->AddFrame(fVframe2, fBfly1);
fMain->AddFrame(fVframe1, fBfly1);
fMain->SetWindowName("Slider Test");
fMain->Resize(size);
fMain->CenterOnParent();
fMain->MapSubwindows();
fMain->MapWindow();
}
TestSliders::~TestSliders()
{
fMain->DeleteWindow();
}
void TestSliders::CloseWindow()
{
delete this;
}
void TestSliders::DoText(const char * )
{
switch (id) {
case HId1:
break;
case VId1:
break;
case HId2:
break;
case VId2:
break;
default:
break;
}
}
void TestSliders::DoSlider(
Int_t pos)
{
} else {
}
char buf[32];
sprintf(buf, "%d", pos);
#ifdef CINT_FIXED
switch (id) {
case HSId1:
#else
if (id == HSId1) {
#endif
#ifdef CINT_FIXED
break;
case VSId1:
#else
}
else if (id == VSId1) {
#endif
#ifdef CINT_FIXED
break;
case HSId2:
#else
}
else if (id == HSId2) {
#endif
#ifdef CINT_FIXED
break;
case VSId2:
#else
}
else if (id == VSId2) {
#endif
#ifdef CINT_FIXED
break;
default:
break;
#endif
}
}
{
fMain->Connect("CloseWindow()", "TestShutter", this, "CloseWindow()");
fMain->DontCallClose();
fDefaultPic =
gClient->GetPicture(
"folder_s.xpm");
AddShutterItem("Histograms", histo_data);
AddShutterItem("Functions", function_data);
AddShutterItem("Trees", tree_data);
fMain->AddFrame(fShutter, fLayout);
fMain->MapSubwindows();
fMain->Resize(80, 300);
fMain->CenterOnParent();
fMain->SetWindowName("Shutter Test");
fMain->MapWindow();
}
void TestShutter::AddShutterItem(const char *name, shutterData_t *data)
{
static int id = 5001;
5, 5, 5, 0);
for (int i=0; data[i].pixmap_name != 0; i++) {
buttonpic =
gClient->GetPicture(data[i].pixmap_name);
if (!buttonpic) {
printf("<TestShutter::AddShutterItem>: missing pixmap \"%s\", using default",
data[i].pixmap_name);
buttonpic = fDefaultPic;
}
button->
Connect(
"Clicked()",
"TestShutter",
this,
"HandleButtons()");
data[i].button = button;
}
}
TestShutter::~TestShutter()
{
fMain->DeleteWindow();
}
void TestShutter::CloseWindow()
{
delete this;
}
void TestShutter::HandleButtons()
{
printf(
"Shutter button %d\n", btn->
WidgetId());
}
{
fMain->Connect("CloseWindow()", "TestDirList", this, "CloseWindow()");
fMain->DontCallClose();
fIcon =
gClient->GetPicture(
"rootdb_t.xpm");
fMain->AddFrame(canvas,lo);
fContents->
Connect(
"DoubleClicked(TGListTreeItem*,Int_t)",
"TestDirList",
this,
"OnDoubleClick(TGListTreeItem*,Int_t)");
fContents->
Connect(
"Clicked(TGListTreeItem*,Int_t)",
"TestDirList",
this,
"OnDoubleClick(TGListTreeItem*,Int_t)");
#ifdef G__WIN32
#else
#endif
fMain->CenterOnParent();
fMain->SetWindowName("List Dir Test");
fMain->MapSubwindows();
fMain->Resize();
fMain->MapWindow();
}
TestDirList::~TestDirList()
{
delete fContents;
}
void TestDirList::CloseWindow()
{
delete this;
}
{
item = parent;
}
return dirname;
}
{
TList *files = dir.GetListOfFiles();
if (files) {
if ((fname!="..") && (fname!=".")) {
}
fContents->
AddItem(item,fname,fIcon,fIcon);
}
}
delete files;
}
}
{
fMain->Connect("CloseWindow()", "TestDirList", this, "CloseWindow()");
fMain->DontCallClose();
fMain->AddFrame(mb, lo);
fMenu->AddSeparator();
fMenu->AddEntry("&Close", 10);
fMenu->Connect("Activated(Int_t)","TestFileList",this,"DoMenu(Int_t)");
fMain->AddFrame(lv,lo);
gClient->GetColorByName(
"white", white);
fContents->
Connect(
"DoubleClicked(TGFrame*,Int_t)",
"TestFileList",
this,
"OnDoubleClick(TGLVEntry*,Int_t)");
fMain->CenterOnParent();
fMain->SetWindowName("File List Test");
fMain->MapSubwindows();
fMain->MapWindow();
fContents->SetDefaultHeaders();
fContents->DisplayDirectory();
fContents->AddFile("..");
fContents->StopRefreshTimer();
}
TestFileList::~TestFileList()
{
delete fContents;
}
void TestFileList::DoMenu(
Int_t mode)
{
if (mode<10) {
} else {
delete this;
}
}
void TestFileList::DisplayFile(
const TString &fname)
{
fContents->SetColHeaders("Name","Title");
TIter next(file.GetListOfKeys());
while ((key=(
TKey*)next())) {
TString cname = key->GetClassName();
}
fMain->Resize();
}
void TestFileList::DisplayDirectory(
const TString &fname)
{
fContents->SetDefaultHeaders();
fContents->ChangeDirectory(fname);
fContents->DisplayDirectory();
fContents->AddFile("..");
}
void TestFileList::DisplayObject(
const TString& fname,
const TString& name)
{
if (file) delete file;
if (obj) {
}
}
{
if (fname) {
DisplayObject(fname, name);
DisplayFile(name);
} else {
DisplayDirectory(name);
}
}
void TestFileList::CloseWindow()
{
delete this;
}
{
fMain->Connect("CloseWindow()", "TestProgress", this, "DoClose()");
fMain->DontCallClose();
fMain->ChangeOptions((fMain->GetOptions() & ~kVerticalFrame) |
kHorizontalFrame);
fVProg1->SetBarColor("purple");
fVProg2->SetBarColor("green");
fHframe1->Resize(300, 300);
fHProg1->ShowPosition();
fHProg2->SetBarColor("lightblue");
fGO->Connect("Clicked()", "TestProgress", this, "DoGo()");
fHframe1->AddFrame(fVProg1, fHint1);
fHframe1->AddFrame(fVProg2, fHint1);
fMain->AddFrame(fHframe1, fHint4);
fMain->AddFrame(fVframe1, fHint5);
fMain->SetWindowName("Progress Test");
fMain->Resize(size);
fMain->CenterOnParent();
fMain->MapSubwindows();
fMain->MapWindow();
}
TestProgress::~TestProgress()
{
fMain->DeleteWindow();
}
void TestProgress::CloseWindow()
{
delete this;
}
void TestProgress::DoClose()
{
if (fClose)
CloseWindow();
else {
}
}
void TestProgress::DoGo()
{
fVProg1->Reset(); fVProg2->Reset();
fHProg1->Reset(); fHProg2->Reset(); fHProg3->Reset();
fVProg2->SetBarColor("green");
int cnt1 = 0, cnt2 = 0, cnt3 = 0, cnt4 = 0;
int inc1 = 4, inc2 = 3, inc3 = 2, inc4 = 1;
while (cnt1 < 100 || cnt2 < 100 || cnt3 < 100 || cnt4 <100) {
if (cnt1 < 100) {
cnt1 += inc1;
fVProg1->Increment(inc1);
}
if (cnt2 < 100) {
cnt2 += inc2;
fVProg2->Increment(inc2);
if (cnt2 > 75)
fVProg2->SetBarColor("red");
}
if (cnt3 < 100) {
cnt3 += inc3;
fHProg1->Increment(inc3);
}
if (cnt4 < 100) {
cnt4 += inc4;
fHProg2->Increment(inc4);
fHProg3->Increment(inc4);
}
if (fClose) return;
}
}
const char *numlabel[] = {
"Integer",
"One digit real",
"Two digit real",
"Three digit real",
"Four digit real",
"Real",
"Degree.min.sec",
"Min:sec",
"Hour:min",
"Hour:min:sec",
"Day/month/year",
"Month/day/year",
"Hex"
};
12345, 1.0, 1.00, 1.000, 1.0000, 1.2E-12,
90 * 3600, 120 * 60, 12 * 60, 12 * 3600 + 15 * 60,
19991121, 19991121, (
Double_t) 0xDEADFACEU
};
{
fMain->Connect("CloseWindow()", "EntryTestDlg", this, "CloseWindow()");
fMain->DontCallClose();
TGFont *myfont =
gClient->GetFont(
"-adobe-helvetica-bold-r-*-*-12-*-*-*-*-*-iso8859-1");
fMain->AddFrame(fF1, fL1);
for (int i = 0; i < 13; i++) {
fNumericEntries[i] =
new TGNumberEntry(fF[i], numinit[i], 12, i + 20,
fF[i]->AddFrame(fNumericEntries[i], fL2);
fF[i]->AddFrame(fLabel[i], fL2);
}
fMain->AddFrame(fF2, fL3);
fLimits[0]->SetLogStep(
kFALSE);
fLimits[1]->SetLogStep(
kFALSE);
fSetButton->Connect("Clicked()", "EntryTestDlg", this, "SetLimits()");
fExitButton->Connect("Clicked()", "EntryTestDlg", this, "DoOK()");
fMain->SetWindowName("Number Entry Test");
fMain->SetIconName("Number Entry Test");
fMain->SetClassHints("NumberEntryDlg", "NumberEntryDlg");
fMain->MapSubwindows();
UInt_t width = fMain->GetDefaultWidth();
UInt_t height = fMain->GetDefaultHeight();
fMain->Resize(width, height);
fMain->CenterOnParent();
fMain->SetWMSize(width, height);
fMain->SetWMSizeHints(width, height, width, height, 0, 0);
fMain->MapWindow();
}
EntryTestDlg::~EntryTestDlg()
{
fMain->DeleteWindow();
}
void EntryTestDlg::CloseWindow()
{
delete this;
}
void EntryTestDlg::DoOK()
{
fMain->SendCloseMessage();
}
void EntryTestDlg::SetLimits()
{
if (low && high) {
} else if (low) {
} else if (high) {
} else {
}
if (pos) {
} else if (nneg) {
} else {
}
for (int i = 0; i < 13; i++) {
fNumericEntries[i]->SetFormat(fNumericEntries[i]->GetNumStyle(), attr);
fNumericEntries[i]->SetLimits(lim, min, max);
}
}
{
fMain->
Connect(
"CloseWindow()",
"Editor",
this,
"CloseWindow()");
fMain->DontCallClose();
fMain->AddFrame(fEdit, fL1);
fEdit->Connect("Opened()", "Editor", this, "DoOpen()");
fEdit->Connect("Saved()", "Editor", this, "DoSave()");
fEdit->Connect("Closed()", "Editor", this, "DoClose()");
gClient->GetColorByName(
"#3399ff", pxl);
fEdit->SetSelectBack(pxl);
fOK->Connect("Clicked()", "Editor", this, "DoOK()");
fMain->AddFrame(fOK, fL2);
SetTitle();
fMain->MapSubwindows();
fMain->Resize();
}
Editor::~Editor()
{
fMain->DeleteWindow();
}
void Editor::SetTitle()
{
TGText *txt = GetEditor()->GetText();
char title[256];
if (untitled)
sprintf(title, "ROOT Editor - Untitled");
else
sprintf(title,
"ROOT Editor - %s", txt->
GetFileName());
fMain->SetWindowName(title);
fMain->SetIconName(title);
}
void Editor::Popup()
{
fMain->MapWindow();
}
void Editor::LoadBuffer(const char *buffer)
{
fEdit->LoadBuffer(buffer);
}
void Editor::LoadFile(const char *file)
{
fEdit->LoadFile(file);
}
void Editor::AddBuffer(const char *buffer)
{
fEdit->AddText(&txt);
}
void Editor::CloseWindow()
{
delete this;
}
void Editor::DoOK()
{
CloseWindow();
}
void Editor::DoOpen()
{
SetTitle();
}
void Editor::DoSave()
{
SetTitle();
}
void Editor::DoClose()
{
CloseWindow();
}
void guitest()
{
new TestMainFrame(
gClient->GetRoot(), 400, 220);
}
#ifdef STANDALONE
int main(
int argc,
char **argv)
{
fprintf(stderr, "%s: cannot run in batch mode\n", argv[0]);
return 1;
}
guitest();
theApp.Run();
return 0;
}
#endif