From b58fa04b8dc505c6d45100ccf772464a4b619df5 Mon Sep 17 00:00:00 2001 From: George Hazan Date: Thu, 22 Sep 2016 09:08:46 +0000 Subject: UI utils: - added class CProgress; - added class CTimer; git-svn-id: http://svn.miranda-ng.org/main/trunk@17331 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c --- include/m_gui.h | 46 +++++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 45 insertions(+), 1 deletion(-) (limited to 'include') diff --git a/include/m_gui.h b/include/m_gui.h index ffc80b1bfd..916e0a4038 100644 --- a/include/m_gui.h +++ b/include/m_gui.h @@ -371,6 +371,7 @@ public: class MIR_CORE_EXPORT CDlgBase { + friend class CTimer; friend class CCtrlBase; friend class CCtrlData; @@ -415,6 +416,8 @@ protected: virtual void OnClose() { } virtual void OnDestroy() { } + virtual void OnTimer(CTimer*) {} + // miranda-related stuff virtual int Resizer(UTILRESIZECONTROL *urc); virtual void OnApply() {} @@ -431,15 +434,42 @@ protected: void ThemeDialogBackground(BOOL tabbed); private: + LIST m_timers; LIST m_controls; void NotifyControls(void (CCtrlBase::*fn)()); CCtrlBase *FindControl(int idCtrl); + CTimer* FindTimer(int idEvent); + static INT_PTR CALLBACK GlobalDlgProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam); static int GlobalDlgResizer(HWND hwnd, LPARAM lParam, UTILRESIZECONTROL *urc); }; +///////////////////////////////////////////////////////////////////////////////////////// +// CTimer + +class MIR_CORE_EXPORT CTimer +{ + friend class CDlgBase; + +public: + CTimer(CDlgBase* wnd, int idEvent); + + __forceinline int GetEventId() const { return m_idEvent; } + + virtual BOOL OnTimer(); + + void Start(int elapse); + void Stop(); + + CCallback OnEvent; + +protected: + int m_idEvent; + CDlgBase* m_wnd; +}; + ///////////////////////////////////////////////////////////////////////////////////////// // CCtrlBase @@ -555,6 +585,20 @@ protected: const char* m_url; }; +///////////////////////////////////////////////////////////////////////////////////////// +// CProgress + +class MIR_CORE_EXPORT CProgress : public CCtrlBase +{ +public: + CProgress(CDlgBase *dlg, int ctrlId); + + void SetRange(WORD max, WORD min = 0); + void SetPosition(WORD value); + void SetStep(WORD value); + WORD Move(WORD delta = 0); +}; + ///////////////////////////////////////////////////////////////////////////////////////// // CCtrlClc @@ -711,7 +755,7 @@ class MIR_CORE_EXPORT CCtrlSpin : public CCtrlBase public: CCtrlSpin(CDlgBase *dlg, int ctrlId); - void SetRange(short min, short max); + void SetRange(WORD max, WORD min = 0); }; ///////////////////////////////////////////////////////////////////////////////////////// -- cgit v1.2.3