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>
200 lines
4.8 KiB
C++
200 lines
4.8 KiB
C++
#include "userlist.h"
|
|
|
|
char g_UserInfoField[4][20] = { "UID", "Char1", "Char2", "Char3" };
|
|
|
|
CUserList::CUserList()
|
|
{
|
|
CGameDBToolApp* pAppWnd = (CGameDBToolApp*)AfxGetApp();
|
|
HICON hIcon;
|
|
|
|
m_ImageList.Create(16, 16, ILC_COLORDDB | ILC_MASK, 1, 0);
|
|
|
|
hIcon = pAppWnd->LoadIcon(IDI_ADMIN);
|
|
m_AdminIndex = m_ImageList.Add(hIcon);
|
|
|
|
hIcon = pAppWnd->LoadIcon(IDI_USER);
|
|
m_UserIndex = m_ImageList.Add(hIcon);
|
|
|
|
DestroyIcon(hIcon);
|
|
}
|
|
|
|
CUserList::~CUserList()
|
|
{
|
|
}
|
|
|
|
|
|
BEGIN_MESSAGE_MAP(CUserList, CListCtrl)
|
|
//{{AFX_MSG_MAP(CUserList)
|
|
ON_NOTIFY_REFLECT(NM_CUSTOMDRAW, OnCustomDraw)
|
|
ON_NOTIFY_REFLECT(LVN_ENDLABELEDIT, OnEndLableEdit)
|
|
ON_WM_LBUTTONDBLCLK()
|
|
ON_WM_HSCROLL()
|
|
ON_WM_VSCROLL()
|
|
//}}AFX_MSG_MAP
|
|
END_MESSAGE_MAP()
|
|
|
|
void CUserList::OnCustomDraw(NMHDR* pNMHDR, LRESULT* pResult)
|
|
{
|
|
CListViewControl::OnCustomDraw(pNMHDR, pResult);
|
|
}
|
|
|
|
void CUserList::OnEndLableEdit(NMHDR* pNMHDR, LRESULT* pResult)
|
|
{
|
|
CListViewControl::OnEndLableEdit(pNMHDR, pResult);
|
|
}
|
|
|
|
void CUserList::OnLButtonDblClk(UINT nFlags, CPoint point)
|
|
{
|
|
CListViewControl::OnLButtonDblClk(nFlags, point);
|
|
}
|
|
|
|
void CUserList::OnHScroll(UINT nSBCode, UINT nPos, CScrollBar* pScrollBar)
|
|
{
|
|
// TODO: Add your message handler code here and/or call default
|
|
|
|
CListViewControl::OnHScroll(nSBCode, nPos, pScrollBar);
|
|
}
|
|
|
|
void CUserList::OnVScroll(UINT nSBCode, UINT nPos, CScrollBar* pScrollBar)
|
|
{
|
|
// TODO: Add your message handler code here and/or call default
|
|
|
|
CListViewControl::OnVScroll(nSBCode, nPos, pScrollBar);
|
|
}
|
|
|
|
//Interface////////////////////////////////////////////////////////////////////////////////////
|
|
//
|
|
// SetColumn [ public ]
|
|
// - 테이블 컬럼 세팅
|
|
//
|
|
// Parameter :
|
|
// 1st : 컬럼 정보
|
|
//
|
|
// Return:
|
|
// 성공시 true
|
|
//
|
|
///////////////////////////////////////////////////////////////////////////////////////////////
|
|
bool CUserList::SetColumn(void)
|
|
{
|
|
DWORD ExStyle = LVS_EX_FLATSB | LVS_EX_FULLROWSELECT | LVS_EX_GRIDLINES;
|
|
SendMessage(LVM_SETEXTENDEDLISTVIEWSTYLE, 0, ExStyle);
|
|
|
|
DWORD Style = GetWindowLong(m_hWnd, GWL_STYLE);
|
|
Style |= LVS_EDITLABELS;
|
|
|
|
if (!SetWindowLong(m_hWnd, GWL_STYLE, Style))
|
|
return false;
|
|
|
|
CStringList StringList;
|
|
int IndexCounter = 0;
|
|
|
|
SetColumnType(0, CT_NORMAL);
|
|
InsertColumn(0, g_UserInfoField[0], LVCFMT_CENTER, 4 * 20 + 10);
|
|
|
|
SetColumnType(1, CT_EDIT);
|
|
InsertColumn(1, g_UserInfoField[1], LVCFMT_CENTER, 4 * 20 + 10);
|
|
|
|
SetColumnType(2, CT_EDIT);
|
|
InsertColumn(2, g_UserInfoField[2], LVCFMT_CENTER, 4 * 20 + 10);
|
|
|
|
SetColumnType(3, CT_EDIT);
|
|
InsertColumn(3, g_UserInfoField[3], LVCFMT_CENTER, 4 * 20 + 10);
|
|
|
|
SetColumnType(4, CT_EDIT);
|
|
InsertColumn(4, g_UserInfoField[4], LVCFMT_CENTER, 4 * 20 + 10);
|
|
|
|
SetColumnType(5, CT_EDIT);
|
|
InsertColumn(5, g_UserInfoField[5], LVCFMT_CENTER, 4 * 20 + 10);
|
|
|
|
SetImageList(&m_ImageList, LVSIL_SMALL);
|
|
|
|
return true;
|
|
}
|
|
|
|
//Interface////////////////////////////////////////////////////////////////////////////////////
|
|
//
|
|
// AddUserRow [ public ]
|
|
// - 줄 추가
|
|
//
|
|
// Parameter :
|
|
// 1st : 컬럼 정보
|
|
//
|
|
// Return:
|
|
// 성공시 true
|
|
//
|
|
///////////////////////////////////////////////////////////////////////////////////////////////
|
|
bool CUserList::AddUserRow(unsigned long dwUID, USER_INFO* UserTable_In, bool Admin)
|
|
{
|
|
CString strItem;
|
|
int Counter = 1;
|
|
int Index;
|
|
|
|
LVITEM Item = {0,};
|
|
|
|
Index = GetItemCount();
|
|
|
|
strItem.Format("%d", dwUID);
|
|
|
|
Item.mask = TVIF_TEXT | TVIF_IMAGE;
|
|
|
|
Item.iItem = Index;
|
|
Item.iSubItem = 0;
|
|
|
|
Item.pszText = strItem.GetBuffer(0);
|
|
Item.cchTextMax = strItem.GetLength();
|
|
|
|
Item.iImage = m_UserIndex;
|
|
Item.lParam = NULL;
|
|
|
|
if(Admin)
|
|
{
|
|
Item.iImage = m_AdminIndex;
|
|
}
|
|
else
|
|
Item.iImage = m_UserIndex;
|
|
|
|
// 유저 아이디
|
|
InsertItem(&Item);
|
|
|
|
// 캐릭터 1
|
|
strItem.Format("%d", UserTable_In->CharID[0]);
|
|
SetItemText(Index, Counter++, strItem);
|
|
|
|
// 캐릭터 2
|
|
strItem.Format("%d", UserTable_In->CharID[1]);
|
|
SetItemText(Index, Counter++, strItem);
|
|
|
|
// 캐릭터 3
|
|
strItem.Format("%d", UserTable_In->CharID[2]);
|
|
SetItemText(Index, Counter++, strItem);
|
|
|
|
// 캐릭터 4
|
|
strItem.Format("%d", UserTable_In->CharID[3]);
|
|
SetItemText(Index, Counter++, strItem);
|
|
|
|
// 캐릭터 4
|
|
strItem.Format("%d", UserTable_In->CharID[4]);
|
|
SetItemText(Index, Counter++, strItem);
|
|
|
|
return true;
|
|
}
|
|
|
|
bool CUserList::GetUserRow(unsigned long Item_In, unsigned long& dwUID, USER_INFO* UserTable_Out)
|
|
{
|
|
char strItemText[256];
|
|
|
|
GetItemText(Item_In, 0, strItemText, 256);
|
|
dwUID = atoi(strItemText);
|
|
GetItemText(Item_In, 1, strItemText, 256);
|
|
UserTable_Out->CharID[0] = atoi(strItemText);
|
|
GetItemText(Item_In, 2, strItemText, 256);
|
|
UserTable_Out->CharID[1] = atoi(strItemText);
|
|
GetItemText(Item_In, 3, strItemText, 256);
|
|
UserTable_Out->CharID[2] = atoi(strItemText);
|
|
GetItemText(Item_In, 4, strItemText, 256);
|
|
UserTable_Out->CharID[3] = atoi(strItemText);
|
|
GetItemText(Item_In, 5, strItemText, 256);
|
|
UserTable_Out->CharID[4] = atoi(strItemText);
|
|
|
|
return true;
|
|
} |