Main Page   Class Hierarchy   Alphabetical List   Compound List   File List   Compound Members

FXSpring.h
Go to the documentation of this file.
1 /********************************************************************************
2 * *
3 * S p r i n g C o n t a i n e r W i d g e t *
4 * *
5 *********************************************************************************
6 * Copyright (C) 2003,2006 by Jeroen van der Zijp. All Rights Reserved. *
7 *********************************************************************************
8 * This library is free software; you can redistribute it and/or *
9 * modify it under the terms of the GNU Lesser General Public *
10 * License as published by the Free Software Foundation; either *
11 * version 2.1 of the License, or (at your option) any later version. *
12 * *
13 * This library 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 * Lesser General Public License for more details. *
17 * *
18 * You should have received a copy of the GNU Lesser General Public *
19 * License along with this library; if not, write to the Free Software *
20 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. *
21 *********************************************************************************
22 * $Id: FXSpring.h,v 1.8 2006/01/22 17:58:10 fox Exp $ *
23 ********************************************************************************/
24 #ifndef FXSPRING_H
25 #define FXSPRING_H
26 
27 #ifndef FXPACKER_H
28 #include "FXPacker.h"
29 #endif
30 
31 namespace FX {
32 
33 
34 /**
35 * The spring widgets, when properly embedded side by side in a horizontal
36 * frame or vertical frame widget, behave like a set of connected springs
37 * of various lengths (hence the name!). The parameters relw (or relh)
38 * determines the length of the spring. The actual length is not really
39 * important; the only thing that counts is the relative length of one
40 * spring widget to that of another, although the length does determine
41 * the default size. The special value zero may be given for relw (or relh)
42 * to cause the spring to calculate its default width (height) normally,
43 * just like the Packer base class does.
44 * In a typical scenario, either the relative width or height is set to
45 * zero, an the flag LAYOUT_FILL_X or LAYOUT_FILL_Y is passed. When
46 * placed inside a horizontal frame, the LAYOUT_FILL_X together with
47 * the relative widths of the springs will cause a fixed width-ratio
48 * between the springs.
49 * You also can mix normal controls and springs together in a horizontal
50 * or vertical frames to provide arbitrary stretchable spacing between
51 * widgets; in this case, the springs do not need to have any children.
52 * Since the spring widget is derived from the packer layout manager,
53 * it provides the same layout behavior as packer.
54 */
55 class FXAPI FXSpring : public FXPacker {
57 protected:
58  FXint relWidth; // Relative width
59  FXint relHeight; // Relative height
60 protected:
61  FXSpring(){}
62 private:
63  FXSpring(const FXSpring&);
64  FXSpring &operator=(const FXSpring&);
65 public:
66 
67  /// Construct packer layout manager
69 
70  /// Return default width
71  virtual FXint getDefaultWidth();
72 
73  /// Return default height
74  virtual FXint getDefaultHeight();
75 
76  /// Change relative width
77  void setRelativeWidth(FXint relw);
78 
79  /// Return relative width
80  FXint getRelativeWidth() const { return relWidth; }
81 
82  /// Change relative height
83  void setRelativeHeight(FXint relh);
84 
85  /// Return relative height
86  FXint getRelativeHeight() const { return relHeight; }
87 
88  /// Save to stream
89  virtual void save(FXStream& store) const;
90 
91  /// Load from stream
92  virtual void load(FXStream& store);
93  };
94 
95 }
96 
97 #endif
unsigned int FXuint
Definition: fxdefs.h:396
#define FXAPI
Definition: fxdefs.h:122
Base composite.
Definition: FXComposite.h:35
The spring widgets, when properly embedded side by side in a horizontal frame or vertical frame widge...
Definition: FXSpring.h:55
Definition: FX4Splitter.h:31
int FXint
Definition: fxdefs.h:397
Packer is a layout manager which automatically places child windows inside its area against the left...
Definition: FXPacker.h:58
Definition: FXPacker.h:38
#define FXDECLARE(classname)
Macro to set up class declaration.
Definition: FXObject.h:92

Copyright © 1997-2005 Jeroen van der Zijp