timeedit.h

来自「管理项目进度工具的原代码」· C头文件 代码 · 共 66 行

H
66
字号
// TimeEdit.h: interface for the CTimeEdit class.
//
//////////////////////////////////////////////////////////////////////

#if !defined(AFX_TIMEEDIT_H__2CCFE44D_9578_4E38_B2BF_091C172C85A5__INCLUDED_)
#define AFX_TIMEEDIT_H__2CCFE44D_9578_4E38_B2BF_091C172C85A5__INCLUDED_

#if _MSC_VER > 1000
#pragma once
#endif // _MSC_VER > 1000

#include "enedit.h"
#include "timehelper.h"

const UINT WM_TEN_UNITSCHANGE = ::RegisterWindowMessage("WM_TEN_UNITSCHANGE"); // wParam == <CtrlID>, lParam = <prev units>

class CTimeEdit : public CEnEdit, public CTimeHelper
{
public:
	CTimeEdit(int nUnits = THU_HOURS, int nMaxDecPlaces = 9);
	virtual ~CTimeEdit();

	double GetTime() const;
	double GetTime(int nUnits) const;

	void SetTime(double dTime);
	void SetTime(double dTime, int nUnits);

	inline int GetUnits() const { return m_nUnits; }
	void SetUnits(int nUnits);

	inline int GetMaxDecimalPlaces() const { return m_nMaxDecPlaces; }
	void SetMaxDecimalPlaces(int nMaxDecPlaces);

	CString FormatTimeHMS() const; 
	CString FormatTime(BOOL bUnits) const; 

	static void SetUnits(int nUnits, LPCTSTR szLongUnits, LPCTSTR szAbbrevUnits);

protected:
	int m_nUnits, m_nMaxDecPlaces;

protected:
// Overrides
	// ClassWizard generated virtual function overrides
	//{{AFX_VIRTUAL(CTimeEdit)
	//}}AFX_VIRTUAL
	virtual void PreSubclassWindow();
	virtual void OnBtnClick(UINT nID);
	virtual void OnSetReadOnly(BOOL bReadOnly);
//	virtual void DrawButton(CDC* pDC, const CRect& rWindow, int nBtn, const CPoint& ptCursor) const;

// Implementation

	// Generated message map functions
protected:
	//{{AFX_MSG(CTimeEdit)
	//}}AFX_MSG

	DECLARE_MESSAGE_MAP()

	static void RemoveTrailingZeros(CString& sTime);
};

#endif // !defined(AFX_TIMEEDIT_H__2CCFE44D_9578_4E38_B2BF_091C172C85A5__INCLUDED_)

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?