summaryrefslogtreecommitdiff
path: root/src/mir_core
diff options
context:
space:
mode:
authoraunsane <aunsane@gmail.com>2018-02-24 00:03:19 +0300
committerGeorge Hazan <ghazan@miranda.im>2018-02-23 23:19:23 +0200
commit3f343c22a352462660a71806303c1f8957a85702 (patch)
treed055089c06c6d8b3e9baa74c29ef9f0e73759d10 /src/mir_core
parent055600d34539311ec30746b0e7bb9c66030da779 (diff)
core: gui
- new method IsChecked for CCtrlCheck - new methods GetUrl and SetUrl for CCtrlHypelink - new event OnClick for CCtrlHypelink - CCtrlSpin inherits from CCtrlData
Diffstat (limited to 'src/mir_core')
-rw-r--r--src/mir_core/src/CCtrlCheck.cpp11
-rw-r--r--src/mir_core/src/CCtrlHyperlink.cpp23
-rw-r--r--src/mir_core/src/CCtrlSpin.cpp17
-rw-r--r--src/mir_core/src/mir_core.def6
-rw-r--r--src/mir_core/src/mir_core64.def6
5 files changed, 56 insertions, 7 deletions
diff --git a/src/mir_core/src/CCtrlCheck.cpp b/src/mir_core/src/CCtrlCheck.cpp
index 13983b148c..01f4773a6d 100644
--- a/src/mir_core/src/CCtrlCheck.cpp
+++ b/src/mir_core/src/CCtrlCheck.cpp
@@ -50,9 +50,16 @@ void CCtrlCheck::OnReset()
}
int CCtrlCheck::GetState()
-{ return SendMessage(m_hwnd, BM_GETCHECK, 0, 0);
+{
+ return SendMessage(m_hwnd, BM_GETCHECK, 0, 0);
}
void CCtrlCheck::SetState(int state)
-{ SendMessage(m_hwnd, BM_SETCHECK, state, 0);
+{
+ SendMessage(m_hwnd, BM_SETCHECK, state, 0);
+}
+
+bool CCtrlCheck::IsChecked()
+{
+ return GetState() == BST_CHECKED;
}
diff --git a/src/mir_core/src/CCtrlHyperlink.cpp b/src/mir_core/src/CCtrlHyperlink.cpp
index 34266982de..fb0ab7f7ae 100644
--- a/src/mir_core/src/CCtrlHyperlink.cpp
+++ b/src/mir_core/src/CCtrlHyperlink.cpp
@@ -28,10 +28,27 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
CCtrlHyperlink::CCtrlHyperlink(CDlgBase* wnd, int idCtrl, const char* url)
: CCtrlBase(wnd, idCtrl),
m_url(url)
-{}
+{
+ OnClick = Callback(this, &CCtrlHyperlink::Default_OnClick);
+}
-BOOL CCtrlHyperlink::OnCommand(HWND, WORD, WORD)
+BOOL CCtrlHyperlink::OnCommand(HWND, WORD, WORD idCode)
{
- ShellExecuteA(m_hwnd, "open", m_url, "", "", SW_SHOW);
+ OnClick(this);
return FALSE;
}
+
+void CCtrlHyperlink::Default_OnClick(CCtrlHyperlink*)
+{
+ ShellExecuteA(m_hwnd, "open", m_url, "", "", SW_SHOW);
+}
+
+void CCtrlHyperlink::SetUrl(const char *url)
+{
+ m_url = url;
+}
+
+const char* CCtrlHyperlink::GetUrl()
+{
+ return m_url;
+}
diff --git a/src/mir_core/src/CCtrlSpin.cpp b/src/mir_core/src/CCtrlSpin.cpp
index 56491c1411..f0af3c9609 100644
--- a/src/mir_core/src/CCtrlSpin.cpp
+++ b/src/mir_core/src/CCtrlSpin.cpp
@@ -26,7 +26,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
// CCtrlSpin class
CCtrlSpin::CCtrlSpin(CDlgBase *dlg, int ctrlId)
- : CCtrlBase(dlg, ctrlId)
+ : CCtrlData(dlg, ctrlId)
{}
BOOL CCtrlSpin::OnNotify(int, NMHDR *pnmh)
@@ -35,10 +35,23 @@ BOOL CCtrlSpin::OnNotify(int, NMHDR *pnmh)
NotifyChange();
return TRUE;
}
-
return FALSE;
}
+void CCtrlSpin::OnApply()
+{
+ CSuper::OnApply();
+
+ if (m_dbLink != nullptr)
+ SaveInt(GetPosition());
+}
+
+void CCtrlSpin::OnReset()
+{
+ if (m_dbLink != nullptr)
+ SetPosition(LoadInt());
+}
+
WORD CCtrlSpin::GetPosition()
{
return SendMsg(UDM_GETPOS, 0, 0);
diff --git a/src/mir_core/src/mir_core.def b/src/mir_core/src/mir_core.def
index d0fd2ed0c5..a0f547246a 100644
--- a/src/mir_core/src/mir_core.def
+++ b/src/mir_core/src/mir_core.def
@@ -1057,3 +1057,9 @@ IsTerminalDisconnected @1245
?FindControl@CDlgBase@@QAEPAVCCtrlBase@@PAUHWND__@@@Z @1247 NONAME
?GlobalFieldEnum@CDlgBase@@CGHPAUHWND__@@J@Z @1248 NONAME
?OnDestroy@CCtrlTreeView@@MAEXXZ @1249 NONAME
+?GetUrl@CCtrlHyperlink@@QAEPBDXZ @1250 NONAME
+?IsChecked@CCtrlCheck@@QAE_NXZ @1251 NONAME
+?OnApply@CCtrlSpin@@UAEXXZ @1252 NONAME
+?OnReset@CCtrlSpin@@UAEXXZ @1253 NONAME
+?SetUrl@CCtrlHyperlink@@QAEXPBD@Z @1254 NONAME
+?Default_OnClick@CCtrlHyperlink@@IAEXPAV1@@Z @1255 NONAME
diff --git a/src/mir_core/src/mir_core64.def b/src/mir_core/src/mir_core64.def
index 26daba4f81..57272df5e8 100644
--- a/src/mir_core/src/mir_core64.def
+++ b/src/mir_core/src/mir_core64.def
@@ -1057,3 +1057,9 @@ IsTerminalDisconnected @1245
?FindControl@CDlgBase@@QEAAPEAVCCtrlBase@@PEAUHWND__@@@Z @1247 NONAME
?GlobalFieldEnum@CDlgBase@@CAHPEAUHWND__@@_J@Z @1248 NONAME
?OnDestroy@CCtrlTreeView@@MEAAXXZ @1249 NONAME
+?Default_OnClick@CCtrlHyperlink@@IEAAXPEAV1@@Z @1250 NONAME
+?GetUrl@CCtrlHyperlink@@QEAAPEBDXZ @1251 NONAME
+?IsChecked@CCtrlCheck@@QEAA_NXZ @1252 NONAME
+?OnApply@CCtrlSpin@@UEAAXXZ @1253 NONAME
+?OnReset@CCtrlSpin@@UEAAXXZ @1254 NONAME
+?SetUrl@CCtrlHyperlink@@QEAAXPEBD@Z @1255 NONAME