#include <Midad/Gui/GuiButton.h>#include <Midad/Gui/GuiTable.h>#include <Midad/Gui/GuiMainWindow.h>#include <Midad/Gui/GuiMenu.h>#include <Midad/Gui/GuiBox.h>#include <Midad/Gui/GuiTab.h>#include <Midad/Gui/GuiFrame.h>#include <Midad/Gui/GuiCanvas.h>#include <Midad/Gui/GuiStatusBar.h>#include <Midad/Gui/GuiSlider.h>#include <Midad/Gui/GuiTextEntry.h>#include "TROOT.h"#include "TApplication.h"#include "TGTableLayout.h"#include "TCanvas.h"#include <sigc++/signal.h>#include <sigc++/bind.h>#include <sigc++/object_slot.h>#include <iostream>#include <string>#include <sstream>Go to the source code of this file.
Classes | |
| class | Buttons |
| class | AWindow |
| class | Display |
| class | MyDisplay |
Functions | |
| void | handler (string what) |
| void | handler_menu (string item, int ncalls) |
| void | add_menu (GuiMenu *menu) |
| void | insert_menu (GuiMenu *menu, GuiMenu::GuiMenuList::iterator gmit) |
| void | say_hello () |
| void | fill_test_menu (GuiMenuBar *gmb) |
| void | clear_menu (GuiMenu *menu, GuiMenuBar *gmb) |
| void | fill_mydisplay_menu (GuiMenuBar *gmb) |
| void | fill_menu (GuiMenuBar *gmb) |
| void | refill_menu (GuiMenuBar *gmb) |
| void | build_table (GuiVBox &vbox) |
| void | tab_chirp (int id, GuiTab *gt) |
| void | add_canvas (GuiVBox &vbox) |
| void | spawn_a_window () |
| void | spawn_mydisplay () |
| void | add_button (GuiVBox *vbox) |
| void | add_spawner (GuiVBox &vbox) |
| void | echo_text_entry (GuiTextEntry *entry) |
| void | echo (const char *text) |
| int | main (int argc, char *argv[]) |
|
|
Definition at line 430 of file test-Gui.cxx. References add_button(), GuiButtonBase::clicked, and GuiBase::SetLayoutHints(). Referenced by add_button(), and add_spawner(). 00431 {
00432 GuiTextButton* gb = manage(new GuiTextButton(*vbox,"add"));
00433 gb->SetLayoutHints(kLHintsExpandX | kLHintsTop | kLHintsLeft);
00434 vbox->Add(*gb);
00435 gb->clicked.connect(bind(slot(add_button),vbox));
00436 }
|
|
|
Definition at line 276 of file test-Gui.cxx. References GuiCompositeFrameBase::Add(), GuiTab::Add(), GuiFrame::GetFrame(), GuiTab::selected, and tab_chirp(). Referenced by main(). 00277 {
00278 #if 1
00279 GuiTab* gt = manage(new GuiTab(vbox));
00280 vbox.Add(*gt);
00281
00282 gt->selected.connect(bind(slot(tab_chirp),gt));
00283
00284 GuiFrame* gf = gt->Add("Canvas");
00285
00286 cerr << "Canvas frame: " << (void*)gf << endl;
00287
00288 GuiCanvas* gc = manage(new GuiCanvas(*gf->GetFrame()));
00289 gf->Add(*gc);
00290
00291 gf->GetFrame()->SetWidth(100); gf->GetFrame()->SetHeight(100);
00292 gc->SetWidth(100); gc->SetHeight(100);
00293 gt->SetWidth(100); gt->SetHeight(100);
00294
00295 TCanvas* canvas = gc->GetCanvas();
00296 canvas->cd();
00297 // MyClass* mc = new MyClass();
00298 // mc->Draw();
00299
00300 gf = gt->Add("button");
00301 cerr << "Button frame: " << (void*)gf << endl;
00302 GuiTextButton* gtb = manage(new GuiTextButton(*gf->GetFrame(),"click me"));
00303 gf->Add(*gtb);
00304
00305 #else
00306 GuiCanvas* gc = manage(new GuiCanvas(vbox));
00307 vbox.Add(*gc);
00308 #endif
00309 }
|
|
|
Definition at line 70 of file test-Gui.cxx. References GuiMenu::Add(), add_menu(), and count. Referenced by add_menu(), MultiPage::BuildMenus(), and fill_test_menu(). 00071 {
00072 static int count = 0;
00073 ++count;
00074 stringstream ss;
00075 ss << "add " << count;
00076 menu->Add(ss.str().c_str(),SigC::bind(SigC::slot(add_menu),menu));
00077 }
|
|
|
Definition at line 438 of file test-Gui.cxx. References add_button(), GuiButtonBase::clicked, GuiBase::SetLayoutHints(), spawn_a_window(), and spawn_mydisplay(). Referenced by main(). 00439 {
00440 using namespace SigC;
00441
00442 GuiTextButton* gb = manage(new GuiTextButton(vbox,"spawn"));
00443 gb->SetLayoutHints(kLHintsExpandX | kLHintsTop | kLHintsLeft);
00444 vbox.Add(*gb);
00445 gb->clicked.connect(SigC::slot(spawn_a_window));
00446
00447
00448 gb = manage(new GuiTextButton(vbox,"test"));
00449 gb->SetLayoutHints(kLHintsExpandX | kLHintsTop | kLHintsLeft);
00450 vbox.Add(*gb);
00451 gb->clicked.connect(SigC::slot(spawn_mydisplay));
00452
00453 add_button(&vbox);
00454 }
|
|
|
Definition at line 212 of file test-Gui.cxx. References GuiTable::Attach(), GuiButtonBase::clicked, GuiBase::GetLayoutHints(), Buttons::GetNext(), Buttons::GetPrev(), Buttons::GetRerun(), handler(), GuiButtonBase::pressed, GuiButtonBase::released, and GuiBase::SetLayoutHints(). Referenced by main(). 00213 {
00214 using SigC::bind;
00215 using SigC::slot;
00216 const int ncols = 5;
00217 const int nrows = 1;
00218
00219 GuiTable* table = manage(new GuiTable(vbox,nrows,ncols));
00220 table->SetLayoutHints(table->GetLayoutHints() & ~kLHintsExpandY);
00221 vbox.Add(*table);
00222
00223 int row = 0;
00224
00225 if (true) {
00226 // Add buttons
00227 for (int i=0; i<ncols; ++i) {
00228 char buf[128];
00229
00230 sprintf(buf,"[%d]",i+1);
00231 GuiTextButton* gb = SigC::manage(new GuiTextButton(*table,buf));
00232 table->Attach(*gb,i,i+1,row,row+1);
00233
00234 sprintf(buf,"click (%d)",i+1);
00235 gb->clicked.connect(bind(slot(handler),buf));
00236 sprintf(buf,"press (%d)",i+1);
00237 gb->pressed.connect(bind(slot(handler),buf));
00238 sprintf(buf,"release (%d)",i+1);
00239 gb->released.connect(bind(slot(handler),buf));
00240 }
00241
00242 ++row;
00243 }
00244
00245
00246 Buttons* gc;
00247 if (row < nrows) {
00248 cerr << "Putting Buttons in table\n";
00249 gc = manage(new Buttons(*table));
00250 table->Attach(*gc,0,ncols,row,row+1);
00251 }
00252 else {
00253 cerr << "Putting Buttons in vbox\n";
00254 gc = manage(new Buttons(vbox));
00255 gc->SetLayoutHints(gc->GetLayoutHints() & ~kLHintsExpandY);
00256 vbox.Add(*gc);
00257 }
00258
00259 gc->GetPrev().clicked.connect(bind(slot(handler),"Previous"));
00260 gc->GetRerun().clicked.connect(bind(slot(handler),"Rerun"));
00261 gc->GetNext().clicked.connect(bind(slot(handler),"Next"));
00262 }
|
|
||||||||||||
|
Definition at line 92 of file test-Gui.cxx. References GuiMenu::ClearAll(), fill_test_menu(), and GuiMenuBar::RemoveMenu(). Referenced by fill_test_menu(). 00093 {
00094 menu->ClearAll();
00095 gmb->RemoveMenu("test");
00096 fill_test_menu(gmb);
00097 gmb->MapSubwindows();
00098 gmb->Layout();
00099 gmb->MapWindow();
00100
00101 }
|
|
|
Definition at line 461 of file test-Gui.cxx. Referenced by JobCInterpreter::JobCInterpreter(), and main(). 00462 {
00463 cerr << text << endl;
00464 }
|
|
|
Definition at line 456 of file test-Gui.cxx. Referenced by main(). 00457 {
00458 cerr << entry->GetText() << endl;
00459 }
|
|
|
Definition at line 160 of file test-Gui.cxx. References GuiMenu::Add(), fill_test_menu(), GuiMenuBar::GetMenu(), handler_menu(), and GuiMenuBar::MakeAddMenu(). 00161 {
00162 using SigC::bind;
00163 using SigC::slot;
00164
00165 static int ncalls = 0;
00166 ++ncalls;
00167
00168 static const char* menu_name[] = {
00169 "Menu1",
00170 "Menu2",
00171 "Menu3",
00172 0
00173 };
00174 static const char* menu_item_name[] = {
00175 "Item1",
00176 "Item2",
00177 "Item3",
00178 0
00179 };
00180
00181 int m=0;
00182 while (menu_name[m]) {
00183 GuiMenu* menu;
00184 if (ncalls==1) menu = gmb->MakeAddMenu(menu_name[m]);
00185 else menu = gmb->GetMenu(menu_name[m]);
00186 if (!menu) {
00187 cerr << "No menu!\n";
00188 ++m;
00189 continue;
00190 }
00191 int i=0;
00192 while (menu_item_name[i]) {
00193 menu->Add(menu_item_name[i],
00194 bind(slot(handler_menu),menu_item_name[i],ncalls));
00195 ++i;
00196 }
00197 ++m;
00198 }
00199
00200 fill_test_menu(gmb);
00201 }
|
|
|
Definition at line 118 of file test-Gui.cxx. References GuiMenu::Add(), fill_test_menu(), GuiMenuBar::GetMenu(), handler_menu(), and GuiMenuBar::MakeAddMenu(). Referenced by MyDisplay::MyDisplay(). 00119 {
00120 using SigC::bind;
00121 using SigC::slot;
00122
00123 static int ncalls = 0;
00124 ++ncalls;
00125
00126 static const char* menu_name[] = {
00127 "Menu1",
00128 "Menu2",
00129 "Menu3",
00130 0
00131 };
00132 static const char* menu_item_name[] = {
00133 "Item1",
00134 "Item2",
00135 "Item3",
00136 0
00137 };
00138
00139 int m=0;
00140 while (menu_name[m]) {
00141 GuiMenu* menu;
00142 if (ncalls==1) menu = gmb->MakeAddMenu(menu_name[m]);
00143 else menu = gmb->GetMenu(menu_name[m]);
00144 if (!menu) {
00145 cerr << "No menu!\n";
00146 ++m;
00147 continue;
00148 }
00149 int i=0;
00150 while (menu_item_name[i]) {
00151 menu->Add(menu_item_name[i],
00152 bind(slot(handler_menu),menu_item_name[i],ncalls));
00153 ++i;
00154 }
00155 ++m;
00156 }
00157
00158 fill_test_menu(gmb);
00159 }
|
|
|
Definition at line 102 of file test-Gui.cxx. References GuiMenu::Add(), add_menu(), clear_menu(), insert_menu(), GuiMenuBar::MakeAddMenu(), and say_hello(). Referenced by main(). 00103 {
00104 using namespace SigC;
00105
00106 GuiMenu* menu = gmb->MakeAddMenu("test");
00107
00108 menu->Add("clear",bind(slot(clear_menu),menu,gmb));
00109 GuiMenu* submenu = manage(new GuiMenu);
00110 menu->Add("submenu",*submenu);
00111 submenu->Add("hello",slot(say_hello));
00112
00113 GuiMenu::GuiMenuList::iterator gmit
00114 = menu->Add("add",bind(slot(add_menu),menu));
00115 menu->Add("insert",bind(slot(insert_menu),menu,gmit));
00116 }
|
|
|
Definition at line 61 of file test-Gui.cxx. Referenced by BfldCanvasRect2d::BfldCanvasRect2d(), build_table(), and main(). 00062 {
00063 cout << what << endl;
00064 }
|
|
||||||||||||
|
Definition at line 65 of file test-Gui.cxx. 00066 {
00067 cout << "[" << ncalls << "]" << item << endl;
00068 }
|
|
||||||||||||
|
Definition at line 78 of file test-Gui.cxx. References count, GuiMenu::Insert(), and insert_menu(). Referenced by fill_test_menu(), and insert_menu(). 00079 {
00080 static int count = 0;
00081 ++count;
00082 stringstream ss;
00083 ss << "insert " << count;
00084 menu->Insert(gmit,ss.str().c_str(),SigC::bind(SigC::slot(insert_menu),
00085 menu,gmit));
00086 }
|
|
||||||||||||
|
Definition at line 465 of file test-Gui.cxx. References GuiTextEntry::activated, GuiCompositeFrameBase::Add(), add_canvas(), add_spawner(), build_table(), echo(), echo_text_entry(), fill_menu(), GuiBase::GetLayoutHints(), GuiBase::SetLayoutHints(), and GuiTextEntry::text_changed. 00466 {
00467 TApplication theApp("App", &argc, argv);
00468
00469 GuiMainWindow* mw = manage(new GuiMainWindow(300,300));
00470
00471 GuiVBox* vbox = manage(new GuiVBox(*mw));
00472 vbox->SetLayoutHints(vbox->GetLayoutHints() | kLHintsExpandX);
00473 mw->Add(*vbox);
00474
00475 GuiHBox* hbox = manage(new GuiHBox(*vbox));
00476 vbox->Add(*hbox);
00477
00478 GuiMenuBar* gmb = manage(new GuiMenuBar(*hbox));
00479 hbox->Add(*gmb);
00480 fill_menu(gmb);
00481
00482 GuiTextEntry* entry = manage(new GuiTextEntry(*vbox,"<enter something>"));
00483 vbox->Add(*entry);
00484 entry->activated.connect(SigC::bind(SigC::slot(echo_text_entry),entry));
00485 entry->text_changed.connect(SigC::slot(echo));
00486
00487 build_table(*vbox);
00488 add_spawner(*vbox);
00489 add_canvas(*vbox);
00490
00491 mw->ShowAll();
00492 mw->SetMinSize();
00493 mw->ConnectClose();
00494
00495 mw->close_window.connect(SigC::slot(*mw,&GuiMainWindow::KillMe));
00496
00497 theApp.Run();
00498 return 0;
00499 } // end of main()
|
|
|
Definition at line 204 of file test-Gui.cxx. References fill_menu(). Referenced by AWindow::AWindow(). 00205 {
00206 fill_menu(gmb);
00207 gmb->MapSubwindows();
00208 gmb->Layout();
00209 gmb->MapWindow();
00210 }
|
|
|
Definition at line 87 of file test-Gui.cxx. Referenced by fill_test_menu(). 00088 {
00089 cerr << "Hello!\n";
00090 }
|
|
|
Definition at line 362 of file test-Gui.cxx. References GuiMainWindow::ShowAll(). Referenced by add_spawner().
|
|
|
Definition at line 419 of file test-Gui.cxx. Referenced by add_spawner(). 00420 {
00421 GuiMainWindow* gmw = new GuiMainWindow();
00422
00423 MyDisplay* disp = manage(new MyDisplay(*gmw));
00424 gmw->Add(*disp);
00425
00426 gmw->ShowAll();
00427 gmw->ConnectClose(true); // delete on close
00428 }
|
|
||||||||||||
|
Definition at line 264 of file test-Gui.cxx. References done(), GuiBase::GetName(), and GuiTab::GuisAt(). Referenced by add_canvas(). 00265 {
00266
00267 GuiBase::ChildrenList cl = gt->GuisAt(id);
00268 cerr << "Tab " << id << " selected with "
00269 << cl.size() << " children\n";
00270 GuiBase::ChildrenList::iterator it, done = cl.end();
00271 for (it=cl.begin(); it != done; ++it) {
00272 cerr << "\t" << (*it)->GetName() << endl;
00273 }
00274 }
|
1.3.9.1