Image Component Library (ICL)
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines
GUIDefinition.h
Go to the documentation of this file.
00001 /********************************************************************
00002 **                Image Component Library (ICL)                    **
00003 **                                                                 **
00004 ** Copyright (C) 2006-2013 CITEC, University of Bielefeld          **
00005 **                         Neuroinformatics Group                  **
00006 ** Website: www.iclcv.org and                                      **
00007 **          http://opensource.cit-ec.de/projects/icl               **
00008 **                                                                 **
00009 ** File   : ICLQt/src/ICLQt/GUIDefinition.h                        **
00010 ** Module : ICLQt                                                  **
00011 ** Authors: Christof Elbrechter                                    **
00012 **                                                                 **
00013 **                                                                 **
00014 ** GNU LESSER GENERAL PUBLIC LICENSE                               **
00015 ** This file may be used under the terms of the GNU Lesser General **
00016 ** Public License version 3.0 as published by the                  **
00017 **                                                                 **
00018 ** Free Software Foundation and appearing in the file LICENSE.GPL  **
00019 ** included in the packaging of this file.  Please review the      **
00020 ** following information to ensure the license requirements will   **
00021 ** be met: http://www.gnu.org/licenses/lgpl-3.0.txt                **
00022 **                                                                 **
00023 ** The development of this software was supported by the           **
00024 ** Excellence Cluster EXC 277 Cognitive Interaction Technology.    **
00025 ** The Excellence Cluster EXC 277 is a grant of the Deutsche       **
00026 ** Forschungsgemeinschaft (DFG) in the context of the German       **
00027 ** Excellence Initiative.                                          **
00028 **                                                                 **
00029 ********************************************************************/
00030 
00031 #pragma once
00032 
00033 #include <string>
00034 #include <vector>
00035 #include <ICLUtils/Size.h>
00036 
00038 class QLayout;
00039 class QWidget;
00042 namespace icl{
00043   namespace qt{
00044 
00046     class GUI;
00047     class ProxyLayout;
00050 
00051     class GUIDefinition{
00052       public:
00054       GUIDefinition(const std::string &def, GUI *gui, 
00055                     QLayout *parentLayout=0, 
00056                     ProxyLayout *parentProxyLayout=0, 
00057                     QWidget *parentWidget=0);
00058         
00060       const std::string &type() const { return m_sType; }
00061   
00063       const std::string &label() const { return m_sLabel; }
00064   
00066       const std::string &handle() const { return m_sHandle; }
00067       
00069       const utils::Size &size() const { return m_oSize; }
00070       
00072       const utils::Size &minSize() const { return m_oMinSize; }
00073   
00075       const utils::Size &maxSize() const { return m_oMaxSize; }
00076       
00078       int margin() const { return m_iMargin; }
00079   
00081       int spacing() const { return m_iSpacing; }
00082       
00084       GUI *getGUI() const { return m_poGUI; }
00085       
00087       QLayout *parentLayout() const { return m_poParentLayout; }
00088       
00090       ProxyLayout *getProxyLayout() const { return m_poParentProxyLayout; }
00091   
00093       unsigned int numParams() const { return m_vecParams.size(); }
00094       
00096       const std::string &param(unsigned int idx) const;
00097       
00099       int intParam(unsigned int idx) const;
00100       
00102       float floatParam(unsigned int idx) const;
00103   
00105 
00107       const std::string &input(unsigned int idx) const;
00108       
00110 
00112       const std::string &output(unsigned int idx) const;
00113   
00115       unsigned int numInputs() const { return m_vecInputs.size(); }
00116   
00118       unsigned int numOutputs() const { return m_vecOutputs.size(); }
00119       
00121       void show() const;
00122   
00124       const std::string &defString() const { return m_sDefinitionString; }
00125       
00127       QWidget *parentWidget() const { return m_poParentWidget; }
00128       
00130       const std::vector<std::string> &allParams() const { return m_vecParams; }
00131       
00133       inline const std::string &toolTip() const { return m_toolTip; }
00134   
00136       inline bool hasToolTip() const { return m_toolTip.length(); }
00137   
00138     private:
00139       std::string m_sDefinitionString;       //<! whole definition string
00140       std::string m_sType;                   //<! parsed type string 
00141       std::vector<std::string> m_vecParams;  //<! vector of mandatory params
00142       std::vector<std::string> m_vecOutputs; //<! vector of output names
00143       std::vector<std::string> m_vecInputs;  //<! vector of input names
00144       std::string m_sLabel;                  //<! parsed label (unused this time)
00145       std::string m_sHandle;                 //<! parsed handle id string
00146       utils::Size m_oSize;                          //<! parsed size
00147       utils::Size m_oMinSize;                       //<! parsed minimal size
00148       utils::Size m_oMaxSize;                       //<! parsed maximum size
00149       int m_iMargin;                         //<! parsed layout margin
00150       int m_iSpacing;                        //<! parsed layout spacing
00151       GUI *m_poGUI;                          //<! parent GUI
00152       QLayout *m_poParentLayout;             //<! parent layout or NULL if there is no parent
00153       QWidget *m_poParentWidget;             //<! parent widget to avoid reparenting calls
00154       ProxyLayout *m_poParentProxyLayout;    //<! parent widget proxy layout
00155       std::string m_toolTip;                 //<! optionally given tooltip
00156     };
00157   } // namespace qt
00158 }
00159 
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines