CMS 3D CMS Logo

Ig3DZoomControl.cc

Go to the documentation of this file.
00001 //<<<<<< INCLUDES                                                       >>>>>>
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 //<<<<<< PRIVATE DEFINES                                                >>>>>>
00010 //<<<<<< PRIVATE CONSTANTS                                              >>>>>>
00011 //<<<<<< PRIVATE TYPES                                                  >>>>>>
00012 //<<<<<< PRIVATE VARIABLE DEFINITIONS                                   >>>>>>
00013 //<<<<<< PUBLIC VARIABLE DEFINITIONS                                    >>>>>>
00014 //<<<<<< CLASS STRUCTURE INITIALIZATION                                 >>>>>>
00015 //<<<<<< PRIVATE FUNCTION DEFINITIONS                                   >>>>>>
00016 //<<<<<< PUBLIC FUNCTION DEFINITIONS                                    >>>>>>
00017 //<<<<<< MEMBER FUNCTION DEFINITIONS                                    >>>>>>
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     // items->setFixedHeight (20);
00027     // items->setFixedWidth (50);
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     // items->setSizePolicy (QSizePolicy (QSizePolicy::Minimum,
00035     // QSizePolicy::Minimum));
00036 
00037     IgQtPixButton *in = new IgQtPixButton (QPixmap (), this);
00038     // in->setFixedHeight (20);
00039     // in->setFixedWidth (60);
00040     in->setText ("Zoom In");
00041     // in->setSizePolicy (QSizePolicy(QSizePolicy::Minimum,QSizePolicy::Minimum));
00042 
00043     IgQtPixButton *out = new IgQtPixButton (QPixmap (), this);
00044     // out->setFixedHeight (20);
00045     // out->setFixedWidth (60);
00046     out->setText ("Zoom Out");
00047     // out->setSizePolicy(QSizePolicy(QSizePolicy::Minimum,QSizePolicy::Minimum));
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 (); }

Generated on Tue Jun 9 17:38:38 2009 for CMSSW by  doxygen 1.5.4