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)
93 PaneSplitter->MouseMoved(p);
105 PaneSplitter->EndSplitterMove(p);
121 PaneSplitter->SetSplitterMoveCursor(
this, p);
193 pane->SetParent(
nullptr);
197 if (
lm2.X.RelWin ==
this)
199 else if (
lm2.Y.RelWin ==
this)
215 pane->SetParent(
nullptr);
221 PaneSplitter->DestroyPane(
pane,
dt);
248 rect.left =
p1->GetWindowAttr().X +
p1->GetWindowAttr().W;
249 rect.top =
p1->GetWindowAttr().Y;
250 rect.right =
rect.left + PaneSplitter->GetSplitterWidth();
251 rect.bottom =
p1->GetWindowAttr().Y +
p1->GetWindowAttr().H;
342 return p1->GetWindowAttr().X <=
p2->GetWindowAttr().X ?
p1 :
p2;
359 return p1->GetWindowAttr().X >
p2->GetWindowAttr().X ?
p1 :
p2;
390 lm.Width.Absolute(
lm.Width.Value +
dist);
395 PercentOf =
static_cast<float>(
lm.Width.Value) /
static_cast<float>(Attr.W);
405 lm.Width.Absolute(
lm.Width.Value -
dist);
406 splitter->SetPercent(
static_cast<float>(
lm.Width.Value) /
407 static_cast<float>(
splitter->GetWindowAttr().W -
dist));
454 rect.left =
p1->GetWindowAttr().X;
455 rect.top =
p1->GetWindowAttr().Y +
p1->GetWindowAttr().H;
456 rect.right =
p1->GetWindowAttr().X +
p1->GetWindowAttr().W;
457 rect.bottom =
rect.top + PaneSplitter->GetSplitterWidth();
549 return p1->GetWindowAttr().Y <=
p2->GetWindowAttr().Y ?
p1 :
p2;
566 return p1->GetWindowAttr().Y >
p2->GetWindowAttr().Y ?
p1 :
p2;
597 lm.Height.Absolute(
lm.Height.Value +
dist);
602 PercentOf = (
float)
lm.Height.Value / (
float)Attr.H;
612 lm.Height.Absolute(
lm.Height.Value -
dist);
669 if (
rect.top > bottom)
671 else if (
rect.top < top)
690 bottom =
orig.bottom;
729 return cur.x -
start.x;
760 if (
r1.left <
r2.left) {
785 if (
rect.left > right)
787 else if (
rect.left < left)
844 return cur.y -
start.y;
876 if (
r1.top <
r2.top) {
916 SplitterIndicatorList = &
sil;
917 StartDragPoint =
point;
945 int dist =
si->CalcDistMoved(StartDragPoint,
point);
959TSplitterIndicatorMgr::DrawIndicators()
961 if( !SplitterIndicatorList )
971TSplitterIndicatorMgr::ClearIndicators()
973 if( !SplitterIndicatorList )
976 ((TSplitterIndicator*)*
iter)->Clear();
1000 PaneSplitterResizing(
false),
1024 PaneSplitterResizing(
false),
1053#if defined(USE_CUSTOM_CURSORS)
1072#if defined(USE_CUSTOM_CURSORS)
1088 PaneSplitterResizing =
true;
1090 PaneSplitterResizing =
false;
1162 PaneSplitterResizing =
true;
1164 PaneSplitterResizing =
false;
1181 if (
target->CanClose()) {
1237 pane1->SetParent(
nullptr);
1249 pane2->SetParent(0);
1294 ForEachObject(
GetFirstChild(), &TPaneSplitter::DoForEachPane,
1327 if (!(*wListIter)->CanClose())
1366 si->SetCushion( SplitterCushion );
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)
1482 tStack.Push(TTraversalRec(
o));
1488 if ((
order == psPreOrder &&
trec.Cnt == 1) ||
1489 (
order == psInOrder &&
trec.Cnt == 2) ||
1490 (
order == psPostOrder &&
trec.Cnt == 3))
1494 if (
trec.Cnt != 3) {
1563TPaneSplitter::FindIntersectingSplitters(
const TPoint&
point)
1568 ForEachObject(
GetFirstChild(), &TPaneSplitter::DoFindIntersectingSplitters,
1589 ForEachObject(
GetFirstChild(), &TPaneSplitter::GetListOfPanesToRemove,
1623 si->GetSplitter()->Move(
si->GetDistMoved());
1624 si->GetSplitter()->Layout();
1635 pane->SetParent(
nullptr);
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))
1692TPaneSplitter::AdjSplitterWidth(TWindow*
o,
void *
p1,
void*)
1705TPaneSplitter::DoPaneCount(TWindow*
o,
void *
p1,
void*)
1716TPaneSplitter::GetPanes(TWindow*
o,
void *
p1,
void*)
1727TPaneSplitter::GetSplitters(TWindow*
o,
void*
p1,
void*)
#define PRECONDITION(condition)
bool DetachItem(const T &t)
DetachItem( detach item and delete it.
void Flush()
Flush all items.
void PushBack(const T &data)
add new item at end of list
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.
Represents a horizontal splitter.
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)
int CalcDistMoved(const TPoint &start, const TPoint &cur)
TRect CalcAreaOfSplitterMove()
When specifying the layout metrics for a window, four layout constraints are needed.
Derived from TWindow, TLayoutWindow provides functionality for defining the layout metrics for a wind...
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.
int(* TForEachPaneCallback)(TWindow &, void *)
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.
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.
TPoint is a support class, derived from tagPOINT.
TRect is a mathematical class derived from tagRect.
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 void AdjForResize(const TSize &sz)=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 TWindow * Pane1()=0
void EvSize(uint sizeType, const TSize &size)
void EvLButtonDown(uint modKeys, const TPoint &point)
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.
TSplitterIndicator * FindIndicatorWithSplitter(TSplitter *splitter)
uint NSplitterIndicators()
void StartMove(TSplitterIndicatorList &sil, const TPoint &point)
void MoveIndicators(const TPoint &point)
static const TUIMetric CxFixedFrame
Represents a vertical splitter.
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)
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 TPoint GetCursorPos()
bool SetCursor(TModule *module, TResId resId)
Sets the mouse cursor for the window, loading the given resId from the given module.
TWindow * GetParentO() const
Return the OWL's parent for this window.
static void ReleaseCapture()
Releases the mouse capture from this window.
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 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
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.