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/ContainerGUIComponent.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 <ICLQt/GUI.h> 00035 00036 namespace icl{ 00037 namespace qt{ 00039 00044 struct ContainerGUIComponent : public GUI{ 00045 protected: 00047 00049 mutable GUIComponent component; 00050 00052 ContainerGUIComponent(const std::string &type, const std::string ¶ms, QWidget *parent): 00053 GUI(type+'('+params+')',parent), component(type, params){} 00054 00055 public: 00056 00058 GUI &operator<<(const GUIComponent &component) const{ 00059 return const_cast<GUI*>(static_cast<const GUI*>(this))->operator<<(component); 00060 } 00061 00063 GUI &operator<<(const GUI &g) const{ 00064 return const_cast<GUI*>(static_cast<const GUI*>(this))->operator<<(g); 00065 } 00066 00068 const ContainerGUIComponent &handle(const std::string &handle) const{ 00069 component.handle(handle); return *this; 00070 } 00071 00073 const ContainerGUIComponent &label(const std::string &label) const{ 00074 component.label(label); return *this; 00075 } 00076 00078 const ContainerGUIComponent &size(const utils::Size &size) const { 00079 component.size(size); return *this; 00080 } 00081 00083 const ContainerGUIComponent &size(int w, int h) const { 00084 return size(utils::Size(w,h)); 00085 } 00086 00088 const ContainerGUIComponent &minSize(const utils::Size &minSize) const { 00089 component.minSize(minSize); return *this; 00090 } 00091 00093 const ContainerGUIComponent &minSize(int w, int h) const { 00094 return minSize(utils::Size(w,h)); 00095 } 00096 00098 const ContainerGUIComponent &maxSize(const utils::Size &maxSize) const { 00099 component.maxSize(maxSize); return *this; 00100 } 00101 00103 const ContainerGUIComponent &maxSize(int w, int h) const { 00104 return maxSize(utils::Size(w,h)); 00105 } 00106 00108 const ContainerGUIComponent &margin(int margin) const{ 00109 component.m_options.margin = margin; return *this; 00110 } 00111 00113 const ContainerGUIComponent &spacing(int spacing) const{ 00114 component.m_options.spacing = spacing; return *this; 00115 } 00116 00118 ContainerGUIComponent &handle(const std::string &handle){ 00119 component.handle(handle); return *this; 00120 } 00121 00123 ContainerGUIComponent &label(const std::string &label){ 00124 component.label(label); return *this; 00125 } 00126 00128 ContainerGUIComponent &size(const utils::Size &size){ 00129 component.size(size); return *this; 00130 } 00131 00133 ContainerGUIComponent &size(int w, int h){ 00134 return size(utils::Size(w,h)); 00135 } 00136 00138 ContainerGUIComponent &minSize(const utils::Size &minSize){ 00139 component.minSize(minSize); return *this; 00140 } 00141 00143 ContainerGUIComponent &minSize(int w, int h){ 00144 return minSize(utils::Size(w,h)); 00145 } 00146 00148 ContainerGUIComponent &maxSize(const utils::Size &maxSize){ 00149 component.maxSize(maxSize); return *this; 00150 } 00151 00153 ContainerGUIComponent &maxSize(int w, int h){ 00154 return maxSize(utils::Size(w,h)); 00155 } 00156 00158 ContainerGUIComponent &margin(int margin){ 00159 component.m_options.margin = margin; return *this; 00160 } 00161 00163 ContainerGUIComponent &spacing(int spacing){ 00164 component.m_options.spacing = spacing; return *this; 00165 } 00166 00167 protected: 00169 virtual std::string createDefinition() const { return component.toString(); } 00170 }; 00171 00172 00173 00174 } // namespace qt 00175 } // namespace icl 00176 00177