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);
73 bool RemovePane(TWindow* pane, TDelete dt = TShouldDelete::DefDelete);
74 bool ReplacePane(TWindow* target, TWindow* newPane,
75 TDelete dt = TShouldDelete::DefDelete);
76 bool SwapPanes(TWindow* pane1, TWindow* pane2);
77 int PaneCount();
78 void RemoveAllPanes(TDelete dt = TShouldDelete::DefDelete);
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);
91 void DeleteOnClose(TDelete dt=TShouldDelete::Delete);
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
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
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
Represents a horizontal splitter.
Definition splitter.h:123
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
ObjectWindows dynamic-link libraries (DLLs) construct an instance of TModule, which acts as an object...
Definition module.h:75
TPaneSplitter is a class that acts as a container for child windows (called panes) and splitters (pan...
Definition panespli.h:52
int GetSplitterWidth()
Returns the width of the splitter widget.
Definition panespli.h:169
TSplitterIndicatorMgr SplitterIndicatorMgr
Definition panespli.h:103
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
TSplitterIndicatorList * SplitterIndicatorList
Definition panespli.h:101
bool DelObj(TDelete dt)
Returns true if the object should be deleted.
Definition panespli.h:186
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
Represents a vertical splitter.
Definition splitter.h:99
TWindow, derived from TEventHandler and TStreamableBase, provides window-specific behavior and encaps...
Definition window.h:414
#define DECLARE_RESPONSE_TABLE(cls)
Definition eventhan.h:436
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.