Files
Client/GameTools/EffectEditor/CusEdit.cpp
LGram16 dd97ddec92 Restructure repository to include all source folders
Move git root from Client/ to src/ to track all source code:
- Client: Game client source (moved to Client/Client/)
- Server: Game server source
- GameTools: Development tools
- CryptoSource: Encryption utilities
- database: Database scripts
- Script: Game scripts
- rylCoder_16.02.2008_src: Legacy coder tools
- GMFont, Game: Additional resources

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-11-29 20:17:20 +09:00

145 lines
2.5 KiB
C++

// CusEdit.cpp : implementation file
//
#include "stdafx.h"
#include "effectEditor.h"
#include "CusEdit.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
/////////////////////////////////////////////////////////////////////////////
// CCusEdit
CCusEdit::CCusEdit()
{
m_br = NULL;
}
CCusEdit::~CCusEdit()
{
if(m_br) DeleteObject(m_br);
}
BEGIN_MESSAGE_MAP(CCusEdit, CEdit)
//{{AFX_MSG_MAP(CCusEdit)
ON_WM_CTLCOLOR_REFLECT()
ON_WM_SETFOCUS()
ON_WM_KILLFOCUS()
//}}AFX_MSG_MAP
END_MESSAGE_MAP()
/////////////////////////////////////////////////////////////////////////////
// CCusEdit message handlers
HBRUSH CCusEdit::CtlColor(CDC* pDC, UINT nCtlColor)
{
if(m_bEnableBkColor)
{
pDC->SetBkColor(m_BkABGR);
pDC->SetTextColor(m_TextABGR);
return m_br;
}
return NULL;
}
void CCusEdit::OnSetFocus(CWnd* pOldWnd)
{
CEdit::OnSetFocus(pOldWnd);
// TODO: Add your message handler code here
Invalidate();
}
void CCusEdit::OnKillFocus(CWnd* pNewWnd)
{
CEdit::OnKillFocus(pNewWnd);
// TODO: Add your message handler code here
Invalidate();
}
void CCusEdit::SetBkColor(COLORREF BkABGR, COLORREF TextABGR)
{
if(m_br) DeleteObject(m_br);
m_br = CreateSolidBrush(BkABGR);
m_BkABGR = BkABGR;
m_TextABGR = TextABGR;
m_bEnableBkColor = TRUE;
}
void CCusEdit::DisableBkColor(void)
{
m_bEnableBkColor = FALSE;
}
void CCusEdit::SetValue(float fValue)
{
char strChar[256];
sprintf(strChar, "%f", fValue);
SetWindowText(strChar);
}
void CCusEdit::SetValue(unsigned char cValue)
{
char strChar[256];
sprintf(strChar, "%d", cValue);
SetWindowText(strChar);
}
void CCusEdit::SetValue(unsigned long dwValue)
{
char strChar[256];
sprintf(strChar, "%u", dwValue);
SetWindowText(strChar);
}
CCusEdit::operator float(void) const
{
CString strValue;
GetWindowText(strValue);
return (float)atof(strValue.GetBuffer(0));
}
CCusEdit::operator unsigned char(void) const
{
CString strValue;
GetWindowText(strValue);
return (unsigned char)atof(strValue.GetBuffer(0));
}
CCusEdit::operator unsigned long(void) const
{
CString strValue;
GetWindowText(strValue);
return (unsigned long)atof(strValue.GetBuffer(0));
}
CCusEdit::operator const char *(void) const
{
CString strValue;
GetWindowText(strValue);
return (const char *)strValue;
}
void CCusEdit::operator=(float const &rhs)
{
char strChar[256];
sprintf(strChar, "%f", rhs);
SetWindowText(strChar);
}
void CCusEdit::operator=(unsigned char const &rhs)
{
char strChar[256];
sprintf(strChar, "%d", rhs);
SetWindowText(strChar);
}