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

FXSplitter.h
Go to the documentation of this file.
1 /********************************************************************************
2 * *
3 * S p l i t t e r W i n d o w 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: FXSplitter.h,v 1.29 2006/01/22 17:58:09 fox Exp $ *
23 ********************************************************************************/
24 #ifndef FXSPLITTER_H
25 #define FXSPLITTER_H
26 
27 #ifndef FXCOMPOSITE_H
28 #include "FXComposite.h"
29 #endif
30 
31 namespace FX {
32 
33 
34 /// Splitter options
35 enum {
36  SPLITTER_HORIZONTAL = 0, /// Split horizontally
37  SPLITTER_VERTICAL = 0x00008000, /// Split vertically
38  SPLITTER_REVERSED = 0x00010000, /// Reverse-anchored
39  SPLITTER_TRACKING = 0x00020000, /// Track continuous during split
41  };
42 
43 
44 
45 /**
46 * Splitter window is used to interactively repartition
47 * two or more subpanels.
48 * Space may be subdivided horizontally (SPLITTER_HORIZONTAL, which
49 * the default) or vertically (SPLITTER_VERTICAL option).
50 * When the splitter is itself resized, the right-most (bottom-most)
51 * child window will be resized unless the splitter window is reversed;
52 * if the splitter is reversed, the left-most (top-most) child window
53 * will be resized instead.
54 * The splitter widget sends a SEL_CHANGED to its target
55 * during the resizing of the panels; at the end of the resize interaction,
56 * it sends a SEL_COMMAND to signify that the resize operation is complete.
57 * Normally, children are resizable from 0 upwards; however, if the child
58 * in a horizontally oriented splitter has LAYOUT_FILL_X in combination with
59 * LAYOUT_FIX_WIDTH, it will not be made smaller than its default width,
60 * except when the child is the last visible widget (or first when the option
61 * SPLITTER_REVERSED has been passed to the splitter).
62 * In a vertically oriented splitter, children with LAYOUT_FILL_Y and
63 * LAYOUT_FIX_HEIGHT behave analogously.
64 */
65 class FXAPI FXSplitter : public FXComposite {
67 private:
68  FXWindow *window; // Window being resized
69  FXint split; // Split value
70  FXint offset; // Mouse offset
71  FXint barsize; // Size of the splitter bar
72 protected:
73  FXSplitter();
74  void adjustHLayout();
75  void adjustVLayout();
76  void moveHSplit(FXint amount);
77  void moveVSplit(FXint amount);
78  void drawHSplit(FXint pos);
79  void drawVSplit(FXint pos);
80  FXWindow* findHSplit(FXint pos);
81  FXWindow* findVSplit(FXint pos);
82 private:
83  FXSplitter(const FXSplitter&);
84  FXSplitter& operator=(const FXSplitter&);
85 public:
86  long onLeftBtnPress(FXObject*,FXSelector,void*);
87  long onLeftBtnRelease(FXObject*,FXSelector,void*);
88  long onMotion(FXObject*,FXSelector,void*);
89  long onFocusNext(FXObject*,FXSelector,void*);
90  long onFocusPrev(FXObject*,FXSelector,void*);
91  long onFocusUp(FXObject*,FXSelector,void*);
92  long onFocusDown(FXObject*,FXSelector,void*);
93  long onFocusLeft(FXObject*,FXSelector,void*);
94  long onFocusRight(FXObject*,FXSelector,void*);
95 public:
96 
97  /// Construct new splitter widget
99 
100  /// Construct new splitter widget, which will notify target about size changes
102 
103  /// Get default width
104  virtual FXint getDefaultWidth();
105 
106  /// Get default height
107  virtual FXint getDefaultHeight();
108 
109  /// Perform layout
110  virtual void layout();
111 
112  /// Return size of the panel at index
113  FXint getSplit(FXint index) const;
114 
115  /// Change the size of panel at the given index
116  void setSplit(FXint index,FXint size);
118  /// Change splitter style
119  void setSplitterStyle(FXuint style);
120 
121  /// Return current splitter style
122  FXuint getSplitterStyle() const;
123 
124  /// Change splitter bar size
125  void setBarSize(FXint bs);
126 
127  /// Return current bar size
128  FXint getBarSize() const { return barsize; }
129 
130  /// Save to stream
131  virtual void save(FXStream& store) const;
132 
133  /// Load from stream
134  virtual void load(FXStream& store);
135 
136  /// Destroy splitter
137  virtual ~FXSplitter();
138  };
139 
140 }
141 
142 #endif
Base class for all windows.
Definition: FXWindow.h:115
unsigned int FXuint
Definition: fxdefs.h:389
FXuint FXSelector
Association key.
Definition: FXObject.h:53
#define FXAPI
Definition: fxdefs.h:122
Split horizontally.
Definition: FXSplitter.h:39
Base composite.
Definition: FXComposite.h:35
A stream is a way to serialize data and objects into a byte stream.
Definition: FXStream.h:99
Track continuous during split.
Definition: FXSplitter.h:42
Splitter window is used to interactively repartition two or more subpanels.
Definition: FXSplitter.h:72
Reverse-anchored.
Definition: FXSplitter.h:41
Definition: FX4Splitter.h:31
int FXint
Definition: fxdefs.h:390
Definition: FXSplitter.h:43
Object is the base class for all objects in FOX; in order to receive messages from the user interface...
Definition: FXObject.h:166
Split vertically.
Definition: FXSplitter.h:40
#define FXDECLARE(classname)
Macro to set up class declaration.
Definition: FXObject.h:92

Copyright © 1997-2005 Jeroen van der Zijp