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

test-GuiNesting.cxx File Reference

#include "Midad/GuiButton.h"
#include "Midad/GuiTable.h"
#include "Midad/GuiMainWindow.h"
#include "Midad/GuiMenu.h"
#include "Midad/GuiBox.h"
#include "Midad/GuiTab.h"
#include "Midad/GuiFrame.h"
#include "Midad/GuiCanvas.h"
#include "Midad/GuiStatusBar.h"
#include "Midad/GuiSlider.h"
#include <iostream>
#include <string>
#include <sstream>
#include "TROOT.h"
#include "TApplication.h"
#include "TGTableLayout.h"
#include <sigc++/signal.h>
#include <sigc++/bind.h>
#include <sigc++/object_slot.h>

Go to the source code of this file.

Functions

void handler_menu (string item, int ncalls)
void fill_menu (GuiMenuBar *gmb)
int main (int argc, char *argv[])


Function Documentation

void fill_menu GuiMenuBar gmb  ) 
 

Definition at line 28 of file test-GuiNesting.cxx.

References GuiMenu::Add(), GuiMenuBar::GetMenu(), handler_menu(), and GuiMenuBar::MakeAddMenu().

Referenced by main(), and refill_menu().

00029 {
00030     using SigC::bind;
00031     using SigC::slot;
00032 
00033     static int ncalls = 0;
00034     ++ncalls;
00035 
00036     static const char* menu_name[] = {
00037         "Menu1",
00038         "Menu2",
00039         "Menu3",
00040         0
00041     };
00042     static const char* menu_item_name[] = {
00043         "Item1",
00044         "Item2",
00045         "Item3",
00046         0
00047     };
00048 
00049     int m=0;
00050     while (menu_name[m]) {
00051         GuiMenu* menu;
00052         if (ncalls==1) menu = gmb->MakeAddMenu(menu_name[m]);
00053         else menu = gmb->GetMenu(menu_name[m]);
00054         int i=0;
00055         while (menu_item_name[i]) {
00056             menu->Add(menu_item_name[i],
00057                       bind(slot(handler_menu),menu_item_name[i],ncalls));
00058             ++i;
00059         }
00060         ++m;
00061     }
00062 }

void handler_menu string  item,
int  ncalls
 

Definition at line 24 of file test-GuiNesting.cxx.

00025 {
00026     cout << "[" << ncalls << "]" << item << endl;
00027 }

int main int  argc,
char *  argv[]
 

Definition at line 64 of file test-GuiNesting.cxx.

References GuiMenu::Add(), and GuiTable::Attach().

00065 {
00066     TApplication theApp("App", &argc, argv);
00067 
00068     GuiMainWindow* mw = manage(new GuiMainWindow(300,300));
00069 
00070 #if 1
00071     GuiBox* box = manage(new GuiBox(*mw,kHorizontalFrame));
00072     mw->Add(*box);
00073     
00074     
00075     GuiBox* main_box = manage(new GuiBox(*box,kVerticalFrame));
00076     box->Add(*main_box);
00077     
00078     GuiTable* table = manage(new GuiTable(*main_box,2,2));
00079     main_box->Add(*table);
00080     
00081 #else
00082 
00083     GuiTable* table = manage(new GuiTable(*mw,2,2));
00084     mw->Add(*table);
00085 
00086 #endif
00087 
00088     GuiCanvas* gc = manage(new GuiCanvas(*table,100,100));
00089     table->Attach(*gc, 0,1, 0,1);
00090     
00091 #if 1
00092     GuiSlider* xslider = manage(new GuiSlider(*table,kHorizontalFrame));
00093     table->Attach(*xslider, 0,1, 1,2);
00094     
00095     GuiSlider* yslider = manage(new GuiSlider(*table,kVerticalFrame));
00096     table->Attach(*yslider, 1,2, 0,1);
00097 
00098     GuiTextButton *b;
00099     b = manage(new GuiTextButton(*table,"three"));
00100     table->Attach(*b, 1,2, 1,2);
00101 #else
00102 
00103     GuiTextButton *b;
00104     b = manage(new GuiTextButton(*table,"one"));
00105     table->Attach(*b, 1,2, 0,1);
00106     b = manage(new GuiTextButton(*table,"two"));
00107     table->Attach(*b, 0,1, 1,2);
00108     b = manage(new GuiTextButton(*table,"three"));
00109     table->Attach(*b, 1,2, 1,2);
00110 
00111 #endif    
00112 
00113     mw->ShowAll();
00114 
00115     theApp.Run();
00116     return 0;
00117 } // end of main()


Generated on Mon Feb 15 11:08:13 2010 for loon by  doxygen 1.3.9.1