Image Component Library (ICL)
|
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.LGPL ** 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 <ICLUtils/CompatMacros.h> 00034 #include <ICLUtils/Size.h> 00035 #include <string> 00036 #include <vector> 00037 00039 class QLayout; 00040 class QWidget; 00043 namespace icl{ 00044 namespace qt{ 00045 00047 class GUI; 00048 class ProxyLayout; 00051 00052 class ICLQt_API GUIDefinition{ 00053 public: 00055 GUIDefinition(const std::string &def, GUI *gui, 00056 QLayout *parentLayout=0, 00057 ProxyLayout *parentProxyLayout=0, 00058 QWidget *parentWidget=0); 00059 00061 const std::string &type() const { return m_sType; } 00062 00064 const std::string &label() const { return m_sLabel; } 00065 00067 const std::string &handle() const { return m_sHandle; } 00068 00070 const utils::Size &size() const { return m_oSize; } 00071 00073 const utils::Size &minSize() const { return m_oMinSize; } 00074 00076 const utils::Size &maxSize() const { return m_oMaxSize; } 00077 00079 int margin() const { return m_iMargin; } 00080 00082 int spacing() const { return m_iSpacing; } 00083 00085 GUI *getGUI() const { return m_poGUI; } 00086 00088 QLayout *parentLayout() const { return m_poParentLayout; } 00089 00091 ProxyLayout *getProxyLayout() const { return m_poParentProxyLayout; } 00092 00094 unsigned int numParams() const { return m_vecParams.size(); } 00095 00097 const std::string ¶m(unsigned int idx) const; 00098 00100 int intParam(unsigned int idx) const; 00101 00103 float floatParam(unsigned int idx) const; 00104 00106 00108 const std::string &input(unsigned int idx) const; 00109 00111 00113 const std::string &output(unsigned int idx) const; 00114 00116 unsigned int numInputs() const { return m_vecInputs.size(); } 00117 00119 unsigned int numOutputs() const { return m_vecOutputs.size(); } 00120 00122 void show() const; 00123 00125 const std::string &defString() const { return m_sDefinitionString; } 00126 00128 QWidget *parentWidget() const { return m_poParentWidget; } 00129 00131 const std::vector<std::string> &allParams() const { return m_vecParams; } 00132 00134 inline const std::string &toolTip() const { return m_toolTip; } 00135 00137 inline bool hasToolTip() const { return m_toolTip.length(); } 00138 00139 private: 00140 std::string m_sDefinitionString; //<! whole definition string 00141 std::string m_sType; //<! parsed type string 00142 std::vector<std::string> m_vecParams; //<! vector of mandatory params 00143 std::vector<std::string> m_vecOutputs; //<! vector of output names 00144 std::vector<std::string> m_vecInputs; //<! vector of input names 00145 std::string m_sLabel; //<! parsed label (unused this time) 00146 std::string m_sHandle; //<! parsed handle id string 00147 utils::Size m_oSize; //<! parsed size 00148 utils::Size m_oMinSize; //<! parsed minimal size 00149 utils::Size m_oMaxSize; //<! parsed maximum size 00150 int m_iMargin; //<! parsed layout margin 00151 int m_iSpacing; //<! parsed layout spacing 00152 GUI *m_poGUI; //<! parent GUI 00153 QLayout *m_poParentLayout; //<! parent layout or NULL if there is no parent 00154 QWidget *m_poParentWidget; //<! parent widget to avoid reparenting calls 00155 ProxyLayout *m_poParentProxyLayout; //<! parent widget proxy layout 00156 std::string m_toolTip; //<! optionally given tooltip 00157 }; 00158 } // namespace qt 00159 } 00160