2016-01-27 09:11:59 +00:00
|
|
|
#pragma once
|
|
|
|
|
|
|
|
#include <wtl/atlctrls.h>
|
2020-04-08 11:44:49 +00:00
|
|
|
#include "DisplayMode.h"
|
2016-01-27 09:11:59 +00:00
|
|
|
|
2017-11-21 20:37:45 +00:00
|
|
|
class CEditNumber32 :
|
|
|
|
public CWindowImpl<CEditNumber32, CEdit>
|
2016-01-27 09:11:59 +00:00
|
|
|
{
|
|
|
|
public:
|
2017-11-21 07:09:50 +00:00
|
|
|
enum DisplayType
|
|
|
|
{
|
|
|
|
DisplayHex,
|
|
|
|
DisplayDec,
|
|
|
|
};
|
2016-01-27 09:11:59 +00:00
|
|
|
|
2017-11-21 20:37:45 +00:00
|
|
|
CEditNumber32(void);
|
|
|
|
virtual ~CEditNumber32(void);
|
|
|
|
|
|
|
|
BOOL Attach(HWND hWndNew);
|
|
|
|
BOOL AttachToDlgItem(HWND parent, UINT dlgID);
|
|
|
|
void SetDisplayType(DisplayType Type);
|
|
|
|
uint32_t GetValue(void);
|
2020-04-09 05:39:31 +00:00
|
|
|
stdstr GetValueText(void);
|
2020-04-08 11:44:49 +00:00
|
|
|
void SetValue(uint32_t Value, DisplayMode Display = DisplayMode::ShowHexIdent);
|
2017-11-21 20:37:45 +00:00
|
|
|
|
2016-01-27 09:11:59 +00:00
|
|
|
protected:
|
2017-11-21 07:09:50 +00:00
|
|
|
enum
|
|
|
|
{
|
|
|
|
WM_VALIDATE_VALUE = WM_USER + 0x97
|
|
|
|
};
|
2016-01-27 09:11:59 +00:00
|
|
|
|
2017-11-21 07:09:50 +00:00
|
|
|
DisplayType m_DisplayType;
|
2016-01-27 09:11:59 +00:00
|
|
|
|
2017-11-21 20:37:45 +00:00
|
|
|
BEGIN_MSG_MAP(CEditNumber32)
|
2017-11-21 07:09:50 +00:00
|
|
|
MESSAGE_HANDLER(WM_CHAR, OnKeyDown)
|
|
|
|
MESSAGE_HANDLER(WM_KEYDOWN, OnKeyDown)
|
|
|
|
MESSAGE_HANDLER(WM_PASTE, OnPaste)
|
|
|
|
MESSAGE_HANDLER(WM_VALIDATE_VALUE, OnValidateValue);
|
|
|
|
END_MSG_MAP()
|
2016-01-27 09:11:59 +00:00
|
|
|
|
2017-11-21 07:09:50 +00:00
|
|
|
bool IsHexConvertableText(LPTSTR _text);
|
|
|
|
void FormatClipboard();
|
2016-01-27 09:11:59 +00:00
|
|
|
|
2017-11-21 20:37:45 +00:00
|
|
|
LRESULT OnValidateValue(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled);
|
|
|
|
LRESULT OnPaste(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled);
|
2017-11-21 07:09:50 +00:00
|
|
|
LRESULT OnKeyDown(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled);
|
2016-01-27 09:11:59 +00:00
|
|
|
};
|