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

FXDockBar.h
1 /********************************************************************************
2 * *
3 * D o c k B a r W i d g e t *
4 * *
5 *********************************************************************************
6 * Copyright (C) 2004,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 FXDOCKBAR_H
22 #define FXDOCKBAR_H
23 
24 #ifndef FXPACKER_H
25 #include "FXPacker.h"
26 #endif
27 
28 namespace FX {
29 
30 
31 class FXDockSite;
32 
33 
42 class FXAPI FXDockBar : public FXPacker {
43  FXDECLARE(FXDockBar)
44 protected:
45  FXComposite *drydock; // Parent when docked
46  FXComposite *wetdock; // Parent when floating
47  FXint gripx; // Grip offset x
48  FXint gripy; // Grip offset y
49  FXuchar allowed; // Where we're allowed to dock
50 // FXuchar mode; // Dragging mode
51 //protected:
52 // static const FXDefaultCursor cursorType[16];
53 protected:
54  FXDockBar();
55  FXbool isAllowable(FXuint hints) const;
56 // FXuchar where(FXint x,FXint y) const;
57 protected:
58  enum {
59  DRAG_NONE = 0,
60  DRAG_TOP = 1,
61  DRAG_BOTTOM = 2,
62  DRAG_LEFT = 4,
63  DRAG_RIGHT = 8,
64  DRAG_TOPLEFT = (DRAG_TOP|DRAG_LEFT),
65  DRAG_TOPRIGHT = (DRAG_TOP|DRAG_RIGHT),
66  DRAG_BOTTOMLEFT = (DRAG_BOTTOM|DRAG_LEFT),
67  DRAG_BOTTOMRIGHT = (DRAG_BOTTOM|DRAG_RIGHT)
68  };
69 private:
70  FXDockBar(const FXDockBar&);
71  FXDockBar &operator=(const FXDockBar&);
72 public:
73 // long onEnter(FXObject*,FXSelector,void*);
74 // long onLeave(FXObject*,FXSelector,void*);
75 // long onMotion(FXObject*,FXSelector,void*);
76 // long onLeftBtnPress(FXObject*,FXSelector,void*);
77 // long onLeftBtnRelease(FXObject*,FXSelector,void*);
78  long onCmdUndock(FXObject*,FXSelector,void*);
79  long onUpdUndock(FXObject*,FXSelector,void*);
80  long onCmdDockTop(FXObject*,FXSelector,void*);
81  long onUpdDockTop(FXObject*,FXSelector,void*);
82  long onCmdDockBottom(FXObject*,FXSelector,void*);
83  long onUpdDockBottom(FXObject*,FXSelector,void*);
84  long onCmdDockLeft(FXObject*,FXSelector,void*);
85  long onUpdDockLeft(FXObject*,FXSelector,void*);
86  long onCmdDockRight(FXObject*,FXSelector,void*);
87  long onUpdDockRight(FXObject*,FXSelector,void*);
88  long onUpdDockFlip(FXObject*,FXSelector,void*);
89  long onBeginDragGrip(FXObject*,FXSelector,void*);
90  long onEndDragGrip(FXObject*,FXSelector,void*);
91  long onDraggedGrip(FXObject*,FXSelector,void*);
92  long onPopupMenu(FXObject*,FXSelector,void*);
93  long onDockTimer(FXObject*,FXSelector,void*);
94 public:
95  enum {
96  ID_DOCK_FLOAT=FXPacker::ID_LAST,
104  ID_LAST
105  };
106 public:
107  enum {
108  ALLOW_NOWHERE=0,
109  ALLOW_TOP=1,
110  ALLOW_BOTTOM=2,
111  ALLOW_LEFT=4,
112  ALLOW_RIGHT=8,
113  ALLOW_HORIZONTAL=ALLOW_TOP|ALLOW_BOTTOM,
114  ALLOW_VERTICAL=ALLOW_LEFT|ALLOW_RIGHT,
115  ALLOW_EVERYWHERE=ALLOW_HORIZONTAL|ALLOW_VERTICAL
116  };
117 public:
118 
128  FXDockBar(FXComposite* p,FXComposite* q,FXuint opts=LAYOUT_TOP|LAYOUT_LEFT|LAYOUT_FILL_X,FXint x=0,FXint y=0,FXint w=0,FXint h=0,FXint pl=3,FXint pr=3,FXint pt=2,FXint pb=2,FXint hs=DEFAULT_SPACING,FXint vs=DEFAULT_SPACING);
129 
134  FXDockBar(FXComposite* p,FXuint opts,FXint x=0,FXint y=0,FXint w=0,FXint h=0,FXint pl=2,FXint pr=3,FXint pt=3,FXint pb=2,FXint hs=DEFAULT_SPACING,FXint vs=DEFAULT_SPACING);
135 
137  FXbool isDocked() const;
138 
142  FXbool insideDock(FXDockSite* docksite,FXint barx,FXint bary);
143 
148  void setDryDock(FXComposite* dry);
149 
154  void setWetDock(FXComposite* wet);
155 
157  FXComposite* getDryDock() const { return drydock; }
158 
160  FXComposite* getWetDock() const { return wetdock; }
161 
163  FXDockSite* findDockAtSide(FXuint side=LAYOUT_SIDE_TOP);
164 
166  FXDockSite* findDockNear(FXint rootx,FXint rooty);
167 
173  virtual void dock(FXDockSite* docksite,FXWindow* other=nullptr,FXbool notify=false);
174 
179  virtual void dock(FXDockSite* docksite,FXint localx,FXint localy,FXbool notify);
180 
186  virtual void undock(FXint rootx,FXint rooty,FXbool notify=false);
187 
192  void allowedSides(FXuchar allow){ allowed=allow; }
193 
197  FXuchar allowedSides() const { return allowed; }
198 
200  virtual void save(FXStream& store) const;
201 
203  virtual void load(FXStream& store);
204 
206  virtual ~FXDockBar();
207  };
208 
209 }
210 
211 #endif
Tool bar grip.
Definition: FXDockBar.h:103
Dock on the right.
Definition: FXDockBar.h:101
FXComposite * getDryDock() const
Return parent when docked.
Definition: FXDockBar.h:157
Window is the base class for all widgets in FOX.
Definition: FXWindow.h:130
Dock on the left.
Definition: FXDockBar.h:100
Undock the dock bar.
Definition: FXDockBar.h:97
Base composite.
Definition: FXComposite.h:32
The dock site widget is a widget where dock bars can be docked.
Definition: FXDockSite.h:62
void allowedSides(FXuchar allow)
Change set of sides (a combination of ALLOW_TOP, ALLOW_LEFT, etc.), where docking is allowed...
Definition: FXDockBar.h:192
A stream is a way to serialize data and objects into a byte stream.
Definition: FXStream.h:81
Dock on the top.
Definition: FXDockBar.h:98
FXComposite * getWetDock() const
Return parent when floating.
Definition: FXDockBar.h:160
FXuchar allowedSides() const
Return set of sides where docking is allowed.
Definition: FXDockBar.h:197
Definition: FX4Splitter.h:28
Packer is a layout manager which automatically places child windows inside its area against the left...
Definition: FXPacker.h:48
Object is the base class for all objects in FOX; in order to receive messages from the user interface...
Definition: FXObject.h:138
Flip orientation.
Definition: FXDockBar.h:102
A dock bar widget can be docked inside a dock site widget, or floated around freely.
Definition: FXDockBar.h:42
Dock on the bottom.
Definition: FXDockBar.h:99

Copyright © 1997-2022 Jeroen van der Zijp