Main Page | Modules | Namespace List | Class Hierarchy | Alphabetical List | Class List | Directories | File List | Namespace Members | Class Members | File Members | Related Pages

test-Menu.cxx File Reference

#include <Midad/Gui/GuiButton.h>
#include <Midad/Gui/GuiMainWindow.h>
#include <Midad/Gui/GuiMenu.h>
#include <Midad/Gui/GuiBox.h>
#include <Midad/Gui/GuiFrame.h>
#include <iostream>
#include <string>
#include <sstream>
#include <TROOT.h>
#include <TApplication.h>
#include <sigc++/sigc++.h>

Go to the source code of this file.

Functions

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, const char *label)
void remake_menu (GuiMenu *menu, GuiMenuBar *gmb, const char *label)
void layout_menu_bar (GuiMenuBar *gmb)
void fill_recurs_menu (GuiMenuBar *gmb)
int main (int argc, char *argv[])


Function Documentation

void add_menu GuiMenu menu  ) 
 

Definition at line 17 of file test-Menu.cxx.

References GuiMenu::Add(), add_menu(), and count.

00018 {
00019     static int count = 0;
00020     ++count;
00021     stringstream ss;
00022     ss << "add " << count;
00023     menu->Add(ss.str().c_str(),bind(slot(add_menu),menu));
00024 }

void clear_menu GuiMenu menu,
GuiMenuBar gmb,
const char *  label
 

Definition at line 39 of file test-Menu.cxx.

References GuiMenu::ClearAll(), and GuiMenuBar::RemoveMenu().

00040 {
00041     menu->ClearAll();
00042     gmb->RemoveMenu(label);
00043 }

void fill_recurs_menu GuiMenuBar gmb  ) 
 

Definition at line 83 of file test-Menu.cxx.

References GuiMenu::Add(), and GuiMenuBar::AddMenu().

Referenced by main().

00084 {
00085     using namespace SigC;
00086 
00087     GuiMenu* menu = manage(new GuiMenu);
00088 
00089     GuiMenu* submenu = manage(new GuiMenu);
00090     menu->Add("two",*submenu);
00091 
00092     GuiMenu* subsubmenu = manage(new GuiMenu);
00093     submenu->Add("three",*subsubmenu);
00094 
00095     gmb->AddMenu(*menu,"one");
00096 }

void fill_test_menu GuiMenuBar gmb  ) 
 

Referenced by AWindow::AWindow(), clear_menu(), fill_menu(), fill_mydisplay_menu(), main(), and remake_menu().

void insert_menu GuiMenu menu,
GuiMenu::GuiMenuList::iterator  gmit
 

Definition at line 25 of file test-Menu.cxx.

References count, GuiMenu::Insert(), and insert_menu().

00026 {
00027     static int count = 0;
00028     ++count;
00029     stringstream ss;
00030     ss << "insert " << count;
00031     menu->Insert(gmit,ss.str().c_str(),bind(slot(insert_menu),
00032                                             menu,gmit));
00033 }

void layout_menu_bar GuiMenuBar gmb  ) 
 

Definition at line 51 of file test-Menu.cxx.

Referenced by main().

00052 {
00053     gmb->MapSubwindows();
00054     gmb->Layout();
00055     gmb->MapWindow();
00056 }

int main int  argc,
char *  argv[]
 

Definition at line 99 of file test-Menu.cxx.

References GuiCompositeFrameBase::Add(), GuiButtonBase::clicked, fill_recurs_menu(), fill_test_menu(), GuiBase::GetLayoutHints(), layout_menu_bar(), and GuiBase::SetLayoutHints().

00100 {
00101     using namespace SigC;
00102 
00103     TApplication theApp("App", &argc, argv);
00104 
00105     GuiMainWindow* mw = manage(new GuiMainWindow(300,300));
00106 
00107     GuiVBox* vbox = manage(new GuiVBox(*mw));
00108     vbox->SetLayoutHints(vbox->GetLayoutHints() | kLHintsExpandX);
00109     mw->Add(*vbox);
00110 
00111     GuiHBox* hbox = manage(new GuiHBox(*vbox));
00112     vbox->Add(*hbox);
00113 
00114     GuiMenuBar* gmb = manage(new GuiMenuBar(*hbox));
00115     hbox->Add(*gmb);
00116     fill_recurs_menu(gmb);
00117     fill_test_menu(gmb);
00118 
00119     GuiHBox* bbox = manage(new GuiHBox(*vbox));
00120     vbox->Add(*bbox);
00121 
00122     GuiTextButton* button = manage(new GuiTextButton(*bbox,"add"));
00123     bbox->Add(*button);
00124     button->clicked.connect(bind(slot(fill_test_menu),gmb));
00125 
00126     button = manage(new GuiTextButton(*bbox,"layout"));
00127     bbox->Add(*button);
00128     button->clicked.connect(bind(slot(layout_menu_bar),gmb));
00129 
00130     mw->ShowAll();
00131     mw->Resize(400,100);
00132     mw->ConnectClose();
00133 
00134     mw->close_window.connect(slot(*mw,&GuiMainWindow::KillMe));
00135 
00136     theApp.Run();
00137     return 0;
00138 } // end of main()

void remake_menu GuiMenu menu,
GuiMenuBar gmb,
const char *  label
 

Definition at line 44 of file test-Menu.cxx.

References GuiMenu::ClearAll(), fill_test_menu(), and GuiMenuBar::RemoveMenu().

00045 {
00046     menu->ClearAll();
00047     gmb->RemoveMenu(label);
00048     fill_test_menu(gmb);
00049 
00050 }

void say_hello  ) 
 

Definition at line 34 of file test-Menu.cxx.

00035 {
00036     cerr << "Hello!\n";
00037 }


Generated on Mon Jun 16 14:59:50 2008 for loon by  doxygen 1.3.9.1