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

FX4Splitter.h
1 /********************************************************************************
2 * *
3 * F o u r - W a y S p l i t t e r *
4 * *
5 *********************************************************************************
6 * Copyright (C) 1999,2024 by Jeroen van der Zijp. All Rights Reserved. *
7 *********************************************************************************
8 * This library is free software; you can redistribute it and/or modify *
9 * it under the terms of the GNU Lesser General Public License as published by *
10 * the Free Software Foundation; either version 3 of the License, or *
11 * (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 *
16 * GNU Lesser General Public License for more details. *
17 * *
18 * You should have received a copy of the GNU Lesser General Public License *
19 * along with this program. If not, see <http://www.gnu.org/licenses/> *
20 ********************************************************************************/
21 #ifndef FX4SPLITTER_H
22 #define FX4SPLITTER_H
23 
24 #ifndef FXCOMPOSITE_H
25 #include "FXComposite.h"
26 #endif
27 
28 namespace FX {
29 
30 // Splitter options
31 enum {
32  FOURSPLITTER_TRACKING = 0x00008000, // Track continuously during split
33  FOURSPLITTER_VERTICAL = 0x00010000, // Prefer vertial expansion of panels
34  FOURSPLITTER_HORIZONTAL = 0, // Prefer horizontal expansion of panels (default)
35  FOURSPLITTER_NORMAL = 0
36  };
37 
38 
39 
64 class FXAPI FX4Splitter : public FXComposite {
65  FXDECLARE(FX4Splitter)
66 private:
67  FXint splitx; // Current x split
68  FXint splity; // Current y split
69  FXint barsize; // Size of the splitter bar
70  FXint fhor; // Horizontal split fraction
71  FXint fver; // Vertical split fraction
72  FXint offx;
73  FXint offy;
74  FXuchar mode;
75 protected:
76  FX4Splitter();
77  FXuchar getMode(FXint x,FXint y);
78  void moveSplit(FXint x,FXint y);
79  void drawSplit(FXint x,FXint y,FXuint m);
80  void adjustLayout();
81 private:
82  FX4Splitter(const FX4Splitter&);
83  FX4Splitter &operator=(const FX4Splitter&);
84 public:
85  long onLeftBtnPress(FXObject*,FXSelector,void*);
86  long onLeftBtnRelease(FXObject*,FXSelector,void*);
87  long onMotion(FXObject*,FXSelector,void*);
88  long onFocusUp(FXObject*,FXSelector,void*);
89  long onFocusDown(FXObject*,FXSelector,void*);
90  long onFocusLeft(FXObject*,FXSelector,void*);
91  long onFocusRight(FXObject*,FXSelector,void*);
92  long onCmdExpand(FXObject*,FXSelector,void*);
93  long onUpdExpand(FXObject*,FXSelector,void*);
94 public:
95  enum {
96  ExpandNone = 0,
97  ExpandTopLeft = 1,
98  ExpandTopRight = 2,
99  ExpandBottomLeft = 4,
100  ExpandBottomRight = 8,
101  ExpandTop = ExpandTopLeft|ExpandTopRight,
102  ExpandBottom = ExpandBottomLeft|ExpandBottomRight,
103  ExpandLeft = ExpandTopLeft|ExpandBottomLeft,
104  ExpandRight = ExpandTopRight|ExpandBottomRight,
105  ExpandCriss = ExpandTopRight|ExpandBottomLeft,
106  ExpandCross = ExpandTopLeft|ExpandBottomRight,
107  ExpandAll = ExpandLeft|ExpandRight
108  };
109 public:
110  enum {
111  ID_EXPAND_NONE=FXComposite::ID_LAST+ExpandNone,
112  ID_EXPAND_TOP=ID_EXPAND_NONE+ExpandTop,
113  ID_EXPAND_BOTTOM=ID_EXPAND_NONE+ExpandBottom,
114  ID_EXPAND_LEFT=ID_EXPAND_NONE+ExpandLeft,
115  ID_EXPAND_RIGHT=ID_EXPAND_NONE+ExpandRight,
116  ID_EXPAND_TOPLEFT=ID_EXPAND_NONE+ExpandTopLeft,
117  ID_EXPAND_TOPRIGHT=ID_EXPAND_NONE+ExpandTopRight,
118  ID_EXPAND_BOTTOMLEFT=ID_EXPAND_NONE+ExpandBottomLeft,
119  ID_EXPAND_BOTTOMRIGHT=ID_EXPAND_NONE+ExpandBottomRight,
120  ID_EXPAND_ALL=ID_EXPAND_NONE+ExpandAll,
121  ID_LAST
122  };
123 public:
124 
126  FX4Splitter(FXComposite* p,FXuint opts=FOURSPLITTER_NORMAL,FXint x=0,FXint y=0,FXint w=0,FXint h=0);
127 
129  FX4Splitter(FXComposite* p,FXObject* tgt,FXSelector sel,FXuint opts=FOURSPLITTER_NORMAL,FXint x=0,FXint y=0,FXint w=0,FXint h=0);
130 
132  FXWindow *getTopLeft() const;
133 
135  FXWindow *getTopRight() const;
136 
138  FXWindow *getBottomLeft() const;
139 
141  FXWindow *getBottomRight() const;
142 
144  FXint getHSplit() const { return fhor; }
145 
147  FXint getVSplit() const { return fver; }
148 
150  void setHSplit(FXint s);
151 
153  void setVSplit(FXint s);
154 
156  virtual void layout();
157 
159  virtual FXint getDefaultWidth();
160 
162  virtual FXint getDefaultHeight();
163 
165  FXuint getSplitterStyle() const;
166 
168  void setSplitterStyle(FXuint style);
169 
171  void setBarSize(FXint bs);
172 
174  FXint getBarSize() const { return barsize; }
175 
177  void setExpanded(FXuint set=FX4Splitter::ExpandAll);
178 
180  FXuint getExpanded() const;
181 
183  virtual void save(FXStream& store) const;
184 
186  virtual void load(FXStream& store);
187  };
188 
189 }
190 
191 #endif
FXint getVSplit() const
Get vertical split fraction.
Definition: FX4Splitter.h:147
Base composite.
Definition: FXComposite.h:32
A stream is a way to serialize data and objects into a byte stream.
Definition: FXStream.h:81
Definition: FX4Splitter.h:28
FXint getBarSize() const
Get splitter bar width.
Definition: FX4Splitter.h:174
FXint getHSplit() const
Get horizontal split fraction.
Definition: FX4Splitter.h:144
Expand diagonally opposing children.
Definition: FX4Splitter.h:107
Object is the base class for all objects in FOX; in order to receive messages from the user interface...
Definition: FXObject.h:138
The four-way splitter is a layout manager which manages four children like four panes in a window...
Definition: FX4Splitter.h:64

Copyright © 1997-2022 Jeroen van der Zijp