Main Page | Namespace List | Class Hierarchy | Class List | Directories | File List | Namespace Members | Class Members | Related Pages

filler.h

00001 /*
00002   libwftk - Worldforge Toolkit - a widget library
00003   Copyright (C) 2003 Ron Steinke <rsteinke@w-link.net>
00004 
00005   This library is free software; you can redistribute it and/or
00006   modify it under the terms of the GNU Lesser General Public
00007   License as published by the Free Software Foundation; either
00008   version 2.1 of the License, or (at your option) any later version.
00009   
00010   This library is distributed in the hope that it will be useful,
00011   but WITHOUT ANY WARRANTY; without even the implied warranty of
00012   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00013   Lesser General Public License for more details.
00014   
00015   You should have received a copy of the GNU Lesser General Public
00016   License along with this library; if not, write to the
00017   Free Software Foundation, Inc., 59 Temple Place - Suite 330,
00018   Boston, MA  02111-1307, SA.
00019 */
00020 
00021 #ifndef _WFTK_FILLER_H
00022 #define _WFTK_FILLER_H
00023 
00024 #include <wftk/screenarea.h>
00025 
00026 namespace wftk {
00027     
00033 class Filler : public ScreenArea
00034 {
00035  public:
00038   enum Orientation {
00039    HORIZONTAL = 1 << 0,
00040    VERTICAL = 1 << 1,
00041    BOTH = HORIZONTAL | VERTICAL
00042   };
00043 
00050   explicit Filler(Orientation o, Uint16 min_size = 0,
00051     unsigned char weight = PackingInfo::Expander::FILL)
00052     : orient_(o), min_(min_size), weight_(weight)
00053     {setPackingInfo();}
00054 
00055  protected:
00056   virtual void setPackingInfo()
00057   {
00058     // set defaults
00059     ScreenArea::setPackingInfo();
00060 
00061     if(orient_ & HORIZONTAL) {
00062       packing_info_.x.filler = weight_;
00063       packing_info_.x.min = min_;
00064       packing_info_.x.pref = min_;
00065     }
00066     if(orient_ & VERTICAL) {
00067       packing_info_.y.filler = weight_;
00068       packing_info_.y.min = min_;
00069       packing_info_.y.pref = min_;
00070     }
00071   }
00072 
00073  private:
00074   Orientation orient_;
00075   Uint16 min_;
00076   unsigned char weight_;
00077 };
00078 
00079 } // namespace wftk
00080 
00081 #endif // _WFTK_FILLER_H

Generated Tue Aug 9 18:40:26 2005.
Copyright © 1998-2003 by the respective authors.

This document is licensed under the terms of the GNU Free Documentation License and may be freely distributed under the conditions given by this license.