#include <Midad/Gui/GuiMainWindow.h>#include <Midad/Gui/GuiTree.h>#include <Midad/Gui/GuiScrolled.h>#include <Midad/Gui/GuiBox.h>#include <Midad/Gui/GuiButton.h>#include <TApplication.h>#include <TGClient.h>#include <sigc++/sigc++.h>#include <iostream>Go to the source code of this file.
Functions | |
| void | hello (const char *label) |
| void | clear_tree (GuiTree *tree) |
| void | fill_tree (GuiTree *tree) |
| int | main (int argc, char *argv[]) |
|
|
Definition at line 20 of file test-GuiTree.cxx. 00021 {
00022 TGListTreeItem* item;
00023 while ( (item = tree->GetFirstItem()) ) {
00024 cerr << "Deleting children of item: " << item->GetText() << endl;
00025 tree->DeleteChildren(item);
00026 cerr << "Now deleteing item\n";
00027 tree->DeleteItem(item);
00028
00029 }
00030 gClient->NeedRedraw(tree);
00031 }
|
|
|
Definition at line 33 of file test-GuiTree.cxx. References GuiTree::AddEntry(), GuiTreeEntry::clicked, count, and hello(). Referenced by main(). 00034 {
00035 GuiTreeEntry* toplevel = tree->AddEntry(0,"Top level");
00036 toplevel->clicked.connect(bind(slot(hello),"Top level"));
00037
00038 const char* level2[] = {
00039 "level 2.1",
00040 "level 2.2",
00041 "level 2.3",
00042 "level 2.4",
00043 0
00044 };
00045
00046 const char* count[] = {
00047 "a one",
00048 "and a two",
00049 "and a three",
00050 0
00051 };
00052
00053 for (int i=0; level2[i]; ++i) {
00054 GuiTreeEntry* seclevel = tree->AddEntry(toplevel,level2[i]);
00055 seclevel->clicked.connect(bind(slot(hello),level2[i]));
00056 for (int j=0; count[j]; ++j) {
00057 GuiTreeEntry* trdlevel = tree->AddEntry(seclevel,count[j]);
00058 trdlevel->clicked.connect(bind(slot(hello),count[i]));
00059 }
00060 }
00061 gClient->NeedRedraw(tree);
00062 }
|
|
|
Definition at line 15 of file test-GuiTree.cxx. Referenced by main(). 00016 {
00017 cout << "Hello from: " << label << endl;
00018 }
|
|
||||||||||||
|
Definition at line 64 of file test-GuiTree.cxx. References GuiScrolled::Add(), GuiCompositeFrameBase::Add(), GuiButtonBase::clicked, fill(), fill_tree(), and GuiBase::SetLayoutHints(). 00065 {
00066 TApplication theApp("App", &argc, argv);
00067
00068 GuiMainWindow* mw = manage(new GuiMainWindow(300,300));
00069
00070 GuiVBox* vbox = manage(new GuiVBox(*mw));
00071 vbox->SetLayoutHints(kLHintsExpandX | kLHintsExpandY);
00072 mw->Add(*vbox);
00073
00074 GuiScrolled* scrolled = manage(new GuiScrolled(*vbox));
00075 scrolled->SetLayoutHints(kLHintsExpandX | kLHintsExpandY);
00076 vbox->Add(*scrolled);
00077
00078 GuiTree* tree = manage(new GuiTree(*scrolled->GetViewPort()));
00079 scrolled->Add(*tree);
00080 tree->SetCanvas(scrolled);
00081
00082 GuiHBox* hbox = manage(new GuiHBox(*vbox));
00083 hbox->SetLayoutHints(kLHintsExpandX);
00084 vbox->Add(*hbox);
00085
00086 GuiTextButton* fill = manage(new GuiTextButton(*hbox,"fill"));
00087 hbox->Add(*fill);
00088 GuiTextButton* clear = manage(new GuiTextButton(*hbox,"clear"));
00089 hbox->Add(*clear);
00090
00091 fill->clicked.connect(bind(slot(fill_tree),tree));
00092 clear->clicked.connect(slot(*tree,&GuiTree::DeleteAllItems));
00093
00094
00095 mw->ShowAll();
00096 mw->Resize(300,400);
00097 mw->ConnectClose();
00098
00099 mw->close_window.connect(slot(*mw,&GuiMainWindow::KillMe));
00100
00101 theApp.Run();
00102 return 0;
00103 } // end of main()
|
1.3.9.1