project64/Source/Project64/UserInterface/WTLControls/ModifiedCheckBox.h

77 lines
1.6 KiB
C
Raw Normal View History

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