1 #include "ModuleControlLong.h"
5 LRESULT
CModuleControlLong::OnScroll(UINT message
, WPARAM wParam
, LPARAM lParam
, BOOL
& bHandled
) {
6 int iValue
= SendMessage(m_hSlider
, TBM_GETPOS
, 0, 0);
9 _sntprintf(tcBuffer
, 100, TEXT("%0.2f"), iValue
/ static_cast<double>(m_iDivisor
));
10 SendMessage(m_hEntry
, WM_SETTEXT
, 0, (LPARAM
) tcBuffer
);
16 int CModuleControlLong::GetHeightRequest() {
20 void CModuleControlLong::Initialise(CAppSettings
*pAppSets
) {
21 int iValue(pAppSets
->GetLongParameter(m_iId
));
22 SendMessage(m_hSlider
, TBM_SETPOS
, (WPARAM
)false, (LPARAM
)iValue
);
25 _sntprintf(tcBuffer
, 100, TEXT("%0.2f"), iValue
/ static_cast<double>(m_iDivisor
));
26 SendMessage(m_hEntry
, WM_SETTEXT
, 0, (LPARAM
) tcBuffer
);
29 void CModuleControlLong::Apply(CAppSettings
*pAppSets
) {
30 int iValue
= SendMessage(m_hSlider
, TBM_GETPOS
, 0, 0);
31 pAppSets
->SetLongParameter(m_iId
, iValue
);
34 void CModuleControlLong::CreateChild(HWND hParent
) {
35 m_hSlider
= CreateWindowEx(WS_EX_CONTROLPARENT
, TRACKBAR_CLASS
, NULL
,
36 TBS_HORZ
| WS_CHILD
| WS_VISIBLE
| WS_TABSTOP
, 0, 0, 0, 0, hParent
, NULL
, WinHelper::hInstApp
, NULL
);
38 SendMessage(m_hSlider
, TBM_SETRANGE
, (WPARAM
)true, (LPARAM
)MAKELONG(m_iMin
, m_iMax
));
39 SendMessage(m_hSlider
, TBM_SETPAGESIZE
, 0, (LPARAM
)m_iStep
);
41 m_hEntry
= CreateWindowEx(WS_EX_CONTROLPARENT
| WS_EX_CLIENTEDGE
, TEXT("EDIT"), NULL
,
42 WS_CHILD
| WS_VISIBLE
| WS_TABSTOP
, 0, 0, 0, 0, hParent
, NULL
, WinHelper::hInstApp
, NULL
);
45 hGuiFont
= GetStockObject(DEFAULT_GUI_FONT
);
47 SendMessage(m_hEntry
, WM_SETFONT
, (WPARAM
)hGuiFont
, (LPARAM
)true);
50 void CModuleControlLong::LayoutChild(RECT
&sRect
) {
51 ::MoveWindow(m_hSlider
, sRect
.left
+ 32, sRect
.top
, sRect
.right
- sRect
.left
- 32, sRect
.bottom
- sRect
.top
, TRUE
);
52 ::MoveWindow(m_hEntry
, sRect
.left
, sRect
.top
, 32, sRect
.bottom
- sRect
.top
, TRUE
);