summaryrefslogtreecommitdiff
path: root/src/mir_core
diff options
context:
space:
mode:
authorGeorge Hazan <ghazan@miranda.im>2021-03-01 21:28:01 +0300
committerGeorge Hazan <ghazan@miranda.im>2021-03-01 21:28:01 +0300
commit01313480057e4272d545732fc3a21150869edf54 (patch)
treefc3d401e61ea485f16410d1bb7d45bebe71c2e30 /src/mir_core
parent3489b2fbaf66dbc60aed544288fb7cc74fc0547e (diff)
CCtrlSlider - new GUI component
Diffstat (limited to 'src/mir_core')
-rw-r--r--src/mir_core/mir_core.vcxproj1
-rw-r--r--src/mir_core/mir_core.vcxproj.filters3
-rw-r--r--src/mir_core/src/CCtrlSlider.cpp70
-rw-r--r--src/mir_core/src/CDlgBase.cpp5
-rw-r--r--src/mir_core/src/mir_core.def8
-rw-r--r--src/mir_core/src/mir_core64.def8
6 files changed, 95 insertions, 0 deletions
diff --git a/src/mir_core/mir_core.vcxproj b/src/mir_core/mir_core.vcxproj
index d95f7b9197..23e75824de 100644
--- a/src/mir_core/mir_core.vcxproj
+++ b/src/mir_core/mir_core.vcxproj
@@ -58,6 +58,7 @@
<ClCompile Include="src\CCtrlMButton.cpp" />
<ClCompile Include="src\CCtrlPages.cpp" />
<ClCompile Include="src\CCtrlRichEdit.cpp" />
+ <ClCompile Include="src\CCtrlSlider.cpp" />
<ClCompile Include="src\CCtrlSpin.cpp" />
<ClCompile Include="src\CCtrlTreeOpts.cpp" />
<ClCompile Include="src\CCtrlTreeView.cpp" />
diff --git a/src/mir_core/mir_core.vcxproj.filters b/src/mir_core/mir_core.vcxproj.filters
index 17987d4682..2eba1c3237 100644
--- a/src/mir_core/mir_core.vcxproj.filters
+++ b/src/mir_core/mir_core.vcxproj.filters
@@ -173,6 +173,9 @@
<ClCompile Include="src\CCtrlColor.cpp">
<Filter>Source Files</Filter>
</ClCompile>
+ <ClCompile Include="src\CCtrlSlider.cpp">
+ <Filter>Source Files</Filter>
+ </ClCompile>
</ItemGroup>
<ItemGroup>
<ClInclude Include="src\miranda.h">
diff --git a/src/mir_core/src/CCtrlSlider.cpp b/src/mir_core/src/CCtrlSlider.cpp
new file mode 100644
index 0000000000..c418051693
--- /dev/null
+++ b/src/mir_core/src/CCtrlSlider.cpp
@@ -0,0 +1,70 @@
+/*
+
+Object UI extensions
+Copyright (c) 2008 Victor Pavlychko, George Hazan
+Copyright (C) 2012-21 Miranda NG team
+
+This program is free software; you can redistribute it and/or
+modify it under the terms of the GNU General Public License
+as published by the Free Software Foundation; either version 2
+of the License, or (at your option) any later version.
+
+This program is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+GNU General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with this program; if not, write to the Free Software
+Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+
+*/
+
+#include "stdafx.h"
+
+/////////////////////////////////////////////////////////////////////////////////////////
+// CCtrlSlider class
+
+CCtrlSlider::CCtrlSlider(CDlgBase *dlg, int ctrlId, int wMax, int wMin) :
+ CCtrlData(dlg, ctrlId),
+ m_wMin(wMin),
+ m_wMax(wMax)
+{
+ m_bNotifiable = true;
+}
+
+BOOL CCtrlSlider::OnCommand(HWND, WORD, WORD idCode)
+{
+ if (idCode == WM_HSCROLL) {
+ NotifyChange();
+ return TRUE;
+ }
+ return FALSE;
+}
+
+bool CCtrlSlider::OnApply()
+{
+ CSuper::OnApply();
+
+ if (m_dbLink != nullptr)
+ SaveInt(GetPosition());
+ return true;
+}
+
+void CCtrlSlider::OnReset()
+{
+ SendMsg(TBM_SETRANGE, 0, MAKELPARAM(m_wMax, m_wMin));
+
+ if (m_dbLink != nullptr)
+ SetPosition(LoadInt());
+}
+
+int CCtrlSlider::GetPosition()
+{
+ return SendMsg(TBM_GETPOS, 0, 0);
+}
+
+void CCtrlSlider::SetPosition(int wPos)
+{
+ SendMsg(TBM_SETPOS, TRUE, wPos);
+}
diff --git a/src/mir_core/src/CDlgBase.cpp b/src/mir_core/src/CDlgBase.cpp
index 95449c56a0..d2cbbc23a1 100644
--- a/src/mir_core/src/CDlgBase.cpp
+++ b/src/mir_core/src/CDlgBase.cpp
@@ -339,6 +339,11 @@ INT_PTR CDlgBase::DlgProc(UINT msg, WPARAM wParam, LPARAM lParam)
}
return FALSE;
+ case WM_HSCROLL:
+ if (auto *pCtrl = FindControl(HWND(lParam)))
+ pCtrl->OnCommand(HWND(lParam), pCtrl->m_idCtrl, WM_HSCROLL);
+ break;
+
case PSM_CHANGED:
if (m_bInitialized)
OnChange();
diff --git a/src/mir_core/src/mir_core.def b/src/mir_core/src/mir_core.def
index e0aca3aaff..2a9322ac5e 100644
--- a/src/mir_core/src/mir_core.def
+++ b/src/mir_core/src/mir_core.def
@@ -1489,3 +1489,11 @@ TimeZone_GetSystemTime @1692
?OnCommand@CCtrlColor@@UAEHPAUHWND__@@GG@Z @1712 NONAME
?OnReset@CCtrlColor@@UAEXXZ @1713 NONAME
?SetColor@CCtrlColor@@QAEXK@Z @1714 NONAME
+??0CCtrlSlider@@QAE@PAVCDlgBase@@HHH@Z @1715 NONAME
+??1CCtrlSlider@@UAE@XZ @1716 NONAME
+??_7CCtrlSlider@@6B@ @1717 NONAME
+?GetPosition@CCtrlSlider@@QAEHXZ @1718 NONAME
+?OnApply@CCtrlSlider@@UAE_NXZ @1719 NONAME
+?OnCommand@CCtrlSlider@@MAEHPAUHWND__@@GG@Z @1720 NONAME
+?OnReset@CCtrlSlider@@UAEXXZ @1721 NONAME
+?SetPosition@CCtrlSlider@@QAEXH@Z @1722 NONAME
diff --git a/src/mir_core/src/mir_core64.def b/src/mir_core/src/mir_core64.def
index d0b84bfdd6..4d694019fb 100644
--- a/src/mir_core/src/mir_core64.def
+++ b/src/mir_core/src/mir_core64.def
@@ -1489,3 +1489,11 @@ TimeZone_GetSystemTime @1692
?OnCommand@CCtrlColor@@UEAAHPEAUHWND__@@GG@Z @1712 NONAME
?OnReset@CCtrlColor@@UEAAXXZ @1713 NONAME
?SetColor@CCtrlColor@@QEAAXK@Z @1714 NONAME
+??0CCtrlSlider@@QEAA@PEAVCDlgBase@@HHH@Z @1715 NONAME
+??1CCtrlSlider@@UEAA@XZ @1716 NONAME
+??_7CCtrlSlider@@6B@ @1717 NONAME
+?GetPosition@CCtrlSlider@@QEAAHXZ @1718 NONAME
+?OnApply@CCtrlSlider@@UEAA_NXZ @1719 NONAME
+?OnCommand@CCtrlSlider@@MEAAHPEAUHWND__@@GG@Z @1720 NONAME
+?OnReset@CCtrlSlider@@UEAAXXZ @1721 NONAME
+?SetPosition@CCtrlSlider@@QEAAXH@Z @1722 NONAME