28#define SPLITTER(x) TYPESAFE_DOWNCAST(x,TSplitter)
29#define LAYOUTWINDOW(x) TYPESAFE_DOWNCAST(x,TLayoutWindow)
33#if !defined(BI_COMP_GNUC)
44#if !defined(BI_COMP_GNUC)
69 Attr.Style &= ~WS_BORDER;
70 Attr.Style |= WS_CLIPCHILDREN;
81 PaneSplitter->StartSplitterMove(
this, p);
93 PaneSplitter->MouseMoved(p);
105 PaneSplitter->EndSplitterMove(p);
119 if (hWndCursor ==
GetHandle() && codeHitTest == HTCLIENT) {
121 PaneSplitter->SetSplitterMoveCursor(
this, p);
136 PaneSplitter->DrawSplitter(dc,
GetRect());
147 if (sizeType != SIZE_MINIMIZED && PaneSplitter->PaneSplitterResizing)
187 if (parentSplitter) {
213 PaneSplitter->GetDefLM(lmOfOtherPane);
221 PaneSplitter->DestroyPane(pane, dt);
250 rect.right = rect.left + PaneSplitter->GetSplitterWidth();
274 splitter =
new THSplitter(
this, PaneSplitter, percent);
276 splitter =
new TVSplitter(
this, PaneSplitter, percent);
283 if (p1 == targetPane) {
294 lmOfSplitter.
X.
RightOf(p1, PaneSplitter->GetSplitterWidth());
310 PaneSplitter->GetDefLM(lmOfSplitter);
311 lmOfPane1 = lmOfPane2 = lmOfSplitter;
317 lmOfPane2.
X.
RightOf(targetPane, PaneSplitter->GetSplitterWidth());
318 SetupEpilog(
this, targetPane, newPane, lmOfPane1, lmOfPane2);
395 PercentOf =
static_cast<float>(lm.
Width.Value) /
static_cast<float>(Attr.W);
457 rect.bottom = rect.top + PaneSplitter->GetSplitterWidth();
480 splitter =
new THSplitter(
this, PaneSplitter, percent);
482 splitter =
new TVSplitter(
this, PaneSplitter, percent);
489 if (p1 == targetPane) {
500 lmOfSplitter.
Y.
Below(p1, PaneSplitter->GetSplitterWidth());
516 PaneSplitter->GetDefLM(lmOfSplitter);
517 lmOfPane1 = lmOfPane2 = lmOfSplitter;
523 lmOfPane2.
Y.
Below(targetPane, PaneSplitter->GetSplitterWidth());
524 SetupEpilog(
this, targetPane, newPane, lmOfPane1, lmOfPane2);
602 PercentOf = (float)lm.
Height.Value / (
float)Attr.H;
669 if (rect.top > bottom)
671 else if (rect.top < top)
685 int splitterWidth = right - left;
687 left = orig.left + dist;
688 right = left + splitterWidth;
690 bottom = orig.bottom;
710 if (left < moveArea.left) {
711 left = moveArea.left;
712 right = left + splitterWidth;
715 right = moveArea.right;
716 left = right - splitterWidth;
729 return cur.x - start.x;
741 int splitterWidth = right - left;
743 r.top -= splitterWidth;
744 r.bottom += splitterWidth;
760 if (r1.left < r2.left) {
762 area.right = r2.right;
766 area.right = r1.right;
785 if (rect.left > right)
787 else if (rect.left < left)
801 int splitterWidth = bottom - top;
803 top = orig.top + dist;
804 bottom = top + splitterWidth;
825 if (top < moveArea.top) {
827 bottom = top + splitterWidth;
830 bottom = moveArea.bottom;
831 top = bottom - splitterWidth;
844 return cur.y - start.y;
856 int splitterWidth = bottom - top;
858 r.left -= splitterWidth;
859 r.right += splitterWidth;
876 if (r1.top < r2.top) {
878 area.bottom = r2.bottom;
882 area.bottom = r1.bottom;
916 SplitterIndicatorList = &sil;
917 StartDragPoint = point;
959TSplitterIndicatorMgr::DrawIndicators()
961 if( !SplitterIndicatorList )
971TSplitterIndicatorMgr::ClearIndicators()
973 if( !SplitterIndicatorList )
976 ((TSplitterIndicator*)*iter)->Clear();
998 SplitterWidth(splitterWidth),
1000 PaneSplitterResizing(false),
1003 Attr.Style |= WS_CLIPCHILDREN;
1022 SplitterWidth(splitterWidth),
1024 PaneSplitterResizing(false),
1027 Attr.Style |= WS_CLIPCHILDREN;
1053#if defined(USE_CUSTOM_CURSORS)
1072#if defined(USE_CUSTOM_CURSORS)
1073 ::DestroyCursor(ResizeCursorH);
1074 ::DestroyCursor(ResizeCursorV);
1075 ::DestroyCursor(ResizeCursorHV);
1088 PaneSplitterResizing =
true;
1090 PaneSplitterResizing =
false;
1131 if (parentSplitter ==
this) {
1145 SPLITTER(parentSplitter)->Split(target, newPane, splitDir, percent);
1147 parentSplitter->
Layout();
1162 PaneSplitterResizing =
true;
1164 PaneSplitterResizing =
false;
1189 pane1 =
SPLITTER(splitter)->Pane1();
1190 pane2 =
SPLITTER(splitter)->Pane2();
1194 if (pane1 == target && pane2) {
1196 if (lmOfOther.
X.
RelWin == target)
1206 DestroyPane(target, dt);
1225 if (splitter1 != splitter2) {
1235 if (paneA == pane1) {
1238 if (lmOfOther.
X.
RelWin == pane1)
1245 paneA = splitter2->
Pane1();
1246 paneB = splitter2->
Pane2();
1247 if (paneA == pane2) {
1250 if (lmOfOther.
X.
RelWin == pane2)
1271 if (lmOfPane1.
X.
RelWin == pane2)
1273 else if (lmOfPane2.
X.
RelWin == pane1)
1275 else if (lmOfPane1.
Y.
RelWin == pane2)
1294 ForEachObject(
GetFirstChild(), &TPaneSplitter::DoForEachPane,
1295 (
void*)callback, p);
1306 ForEachObject(
GetFirstChild(), &TPaneSplitter::DoPaneCount, &nPanes,
nullptr);
1321 ForEachObject(
GetFirstChild(), &TPaneSplitter::GetPanes, &wList,
nullptr);
1327 if (!(*wListIter)->CanClose())
1344 int oldWidth = SplitterWidth;
1345 int widthDiff = newWidth - SplitterWidth;
1347 SplitterWidth = newWidth;
1348 ForEachObject(
GetFirstChild(), &TPaneSplitter::AdjSplitterWidth, &widthDiff,
1387TPaneSplitter::MouseMoved(
const TPoint& point)
1411TPaneSplitter::EndSplitterMove(
const TPoint& )
1429TPaneSplitter::SetSplitterMoveCursor(
TSplitter* splitter,
const TPoint& point)
1432 FindIntersectingSplitters(point);
1439 ::SetCursor(ResizeCursorV);
1445struct TTraversalRec {
1446 TTraversalRec() : Cnt(0), Object(nullptr) {}
1447 TTraversalRec(TWindow* o) : Cnt(0), Object(o) {}
1448 TTraversalRec(
const TTraversalRec& r) : Cnt(r.Cnt), Object(r.Object) {}
1450 int operator == (
const TTraversalRec& r)
const {
return Object == r.Object; }
1451 int operator < (
const TTraversalRec& r)
const {
return Object < r.Object; }
1452 TTraversalRec& operator = (
const TTraversalRec& r);
1459TTraversalRec::operator = (
const TTraversalRec& r)
1461 Cnt = r.Cnt; Object = r.Object;
1471TPaneSplitter::ForEachObject(
TWindow* o, TForEachObjectCallback callback,
1472 void* p1,
void* p2, TTraversalOrder order)
1477 TBaseList<TTraversalRec> tStack;
1482 tStack.Push(TTraversalRec(o));
1484 trec = tStack.Pop();
1488 if ((order == psPreOrder && trec.Cnt == 1) ||
1489 (order == psInOrder && trec.Cnt == 2) ||
1490 (order == psPostOrder && trec.Cnt == 3))
1491 done = !(this->*callback)(trec.Object, p1, p2);
1494 if (trec.Cnt != 3) {
1495 tStack.Push(TTraversalRec(trec));
1496 if (trec.Cnt == 1 &&
SPLITTER(trec.Object))
1497 tStack.Push(TTraversalRec(
SPLITTER(trec.Object)->Pane1()));
1498 else if (trec.Cnt == 2 &&
SPLITTER(trec.Object) &&
1500 tStack.Push(TTraversalRec(
SPLITTER(trec.Object)->Pane2()));
1502 done = tStack.Empty();
1554 DestroyPane(pane, dt);
1563TPaneSplitter::FindIntersectingSplitters(
const TPoint& point)
1568 ForEachObject(
GetFirstChild(), &TPaneSplitter::DoFindIntersectingSplitters,
1581 int nPanesNotRemoved = 0;
1586 if(!tempList.
Find(si)){
1589 ForEachObject(
GetFirstChild(), &TPaneSplitter::GetListOfPanesToRemove,
1612 return nPanesNotRemoved;
1632TPaneSplitter::DestroyPane(
TWindow* pane, TDelete dt)
1649TPaneSplitter::DoForEachPane(TWindow* o,
void *p1,
void*p2)
1660TPaneSplitter::DoFindIntersectingSplitters(
TWindow* o,
void *p1,
void*p2)
1664 TSplitterIndicator* i = splitter->CreateSplitterIndicator();
1665 i->SetCushion( SplitterCushion );
1666 if (i->CouldContain(*(TPoint*)p2))
1667 ((TSplitterIndicatorList*)p1)->PushBack(i);
1678TPaneSplitter::GetListOfPanesToRemove(
TWindow* o,
void *p1,
void*p2)
1681 TRect r = o->GetWindowRect();
1682 if ((*(TRect*)p2).Contains(r))
1683 ((TBaseList<TWindow*>*)p1)->PushBack(o);
1692TPaneSplitter::AdjSplitterWidth(
TWindow* o,
void *p1,
void*)
1697 splitter->AdjSplitterWidth(*(
int *)p1);
1705TPaneSplitter::DoPaneCount(
TWindow* o,
void *p1,
void*)
1716TPaneSplitter::GetPanes(
TWindow* o,
void *p1,
void*)
1719 ((TBaseList<TWindow*>*)p1)->PushBack(o);
1727TPaneSplitter::GetSplitters(
TWindow* o,
void* p1,
void*)
1730 ((TBaseList<TWindow*>*)p1)->PushBack(o);
#define PRECONDITION(condition)
bool DetachItem(const T &t)
TBaseNode< T > * Find(const T &t) const
TBaseListIterator< T > Iterator
void PushBack(const T &data)
static const TColor Sys3dFace
The symbolic system color value for the face color of 3-dimensional display elements.
TDC is the root class for GDI DC wrappers.
bool TextRect(int x1, int y1, int x2, int y2)
Fills the given rectangle, clipping any text to the rectangle.
TSplitterIndicator * CreateSplitterIndicator()
TSplitDirection SplitDirection()
TLayoutMetrics Setup(TWindow *targetPane, TWindow *newPane, float percent)
void AdjSplitterWidth(int w)
void AdjForResize(const TSize &sz)
void Split(TWindow *targetPane, TWindow *newPane, TSplitDirection sd, float percent=50.0f)
THSplitter(TWindow *parent, TPaneSplitter *ps, float percent=50.0f)
void ConnectToRect(const TRect &rect)
bool CouldContain(const TPoint &point)
THSplitterIndicator(TSplitter *splitter, const TRect &rect, uint cushion=0)
int CalcDistMoved(const TPoint &start, const TPoint &cur)
TRect CalcAreaOfSplitterMove()
When specifying the layout metrics for a window, four layout constraints are needed.
TEdgeConstraint Y
Y contains the Y (top, center, bottom) edge constraint of the window.
TEdgeOrWidthConstraint Width
Contains the width size constraint, center edge constraint, or right edge (lmRight) constraint of the...
TEdgeOrHeightConstraint Height
Contains the height size constraint, center edge constraint, or bottom edge constraint of the window.
void SetMeasurementUnits(TMeasurementUnits units)
TEdgeConstraint X
X contains the X (left, center, right) edge constraint of the window.
Derived from TWindow, TLayoutWindow provides functionality for defining the layout metrics for a wind...
TLayoutWindow(TWindow *parent, LPCTSTR title=0, TModule *module=0)
Creates a TLayoutWindow object with specified parent, window caption, and library ID.
void EvSize(uint sizeType, const TSize &size)
Responds to a change in size by calling Layout() to resize the window.
virtual void Layout()
Causes the window to resize and position its children according to the specified metrics.
bool GetChildLayoutMetrics(const TWindow &child, TLayoutMetrics &metrics)
Gets the layout metrics of the child window.
void SetChildLayoutMetrics(TWindow &child, const TLayoutMetrics &metrics)
Sets the metrics for the window and removes any existing ones.
bool RemoveChildLayoutMetrics(const TWindow &child)
Removes child (layout) metrics for a given child (if found) and updates other children as necessary.
ObjectWindows dynamic-link libraries (DLLs) construct an instance of TModule, which acts as an object...
TPaneSplitter is a class that acts as a container for child windows (called panes) and splitters (pan...
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...
bool ReplacePane(TWindow *target, TWindow *newPane, TDelete dt=TShouldDelete::DefDelete)
Replaces 'target' pane (must exist) with 'newPane' (does not exist).
TPaneSplitter(TWindow *parent, LPCTSTR title=0, int splitterWidth=0, TModule *module=0)
Initializes data members.
TSplitterIndicatorMgr SplitterIndicatorMgr
virtual void StartSplitterMove(TSplitter *splitter, const TPoint &point)
void GetDefLM(TLayoutMetrics &lm)
virtual int RemovePanes()
int PaneCount()
Returns the number of panes in TPaneSplitter.
virtual void DrawSplitter(TDC &dc, const TRect &splitter)
Called by TSplitter when it needs to draw itself.
int(*) TForEachPaneCallback(TWindow &, void *)
bool RemovePane(TWindow *pane, TDelete dt=TShouldDelete::DefDelete)
Removes given pane from TPaneSplitter, deleting it if requested.
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
~TPaneSplitter() override
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.
bool MoveSplitter(TWindow *pane, int dist)
Moves 'pane' a given distance.
TShouldDelete::TDelete TDelete
TPoint is a support class, derived from tagPOINT.
TRect is a mathematical class derived from tagRect.
int Height() const
Returns the height of this rectangle (bottom - top).
int Width() const
Returns the width of this rectangle (right - left).
bool Contains(const TPoint &point) const
Returns true if the given point lies within this rectangle; otherwise, it returns false.
The tagSIZE struct is defined as.
Abstract base class for TVSplitter and THSplitter.
virtual TRect GetRect()=0
TRect GetScreenRect()
Similar to above except rect is in screen coordinates.
virtual TSplitDirection SplitDirection()=0
virtual void AdjForResize(const TSize &sz)=0
virtual TSplitterIndicator * CreateSplitterIndicator()=0
TRect GetMoveArea()
Return the area the splitter can move in (bounding rectangle).
TLayoutWindow * RemovePane(TWindow *pane, TShouldDelete::DeleteType dt=TShouldDelete::DefDelete)
void EvLButtonUp(uint modKeys, const TPoint &point)
bool EvSetCursor(HWND hwndCursor, uint codeHitTest, TMsgId mouseMsg)
virtual void Move(int dist)=0
virtual TWindow * Pane1()=0
void EvSize(uint sizeType, const TSize &size)
void EvLButtonDown(uint modKeys, const TPoint &point)
virtual TLayoutMetrics Setup(TWindow *targetPane, TWindow *newPane, float percent)=0
void SetupEpilog(TSplitter *s, TWindow *targetPane, TWindow *newPane, TLayoutMetrics &lmOfTargetPane, TLayoutMetrics &lmOfNewPane)
virtual TWindow * Pane2()=0
void Paint(TDC &, bool erase, TRect &) override
TSplitter(TWindow *parent, TPaneSplitter *ps, float percent)
void EvMouseMove(uint modKeys, const TPoint &point)
Indicates to the user where the splitter will be moved to when dragging completes.
TSplitter * GetSplitter()
Return splitter from which this indicator was created.
virtual TRect CalcAreaOfSplitterMove()=0
void SetCushion(const uint cushion)
Set cushion.
virtual void ConnectToRect(const TRect &rect)=0
virtual int CalcDistMoved(const TPoint &start, const TPoint &cur)=0
virtual void Move(int dist)=0
TSplitterIndicator * FindIndicatorWithSplitter(TSplitter *splitter)
uint NSplitterIndicators()
void StartMove(TSplitterIndicatorList &sil, const TPoint &point)
void MoveIndicators(const TPoint &point)
static const TUIMetric CxFixedFrame
void Split(TWindow *targetPane, TWindow *newPane, TSplitDirection sd, float percent=50.0f)
void AdjSplitterWidth(int w)
TLayoutMetrics Setup(TWindow *targetPane, TWindow *newPane, float percent)
TSplitDirection SplitDirection()
TSplitterIndicator * CreateSplitterIndicator()
TVSplitter(TWindow *parent, TPaneSplitter *ps, float percent=50.0f)
void AdjForResize(const TSize &sz)
void ConnectToRect(const TRect &rect)
int CalcDistMoved(const TPoint &start, const TPoint &cur)
TVSplitterIndicator(TSplitter *splitter, const TRect &rect, uint cushion=0)
TRect CalcAreaOfSplitterMove()
bool CouldContain(const TPoint &point)
Derived from TDC, TWindowDC is a device context (DC) class that provides access to the entire area ow...
TWindow, derived from TEventHandler and TStreamableBase, provides window-specific behavior and encaps...
static void GetCursorPos(TPoint &pos)
Retrieves the cursor's current position (in window screen coordinates) and copies the values into the...
bool SetCursor(TModule *module, TResId resId)
Sets the mouse cursor for the window, loading the given resId from the given module.
HWND SetCapture()
Sets the mouse capture to the current window.
virtual void SetParent(TWindow *newParent)
Sets the parent for the specified window by setting Parent to the specified new Parent window object.
virtual void Destroy(int retVal=0)
Destroys an MS-Windows element associated with the TWindow.
virtual bool Create()
Creates the window interface element to be associated with this ObjectWindows interface element.
TWindow * GetParentO() const
Return the OWL's parent for this window.
static void ReleaseCapture()
Releases the mouse capture from this window.
TWindowAttr & GetWindowAttr()
Returns the TWindowAttr structure, which contains the window's creation attributes.
void MapWindowPoints(HWND hWndTo, TPoint *pts, int count) const
Maps a set of points in one window to a relative set of points in another window.
void SetCaption(LPCTSTR title)
Copies title to an allocated string pointed to by title.
virtual void CleanupWindow()
Always called immediately before the HWindow becomes invalid, CleanupWindow gives derived classes an ...
TPoint MapScreenToClient(const TPoint &p) const
Functional-style version of ScreenToClient.
HCURSOR LoadCursor(TResId id) const
virtual bool CanClose()
Use this function to determine if it is okay to close a window.
TWindow * Next()
Returns a pointer to the next sibling window in the window's sibling list.
virtual bool ShowWindow(int cmdShow)
Displays this TWindow in a given state.
virtual void SetupWindow()
Performs setup following creation of an associated MS-Windows window.
virtual void Paint(TDC &dc, bool erase, TRect &rect)
Repaints the client area (the area you can use for drawing) of a window.
uint NumChildren() const
Returns the number of child windows of the window.
bool EvSetCursor(HWND hWndCursor, uint codeHitTest, TMsgId mouseMsg)
Response method for an incoming WM_SETCURSOR message.
TWindow * GetFirstChild()
Returns a pointer to the first child window, which is the first window created in the interface objec...
HWND GetHandle() const
Returns the handle of the window.
Definition of container classes used and made available by OWL.
Definition of GDI DC encapsulation classes: TDC, TWindowDC, TScreenDC, TDesktopDC,...
#define DEFINE_RESPONSE_TABLE1(cls, base)
Macro to define a response table for a class with one base.
#define lmParent
Use to represent the parent in layout metrics.
@ lmTop
The top edge of the window.
@ lmBottom
The bottom edge of the window.
@ lmRight
The right edge of the window.
@ lmLeft
The left edge of the window.
Definition of classes TLayoutMetrics & TLayoutWindow.
Object Windows Library (OWLNext Core).
UINT TMsgId
Message ID type.
TSplitDirection
Enumeration describing whether to split a window in the X or Y plane.
@ psHorizontal
Horizontal split.
TSplitterIndicatorList::Iterator TSplitterIndicatorListIterator
void Below(TWindow *sibling, int margin=0)
Positions your window with respect to a sibling window.
void RightOf(TWindow *sibling, int margin=0)
Positions one window with respect to a sibling window.
void SameAs(TWindow *otherWin, TEdge edge)
Sets the edge of your window indicated by edge equivalent to the corresponding edge of the window in ...
void Set(TEdge edge, TRelationship rel, TWindow *otherWin, TEdge otherEdge, int value=0)
For setting arbitrary edge constraints.
void Absolute(TEdge edge, int value)
void Absolute(TEdge edge, int value)
TWindow * RelWin
RelWin is a pointer to the sibling windows or lmParent if the child is a proportion of the parent's d...
int X
horizontal position of top left corenr of the window
int H
height of the window
int Y
vertical position of top left corenr of the window
Definition of container classes used and made available by OWL.
Definition of the UI Helper Classes: TUIHandle, TUIBorder, TUIFace, TUIPart.
Definition of TUIMetric, a UI metrics provider class.