Image Component Library (ICL)
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines
ContainerGUIComponent.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/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.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 <ICLQt/GUI.h>
00034 
00035 namespace icl{
00036   namespace qt{
00038 
00043     struct ContainerGUIComponent : public GUI{
00044       protected:
00046 
00048       mutable GUIComponent component;
00049   
00051       ContainerGUIComponent(const std::string &type, const std::string &params, QWidget *parent):
00052       GUI(type+'('+params+')',parent), component(type, params){}
00053         
00054       public:
00055       
00057       GUI &operator<<(const GUIComponent &component) const{
00058         return const_cast<GUI*>(static_cast<const GUI*>(this))->operator<<(component);
00059       }
00060       
00062       GUI &operator<<(const GUI &g) const{
00063         return const_cast<GUI*>(static_cast<const GUI*>(this))->operator<<(g);
00064       }
00065   
00067       const ContainerGUIComponent &handle(const std::string &handle) const{
00068         component.handle(handle); return *this;
00069       }
00070         
00072       const ContainerGUIComponent &label(const std::string &label) const{
00073         component.label(label); return *this;
00074       }
00075         
00077       const ContainerGUIComponent &size(const utils::Size &size) const {
00078         component.size(size); return *this;
00079       }
00080         
00082       const ContainerGUIComponent &size(int w, int h) const {
00083         return size(utils::Size(w,h));
00084       }
00085   
00087       const ContainerGUIComponent &minSize(const utils::Size &minSize) const {
00088         component.minSize(minSize); return *this;
00089       }
00090         
00092       const ContainerGUIComponent &minSize(int w, int h) const {
00093         return minSize(utils::Size(w,h));
00094       }
00095         
00097       const ContainerGUIComponent &maxSize(const utils::Size &maxSize) const {
00098         component.maxSize(maxSize); return *this;
00099       }
00100         
00102       const ContainerGUIComponent &maxSize(int w, int h) const {
00103         return maxSize(utils::Size(w,h));
00104       }
00105         
00107       const ContainerGUIComponent &margin(int margin) const{
00108         component.m_options.margin = margin; return *this;
00109       }
00110         
00112       const ContainerGUIComponent &spacing(int spacing) const{
00113         component.m_options.spacing = spacing; return *this;
00114       }
00115   
00117       ContainerGUIComponent &handle(const std::string &handle){
00118         component.handle(handle); return *this;
00119       }
00120         
00122       ContainerGUIComponent &label(const std::string &label){
00123         component.label(label); return *this;
00124       }
00125         
00127       ContainerGUIComponent &size(const utils::Size &size){
00128         component.size(size); return *this;
00129       }
00130         
00132       ContainerGUIComponent &size(int w, int h){
00133         return size(utils::Size(w,h));
00134       }
00135   
00137       ContainerGUIComponent &minSize(const utils::Size &minSize){
00138         component.minSize(minSize); return *this;
00139       }
00140         
00142       ContainerGUIComponent &minSize(int w, int h){
00143         return minSize(utils::Size(w,h));
00144       }
00145         
00147       ContainerGUIComponent &maxSize(const utils::Size &maxSize){
00148         component.maxSize(maxSize); return *this;
00149       }
00150         
00152       ContainerGUIComponent &maxSize(int w, int h){
00153         return maxSize(utils::Size(w,h));
00154       }
00155         
00157       ContainerGUIComponent &margin(int margin){
00158         component.m_options.margin = margin; return *this;
00159       }
00160         
00162       ContainerGUIComponent &spacing(int spacing){
00163         component.m_options.spacing = spacing; return *this;
00164       }
00165   
00166       protected:
00168       virtual std::string createDefinition() const { return component.toString();  }    
00169     };
00170       
00171     
00172   
00173   } // namespace qt
00174 } // namespace icl
00175 
00176 
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines