2016-01-27 09:11:59 +00:00
|
|
|
#pragma once
|
|
|
|
|
|
|
|
class CModifiedButton :
|
|
|
|
public CButton
|
|
|
|
{
|
|
|
|
bool m_Changed;
|
|
|
|
bool m_Reset;
|
|
|
|
HFONT m_BoldFont;
|
|
|
|
HFONT m_OriginalFont;
|
|
|
|
|
|
|
|
|
|
|
|
public:
|
|
|
|
// Constructors
|
2021-04-12 11:35:39 +00:00
|
|
|
CModifiedButton(HWND hWnd = nullptr) :
|
2016-01-27 09:11:59 +00:00
|
|
|
CButton(hWnd),
|
|
|
|
m_Changed(false),
|
|
|
|
m_Reset(false),
|
2021-04-12 11:35:39 +00:00
|
|
|
m_BoldFont(nullptr),
|
|
|
|
m_OriginalFont(nullptr)
|
2016-01-27 09:11:59 +00:00
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
~CModifiedButton()
|
|
|
|
{
|
|
|
|
if (m_BoldFont)
|
|
|
|
{
|
|
|
|
DeleteObject(m_BoldFont);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
void SetReset (bool Reset)
|
|
|
|
{
|
|
|
|
m_Reset = Reset;
|
|
|
|
if (m_Reset)
|
|
|
|
{
|
|
|
|
SetChanged(false);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
void SetChanged (bool Changed)
|
|
|
|
{
|
|
|
|
m_Changed = Changed;
|
|
|
|
if (m_Changed)
|
|
|
|
{
|
|
|
|
SetReset(false);
|
2021-04-12 11:35:39 +00:00
|
|
|
if (m_BoldFont == nullptr)
|
2016-01-27 09:11:59 +00:00
|
|
|
{
|
|
|
|
m_OriginalFont = (HFONT)SendMessage(WM_GETFONT);
|
|
|
|
|
|
|
|
LOGFONT lfSystemVariableFont;
|
|
|
|
GetObject ( m_OriginalFont, sizeof(LOGFONT), &lfSystemVariableFont );
|
|
|
|
lfSystemVariableFont.lfWeight = FW_BOLD;
|
|
|
|
|
|
|
|
m_BoldFont = CreateFontIndirect ( &lfSystemVariableFont );
|
|
|
|
}
|
|
|
|
SendMessage(WM_SETFONT,(WPARAM)m_BoldFont);
|
2021-04-12 11:35:39 +00:00
|
|
|
InvalidateRect(nullptr);
|
2016-01-27 09:11:59 +00:00
|
|
|
} else {
|
|
|
|
if (m_OriginalFont)
|
|
|
|
{
|
|
|
|
SendMessage(WM_SETFONT,(WPARAM)m_OriginalFont);
|
2021-04-12 11:35:39 +00:00
|
|
|
InvalidateRect(nullptr);
|
2016-01-27 09:11:59 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
inline bool IsChanged ( void ) const
|
|
|
|
{
|
|
|
|
return m_Changed;
|
|
|
|
}
|
|
|
|
inline bool IsReset ( void ) const
|
|
|
|
{
|
|
|
|
return m_Reset;
|
|
|
|
}
|
|
|
|
};
|