OWLNext    7.0
Borland's Object Windows Library for the modern age
Loading...
Searching...
No Matches
panespli.h
Go to the documentation of this file.
1//----------------------------------------------------------------------------
2// ObjectWindows
3// Copyright (c) 1995, 1996 by Borland International, All Rights Reserved
4//
5/// \file
6// Definition of Pane Splitter classes
7//----------------------------------------------------------------------------
8
9#if !defined(OWL_PANESPLI_H)
10#define OWL_PANESPLI_H
11
12#include <owl/private/defs.h>
13#if defined(BI_HAS_PRAGMA_ONCE)
14# pragma once
15#endif
16
17#include <owl/splitter.h>
18
19/* we are not using owl's resource files
20#if !defined(OWL_PANESPLI_RH)
21# include <owl/panespli.rh>
22#endif
23*/
24
25
26namespace owl {
27
28/// \cond
29
30//
31// Define macro [missing from 16-bit headers]used by PANESPLI.CPP
32//
33#if !defined(IDC_SIZEALL)
34# define IDC_SIZEALL MAKEINTRESOURCE(32646)
35#endif
36
37/// \endcond
38
39#include <owl/preclass.h>
40
41//
42/// \class TPaneSplitter
43// ~~~~~ ~~~~~~~~~~~~~
44/// TPaneSplitter is a class that acts as a container for child windows (called
45/// panes) and splitters (pane mover, separator). It supports operations for
46/// manipulating panes (add, remove, move, resize, etc) and splitters (drawing,
47/// width, etc). Splitters can be moved (thereby resizing the panes) by function
48/// call or mouse input. Using the mouse, multiple splitters can be moved
49/// simultaneously.
50//
52{
53 public:
55
56 TPaneSplitter(TWindow* parent,
57 LPCTSTR title = 0,
58 int splitterWidth = 0,
59 TModule* module = 0);
60
62 TWindow* parent,
63 const tstring& title,
64 int splitterWidth = 0,
65 TModule* module = 0);
66
67 ~TPaneSplitter() override;
68
69 // Pane functions
70 //
71 virtual bool SplitPane(TWindow* target, TWindow* newPane,
72 TSplitDirection splitDir, float percent = 0.50f);
74 bool ReplacePane(TWindow* target, TWindow* newPane,
76 bool SwapPanes(TWindow* pane1, TWindow* pane2);
77 int PaneCount();
79
80 typedef int (*TForEachPaneCallback)(TWindow&, void*);
81 void ForEachPane(TForEachPaneCallback callback, void* p);
82
83 // Splitter functions
84 //
85 int GetSplitterWidth();
86 int SetSplitterWidth(int newWidth);
87 void SetSplitterCushion(uint cushion);
88 bool MoveSplitter(TWindow* pane, int dist);
89
90 bool DelObj(TDelete dt);
92
93 protected:
94 void SetupWindow() override;
95 void CleanupWindow() override;
96 void EvSize(uint sizeType, const TSize& size);
97 virtual void DrawSplitter(TDC& dc, const TRect& splitter);
98
99// **************** (JAM) 03-16-01
100// The following class members were moved from private to protected
104
105 void GetDefLM(TLayoutMetrics& lm);
106 bool HasPane(TWindow* p);
107 virtual void StartSplitterMove(TSplitter* splitter, const TPoint& point);
108 virtual int RemovePanes();
109 void MoveSplitters();
110
111
112 private:
113 enum TTraversalOrder {psPreOrder, psInOrder, psPostOrder};
114 typedef int (TPaneSplitter::*TForEachObjectCallback)(TWindow*, void*, void*);
115
116 int SplitterWidth;
117 uint SplitterCushion;
118 HCURSOR ResizeCursorH;
119 HCURSOR ResizeCursorV;
120 HCURSOR ResizeCursorHV;
121 bool PaneSplitterResizing;
122 TDelete ShouldDelete;
123
124 void MouseMoved(const TPoint& point);
125
126 virtual void EndSplitterMove(const TPoint& point);
127 void SetSplitterMoveCursor(TSplitter* splitter, const TPoint& point);
128
129 void ForEachObject(TWindow* o,
130 TForEachObjectCallback callback,
131 void* p1, void* p2 = 0,
132 TTraversalOrder order = psPostOrder);
133 void ScreenToClientRect(TRect& rect);
134 void ClientToScreenRect(TRect& rect);
135
136 TLayoutWindow* DoRemovePane(TWindow* pane, TDelete dt = TShouldDelete::DefDelete);
137 void FindIntersectingSplitters(const TPoint& point);
138
139 void DestroyPane(TWindow* pane, TDelete dt = TShouldDelete::DefDelete);
140
141 // ForEachObject() callbacks..
142 //
143 int DoForEachPane(TWindow* splitter, void* p1, void* p2);
144 int DoFindIntersectingSplitters(TWindow* splitter, void* p1, void* p2);
145 int GetListOfPanesToRemove(TWindow* splitter, void* p1, void* p2);
146 int AdjSplitterWidth(TWindow* splitter, void* p1, void* p2);
147 int DoPaneCount(TWindow* splitter, void* p1, void* p2);
148 int GetPanes(TWindow* splitter, void* p1, void* p2);
149 int GetSplitters(TWindow* splitter, void* p1, void* p2);
150
151 friend class _OWLCLASS TSplitter;
152 friend class _OWLCLASS THSplitter;
153 friend class _OWLCLASS TVSplitter;
154
155 DECLARE_RESPONSE_TABLE(TPaneSplitter);
156};
157
158#include <owl/posclass.h>
159
160
161//----------------------------------------------------------------------------
162// Inline implementations
163//
164
165//
166/// Returns the width of the splitter widget.
167//
168inline int
170{
171 return SplitterWidth;
172}
173
174//
175/// Set the cushion for the splitter widget.
176//
177inline void
179{
180 SplitterCushion = cushion;
181}
182//
183/// Returns true if the object should be deleted.
184//
185inline bool
187{
188 return dt == TShouldDelete::Delete ||
189 (dt==TShouldDelete::DefDelete && ShouldDelete==TShouldDelete::Delete);
190}
191
192//
193//
194//
195inline void
197{
198 ShouldDelete = dt;
199}
200
201} // OWL namespace
202
203
204
205#endif // OWL_PANESPLI_H
TDC is the root class for GDI DC wrappers.
Definition dc.h:64
When specifying the layout metrics for a window, four layout constraints are needed.
Definition layoutwi.h:54
Derived from TWindow, TLayoutWindow provides functionality for defining the layout metrics for a wind...
Definition layoutwi.h:122
TLayoutWindow(TWindow *parent, LPCTSTR title=0, TModule *module=0)
Creates a TLayoutWindow object with specified parent, window caption, and library ID.
Definition layoutwi.cpp:262
ObjectWindows dynamic-link libraries (DLLs) construct an instance of TModule, which acts as an object...
Definition module.h:78
TPaneSplitter is a class that acts as a container for child windows (called panes) and splitters (pan...
Definition panespli.h:52
void CleanupWindow() override
Removes all panes (and related splitters). Destroys cursors.
void EvSize(uint sizeType, const TSize &size)
Sets data member 'PaneSplitterResizing' to indicate that contained splitters should adjust themselves...
int GetSplitterWidth()
Returns the width of the splitter widget.
Definition panespli.h:169
bool ReplacePane(TWindow *target, TWindow *newPane, TDelete dt=TShouldDelete::DefDelete)
Replaces 'target' pane (must exist) with 'newPane' (does not exist).
friend class TVSplitter
Definition panespli.h:153
TPaneSplitter(TWindow *parent, LPCTSTR title=0, int splitterWidth=0, TModule *module=0)
Initializes data members.
Definition panespli.cpp:991
TSplitterIndicatorMgr SplitterIndicatorMgr
Definition panespli.h:103
virtual void StartSplitterMove(TSplitter *splitter, const TPoint &point)
void SetSplitterCushion(uint cushion)
Set the cushion for the splitter widget.
Definition panespli.h:178
void DeleteOnClose(TDelete dt=TShouldDelete::Delete)
Definition panespli.h:196
void GetDefLM(TLayoutMetrics &lm)
virtual int RemovePanes()
int PaneCount()
Returns the number of panes in TPaneSplitter.
bool HasPane(TWindow *p)
virtual void DrawSplitter(TDC &dc, const TRect &splitter)
Called by TSplitter when it needs to draw itself.
friend class THSplitter
Definition panespli.h:152
int(*) TForEachPaneCallback(TWindow &, void *)
Definition panespli.h:80
bool RemovePane(TWindow *pane, TDelete dt=TShouldDelete::DefDelete)
Removes given pane from TPaneSplitter, deleting it if requested.
friend class TSplitter
Definition panespli.h:151
void ForEachPane(TForEachPaneCallback callback, void *p)
Iterates over each pane. If 'callback' returns 0, then iteration stops.
virtual bool SplitPane(TWindow *target, TWindow *newPane, TSplitDirection splitDir, float percent=0.50f)
Splits given pane, 'target', with 'newPane', in either the vertical or horizontal direction.
int SetSplitterWidth(int newWidth)
Sets the splitter width and adjusts all splitters. Takes effect immediately.
void SetupWindow() override
Loads cursors and sets TSplitter's pane splitter object.
TSplitterIndicatorList * SplitterIndicatorList
Definition panespli.h:101
bool SwapPanes(TWindow *pane1, TWindow *pane2)
Swaps given panes (must exist). Panes take on each others' layout metrics.
void RemoveAllPanes(TDelete dt=TShouldDelete::DefDelete)
Removes all the panes (and their splitters).
bool DelObj(TDelete dt)
Returns true if the object should be deleted.
Definition panespli.h:186
bool MoveSplitter(TWindow *pane, int dist)
Moves 'pane' a given distance.
TShouldDelete::TDelete TDelete
Definition panespli.h:54
TPoint is a support class, derived from tagPOINT.
Definition geometry.h:87
TRect is a mathematical class derived from tagRect.
Definition geometry.h:308
The tagSIZE struct is defined as.
Definition geometry.h:234
Abstract base class for TVSplitter and THSplitter.
Definition splitter.h:44
Handles the moving of the indicators.
Definition splitter.h:234
TWindow, derived from TEventHandler and TStreamableBase, provides window-specific behavior and encaps...
Definition window.h:414
Object Windows Library (OWLNext Core).
Definition animctrl.h:22
TSplitDirection
Enumeration describing whether to split a window in the X or Y plane.
Definition splitter.h:30
std::string tstring
Definition defs.h:79
unsigned int uint
Definition number.h:25
#define _OWLCLASS
Definition defs.h:338
Definition of helper classes for Pane Splitters.