00001 #include "Midad/Gui/GuiButton.h"
00002 #include "Midad/Gui/GuiTable.h"
00003 #include "Midad/Gui/GuiMainWindow.h"
00004 #include "Midad/Gui/GuiMenu.h"
00005 #include "Midad/Gui/GuiBox.h"
00006 #include "Midad/Gui/GuiTab.h"
00007 #include "Midad/Gui/GuiFrame.h"
00008 #include "Midad/Gui/GuiCanvas.h"
00009 #include "Midad/Gui/GuiStatusBar.h"
00010 #include "Midad/Gui/GuiSlider.h"
00011 #include "Midad/Gui/GuiTextEntry.h"
00012 #include <iostream>
00013 #include <string>
00014 #include <strstream>
00015
00016 #include "TROOT.h"
00017 #include "TApplication.h"
00018 #include "TGTableLayout.h"
00019 #include "TCanvas.h"
00020
00021 #include <sigc++/signal.h>
00022 #include <sigc++/bind.h>
00023 #include <sigc++/object_slot.h>
00024
00025
00026 class MyVBox : public GuiVBox {
00027 public:
00028 MyVBox(TGWindow& parent) : GuiVBox(parent) {};
00029 void LayoutChildren(void) { this->GuiVBox::LayoutChildren(); }
00030 };
00031
00032
00033 void handler_menu(MyVBox* vbox)
00034 {
00035 GuiTextButton* b = new GuiTextButton(*vbox,"Click me");
00036 vbox->Add(*b);
00037 GuiMainWindow* mw = vbox->GetMainWindow();
00038 mw->ShowAll();
00039 }
00040
00041 void fill_menu(GuiMenuBar* gmb, MyVBox* vbox)
00042 {
00043 using SigC::bind;
00044 using SigC::slot;
00045
00046 GuiMenu* menu = gmb->MakeAddMenu("Menu");
00047 menu->Add("Add Button",
00048 bind(slot(handler_menu),vbox));
00049 }
00050
00051
00052 int main (int argc, char *argv[])
00053 {
00054 TApplication theApp("App", &argc, argv);
00055
00056 GuiMainWindow* mw = manage(new GuiMainWindow(300,300));
00057
00058 MyVBox* vbox = manage(new MyVBox(*mw));
00059 vbox->SetLayoutHints(vbox->GetLayoutHints() | kLHintsExpandX);
00060 mw->Add(*vbox);
00061
00062 GuiHBox* hbox = manage(new GuiHBox(*vbox));
00063 vbox->Add(*hbox);
00064
00065 GuiMenuBar* gmb = manage(new GuiMenuBar(*hbox));
00066 hbox->Add(*gmb);
00067 fill_menu(gmb,vbox);
00068
00069 mw->ShowAll();
00070 mw->SetMinSize();
00071 mw->ConnectClose();
00072
00073 mw->close_window.connect(SigC::slot(*mw,&GuiMainWindow::KillMe));
00074
00075 theApp.Run();
00076 return 0;
00077 }