Scope
ScopeScrollbarCtrl.h
1 #pragma once
2 
3 #include "helpers/ScopeNumber.h"
4 #include "ScopeDefines.h"
5 
6 namespace scope {
7  namespace gui {
8 
12  : public CWindowImpl<CScopeScrollbarCtrl, CScrollBar> {
13 
14 protected:
16  bool created;
17 
20 
22  boost::signals2::connection stateconnection;
23 
25  boost::signals2::connection valueconnection;
26 
29 
32 
34  bool shiftstate;
35 
36 public:
37 
38  BEGIN_MSG_MAP_EX(CScopeScrollbarCtrl)
39  MSG_OCM_VSCROLL(OnScroll)
40  MSG_OCM_HSCROLL(OnScroll)
41  MESSAGE_HANDLER(WM_KEYDOWN, OnKeyDown)
42  MESSAGE_HANDLER(WM_KEYUP, OnKeyUp)
43  MESSAGE_HANDLER(WM_UPDATECONTROL, OnUpdateControl)
44  DEFAULT_REFLECTION_HANDLER()
45  END_MSG_MAP()
46 
47 
54  CScopeScrollbarCtrl(ScopeNumber<double>* _scopenum, const double& _smallincrement, const double& _largeincrement, const bool& _connectback = false, const bool& _connectcontrolstate = false);
55 
58 
60  BOOL AttachToDlgItem(HWND hWnd);
61 
66  LRESULT OnKeyDown(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled);
67 
69  LRESULT OnKeyUp(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled);
70 
72  void OnScroll(int nSBCode, short nPos, CScrollBar pScrollBar);
73 
75  LRESULT OnUpdateControl(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled);
76  // LRESULT OnUpdateValue(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled); not needed, since we do OnScroll
82 
86 
89 
bool created
true if window created
LRESULT OnKeyUp(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL &bHandled)
Resets state of shift key.
boost::signals2::connection stateconnection
The connection object for the control state (connection to the scopenum rw state change) ...
ScopeNumber< double > *const scopenum
pointer to underlying ScopeValue
bool shiftstate
stores state of shift key
void OnScroll(int nSBCode, short nPos, CScrollBar pScrollBar)
Updates the ScopeNumber from the slider position.
double smallincrement
if != 0, then scopenum is changed by increment on click on scrollbar arrows, otherwise by range/100 ...
boost::signals2::connection valueconnection
The connection object for the control state (connection to the scopenum value change) ...
LRESULT OnUpdateControl(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL &bHandled)
Worker for UpdateControl.
BOOL AttachToDlgItem(HWND hWnd)
Attach the control to a dialog item and set range and tick frequency.
LRESULT OnKeyDown(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL &bHandled)
Switches to next control on return or tab and updates ScopeValue scope_val Also sets state of shift k...
An adapted CScrollB ar control around a ScopeNumber.
double largeincrement
if != 0, then scopenum is changed by largeincrement on click inside scrollbar, otherwise by range/20 ...