ctkDynamicSpacer.cpp

Go to the documentation of this file.
00001 /*=========================================================================
00002 
00003   Library:   CTK
00004  
00005   Copyright (c) 2010  Kitware Inc.
00006 
00007   Licensed under the Apache License, Version 2.0 (the "License");
00008   you may not use this file except in compliance with the License.
00009   You may obtain a copy of the License at
00010 
00011       http://www.commontk.org/LICENSE
00012 
00013   Unless required by applicable law or agreed to in writing, software
00014   distributed under the License is distributed on an "AS IS" BASIS,
00015   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
00016   See the License for the specific language governing permissions and
00017   limitations under the License.
00018  
00019 =========================================================================*/
00020 
00021 // CTK includes
00022 #include "ctkDynamicSpacer.h"
00023 
00024 // -----------------------------------------------------------------------------
00025 class ctkDynamicSpacerPrivate : public ctkPrivate<ctkDynamicSpacer>
00026 {
00027   CTK_DECLARE_PUBLIC(ctkDynamicSpacer);
00028 public:
00029   void init();
00030 
00031   QSizePolicy ActiveSizePolicy;
00032   QSizePolicy InactiveSizePolicy;
00033 };
00034 
00035 // -----------------------------------------------------------------------------
00036 void ctkDynamicSpacerPrivate::init()
00037 {
00038   CTK_P(ctkDynamicSpacer);
00039   this->ActiveSizePolicy = p->sizePolicy();
00040   this->InactiveSizePolicy = p->sizePolicy();
00041 }
00042 
00043 // -----------------------------------------------------------------------------
00044 ctkDynamicSpacer::ctkDynamicSpacer(QWidget *_parent)
00045   :QWidget(_parent)
00046 {
00047   CTK_INIT_PRIVATE(ctkDynamicSpacer);
00048   ctk_d()->init();
00049 }
00050 
00051 // -----------------------------------------------------------------------------
00052 ctkDynamicSpacer::~ctkDynamicSpacer()
00053 {
00054 }
00055 
00056 // -----------------------------------------------------------------------------
00057 QSizePolicy ctkDynamicSpacer::activeSizePolicy() const
00058 {
00059   CTK_D(const ctkDynamicSpacer);
00060   return d->ActiveSizePolicy;
00061 }
00062 
00063 // -----------------------------------------------------------------------------
00064 void ctkDynamicSpacer::setActiveSizePolicy(QSizePolicy newActiveSizePolicy)
00065 {
00066   CTK_D(ctkDynamicSpacer);
00067   d->ActiveSizePolicy = newActiveSizePolicy;
00068 }
00069 
00070 // -----------------------------------------------------------------------------
00071 QSizePolicy ctkDynamicSpacer::inactiveSizePolicy() const
00072 {
00073   CTK_D(const ctkDynamicSpacer);
00074   return d->InactiveSizePolicy;
00075 }
00076 
00077 // -----------------------------------------------------------------------------
00078 void ctkDynamicSpacer::setInactiveSizePolicy(QSizePolicy newInactiveSizePolicy)
00079 {
00080   CTK_D(ctkDynamicSpacer);
00081   d->InactiveSizePolicy = newInactiveSizePolicy;
00082 }
00083 
00084 // -----------------------------------------------------------------------------
00085 void ctkDynamicSpacer::activate(bool enableSizePolicy)
00086 {
00087   CTK_D(ctkDynamicSpacer);
00088   this->setSizePolicy(
00089     enableSizePolicy ? d->ActiveSizePolicy : d->InactiveSizePolicy);
00090 }
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Defines

Generated on 21 May 2010 for CTK by  doxygen 1.6.1