summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGeorge Hazan <ghazan@miranda.im>2016-12-02 16:25:50 +0300
committerGeorge Hazan <ghazan@miranda.im>2016-12-02 16:25:50 +0300
commit9cece856f594b529aae2f42ad116d16cbb3c0e52 (patch)
treed43b6b7fb4d8293a3f3aaba0a07c5ba28b05e611
parent428051b8b98331a7419ca025be55a1ce0c52f826 (diff)
if nothing else helps, finally read the manual
- CCtrlSpin::SetRange had mixed up max & min values; - changing data in a spin control didn't send a change notification
-rw-r--r--bin10/lib/mir_core.libbin313530 -> 313858 bytes
-rw-r--r--bin10/lib/mir_core64.libbin314560 -> 314896 bytes
-rw-r--r--bin12/lib/mir_core.libbin313530 -> 313858 bytes
-rw-r--r--bin12/lib/mir_core64.libbin314560 -> 314896 bytes
-rw-r--r--bin14/lib/mir_core.libbin313530 -> 313858 bytes
-rw-r--r--bin14/lib/mir_core64.libbin314560 -> 314896 bytes
-rw-r--r--include/m_gui.h42
-rw-r--r--src/mir_core/src/mir_core.def3
-rw-r--r--src/mir_core/src/mir_core64.def3
-rw-r--r--src/mir_core/src/ui_utils.cpp16
10 files changed, 39 insertions, 25 deletions
diff --git a/bin10/lib/mir_core.lib b/bin10/lib/mir_core.lib
index 40a38f9015..238a5e57e8 100644
--- a/bin10/lib/mir_core.lib
+++ b/bin10/lib/mir_core.lib
Binary files differ
diff --git a/bin10/lib/mir_core64.lib b/bin10/lib/mir_core64.lib
index 2f3d1ccb59..6a457470e8 100644
--- a/bin10/lib/mir_core64.lib
+++ b/bin10/lib/mir_core64.lib
Binary files differ
diff --git a/bin12/lib/mir_core.lib b/bin12/lib/mir_core.lib
index 40a38f9015..238a5e57e8 100644
--- a/bin12/lib/mir_core.lib
+++ b/bin12/lib/mir_core.lib
Binary files differ
diff --git a/bin12/lib/mir_core64.lib b/bin12/lib/mir_core64.lib
index 2f3d1ccb59..6a457470e8 100644
--- a/bin12/lib/mir_core64.lib
+++ b/bin12/lib/mir_core64.lib
Binary files differ
diff --git a/bin14/lib/mir_core.lib b/bin14/lib/mir_core.lib
index 40a38f9015..238a5e57e8 100644
--- a/bin14/lib/mir_core.lib
+++ b/bin14/lib/mir_core.lib
Binary files differ
diff --git a/bin14/lib/mir_core64.lib b/bin14/lib/mir_core64.lib
index 2f3d1ccb59..6a457470e8 100644
--- a/bin14/lib/mir_core64.lib
+++ b/bin14/lib/mir_core64.lib
Binary files differ
diff --git a/include/m_gui.h b/include/m_gui.h
index 24d09ff14c..e020389051 100644
--- a/include/m_gui.h
+++ b/include/m_gui.h
@@ -555,7 +555,7 @@ class MIR_CORE_EXPORT CCtrlButton : public CCtrlBase
public:
CCtrlButton(CDlgBase *dlg, int ctrlId);
- virtual BOOL OnCommand(HWND hwndCtrl, WORD idCtrl, WORD idCode);
+ virtual BOOL OnCommand(HWND hwndCtrl, WORD idCtrl, WORD idCode) override;
CCallback<CCtrlButton> OnClick;
};
@@ -586,7 +586,7 @@ class MIR_CORE_EXPORT CCtrlHyperlink : public CCtrlBase
public:
CCtrlHyperlink(CDlgBase *dlg, int ctrlId, const char* url);
- virtual BOOL OnCommand(HWND hwndCtrl, WORD idCtrl, WORD idCode);
+ virtual BOOL OnCommand(HWND hwndCtrl, WORD idCtrl, WORD idCode) override;
protected:
const char* m_url;
@@ -687,7 +687,7 @@ public:
CCallback<TEventInfo> OnClick;
protected:
- virtual BOOL OnNotify(int idCtrl, NMHDR *pnmh);
+ virtual BOOL OnNotify(int idCtrl, NMHDR *pnmh) override;
};
/////////////////////////////////////////////////////////////////////////////////////////
@@ -726,10 +726,10 @@ class MIR_CORE_EXPORT CCtrlCheck : public CCtrlData
public:
CCtrlCheck(CDlgBase *dlg, int ctrlId);
- virtual BOOL OnCommand(HWND /*hwndCtrl*/, WORD /*idCtrl*/, WORD /*idCode*/);
+ virtual BOOL OnCommand(HWND /*hwndCtrl*/, WORD /*idCtrl*/, WORD /*idCode*/) override;
- virtual void OnApply();
- virtual void OnReset();
+ virtual void OnApply() override;
+ virtual void OnReset() override;
int GetState();
void SetState(int state);
@@ -744,10 +744,10 @@ class MIR_CORE_EXPORT CCtrlEdit : public CCtrlData
public:
CCtrlEdit(CDlgBase *dlg, int ctrlId);
- virtual BOOL OnCommand(HWND /*hwndCtrl*/, WORD /*idCtrl*/, WORD idCode);
+ virtual BOOL OnCommand(HWND /*hwndCtrl*/, WORD /*idCtrl*/, WORD idCode) override;
- virtual void OnApply();
- virtual void OnReset();
+ virtual void OnApply() override;
+ virtual void OnReset() override;
void SetMaxLength(unsigned int len);
};
@@ -759,11 +759,13 @@ class MIR_CORE_EXPORT CCtrlSpin : public CCtrlBase
{
typedef CCtrlData CSuper;
+ virtual BOOL OnNotify(int, NMHDR*) override;
+
public:
CCtrlSpin(CDlgBase *dlg, int ctrlId);
WORD GetPosition();
- void SetPosition(WORD max, WORD min = 0);
+ void SetPosition(WORD pos);
void SetRange(WORD max, WORD min = 0);
};
@@ -804,7 +806,7 @@ public:
CCallback<CCtrlListBox> OnSelChange;
protected:
- BOOL OnCommand(HWND hwndCtrl, WORD idCtrl, WORD idCode);
+ BOOL OnCommand(HWND hwndCtrl, WORD idCtrl, WORD idCode) override;
};
/////////////////////////////////////////////////////////////////////////////////////////
@@ -817,7 +819,7 @@ class MIR_CORE_EXPORT CCtrlCombo : public CCtrlData
public:
CCtrlCombo(CDlgBase *dlg, int ctrlId);
- virtual BOOL OnCommand(HWND /*hwndCtrl*/, WORD /*idCtrl*/, WORD idCode);
+ virtual BOOL OnCommand(HWND /*hwndCtrl*/, WORD /*idCtrl*/, WORD idCode) override;
virtual void OnInit();
virtual void OnApply();
virtual void OnReset();
@@ -1026,7 +1028,7 @@ public:
CCallback<TEventInfo> OnSetDispInfo;
protected:
- virtual BOOL OnNotify(int idCtrl, NMHDR *pnmh);
+ virtual BOOL OnNotify(int idCtrl, NMHDR *pnmh) override;
};
/////////////////////////////////////////////////////////////////////////////////////////
@@ -1162,7 +1164,7 @@ public:
protected:
virtual void OnInit();
- virtual BOOL OnNotify(int idCtrl, NMHDR *pnmh);
+ virtual BOOL OnNotify(int idCtrl, NMHDR *pnmh) override;
virtual LRESULT CustomWndProc(UINT msg, WPARAM wParam, LPARAM lParam);
@@ -1198,7 +1200,7 @@ public:
void ActivatePage(int iPage);
protected:
- virtual BOOL OnNotify(int idCtrl, NMHDR *pnmh);
+ virtual BOOL OnNotify(int idCtrl, NMHDR *pnmh) override;
virtual void OnInit();
virtual void OnDestroy();
@@ -1257,7 +1259,7 @@ public:
m_pfnOnDeleteItem = pfnOnDeleteItem;
}
- virtual BOOL OnCommand(HWND hwndCtrl, WORD idCtrl, WORD idCode)
+ virtual BOOL OnCommand(HWND hwndCtrl, WORD idCtrl, WORD idCode) override
{
if (m_parentWnd && m_pfnOnCommand) {
m_parentWnd->m_lresult = 0;
@@ -1266,7 +1268,7 @@ public:
}
return FALSE;
}
- virtual BOOL OnNotify(int idCtrl, NMHDR *pnmh)
+ virtual BOOL OnNotify(int idCtrl, NMHDR *pnmh) override
{
if (m_parentWnd && m_pfnOnNotify) {
m_parentWnd->m_lresult = 0;
@@ -1276,7 +1278,7 @@ public:
return FALSE;
}
- virtual BOOL OnMeasureItem(MEASUREITEMSTRUCT *param)
+ virtual BOOL OnMeasureItem(MEASUREITEMSTRUCT *param) override
{
if (m_parentWnd && m_pfnOnMeasureItem) {
m_parentWnd->m_lresult = 0;
@@ -1285,7 +1287,7 @@ public:
}
return FALSE;
}
- virtual BOOL OnDrawItem(DRAWITEMSTRUCT *param)
+ virtual BOOL OnDrawItem(DRAWITEMSTRUCT *param) override
{
if (m_parentWnd && m_pfnOnDrawItem) {
m_parentWnd->m_lresult = 0;
@@ -1294,7 +1296,7 @@ public:
}
return FALSE;
}
- virtual BOOL OnDeleteItem(DELETEITEMSTRUCT *param)
+ virtual BOOL OnDeleteItem(DELETEITEMSTRUCT *param) override
{
if (m_parentWnd && m_pfnOnDeleteItem) {
m_parentWnd->m_lresult = 0;
diff --git a/src/mir_core/src/mir_core.def b/src/mir_core/src/mir_core.def
index ab1a87b9c7..6647e17126 100644
--- a/src/mir_core/src/mir_core.def
+++ b/src/mir_core/src/mir_core.def
@@ -1036,5 +1036,6 @@ CallFunctionSync @1170
?GetItemRect@CCtrlListBox@@QAEHHPAUtagRECT@@@Z @1193 NONAME
?SetItemHeight@CCtrlListBox@@QAEXHH@Z @1194 NONAME
?UseSystemColors@CCtrlBase@@QAEXXZ @1195 NONAME
-?SetPosition@CCtrlSpin@@QAEXGG@Z @1196 NONAME
+?SetPosition@CCtrlSpin@@QAEXG@Z @1196 NONAME
?GetPosition@CCtrlSpin@@QAEGXZ @1197 NONAME
+?OnNotify@CCtrlSpin@@EAEHHPAUtagNMHDR@@@Z @1198 NONAME
diff --git a/src/mir_core/src/mir_core64.def b/src/mir_core/src/mir_core64.def
index 2f448e51a0..80f401f367 100644
--- a/src/mir_core/src/mir_core64.def
+++ b/src/mir_core/src/mir_core64.def
@@ -1036,5 +1036,6 @@ CallFunctionSync @1170
?GetItemRect@CCtrlListBox@@QEAAHHPEAUtagRECT@@@Z @1193 NONAME
?SetItemHeight@CCtrlListBox@@QEAAXHH@Z @1194 NONAME
?UseSystemColors@CCtrlBase@@QEAAXXZ @1195 NONAME
-?SetPosition@CCtrlSpin@@QEAAXGG@Z @1196 NONAME
+?SetPosition@CCtrlSpin@@QEAAXG@Z @1196 NONAME
?GetPosition@CCtrlSpin@@QEAAGXZ @1197 NONAME
+?OnNotify@CCtrlSpin@@EEAAHHPEAUtagNMHDR@@@Z @1198 NONAME
diff --git a/src/mir_core/src/ui_utils.cpp b/src/mir_core/src/ui_utils.cpp
index a1ff5a9597..e4719b7372 100644
--- a/src/mir_core/src/ui_utils.cpp
+++ b/src/mir_core/src/ui_utils.cpp
@@ -676,19 +676,29 @@ CCtrlSpin::CCtrlSpin(CDlgBase *dlg, int ctrlId)
: CCtrlBase(dlg, ctrlId)
{}
+BOOL CCtrlSpin::OnNotify(int, NMHDR *pnmh)
+{
+ if (pnmh->code == UDN_DELTAPOS) {
+ NotifyChange();
+ return TRUE;
+ }
+
+ return FALSE;
+}
+
WORD CCtrlSpin::GetPosition()
{
return SendMsg(UDM_GETPOS, 0, 0);
}
-void CCtrlSpin::SetPosition(WORD wMax, WORD wMin)
+void CCtrlSpin::SetPosition(WORD wPos)
{
- SendMsg(UDM_SETPOS, 0, MAKELONG(wMin, wMax));
+ SendMsg(UDM_SETPOS, 0, wPos);
}
void CCtrlSpin::SetRange(WORD wMax, WORD wMin)
{
- SendMsg(UDM_SETRANGE, 0, MAKELONG(wMin, wMax));
+ SendMsg(UDM_SETRANGE, 0, MAKELPARAM(wMax, wMin));
}
/////////////////////////////////////////////////////////////////////////////////////////