00001
00002
00003 #include "Iguana/GLBrowsers/interface/Ig3DZoomControl.h"
00004 #include "Iguana/Studio/interface/IgQtPixButton.h"
00005 #include <classlib/utils/DebugAids.h>
00006 #include <qlayout.h>
00007 #include <qcombobox.h>
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019 Ig3DZoomControl::Ig3DZoomControl (QWidget *parent, const char *name)
00020 : QWidget (parent, name),
00021 m_zoomValue (2)
00022 {
00023 QHBoxLayout *layout = new QHBoxLayout (this, 0, 5);
00024 QComboBox *items = new QComboBox (this);
00025
00026
00027
00028 items->insertItem ("2");
00029 items->insertItem ("5");
00030 items->insertItem ("10");
00031 items->insertItem ("100");
00032 items->setCurrentItem (0);
00033 items->setEditable (false);
00034
00035
00036
00037 IgQtPixButton *in = new IgQtPixButton (QPixmap (), this);
00038
00039
00040 in->setText ("Zoom In");
00041
00042
00043 IgQtPixButton *out = new IgQtPixButton (QPixmap (), this);
00044
00045
00046 out->setText ("Zoom Out");
00047
00048
00049 layout->addItem (new QSpacerItem (20, 20, QSizePolicy::Expanding));
00050 layout->addWidget (in);
00051 layout->addWidget (items);
00052 layout->addWidget (out);
00053 layout->addItem (new QSpacerItem (20, 20, QSizePolicy::Expanding));
00054
00055 connect (in, SIGNAL(clicked()), this, SLOT(zoomIn()));
00056 connect (out, SIGNAL(clicked()), this, SLOT(zoomOut()));
00057 connect (items, SIGNAL(activated(const QString &)),
00058 this, SLOT(setZoom(const QString &)));
00059 }
00060
00061 void
00062 Ig3DZoomControl::zoomIn (void)
00063 { emit zoom (1.0/m_zoomValue); }
00064
00065 void
00066 Ig3DZoomControl::zoomOut (void)
00067 { emit zoom (m_zoomValue); }
00068
00069 unsigned int
00070 Ig3DZoomControl::zoomValue (void)
00071 { return m_zoomValue; }
00072
00073 void
00074 Ig3DZoomControl::setZoom (const QString &value)
00075 { m_zoomValue = value.toUInt (); }