diff options
author | George Hazan <george.hazan@gmail.com> | 2016-09-22 09:08:46 +0000 |
---|---|---|
committer | George Hazan <george.hazan@gmail.com> | 2016-09-22 09:08:46 +0000 |
commit | b58fa04b8dc505c6d45100ccf772464a4b619df5 (patch) | |
tree | 14e48f9e3ad7165061090bdd400a4311b9d1776b /src/mir_core | |
parent | 2a5135f1283ffc05a8a5c1e56b7025fe3d55a013 (diff) |
UI utils:
- added class CProgress;
- added class CTimer;
git-svn-id: http://svn.miranda-ng.org/main/trunk@17331 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
Diffstat (limited to 'src/mir_core')
-rw-r--r-- | src/mir_core/src/mir_core.def | 21 | ||||
-rw-r--r-- | src/mir_core/src/mir_core64.def | 21 | ||||
-rw-r--r-- | src/mir_core/src/ui_utils.cpp | 83 |
3 files changed, 119 insertions, 6 deletions
diff --git a/src/mir_core/src/mir_core.def b/src/mir_core/src/mir_core.def index 435036b9b4..1c291ab133 100644 --- a/src/mir_core/src/mir_core.def +++ b/src/mir_core/src/mir_core.def @@ -1008,6 +1008,25 @@ db_delete_module @1161 ??4CCtrlSpin@@QAEAAV0@ABV0@@Z @1165 NONAME
??_7CCtrlSpin@@6B@ @1166 NONAME
?SetMaxLength@CCtrlEdit@@QAEXI@Z @1167 NONAME
-?SetRange@CCtrlSpin@@QAEXFF@Z @1168 NONAME
+?SetRange@CCtrlSpin@@QAEXGG@Z @1168 NONAME
db_get_current @1169
CallFunctionSync @1170
+??0CProgress@@QAE@ABV0@@Z @1171 NONAME
+??0CProgress@@QAE@PAVCDlgBase@@H@Z @1172 NONAME
+??0CTimer@@QAE@ABV0@@Z @1173 NONAME
+??0CTimer@@QAE@PAVCDlgBase@@H@Z @1174 NONAME
+??1CProgress@@UAE@XZ @1175 NONAME
+??4CProgress@@QAEAAV0@ABV0@@Z @1176 NONAME
+??4CTimer@@QAEAAV0@ABV0@@Z @1177 NONAME
+??_7CProgress@@6B@ @1178 NONAME
+??_7CTimer@@6B@ @1179 NONAME
+?FindTimer@CDlgBase@@AAEPAVCTimer@@H@Z @1180 NONAME
+?GetEventId@CTimer@@QBEHXZ @1181 NONAME
+?Move@CProgress@@QAEGG@Z @1182 NONAME
+?OnTimer@CDlgBase@@MAEXPAVCTimer@@@Z @1183 NONAME
+?OnTimer@CTimer@@UAEHXZ @1184 NONAME
+?SetPosition@CProgress@@QAEXG@Z @1185 NONAME
+?SetRange@CProgress@@QAEXGG@Z @1186 NONAME
+?SetStep@CProgress@@QAEXG@Z @1187 NONAME
+?Start@CTimer@@QAEXH@Z @1188 NONAME
+?Stop@CTimer@@QAEXXZ @1189 NONAME
diff --git a/src/mir_core/src/mir_core64.def b/src/mir_core/src/mir_core64.def index f08ff49cdf..d2662a7730 100644 --- a/src/mir_core/src/mir_core64.def +++ b/src/mir_core/src/mir_core64.def @@ -1008,6 +1008,25 @@ db_delete_module @1161 ??4CCtrlSpin@@QEAAAEAV0@AEBV0@@Z @1165 NONAME
??_7CCtrlSpin@@6B@ @1166 NONAME
?SetMaxLength@CCtrlEdit@@QEAAXI@Z @1167 NONAME
-?SetRange@CCtrlSpin@@QEAAXFF@Z @1168 NONAME
+?SetRange@CCtrlSpin@@QEAAXGG@Z @1168 NONAME
db_get_current @1169
CallFunctionSync @1170
+??0CProgress@@QEAA@AEBV0@@Z @1171 NONAME
+??0CProgress@@QEAA@PEAVCDlgBase@@H@Z @1172 NONAME
+??0CTimer@@QEAA@AEBV0@@Z @1173 NONAME
+??0CTimer@@QEAA@PEAVCDlgBase@@H@Z @1174 NONAME
+??1CProgress@@UEAA@XZ @1175 NONAME
+??4CProgress@@QEAAAEAV0@AEBV0@@Z @1176 NONAME
+??4CTimer@@QEAAAEAV0@AEBV0@@Z @1177 NONAME
+??_7CProgress@@6B@ @1178 NONAME
+??_7CTimer@@6B@ @1179 NONAME
+?FindTimer@CDlgBase@@AEAAPEAVCTimer@@H@Z @1180 NONAME
+?GetEventId@CTimer@@QEBAHXZ @1181 NONAME
+?Move@CProgress@@QEAAGG@Z @1182 NONAME
+?OnTimer@CDlgBase@@MEAAXPEAVCTimer@@@Z @1183 NONAME
+?OnTimer@CTimer@@UEAAHXZ @1184 NONAME
+?SetPosition@CProgress@@QEAAXG@Z @1185 NONAME
+?SetRange@CProgress@@QEAAXGG@Z @1186 NONAME
+?SetStep@CProgress@@QEAAXG@Z @1187 NONAME
+?Start@CTimer@@QEAAXH@Z @1188 NONAME
+?Stop@CTimer@@QEAAXXZ @1189 NONAME
diff --git a/src/mir_core/src/ui_utils.cpp b/src/mir_core/src/ui_utils.cpp index 7c354bad0a..5e58783be2 100644 --- a/src/mir_core/src/ui_utils.cpp +++ b/src/mir_core/src/ui_utils.cpp @@ -40,12 +40,22 @@ static LIST<CCtrlBase> arControls(10, CompareControls); #pragma comment(lib, "uxtheme")
+/////////////////////////////////////////////////////////////////////////////////////////
+// CDlgBase
+
static int CompareControlId(const CCtrlBase *c1, const CCtrlBase *c2)
-{ return c1->GetCtrlId() - c2->GetCtrlId();
+{
+ return c1->GetCtrlId() - c2->GetCtrlId();
+}
+
+static int CompareTimerId(const CTimer *t1, const CTimer *t2)
+{
+ return t1->GetEventId() - t2->GetEventId();
}
CDlgBase::CDlgBase(HINSTANCE hInst, int idDialog)
- : m_controls(1, CompareControlId)
+ : m_controls(1, CompareControlId),
+ m_timers(1, CompareTimerId)
{
m_hInst = hInst;
m_idDialog = idDialog;
@@ -198,6 +208,11 @@ INT_PTR CDlgBase::DlgProc(UINT msg, WPARAM wParam, LPARAM lParam) Utils_ResizeDialog(m_hwnd, m_hInst, MAKEINTRESOURCEA(m_idDialog), GlobalDlgResizer);
return TRUE;
+ case WM_TIMER:
+ if (CTimer *timer = FindTimer(wParam))
+ return timer->OnTimer();
+ return FALSE;
+
case WM_CLOSE:
m_lresult = FALSE;
OnClose();
@@ -273,6 +288,12 @@ CCtrlBase* CDlgBase::FindControl(int idCtrl) return m_controls.find(&search);
}
+CTimer* CDlgBase::FindTimer(int idEvent)
+{
+ CTimer search(NULL, idEvent);
+ return m_timers.find(&search);
+}
+
CDlgBase* CDlgBase::Find(HWND hwnd)
{
PVOID bullshit[2]; // vfptr + hwnd
@@ -609,7 +630,7 @@ CCtrlSpin::CCtrlSpin(CDlgBase* dlg, int ctrlId) : CCtrlBase(dlg, ctrlId)
{}
-void CCtrlSpin::SetRange(short min, short max)
+void CCtrlSpin::SetRange(WORD max, WORD min)
{
SendMsg(UDM_SETRANGE, 0, MAKELONG(min, max));
}
@@ -712,6 +733,60 @@ BOOL CCtrlHyperlink::OnCommand(HWND, WORD, WORD) }
/////////////////////////////////////////////////////////////////////////////////////////
+// CTimer
+
+CTimer::CTimer(CDlgBase *wnd, int idEvent)
+ : m_wnd(wnd), m_idEvent(idEvent)
+{
+}
+
+BOOL CTimer::OnTimer()
+{
+ OnEvent(this);
+ return FALSE;
+}
+
+void CTimer::Start(int elapse)
+{
+ SetTimer(m_wnd->GetHwnd(), m_idEvent, elapse, NULL);
+}
+
+void CTimer::Stop()
+{
+ KillTimer(m_wnd->GetHwnd(), m_idEvent);
+}
+
+/////////////////////////////////////////////////////////////////////////////////////////
+// CProgress
+
+CProgress::CProgress(CDlgBase *wnd, int idCtrl)
+ : CCtrlBase(wnd, idCtrl)
+{
+}
+
+void CProgress::SetRange(WORD max, WORD min)
+{
+ SendMsg(PBM_SETRANGE, 0, MAKELPARAM(min, max));
+}
+
+void CProgress::SetPosition(WORD value)
+{
+ SendMsg(PBM_SETPOS, value, 0);
+}
+
+void CProgress::SetStep(WORD value)
+{
+ SendMsg(PBM_SETSTEP, value, 0);
+}
+
+WORD CProgress::Move(WORD delta)
+{
+ return delta == 0
+ ? SendMsg(PBM_STEPIT, 0, 0)
+ : SendMsg(PBM_DELTAPOS, delta, 0);
+}
+
+/////////////////////////////////////////////////////////////////////////////////////////
// CCtrlClc
CCtrlClc::CCtrlClc(CDlgBase* dlg, int ctrlId)
: CCtrlBase(dlg, ctrlId)
@@ -2539,4 +2614,4 @@ wchar_t* CDbLink::LoadText() void CDbLink::SaveText(wchar_t *value)
{
db_set_ws(NULL, m_szModule, m_szSetting, value);
-}
+}
\ No newline at end of file |