cwidget  0.5.17
size_box.h
1 // size_box.h -*-c++-*-
2 //
3 // A container to ensure that its child has a particular minimum size
4 // (at least).
5 //
6 // Copyright 2004 Daniel Burrows
7 //
8 // This program is free software; you can redistribute it and/or
9 // modify it under the terms of the GNU General Public License as
10 // published by the Free Software Foundation; either version 2 of
11 // the License, or (at your option) any later version.
12 //
13 // This program is distributed in the hope that it will be useful,
14 // but WITHOUT ANY WARRANTY; without even the implied warranty of
15 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
16 // General Public License for more details.
17 //
18 // You should have received a copy of the GNU General Public License
19 // along with this program; see the file COPYING. If not, write to
20 // the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
21 // Boston, MA 02111-1307, USA.
22 
23 #ifndef SIZE_BOX_H
24 #define SIZE_BOX_H
25 
26 #include "bin.h"
27 
28 namespace cwidget
29 {
30  namespace widgets
31  {
35  class size_box:public bin
36  {
37  size min_size;
38 
40  void layout_me();
41  protected:
42  size_box(size s, const widget_ref &w);
43 
44  public:
51  static util::ref_ptr<size_box> create(size s, const widget_ref &w=NULL)
52  {
53  util::ref_ptr<size_box> rval(new size_box(s, w));
54  rval->decref();
55  return rval;
56  }
57 
61  int width_request();
62 
68  int height_request(int w);
69  };
70 
72  }
73 }
74 
75 #endif
A size_box ensures that the requested size of its child is a given size or larger.
Definition: size_box.h:35
The namespace containing everything defined by cwidget.
Definition: columnify.cc:26
Definition: widget.h:83
Definition: bin.h:16
static util::ref_ptr< size_box > create(size s, const widget_ref &w=NULL)
Create a size_box.
Definition: size_box.h:51
int width_request()
Definition: size_box.cc:25
int height_request(int w)
Definition: size_box.cc:37