size_box.h

00001 // size_box.h                       -*-c++-*-
00002 //
00003 // A container to ensure that its child has a particular minimum size
00004 // (at least).
00005 //
00006 // Copyright 2004 Daniel Burrows
00007 //
00008 //   This program is free software; you can redistribute it and/or
00009 //   modify it under the terms of the GNU General Public License as
00010 //   published by the Free Software Foundation; either version 2 of
00011 //   the License, or (at your option) any later version.
00012 //
00013 //   This program is distributed in the hope that it will be useful,
00014 //   but WITHOUT ANY WARRANTY; without even the implied warranty of
00015 //   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00016 //   General Public License for more details.
00017 //
00018 //   You should have received a copy of the GNU General Public License
00019 //   along with this program; see the file COPYING.  If not, write to
00020 //   the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
00021 //   Boston, MA 02111-1307, USA.
00022 
00023 #ifndef SIZE_BOX_H
00024 #define SIZE_BOX_H
00025 
00026 #include "bin.h"
00027 
00028 namespace cwidget
00029 {
00030   namespace widgets
00031   {
00035     class size_box:public bin
00036     {
00037       size min_size;
00038 
00040       void layout_me();
00041     protected:
00042       size_box(size s, const widget_ref &w);
00043 
00044     public:
00051       static util::ref_ptr<size_box> create(size s, const widget_ref &w=NULL)
00052       {
00053         util::ref_ptr<size_box> rval(new size_box(s, w));
00054         rval->decref();
00055         return rval;
00056       }
00057 
00061       int width_request();
00062 
00068       int height_request(int w);
00069     };
00070 
00071     typedef util::ref_ptr<size_box> size_box_ref;
00072   }
00073 }
00074 
00075 #endif

Generated on Mon Jul 7 11:11:55 2008 for cwidget by  doxygen 1.5.6