00001
00002 #include "TROOT.h"
00003 #include "TApplication.h"
00004
00005 #include "Midad/Gui/GuiMainWindow.h"
00006 #include "Midad/Gui/GuiSlider.h"
00007 #include "Midad/Gui/GuiTable.h"
00008 #include "Midad/Gui/GuiLabel.h"
00009 #include "Midad/Gui/GuiButton.h"
00010
00011 #include <sigc++/sigc++.h>
00012 #include <sigc++/bind.h>
00013 #include <sigc++/slot.h>
00014
00015 #include <iostream>
00016
00017 using namespace std;
00018
00019 void done(const char* which)
00020 {
00021 cerr << which << " is done\n";
00022 }
00023
00024 void print_range(RangeDouble* r)
00025 {
00026 cerr << r->Min() << " < " << r->Max() << endl;
00027 }
00028
00029 void set_label(GuiLabel* gl, RangeDouble* range, RangeDouble* extrema)
00030 {
00031 char buf[1024];
00032 sprintf(buf,"%.1f < %.1f < %.1f < %.1f",
00033 extrema->Min(), range->Min(), range->Max(), extrema->Max());
00034 gl->SetText(buf);
00035 cerr << buf << endl;
00036 }
00037
00038 int main (int argc, char *argv[])
00039 {
00040 using namespace SigC;
00041
00042 TApplication theApp("App", &argc, argv);
00043 GuiMainWindow mw(200,200);
00044 GuiTable gt(mw,3,3);
00045 mw.Add(gt);
00046
00047 GuiLabel label(gt,"");
00048 gt.Attach(label,0,1,0,1,GUI_ALL,GUI_ALL);
00049
00050 GuiPicButton button1(gt,"full-zoom.xpm");
00051 gt.Attach(button1,1,2,1,2,0,0);
00052
00053 GuiSlider s1(gt,kHorizontalFrame);
00054 gt.Attach(s1,0,1,1,2,GUI_ALL,0);
00055 GuiSlider s2(gt,kVerticalFrame);
00056 gt.Attach(s2,1,2,0,1,0,GUI_ALL);
00057
00058 RangeDouble* range = manage(new RangeDouble(2,8));
00059 RangeDouble* extrema = manage(new RangeDouble(0,10));
00060
00061 s1.UseExtrema(*extrema);
00062 s2.UseExtrema(*extrema);
00063 s1.UseRange(*range);
00064 s2.UseRange(*range);
00065
00066 range->modified.connect(bind(slot(print_range),range));
00067
00068 Slot0<void> s = bind(bind(bind(slot(set_label),extrema),range),&label);
00069 range->modified.connect(s);
00070 extrema->modified.connect(s);
00071
00072 GuiSlider e1(gt,kHorizontalFrame);
00073 gt.Attach(e1,0,1,2,3,GUI_ALL,GUI_FILL);
00074 e1.GetExtremaCtrl().Set(0, 100);
00075 e1.UseRange(*extrema);
00076
00077 GuiSlider e2(gt,kVerticalFrame);
00078 gt.Attach(e2,2,3,0,1,GUI_FILL,GUI_ALL);
00079 e2.GetExtremaCtrl().Set(0, 100);
00080 e2.UseRange(*extrema);
00081
00082 GuiPicButton button2(gt,"full-zoom.xpm");
00083 gt.Attach(button2,2,3,2,3,0,0);
00084
00085 mw.ShowAll();
00086 theApp.Run();
00087
00088 return 0;
00089 }