scrollable_wnd
is a mix-in class for the great Win32GUI Lib by John Torjo. Steven Weiss has
the full copyright but you can use and modify the code as long as the copyright
comment persists.
scrollable_wnd
takes care of all scroll-relating actions including mouse whell navigation appearing
on a window. You only have to set a few parameters that manipulate the scrolling
behaviour.
Download scrollable_wnd class from here.
namespace win32 { namespace gui { struct scrollable_wnd : wnd_extend<window_base, scrollable_wnd> { // c'tor scrollable_wnd(); // operations void total_size(unsigned cx, unsigned cy); SIZE total_size() const; void line_scrolling_size(int cx, int cy); SIZE line_scrolling_size() const; void page_factor(float xFactor, float yFactor); float page_factor_x() const; float page_factor_y() const; void wheel_factor(float yFactor); float wheel_factor() const; void scroll_pos(unsigned x, unsigned y); POINT scroll_pos() const; }; } }
#include <win32gui/scrollable_wnd.hpp> struct your_window : wnd_extend<dialog, your_window>, wnd_extend<scrollable_wnd, your_window> { ... };
total_size(). If the window is resized and the visible part of the client area is smaller than the total, the scrollbars are shown. scrollable_wnd automatically adjust's the scrollbar's thumb.
A scrollable_wnd which has the total size 400 x 300
scroll_pos(). You can also scroll to a position with this function. line_scrolling_size(), page_factor() and wheel_factor(). Note that only line_scrolling_size() takes total values - the other values are multiplied with the line scrolling value. line_scrolling_size(10, 10); // scrolls 10 pixel in each direction when line scrolling is invoked page_factor(3, 4); // scrolls 30 pixel horizontally and 40 pixel vertically when page scrolling is invoked
| Currently (December 2004) I am an apprentice to Deutsche Telekom for IT specialist. I have done several projects for my company in C++, Java, SQL and PHP but my real love is C++ ;-). After finishing my apprenticeship in January I will work as a programmer in a small biotech-company. If you find bugs, have any suggestions and/or criticism you can contact me at steven11@gmx.de |
1.3.9.1