OWLNext    7.0
Borland's Object Windows Library for the modern age
Loading...
Searching...
No Matches
scrollba.h
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/// Definition of class TScrollBar. This defines the basic behavior of all
7/// scrollbar controls.
8//----------------------------------------------------------------------------
9
10#if !defined(OWL_SCROLLBAR_H)
11#define OWL_SCROLLBAR_H
12
13#include <owl/private/defs.h>
14#if defined(BI_HAS_PRAGMA_ONCE)
15# pragma once
16#endif
17
18#include <owl/control.h>
19
20namespace owl {
21
22struct _OWLCLASS TScrollBarData;
23
24#include <owl/preclass.h>
25
26//
27/// \class TScrollBar
28/// TScrollBar objects represent standalone vertical and horizontal scroll bar
29/// controls. Most of TScrollBar's member functions manage the scroll bar's sliding
30/// box (thumb) position and range.
31///
32/// One special feature of TScrollBar is the notify-based set of member functions
33/// that automatically adjust the scroll bar's thumb position in response to scroll
34/// bar messages.
35///
36/// Never place TScrollBar objects in windows that have either the WS_HSCROLL or
37/// WS_VSCROLL styles in their attributes.
38//
40 : public TControl
41{
42 public:
43
44 TScrollBar(TWindow* parent, int id, int x, int y, int w, int h, bool isHScrollBar, TModule* module = 0);
45 TScrollBar(TWindow* parent, int resourceId, TModule* module = 0);
46 TScrollBar(THandle hWnd, TModule* module = 0);
47
48 int GetLineMagnitude() const;
49 void SetLineMagnitude(int linemagnitude);
50
51 int GetPageMagnitude() const;
52 void SetPageMagnitude(int pagemagnitude);
53
54 /// \name Virtual functions to interface to scrollbars & derived
55 /// @{
56 virtual void GetRange(int& minValue, int& maxValue) const;
57 virtual int GetPosition() const;
58 virtual void SetRange(int minValue, int maxValue, bool redraw = true);
59 virtual void SetPosition(int thumbPos, bool redraw = true);
60 virtual int DeltaPos(int delta);
61 virtual void GetScrollInfo(SCROLLINFO* info) const;
62 virtual void SetScrollInfo(SCROLLINFO* info, bool redraw = true);
63 /// @}
64
65 /// \name Called by EvHScroll and EvVScroll response table handlers
66 /// These routines all end up calling SetPosition()
67 /// @{
68 virtual void SBLineUp();
69 virtual void SBLineDown();
70 virtual void SBPageUp();
71 virtual void SBPageDown();
72 virtual void SBThumbPosition(int thumbPos);
73 virtual void SBThumbTrack(int thumbPos);
74 virtual void SBTop();
75 virtual void SBBottom();
76 virtual void SBEndScroll();
77 /// @}
78
79 /// \name Response table handlers that call above virtual functions in
80 /// response to messages sent by to us by TWindow::DispatchScroll()
81 /// @{
82 void EvHScroll(uint scrollCode, uint thumbPos, HWND hWndCtl);
83 void EvVScroll(uint scrollCode, uint thumbPos, HWND hWndCtl);
84 /// @}
85
86 /// Safe overload
87 //
89
90 protected:
91
92 // Override TWindow virtual member functions
93 //
94 auto Transfer(void* buffer, TTransferDirection) -> uint override;
95 auto GetWindowClassName() -> TWindowClassName override;
96 void SetupWindow() override;
97
99
100 /// The number of range units to scroll the scroll bar when the user requests a
101 /// small movement by clicking on the scroll bar's arrows. TScrollBar's constructor
102 /// sets LineMagnitude to 1 by default. (The scroll range is 0-100 by default.)
103 //
104 int LineMagnitude;
105
106 /// The number of range units to scroll the scroll bar when the user requests a
107 /// large movement by clicking in the scroll bar's scrolling area. TScrollBar's
108 /// constructor sets PageMagnitude to 10 by default. (The scroll range is 0-100 by
109 /// default.)
110 //
111 int PageMagnitude;
112
113 private:
114
115 // Hidden to prevent accidental copying or assignment
116 //
117 TScrollBar(const TScrollBar&);
118 TScrollBar& operator=(const TScrollBar&);
119
122};
123
125
126//
127// Scroll bar notification macros. methods are: void method()
128//
129// EV_SB_LINEDOWN(id, method)
130// EV_SB_LINEUP(id, method)
131// EV_SB_PAGEDOWN(id, method)
132// EV_SB_PAGEUP(id, method)
133// EV_SB_TOP(id, method)
134// EV_SB_BOTTOM(id, method)
135// EV_SB_THUMBPOSITION(id, method)
136// EV_SB_ENDSCROLL(id, method)
137// EV_SB_BEGINTRACK(id, method)
138
139//
140/// \struct TScrollBarData
141/// The TScrollBarData structure contains integer values that represent a range of
142/// thumb positions on the scroll bar. TScrollBar's function GetRange calls
143/// TScrollBarData to obtain the highest and lowest thumb positions on the scroll
144/// bar. GetPosition calls TScrollBarData to obtain the current thumb position on
145/// the scroll bar.
146//
148{
149 int LowValue; ///< Contains the lowest value of thumb position in the scroll bar's range.
150 int HighValue; ///< Contains the highest value of the thumb position in the scroll bar's range.
151 int Position; ///< Contains the scroll bar's thumb position.
152};
153
154#include <owl/posclass.h>
155
156//----------------------------------------------------------------------------
157// Inline implementation
158//
159
160//
161/// Returns the current delta to move the thumb when line up/line down is received.
162//
164{
165 return LineMagnitude;
166}
167
168//
169/// Sets the delta to move the thumb when line up/line down is received.
170//
172{
173 LineMagnitude = linemagnitude;
174}
175
176
177} // OWL namespace
178
179
180#endif // OWL_SCROLLBAR_H
TControl unifies its derived control classes, such as TScrollBar, TControlGadget, and TButton.
Definition control.h:38
ObjectWindows dynamic-link libraries (DLLs) construct an instance of TModule, which acts as an object...
Definition module.h:75
TScrollBar objects represent standalone vertical and horizontal scroll bar controls.
Definition scrollba.h:41
void Transfer(TScrollBarData &data, TTransferDirection direction)
Safe overload.
Definition scrollba.h:88
void SetLineMagnitude(int linemagnitude)
Sets the delta to move the thumb when line up/line down is received.
Definition scrollba.h:171
int GetLineMagnitude() const
Returns the current delta to move the thumb when line up/line down is received.
Definition scrollba.h:163
Type-safe encapsulation of a Windows class name, a union between ATOM and LPCTSTR.
Definition module.h:47
TWindow, derived from TEventHandler and TStreamableBase, provides window-specific behavior and encaps...
Definition window.h:414
HWND THandle
TWindow encapsulates an HWND.
Definition window.h:418
Definition of class TControl.
#define DECLARE_RESPONSE_TABLE(cls)
Definition eventhan.h:436
#define DECLARE_STREAMABLE_OWL(cls, ver)
Definition objstrm.h:1529
#define DECLARE_STREAMABLE_INLINES(cls)
Definition objstrm.h:1538
TTransferDirection
The TTransferDirection enum describes the constants that the transfer function uses to determine how ...
Definition window.h:92
Object Windows Library (OWLNext Core)
Definition animctrl.h:22
unsigned int uint
Definition number.h:25
#define public_data
Definition defs.h:207
#define _OWLCLASS
Definition defs.h:338
The TScrollBarData structure contains integer values that represent a range of thumb positions on the...
Definition scrollba.h:148
int HighValue
Contains the highest value of the thumb position in the scroll bar's range.
Definition scrollba.h:150
int LowValue
Contains the lowest value of thumb position in the scroll bar's range.
Definition scrollba.h:149
int Position
Contains the scroll bar's thumb position.
Definition scrollba.h:151