OWLNext    7.0
Borland's Object Windows Library for the modern age
Loading...
Searching...
No Matches
scroller.cpp
Go to the documentation of this file.
1//----------------------------------------------------------------------------
2// ObjectWindows
3// Copyright (c) 1991, 1996 by Borland International, All Rights Reserved
4//
5/// \file
6/// Implementation of class TScroller.
7/// Including bug fixes by Rich Goldstein
8//----------------------------------------------------------------------------
9#include <owl/pch.h>
10#include <owl/scroller.h>
11#include <owl/window.h>
12#include <owl/dc.h>
13#include <stdlib.h>
14
15#include <algorithm>
16
17namespace owl {
18
20
21namespace
22{
23
24//
25// Guards the scroll bar synchronization of a scroller against re-entry [bugs:#623].
26// Showing or hiding a scroll bar changes the client area, and Windows then sends WM_SIZE
27// synchronously, from within SetScrollInfo. The resulting nested calls to SetPageSize and
28// SetSBarRange must be ignored, since the outer call will take the new client area into account.
29//
30// The state is kept in a window property, rather than in the scroller, to keep the class layout
31// unchanged (ABI compatibility). Since a window belongs to a single thread, this is thread-safe.
32//
33const TCHAR SyncPropertyName[] = _T("OWL_TScroller_SyncScrollBars");
34
35auto IsSyncing(const TWindow& w) -> bool
36{
37 return ::GetProp(w.GetHandle(), SyncPropertyName) != nullptr;
38}
39
40class TSyncGuard
41{
42public:
43 explicit TSyncGuard(const TWindow& w)
44 : Window(w.GetHandle()), Entered(!::GetProp(Window, SyncPropertyName))
45 {
46 if (Entered) ::SetProp(Window, SyncPropertyName, reinterpret_cast<HANDLE>(1));
47 }
48
49 ~TSyncGuard()
50 {
51 if (Entered) ::RemoveProp(Window, SyncPropertyName);
52 }
53
54 auto IsReentry() const -> bool { return !Entered; }
55
56private:
57 HWND Window;
58 bool Entered;
59
60 TSyncGuard(const TSyncGuard&); // Not implemented.
61 TSyncGuard& operator =(const TSyncGuard&); // Not implemented.
62};
63
64//
65// Page and scroll bar properties for one direction.
66//
67struct TBarMetrics
68{
69 int Page; ///< Scroller page (TScroller::XPage or YPage), in scroll units.
70 int ScrollPage; ///< Scroll bar page (SCROLLINFO::nPage).
71 int ScrollMax; ///< Scroll bar range maximum (SCROLLINFO::nMax); the minimum is always zero.
72
73 //
74 // Returns true if the scroll bar is needed, i.e. if the page does not cover the whole range.
75 //
76 auto IsScrollable() const -> bool { return ScrollMax > 0 && ScrollPage <= ScrollMax; }
77};
78
79//
80// Calculates the page properties for the given client extent (in device units).
81// If the extent or the unit is not positive, the given fallback page values are used.
82//
83// The page is the number of units that are fully visible. Previously, the page was one unit less
84// than that (in most cases), so that a scroll bar was shown, and could be scrolled, one unit before
85// the content exceeded the client area [bugs:#623].
86//
87auto CalculateBarMetrics(int extent, int unit, long range, long totalUnits, int scrollMax, int page, int scrollPage) -> TBarMetrics
88{
89 if (extent > 0 && unit > 0)
90 {
91 page = std::max(1, extent / unit);
92 scrollPage = (totalUnits && totalUnits > extent) ?
93 static_cast<int>(static_cast<long long>(extent) * range / totalUnits) :
94 page;
95 }
96 const TBarMetrics m = {page, scrollPage, scrollMax};
97 return m;
98}
99
100auto CalculateScrollMax(long range) -> int
101{
102 return static_cast<int>(std::max(0L, std::min(range - 1, static_cast<long>(INT_MAX))));
103}
104
105} // namespace
106
107//
108/// Constructs a TScroller object with window as the owner window, and xUnit, yUnit,
109/// xRange, and yRange as xUnit, yUnit, xRange and yRange, respectively. Initializes
110/// data members to default values. HasHScrollBar and HasVScrollBar are set
111/// according to the scroll bar attributes of the owner window.
112//
114 int xUnit,
115 int yUnit,
116 long xRange,
117 long yRange)
118{
119 Window = window;
120 XPos = YPos = 0;
121 XUnit = xUnit;
122 YUnit = yUnit;
123 XRange = xRange;
124 YRange = yRange;
125 XTotalUnits = 0;
126 YTotalUnits = 0;
127 XLine = 1; YLine = 1;
128 XPage = 1; YPage = 1;
129 AutoMode = true;
130 TrackMode = true;
131 AutoOrg = true;
132 HasHScrollBar = ToBool(Window && (Window->GetWindowAttr().Style&WS_HSCROLL));
133 HasVScrollBar = ToBool(Window && (Window->GetWindowAttr().Style&WS_VSCROLL));
134}
135
136//
137/// Destructs a TScroller object. Sets owning window's Scroller number variable to 0.
138//
140{
141 if (Window && Window->GetScroller() == this)
143}
144
145//
146/// Sets the XPage and YPage data members (amount by which to scroll on a page
147/// scroll request) to the width and height (in XUnits and
148/// YUnits) of the owner window's client area.
149///
150/// The client area used is the one that results after the scroll bars have been
151/// shown or hidden as needed, and the scroll bars are updated accordingly (see
152/// SetSBarRange). The scroll position is then clamped to the new page size.
153//
154void
156{
159
160 if (Window && Window->GetHandle()) {
161 if (IsSyncing(*Window)) return; // Nested call; see TSyncGuard.
162
163 // Call the base implementation explicitly, since an override of SetSBarRange may only update
164 // the ranges, while the page sizes and scroll bar visibility must be updated here.
165 //
168 }
169}
170
171//
172/// Sets the xRange and yRange of the TScroller to the parameters specified. Then
173/// calls SetSBarRange to synchronize the range of the owner window's scroll bars.
174//
175void
176TScroller::SetRange(long xRange, long yRange)
177{
178 XRange = xRange;
179 YRange = yRange;
180 SetSBarRange();
182}
183
184//
185// Sets the total units of the window
186//
187void
188TScroller::SetTotalRangeOfUnits(long xTotalUnits, long yTotalUnits)
189{
190 XTotalUnits = xTotalUnits;
191 YTotalUnits = yTotalUnits;
192 SetSBarRange();
194}
195
196//
197/// Sets the XUnit and YUnit data members to TheXUnit and TheYUnit, respectively.
198/// Updates XPage and YPage by calling SetPageSize.
199//
200void
201TScroller::SetUnits(int xUnit, int yUnit)
202{
203 XUnit = xUnit;
204 YUnit = yUnit;
205 SetPageSize();
206}
207
208//
209/// Sets the range of the owner window's scroll bars to match the range of the
210/// TScroller and repaints as necessary.
211///
212/// The page sizes and the visibility of the scroll bars are updated as well, since showing or
213/// hiding a scroll bar changes the client area of the window [bugs:#623]:
214///
215/// - The visibility of both scroll bars is decided up front, based on the client area without
216/// any of the scroller's scroll bars, accounting for the space each scroll bar takes from the
217/// other direction. The page sizes are then calculated for the resulting client area.
218/// - A scroll bar that is not needed is hidden by an empty range. Windows clamps the stored page
219/// to the size of the range, so with the actual range, the page stored for a hidden scroll bar
220/// is just large enough to hide it, and any increase of the range would show the scroll bar
221/// before the new page could be applied, making it flash. Hence, the need for a scroll bar is
222/// decided from XRange and YRange, never from the range stored in the scroll bar.
223/// - For a visible scroll bar, range and page are applied in an order that keeps it visible.
224/// - If the client area still changed, e.g. due to inaccurate scroll bar metrics, the process is
225/// repeated (at most three passes).
226//
227void
229{
232
233 if (!Window || !Window->GetHandle()) return;
234 const TSyncGuard guard(*Window);
235 if (guard.IsReentry()) return;
236
237 const auto isShown = [&](uint32 style) { return (Window->GetStyle() & style) != 0; };
238 const auto apply = [&](int bar, const TBarMetrics& m)
239 {
240 int curMin, curMax;
241 GetScrollRange(bar, curMin, curMax);
242 if (!m.IsScrollable())
243 {
244 // Hide the scroll bar by an empty range (see above). The page is irrelevant.
245 //
246 if (curMin != 0 || curMax != 0)
247 SetScrollRange(bar, 0, 0, true);
248 return;
249 }
250
251 // Keep the scroll bar visible in between: Apply the range first, unless the current page
252 // does not fit within the new range, in which case the new page is applied first.
253 //
254 const auto curPage = GetScrollPage(bar);
255 const auto rangeChanged = curMin != 0 || curMax != m.ScrollMax;
256 const auto pageChanged = curPage != m.ScrollPage;
257 const auto rangeFirst = curPage <= m.ScrollMax;
258 if (rangeChanged && rangeFirst)
259 SetScrollRange(bar, 0, m.ScrollMax, true);
260 if (pageChanged)
261 SetScrollPage(bar, m.ScrollPage, true);
262 if (rangeChanged && !rangeFirst)
263 SetScrollRange(bar, 0, m.ScrollMax, true);
264 };
265
266 const auto xMax = HasHScrollBar ? CalculateScrollMax(XRange) : 0;
267 const auto yMax = HasVScrollBar ? CalculateScrollMax(YRange) : 0;
268 const auto maxPassCount = 3;
269 auto pass = 0;
270 for (; pass != maxPassCount; ++pass)
271 {
272 const auto client = Window->GetClientRect().Size();
273 const auto hShown = HasHScrollBar && isShown(WS_HSCROLL);
274 const auto vShown = HasVScrollBar && isShown(WS_VSCROLL);
275 const auto barHeight = ::GetSystemMetrics(SM_CYHSCROLL);
276 const auto barWidth = ::GetSystemMetrics(SM_CXVSCROLL);
277 const auto full = TSize(client.cx + (vShown ? barWidth : 0), client.cy + (hShown ? barHeight : 0));
278 TBarMetrics h, v;
279 const auto calculate = [&](bool needH, bool needV)
280 {
281 // If the visibility is unchanged, use the actual client area, rather than relying on metrics.
282 //
283 const auto unchanged = needH == hShown && needV == vShown;
284 const auto width = unchanged ? client.cx : full.cx - (needV ? barWidth : 0);
285 const auto height = unchanged ? client.cy : full.cy - (needH ? barHeight : 0);
286 h = CalculateBarMetrics(width, XUnit, XRange, XTotalUnits, xMax, XPage, XPage);
287 v = CalculateBarMetrics(height, YUnit, YRange, YTotalUnits, yMax, YPage, YPage);
288 };
289
290 // Determine which scroll bars are needed. Since a scroll bar only reduces the space available
291 // in the other direction, the need for a scroll bar can only arise, never go away, as we
292 // iterate. Hence this loop terminates after at most three iterations.
293 //
294 auto needH = false;
295 auto needV = false;
296 calculate(needH, needV);
297 for (;;)
298 {
299 const auto nh = needH || (HasHScrollBar && h.IsScrollable());
300 const auto nv = needV || (HasVScrollBar && v.IsScrollable());
301 if (nh == needH && nv == needV) break;
302 needH = nh;
303 needV = nv;
304 calculate(needH, needV);
305 }
306
307 XPage = h.Page;
308 YPage = v.Page;
309 if (HasHScrollBar) apply(SB_HORZ, h);
310 if (HasVScrollBar) apply(SB_VERT, v);
311
312 if (Window->GetClientRect().Size() == client) break;
313 }
314 WARN(pass == maxPassCount, _T("TScroller::SetSBarRange: Scroll bar layout did not settle."));
315}
316
317//
318/// If TScroller_AutoOrg is true (default condition), BeginView automatically
319/// offsets the origin of the logical coordinates of the client area by XPos, YPos
320/// during a paint operation. If AutoOrg is false (for example, when the scroller is
321/// larger than 32,767 units), you must set the offset manually.
322//
323void
325{
326 long xOrg = XPos * XUnit;
327 long yOrg = YPos * YUnit;
328
329 if (AutoOrg && xOrg <= INT_MAX && yOrg <= INT_MAX) {
330 TPoint offset(int(-xOrg), int(-yOrg));
331 dc.SetViewportOrg(offset);
332 rect -= offset;
333 }
334}
335
336//
337/// Updates the position of the owner window's scroll bars to be coordinated with
338/// the position of the TScroller.
339//
340void
342{
343 if (Window) {
344 if (HasHScrollBar) {
345 int newPos = XPos;
346 if (newPos != GetScrollPos(SB_HORZ))
347 SetScrollPos(SB_HORZ, newPos, true);
348 }
349
350 if (HasVScrollBar) {
351 int newPos = YPos;
352 if (newPos != GetScrollPos(SB_VERT))
353 SetScrollPos(SB_VERT, newPos, true);
354 }
355 }
356}
357
358//
359/// Responds to the specified vertical scrollEvent by calling ScrollBy or ScrollTo.
360/// The type of scroll event is identified by the corresponding SB_ constants.
361/// The 16-bit thumbPos argument is ignored. The function retrieves the 32-bit value
362/// directly from the scroll bar instead.
363//
364void
365TScroller::VScroll(uint scrollEvent, int)
366{
367 switch (scrollEvent) {
368 case SB_LINEDOWN:
369 ScrollBy(0, YLine);
370 break;
371
372 case SB_LINEUP:
373 ScrollBy(0, -YLine);
374 break;
375
376 case SB_PAGEDOWN:
377 ScrollBy(0, YPage);
378 break;
379
380 case SB_PAGEUP:
381 ScrollBy(0, -YPage);
382 break;
383
384 case SB_TOP:
385 ScrollTo(XPos, 0);
386 break;
387
388 case SB_BOTTOM:
390 break;
391
392 case SB_THUMBPOSITION:
394 break;
395
396 case SB_THUMBTRACK:
397 {
398 int thumbPos32 = GetScrollTrackPos(SB_VERT);
399 if (TrackMode)
400 ScrollTo(XPos, thumbPos32);
401 if (Window && HasVScrollBar)
402 SetScrollPos(SB_VERT, thumbPos32, true);
403 break;
404 }
405 }
406}
407
408//
409/// Responds to the specified horizontal scrollEvent by calling ScrollBy or ScrollTo.
410/// The type of scroll event is identified by the corresponding SB_ constants.
411/// The 16-bit thumbPos argument is ignored. The function retrieves the 32-bit value
412/// directly from the scroll bar instead.
413//
414void
415TScroller::HScroll(uint scrollEvent, int)
416{
417 switch (scrollEvent) {
418 case SB_LINEDOWN:
419 ScrollBy(XLine, 0);
420 break;
421
422 case SB_LINEUP:
423 ScrollBy(-XLine, 0);
424 break;
425
426 case SB_PAGEDOWN:
427 ScrollBy(XPage, 0);
428 break;
429
430 case SB_PAGEUP:
431 ScrollBy(-XPage, 0);
432 break;
433
434 case SB_TOP:
435 ScrollTo(0, YPos);
436 break;
437
438 case SB_BOTTOM:
440 break;
441
442 case SB_THUMBPOSITION:
444 break;
445
446 case SB_THUMBTRACK:
447 {
448 int thumbPos32 = GetScrollTrackPos(SB_HORZ);
449 if (TrackMode)
450 ScrollTo(thumbPos32, YPos);
451 if (Window && HasHScrollBar)
452 SetScrollPos(SB_HORZ, thumbPos32, true);
453 break;
454 }
455 }
456}
457
458//
459/// Scrolls the rectangle to the position specified in x and y after checking boundary conditions.
460/// Causes a WM_PAINT message to be sent
461///
462/// First scrolls the contents of the client area, if a portion of the client
463/// area will remain visible
464//
465void
466TScroller::ScrollTo(long x, long y)
467{
470
471 if (Window && Window->GetHandle()) {
472 long newXPos = std::max(0L, std::min(x, long(XRange - XPage)));
473 long newYPos = std::max(0L, std::min(y, long(YRange - YPage)));
474
475 if (newXPos != XPos || newYPos != YPos) {
476 //
477 // scaling isn't needed here. if condition is met, ScrollWindow()
478 // will succeed since XPage and YPage are ints
479 //
480 // if condition isn't met, ScrollWindow() is called in EndScroll()
481 // as a result of calling UpdateWindow()
482 //
483 // EndScroll() performs the necessary scaling
484 //
485 if (AutoOrg || (abs(YPos-newYPos) < YPage && abs(XPos-newXPos) < XPage))
486 Window->ScrollWindow(static_cast<int>(XPos - newXPos) * XUnit,
487 static_cast<int>(YPos - newYPos) * YUnit, nullptr, nullptr);
488
489 else
491
492 XPos = newXPos;
493 YPos = newYPos;
495 }
496 }
497}
498
499//
500/// IsAutoMode is true if automatic scrolling is activated.
501//
502bool
504{
505 return AutoMode;
506}
507
508//
509/// Performs "auto-scrolling" (dragging the mouse from within the client
510/// client area of the Window to without results in auto-scrolling when
511/// the AutoMode data member of the Scroller is true)
512///
513/// Scrolls the owner window's display in response to the mouse being dragged from
514/// inside to outside the window. The direction and the amount by which the display
515/// is scrolled depend on the current position of the mouse.
516//
517void
519{
522
523 if (AutoMode && Window) {
524 TRect clientRect;
525 TPoint cursorPos;
526 long dx = 0, dy = 0;
527
528 GetCursorPos(&cursorPos);
529 Window->ScreenToClient(cursorPos);
530 Window->GetClientRect(clientRect);
531
532 if (cursorPos.y < 0)
533 dy = std::min(static_cast<long>(-YLine), std::max(static_cast<long>(-YPage), long(cursorPos.y / 10 * YLine)));
534
535 else if (cursorPos.y > clientRect.bottom)
536 dy = std::max(static_cast<long>(YLine), std::min(static_cast<long>(YPage), long((cursorPos.y-clientRect.bottom)/10 * YLine)));
537
538 if (cursorPos.x < 0)
539 dx = std::min(static_cast<long>(-XLine), std::max(static_cast<long>(-XPage), long(cursorPos.x / 10 * XLine)));
540
541 else if (cursorPos.x > clientRect.right)
542 dx = std::max(static_cast<long>(XLine), std::min(static_cast<long>(XPage), (cursorPos.x-clientRect.right)/10 * XLine));
543
544 ScrollBy(dx, dy);
545 }
546}
547
548
550
551#if OWL_PERSISTENT_STREAMS
552
553//
554// reads an instance of TScroller from the passed ipstream
555//
556void*
557TScroller::Streamer::Read(ipstream& is, uint32 /*version*/) const
558{
559 TScroller* o = GetObject();
560 is >> o->XPos >> o->YPos >>
561 o->XUnit >> o->YUnit >>
562 o->XRange >> o->YRange >>
563 o->XLine >> o->YLine >>
564 o->XPage >> o->YPage >>
565 o->AutoMode >> o->TrackMode >>
566 o->AutoOrg >>
568
569 o->Window = 0;
570 return o;
571}
572
573//
574// writes the TScroller to the passed opstream
575//
576void
577TScroller::Streamer::Write(opstream& os) const
578{
579 TScroller* o = GetObject();
580 os << o->XPos << o->YPos <<
581 o->XUnit << o->YUnit <<
582 o->XRange << o->YRange <<
583 o->XLine << o->YLine <<
584 o->XPage << o->YPage <<
585 o->AutoMode << o->TrackMode <<
586 o->AutoOrg <<
587 o->HasHScrollBar << o->HasVScrollBar;
588}
589
590
591#endif
592
593} // OWL namespace
594
595/* ========================================================================== */
596
#define WARN(condition, message)
Definition checks.h:273
#define PRECONDITION(condition)
Definition checks.h:227
TDC is the root class for GDI DC wrappers.
Definition dc.h:64
virtual bool SetViewportOrg(const TPoint &origin, TPoint *oldOrg=nullptr)
Sets this DC's viewport origin to the given origin value, and saves the previous origin in oldOrg.
Definition dc.cpp:444
TPoint is a support class, derived from tagPOINT.
Definition geometry.h:87
TRect is a mathematical class derived from tagRect.
Definition geometry.h:308
Class TScroller implements the actual scroller object.
Definition scroller.h:46
int XUnit
Specifies the amount (in logical device units) to scroll the rectangle in the horizontal (X) directio...
Definition scroller.h:98
int YUnit
Specifies the amount (in logical device units) to scroll the rectangle in the vertical (Y) direction.
Definition scroller.h:100
virtual ~TScroller()
Destructs a TScroller object. Sets owning window's Scroller number variable to 0.
Definition scroller.cpp:139
long YTotalUnits
Total number of vertical scroll units.
Definition scroller.h:97
virtual void SetRange(long xRange, long yRange)
Sets the xRange and yRange of the TScroller to the parameters specified.
Definition scroller.cpp:176
bool HasHScrollBar
Is true if scroller has horizontal scroll.
Definition scroller.h:109
int YPage
Specifies the number of logical device units per page to scroll the rectangle in the vertical (Y) dir...
Definition scroller.h:105
virtual void BeginView(TDC &dc, TRect &rect)
If TScroller_AutoOrg is true (default condition), BeginView automatically offsets the origin of the l...
Definition scroller.cpp:324
TScroller(TWindow *window, int xUnit, int yUnit, long xRange, long yRange)
Constructs a TScroller object with window as the owner window, and xUnit, yUnit, xRange,...
Definition scroller.cpp:113
long YPos
Specifies the current position of the rectangle in vertical scroll units.
Definition scroller.h:93
virtual bool IsAutoMode()
IsAutoMode is true if automatic scrolling is activated.
Definition scroller.cpp:503
virtual int SetScrollPos(int bar, int pos, bool redraw=true)
Definition scroller.h:181
long XPos
Specifies the current position of the rectangle in horizontal scroll units.
Definition scroller.h:92
virtual void SetScrollPage(int bar, int page, bool redraw=true)
Definition scroller.h:146
long YRange
Specifies the number of vertical scroll units.
Definition scroller.h:95
bool AutoOrg
Is true if scroller offsets origin.
Definition scroller.h:108
int XLine
Specifies the number of logical device units per line to scroll the rectangle in the horizontal (X) d...
Definition scroller.h:102
virtual int GetScrollPos(int bar) const
Definition scroller.h:176
virtual void VScroll(uint scrollEvent, int thumbPos)
Responds to the specified vertical scrollEvent by calling ScrollBy or ScrollTo.
Definition scroller.cpp:365
virtual void SetTotalRangeOfUnits(long xTotalUnits, long yTotalUnits)
Definition scroller.cpp:188
TWindow * Window
Points to the window whose client area scroller is to be managed.
Definition scroller.h:91
virtual int GetScrollPage(int bar) const
Definition scroller.h:151
virtual void HScroll(uint scrollEvent, int thumbPos)
Responds to the specified horizontal scrollEvent by calling ScrollBy or ScrollTo.
Definition scroller.cpp:415
bool TrackMode
Is true if track scrolling is activated.
Definition scroller.h:107
void ScrollBy(long dx, long dy)
Scrolls to a position calculated using the passed delta values.
Definition scroller.h:134
virtual void ScrollTo(long x, long y)
Scrolls the rectangle to the position specified in x and y after checking boundary conditions.
Definition scroller.cpp:466
virtual int GetScrollTrackPos(int bar) const
Definition scroller.h:186
virtual void SetSBarRange()
Sets the range of the owner window's scroll bars to match the range of the TScroller and repaints as ...
Definition scroller.cpp:228
long XRange
Specifies the number of horizontal scroll units.
Definition scroller.h:94
virtual void GetScrollRange(int bar, int &minPos, int &maxPos) const
Definition scroller.h:156
bool HasVScrollBar
Is true if scroller has vertical scroll.
Definition scroller.h:110
long XTotalUnits
Total number of horizontal scroll units.
Definition scroller.h:96
bool AutoMode
Is true if automatic scrolling is activated.
Definition scroller.h:106
virtual void SetUnits(int xUnit, int yUnit)
Sets the XUnit and YUnit data members to TheXUnit and TheYUnit, respectively.
Definition scroller.cpp:201
virtual void EndView()
Updates the position of the owner window's scroll bars to be coordinated with the position of the TSc...
Definition scroller.cpp:341
virtual void SetScrollRange(int bar, int minPos, int maxPos, bool redraw=true)
Definition scroller.h:161
int YLine
Specifies the number of logical device units per line to scroll the rectangle in the vertical (Y) dir...
Definition scroller.h:103
virtual void AutoScroll()
Performs "auto-scrolling" (dragging the mouse from within the client client area of the Window to wit...
Definition scroller.cpp:518
int XPage
Specifies the number of logical device units per page to scroll the rectangle in the horizontal (X) d...
Definition scroller.h:104
virtual void SetPageSize()
Sets the XPage and YPage data members (amount by which to scroll on a page scroll request) to the wid...
Definition scroller.cpp:155
TSize()
Default constructor that does nothing.
Definition geometry.h:1406
TWindow, derived from TEventHandler and TStreamableBase, provides window-specific behavior and encaps...
Definition window.h:414
TWindowAttr & GetWindowAttr()
Returns the TWindowAttr structure, which contains the window's creation attributes.
Definition window.h:1886
void SetScroller(TScroller *scroller)
Sets the scroller object for this window.
Definition window.cpp:788
uint32 GetStyle() const
Gets the style bits of the underlying window or the 'Style' member of the attribute structure associa...
Definition window.cpp:3558
void ScrollWindow(int dx, int dy, const TRect *scroll=nullptr, const TRect *clip=nullptr)
Scrolls a window in the vertical (dx) and horizontal (dy) directions.
Definition window.h:3057
void UpdateWindow()
Updates the client area of the specified window by immediately sending a WM_PAINT message.
Definition window.h:2901
void ScreenToClient(TPoint &point) const
Uses the screen coordinates specified in point to calculate the client window's coordinates and then ...
Definition window.h:2192
void GetClientRect(TRect &rect) const
Gets the coordinates of the window's client area and then copies them into the object referred to by ...
Definition window.cpp:3624
virtual void Invalidate(bool erase=true)
Invalidates (mark for painting) the entire client area of a window.
Definition window.h:2822
HWND GetHandle() const
Returns the handle of the window.
Definition window.h:2020
TScroller * GetScroller()
Returns the associated scroller object for this window.
Definition window.h:1867
ipstream, a specialized input stream derivative of pstream, is the base class for reading (extracting...
Definition objstrm.h:391
char TCHAR
Definition cygwin.h:42
#define _T(x)
Definition cygwin.h:51
Definition of GDI DC encapsulation classes: TDC, TWindowDC, TScreenDC, TDesktopDC,...
Object Windows Library (OWLNext Core).
Definition animctrl.h:22
unsigned long uint32
Definition number.h:34
bool ToBool(const T &t)
Definition defs.h:291
OWL_DIAGINFO
Definition animctrl.cpp:14
IMPLEMENT_STREAMABLE(TDocManager)
unsigned int uint
Definition number.h:25
Definition of class TScroller.
uint32 Style
Contains the values that define the style, shape, and size of your window.
Definition window.h:331
Base window class TWindow definition, including HWND encapsulation.