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

FXSwitcher.h
Go to the documentation of this file.
1 /********************************************************************************
2 * *
3 * S w i t c h C o n t a i n e r W i d g e t *
4 * *
5 *********************************************************************************
6 * Copyright (C) 1997,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: FXSwitcher.h,v 1.17 2006/01/22 17:58:10 fox Exp $ *
23 ********************************************************************************/
24 #ifndef FXSWITCHER_H
25 #define FXSWITCHER_H
26 
27 #ifndef FXPACKER_H
28 #include "FXPacker.h"
29 #endif
30 
31 namespace FX {
32 
33 /// Switcher options
34 enum {
35  SWITCHER_HCOLLAPSE = 0x00020000, /// Collapse horizontally to width of current child
36  SWITCHER_VCOLLAPSE = 0x00040000 /// Collapse vertically to height of current child
37  };
38 
39 
40 /**
41 * The Switcher layout manager automatically arranges its child
42 * windows such that one of them is placed on top; all other
43 * child windows are hidden.
44 * Switcher provides a convenient method to conserve screen
45 * real-estate by arranging several GUI panels to appear in the
46 * same space, depending on context.
47 * Switcher ignores all layout hints from its children:- all
48 * children are stretched according to the switcher layout
49 * managers own size.
50 * When the SWITCHER_HCOLLAPSE or SWITCHER_VCOLLAPSE options
51 * are used, Switcher's default size is based on the width or
52 * height of the current child, instead of the maximum width
53 * or height of all of the children.
54 */
55 class FXAPI FXSwitcher : public FXPacker {
57 protected:
58  FXint current;
59 protected:
60  FXSwitcher(){}
61 private:
63  FXSwitcher& operator=(const FXSwitcher&);
64 public:
65  long onPaint(FXObject*,FXSelector,void*);
66  long onCmdSetValue(FXObject*,FXSelector,void*);
67  long onCmdSetIntValue(FXObject*,FXSelector,void*);
68  long onCmdGetIntValue(FXObject*,FXSelector,void*);
69  long onCmdOpen(FXObject*,FXSelector,void*);
70  long onUpdOpen(FXObject*,FXSelector,void*);
71 public:
72  enum {
73  ID_OPEN_FIRST=FXPacker::ID_LAST,
74  ID_OPEN_SECOND,
75  ID_OPEN_THIRD,
76  ID_OPEN_FOURTH,
77  ID_OPEN_FIFTH,
78  ID_OPEN_SIXTH,
79  ID_OPEN_SEVENTH,
80  ID_OPEN_EIGHTH,
81  ID_OPEN_NINETH,
82  ID_OPEN_TENTH,
83  ID_OPEN_LAST=ID_OPEN_FIRST+100,
84  ID_LAST
85  };
86 public:
87 
88  /// Construct a switcher layout manager
90 
91  /// Return default width
92  virtual FXint getDefaultWidth();
93 
94  /// Return default height
95  virtual FXint getDefaultHeight();
96 
97  /// Perform layout
98  virtual void layout();
99 
100  /// Bring the child window at index to the top
101  void setCurrent(FXint index,FXbool notify=FALSE);
102 
103  /// Return the index of the child window currently on top
104  FXint getCurrent() const { return current; }
105 
106  /// Set the switcher style flags
107  void setSwitcherStyle(FXuint style);
108 
109  /// Get the switcher style flags
110  FXuint getSwitcherStyle() const;
111 
112  /// Save to stream
113  virtual void save(FXStream& store) const;
114 
115  /// Load from stream
116  virtual void load(FXStream& store);
117  };
118 
119 }
120 
121 #endif
Collapse horizontally to width of current child.
Definition: FXSwitcher.h:38
Definition: FXWindow.h:241
unsigned int FXuint
Definition: fxdefs.h:396
FXuint FXSelector
Association key.
Definition: FXObject.h:53
#define FXAPI
Definition: fxdefs.h:122
FXuchar FXbool
Definition: fxdefs.h:393
Base composite.
Definition: FXComposite.h:35
The Switcher layout manager automatically arranges its child windows such that one of them is placed ...
Definition: FXSwitcher.h:62
A stream is a way to serialize data and objects into a byte stream.
Definition: FXStream.h:99
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
Collapse vertically to height of current child.
Definition: FXSwitcher.h:39
#define FALSE
Definition: fxdefs.h:35
Definition: FXPacker.h:38
Object is the base class for all objects in FOX; in order to receive messages from the user interface...
Definition: FXObject.h:166
#define FXDECLARE(classname)
Macro to set up class declaration.
Definition: FXObject.h:92

Copyright © 1997-2005 Jeroen van der Zijp