test-RangeControl.cxx File Reference

#include "TROOT.h"
#include "TApplication.h"
#include "Midad/Gui/GuiMainWindow.h"
#include "Midad/Gui/GuiSlider.h"
#include "Midad/Gui/GuiTable.h"
#include "Midad/Gui/GuiLabel.h"
#include "Midad/Gui/GuiButton.h"
#include <sigc++/sigc++.h>
#include <sigc++/bind.h>
#include <sigc++/slot.h>
#include <sigc++/retype_return.h>
#include <iostream>

Go to the source code of this file.

Functions

void done (const char *which)
void print_range (RangeDouble *r)
void set_label (GuiLabel *gl, RangeDouble *range, RangeDouble *extrema)
int main (int argc, char *argv[])

Function Documentation

void done ( const char *  which  ) 

Definition at line 19 of file test-RangeControl.cxx.

00020 {
00021     cerr << which << " is done\n";
00022 }

int main ( int  argc,
char *  argv[] 
)

Definition at line 38 of file test-RangeControl.cxx.

References GuiCompositeFrameBase::Add(), GuiTable::Attach(), GuiButtonBase::clicked, GUI_ALL, Range< TYPE >::modified, print_range(), UndoHistory::Redo(), set_label(), GuiMainWindow::ShowAll(), UndoHistory::Undo(), GuiSlider::UseExtremaControl(), and GuiSlider::UseRangeControl().

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     GuiTextButton button1(gt,"undo");
00051     gt.Attach(button1,1,2,1,3,0,0);
00052     GuiTextButton button2(gt,"redo");
00053     gt.Attach(button2,2,3,1,3,0,0);
00054 
00055     GuiSlider s1(gt,kHorizontalFrame);
00056     gt.Attach(s1,0,1,1,3,GUI_ALL,0);
00057     GuiSlider s2(gt,kVerticalFrame);
00058     gt.Attach(s2,1,3,0,1,0,GUI_ALL);
00059 
00060 
00061     UndoHistory* hist = manage(new UndoHistory);
00062 
00063     button1.clicked.connect(retype_return<void>(slot(*hist,&UndoHistory::Undo)));
00064     button2.clicked.connect(retype_return<void>(slot(*hist,&UndoHistory::Redo)));
00065 
00066     RangeDouble* range = manage(new RangeDouble(2,8));
00067     RangeControl<double> rc(hist,range);
00068     RangeDouble* extrema = manage(new RangeDouble(0,10));
00069     RangeControl<double> ec(hist,extrema);
00070 
00071     s1.UseExtremaControl(ec);
00072     s2.UseExtremaControl(ec);
00073     s1.UseRangeControl(rc);
00074     s2.UseRangeControl(rc);
00075     
00076     range->modified.connect(bind(slot(print_range),range));
00077         
00078     Slot0<void> s = bind(bind(bind(slot(set_label),extrema),range),&label);
00079     range->modified.connect(s);
00080     extrema->modified.connect(s);
00081     
00082     mw.ShowAll();
00083     mw.Resize(mw.GetDefaultWidth(),mw.GetDefaultHeight());
00084 
00085     theApp.Run();
00086 
00087     return 0;
00088 } // end of main()

void print_range ( RangeDouble r  ) 

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

References Range< TYPE >::Max(), and Range< TYPE >::Min().

00025 {
00026     cerr << r->Min() << " < " << r->Max() << endl;
00027 }

void set_label ( GuiLabel gl,
RangeDouble range,
RangeDouble extrema 
)

Definition at line 29 of file test-RangeControl.cxx.

References Range< TYPE >::Max(), and Range< TYPE >::Min().

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 }


Generated on 8 Jul 2019 for loon by  doxygen 1.6.1