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>
This commit is contained in:
127
Server/ToolProject/AuthDBManager/ListViewControl/InPlaceEdit.cpp
Normal file
127
Server/ToolProject/AuthDBManager/ListViewControl/InPlaceEdit.cpp
Normal file
@@ -0,0 +1,127 @@
|
||||
#include "InPlaceEdit.h"
|
||||
|
||||
CInPlaceEdit::CInPlaceEdit(int iItem, int iSubItem, CString sInitText) :m_sInitText( sInitText )
|
||||
{
|
||||
m_iItem = iItem;
|
||||
m_iSubItem = iSubItem;
|
||||
m_bESC = FALSE;
|
||||
}
|
||||
|
||||
CInPlaceEdit::~CInPlaceEdit()
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
BEGIN_MESSAGE_MAP(CInPlaceEdit, CEdit)
|
||||
//{{AFX_MSG_MAP(CInPlaceEdit)
|
||||
ON_WM_KILLFOCUS()
|
||||
ON_WM_NCDESTROY()
|
||||
ON_WM_CHAR()
|
||||
ON_WM_CREATE()
|
||||
//}}AFX_MSG_MAP
|
||||
END_MESSAGE_MAP()
|
||||
|
||||
BOOL CInPlaceEdit::PreTranslateMessage(MSG* pMsg)
|
||||
{
|
||||
if(pMsg->message == WM_KEYDOWN)
|
||||
{
|
||||
if(pMsg->wParam == VK_RETURN || pMsg->wParam == VK_DELETE || pMsg->wParam == VK_ESCAPE || GetKeyState(VK_CONTROL))
|
||||
{
|
||||
::TranslateMessage(pMsg);
|
||||
::DispatchMessage(pMsg);
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
}
|
||||
|
||||
return CEdit::PreTranslateMessage(pMsg);
|
||||
}
|
||||
|
||||
|
||||
void CInPlaceEdit::OnKillFocus(CWnd* pNewWnd)
|
||||
{
|
||||
CEdit::OnKillFocus(pNewWnd);
|
||||
|
||||
CString str;
|
||||
GetWindowText(str);
|
||||
|
||||
LV_DISPINFO dispinfo;
|
||||
dispinfo.hdr.hwndFrom = GetParent()->m_hWnd;
|
||||
dispinfo.hdr.idFrom = GetDlgCtrlID();
|
||||
dispinfo.hdr.code = LVN_ENDLABELEDIT;
|
||||
|
||||
dispinfo.item.mask = LVIF_TEXT;
|
||||
dispinfo.item.iItem = m_iItem;
|
||||
dispinfo.item.iSubItem = m_iSubItem;
|
||||
dispinfo.item.pszText = m_bESC ? NULL : LPTSTR((LPCTSTR)str);
|
||||
dispinfo.item.cchTextMax = str.GetLength();
|
||||
|
||||
GetParent()->GetParent()->SendMessage(WM_NOTIFY, GetParent()->GetDlgCtrlID(), (LPARAM)&dispinfo);
|
||||
|
||||
DestroyWindow();
|
||||
}
|
||||
|
||||
void CInPlaceEdit::OnNcDestroy()
|
||||
{
|
||||
CEdit::OnNcDestroy();
|
||||
|
||||
delete this;
|
||||
}
|
||||
|
||||
|
||||
void CInPlaceEdit::OnChar(UINT nChar, UINT nRepCnt, UINT nFlags)
|
||||
{
|
||||
if(nChar == VK_ESCAPE || nChar == VK_RETURN)
|
||||
{
|
||||
if(nChar == VK_ESCAPE)
|
||||
m_bESC = TRUE;
|
||||
|
||||
GetParent()->SetFocus();
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
CEdit::OnChar(nChar, nRepCnt, nFlags);
|
||||
|
||||
CString str;
|
||||
|
||||
GetWindowText(str);
|
||||
CWindowDC dc(this);
|
||||
CFont *pFont = GetParent()->GetFont();
|
||||
CFont *pFontDC = dc.SelectObject(pFont);
|
||||
CSize size = dc.GetTextExtent(str);
|
||||
dc.SelectObject(pFontDC);
|
||||
size.cx += 5;
|
||||
|
||||
CRect rect, parentrect;
|
||||
GetClientRect(&rect);
|
||||
GetParent()->GetClientRect(&parentrect);
|
||||
|
||||
ClientToScreen(&rect);
|
||||
GetParent()->ScreenToClient(&rect);
|
||||
|
||||
if(size.cx > rect.Width())
|
||||
{
|
||||
if(size.cx + rect.left < parentrect.right)
|
||||
rect.right = rect.left + size.cx;
|
||||
else
|
||||
rect.right = parentrect.right;
|
||||
|
||||
MoveWindow(&rect);
|
||||
}
|
||||
}
|
||||
|
||||
int CInPlaceEdit::OnCreate(LPCREATESTRUCT lpCreateStruct)
|
||||
{
|
||||
if(CEdit::OnCreate(lpCreateStruct) == -1)
|
||||
return -1;
|
||||
|
||||
CFont* font = GetParent()->GetFont();
|
||||
SetFont(font);
|
||||
|
||||
SetWindowText(m_sInitText);
|
||||
SetFocus();
|
||||
SetSel(0, -1);
|
||||
|
||||
return 0;
|
||||
}
|
||||
@@ -0,0 +1,40 @@
|
||||
#include <afxcmn.h> // MFC support for Windows Common Controls
|
||||
|
||||
class CInPlaceEdit : public CEdit
|
||||
{
|
||||
public:
|
||||
CInPlaceEdit(int iItem, int iSubItem, CString sInitText);
|
||||
|
||||
// Overrides
|
||||
// ClassWizard generated virtual function overrides
|
||||
//{{AFX_VIRTUAL(CInPlaceEdit)
|
||||
public:
|
||||
virtual BOOL PreTranslateMessage(MSG* pMsg);
|
||||
//}}AFX_VIRTUAL
|
||||
|
||||
// Implementation
|
||||
public:
|
||||
virtual ~CInPlaceEdit();
|
||||
|
||||
// Generated message map functions
|
||||
protected:
|
||||
//{{AFX_MSG(CInPlaceEdit)
|
||||
afx_msg void OnKillFocus(CWnd* pNewWnd);
|
||||
afx_msg void OnNcDestroy();
|
||||
afx_msg void OnChar(UINT nChar, UINT nRepCnt, UINT nFlags);
|
||||
afx_msg int OnCreate(LPCREATESTRUCT lpCreateStruct);
|
||||
//}}AFX_MSG
|
||||
|
||||
DECLARE_MESSAGE_MAP()
|
||||
private:
|
||||
int m_iItem;
|
||||
int m_iSubItem;
|
||||
CString m_sInitText;
|
||||
BOOL m_bESC; // To indicate whether ESC key was pressed
|
||||
};
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
//{{AFX_INSERT_LOCATION}}
|
||||
// Microsoft Visual C++ will insert additional declarations immediately before the previous line.
|
||||
|
||||
126
Server/ToolProject/AuthDBManager/ListViewControl/InPlaceList.cpp
Normal file
126
Server/ToolProject/AuthDBManager/ListViewControl/InPlaceList.cpp
Normal file
@@ -0,0 +1,126 @@
|
||||
// InPlaceList.cpp : implementation file
|
||||
//
|
||||
|
||||
#include "InPlaceList.h"
|
||||
|
||||
#ifdef _DEBUG
|
||||
#define new DEBUG_NEW
|
||||
#undef THIS_FILE
|
||||
static char THIS_FILE[] = __FILE__;
|
||||
#endif
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// CInPlaceList
|
||||
|
||||
CInPlaceList::CInPlaceList(int iItem, int iSubItem, CStringList *plstItems, int nSel)
|
||||
{
|
||||
m_iItem = iItem;
|
||||
m_iSubItem = iSubItem;
|
||||
|
||||
m_lstItems.AddTail( plstItems );
|
||||
m_nSel = nSel;
|
||||
m_bESC = FALSE;
|
||||
}
|
||||
|
||||
CInPlaceList::~CInPlaceList()
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
BEGIN_MESSAGE_MAP(CInPlaceList, CComboBox)
|
||||
//{{AFX_MSG_MAP(CInPlaceList)
|
||||
ON_WM_CREATE()
|
||||
ON_WM_KILLFOCUS()
|
||||
ON_WM_CHAR()
|
||||
ON_WM_NCDESTROY()
|
||||
ON_CONTROL_REFLECT(CBN_CLOSEUP, OnCloseup)
|
||||
//}}AFX_MSG_MAP
|
||||
END_MESSAGE_MAP()
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// CInPlaceList message handlers
|
||||
|
||||
int CInPlaceList::OnCreate(LPCREATESTRUCT lpCreateStruct)
|
||||
{
|
||||
if (CComboBox::OnCreate(lpCreateStruct) == -1)
|
||||
return -1;
|
||||
|
||||
// Set the proper font
|
||||
CFont* font = GetParent()->GetFont();
|
||||
SetFont(font);
|
||||
|
||||
for( POSITION pos = m_lstItems.GetHeadPosition(); pos != NULL; )
|
||||
{
|
||||
AddString( (LPCTSTR) (m_lstItems.GetNext( pos )) );
|
||||
}
|
||||
SetCurSel( m_nSel );
|
||||
SetFocus();
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
BOOL CInPlaceList::PreTranslateMessage(MSG* pMsg)
|
||||
{
|
||||
if( pMsg->message == WM_KEYDOWN )
|
||||
{
|
||||
if(pMsg->wParam == VK_RETURN
|
||||
|| pMsg->wParam == VK_ESCAPE
|
||||
)
|
||||
{
|
||||
::TranslateMessage(pMsg);
|
||||
::DispatchMessage(pMsg);
|
||||
return TRUE; // DO NOT process further
|
||||
}
|
||||
}
|
||||
|
||||
return CComboBox::PreTranslateMessage(pMsg);
|
||||
}
|
||||
|
||||
void CInPlaceList::OnKillFocus(CWnd* pNewWnd)
|
||||
{
|
||||
CComboBox::OnKillFocus(pNewWnd);
|
||||
|
||||
CString str;
|
||||
GetWindowText(str);
|
||||
|
||||
// Send Notification to parent of ListView ctrl
|
||||
LV_DISPINFO dispinfo;
|
||||
dispinfo.hdr.hwndFrom = GetParent()->m_hWnd;
|
||||
dispinfo.hdr.idFrom = GetDlgCtrlID();
|
||||
dispinfo.hdr.code = LVN_ENDLABELEDIT;
|
||||
|
||||
dispinfo.item.mask = LVIF_TEXT;
|
||||
dispinfo.item.iItem = m_iItem;
|
||||
dispinfo.item.iSubItem = m_iSubItem;
|
||||
dispinfo.item.pszText = m_bESC ? NULL : LPTSTR((LPCTSTR)str);
|
||||
dispinfo.item.cchTextMax = str.GetLength();
|
||||
|
||||
GetParent()->GetParent()->SendMessage( WM_NOTIFY, GetParent()->GetDlgCtrlID(), (LPARAM)&dispinfo );
|
||||
|
||||
PostMessage( WM_CLOSE );
|
||||
}
|
||||
|
||||
void CInPlaceList::OnChar(UINT nChar, UINT nRepCnt, UINT nFlags)
|
||||
{
|
||||
if( nChar == VK_ESCAPE || nChar == VK_RETURN)
|
||||
{
|
||||
if( nChar == VK_ESCAPE )
|
||||
m_bESC = TRUE;
|
||||
GetParent()->SetFocus();
|
||||
return;
|
||||
}
|
||||
|
||||
CComboBox::OnChar(nChar, nRepCnt, nFlags);
|
||||
}
|
||||
|
||||
void CInPlaceList::OnNcDestroy()
|
||||
{
|
||||
CComboBox::OnNcDestroy();
|
||||
|
||||
delete this;
|
||||
}
|
||||
|
||||
void CInPlaceList::OnCloseup()
|
||||
{
|
||||
GetParent()->SetFocus();
|
||||
}
|
||||
@@ -0,0 +1,48 @@
|
||||
// InPlaceList.h : header file
|
||||
//
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// CInPlaceList window
|
||||
#include <afxcmn.h> // MFC support for Windows Common Controls
|
||||
|
||||
class CInPlaceList : public CComboBox
|
||||
{
|
||||
// Construction
|
||||
public:
|
||||
CInPlaceList(int iItem, int iSubItem, CStringList *plstItems, int nSel);
|
||||
|
||||
// Attributes
|
||||
public:
|
||||
|
||||
// Operations
|
||||
public:
|
||||
|
||||
// Overrides
|
||||
// ClassWizard generated virtual function overrides
|
||||
//{{AFX_VIRTUAL(CInPlaceList)
|
||||
public:
|
||||
virtual BOOL PreTranslateMessage(MSG* pMsg);
|
||||
//}}AFX_VIRTUAL
|
||||
|
||||
// Implementation
|
||||
public:
|
||||
virtual ~CInPlaceList();
|
||||
|
||||
// Generated message map functions
|
||||
protected:
|
||||
//{{AFX_MSG(CInPlaceList)
|
||||
afx_msg int OnCreate(LPCREATESTRUCT lpCreateStruct);
|
||||
afx_msg void OnKillFocus(CWnd* pNewWnd);
|
||||
afx_msg void OnChar(UINT nChar, UINT nRepCnt, UINT nFlags);
|
||||
afx_msg void OnNcDestroy();
|
||||
afx_msg void OnCloseup();
|
||||
//}}AFX_MSG
|
||||
|
||||
DECLARE_MESSAGE_MAP()
|
||||
private:
|
||||
int m_iItem;
|
||||
int m_iSubItem;
|
||||
CStringList m_lstItems;
|
||||
int m_nSel;
|
||||
BOOL m_bESC; // To indicate whether ESC key was pressed
|
||||
};
|
||||
@@ -0,0 +1,260 @@
|
||||
///////////////////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// CListViewControl
|
||||
//
|
||||
//////////////////////////////////////////////////////////////////////////////////////////////
|
||||
#include "ListViewControl.h"
|
||||
|
||||
CListViewControl::CListViewControl()
|
||||
{
|
||||
ZeroMemory(m_ColType, sizeof(unsigned int) * 100);
|
||||
}
|
||||
|
||||
CListViewControl::~CListViewControl()
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
BEGIN_MESSAGE_MAP(CListViewControl, CListCtrl)
|
||||
//{{AFX_MSG_MAP(CListViewControl)
|
||||
ON_NOTIFY_REFLECT(NM_CUSTOMDRAW, OnCustomDraw)
|
||||
ON_WM_LBUTTONDBLCLK()
|
||||
//}}AFX_MSG_MAP
|
||||
END_MESSAGE_MAP()
|
||||
|
||||
void CListViewControl::OnCustomDraw(NMHDR* pNMHDR, LRESULT* pResult)
|
||||
{
|
||||
LPNMLVCUSTOMDRAW lplvcd = (LPNMLVCUSTOMDRAW)pNMHDR;
|
||||
|
||||
switch(lplvcd->nmcd.dwDrawStage)
|
||||
{
|
||||
case CDDS_PREPAINT:
|
||||
*pResult = CDRF_NOTIFYITEMDRAW;
|
||||
|
||||
break;
|
||||
|
||||
case CDDS_ITEMPREPAINT:
|
||||
if(lplvcd->nmcd.dwItemSpec % 2)
|
||||
lplvcd->clrTextBk = RGB(200, 228, 248);
|
||||
|
||||
*pResult = CDRF_DODEFAULT;
|
||||
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
void CListViewControl::OnLButtonDblClk(UINT nFlags, CPoint point)
|
||||
{
|
||||
CListCtrl::OnLButtonDblClk(nFlags, point);
|
||||
|
||||
int index, colnum;
|
||||
|
||||
if((index = HitTestEx(point, &colnum)) != -1)
|
||||
{
|
||||
if(m_ColType[colnum] == CT_EDIT)
|
||||
{
|
||||
if(GetWindowLong(m_hWnd, GWL_STYLE) & LVS_EDITLABELS)
|
||||
EditSubLabel(index, colnum);
|
||||
}
|
||||
|
||||
if(m_ColType[colnum] == CT_COMBO)
|
||||
{
|
||||
if(GetWindowLong(m_hWnd, GWL_STYLE) & LVS_EDITLABELS)
|
||||
ShowInPlaceList(index, colnum, m_ColumnStringList[colnum], 0);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void CListViewControl::OnHScroll(UINT nSBCode, UINT nPos, CScrollBar* pScrollBar)
|
||||
{
|
||||
if(GetFocus() != this)
|
||||
SetFocus();
|
||||
|
||||
CListCtrl::OnHScroll(nSBCode, nPos, pScrollBar);
|
||||
}
|
||||
|
||||
void CListViewControl::OnVScroll(UINT nSBCode, UINT nPos, CScrollBar* pScrollBar)
|
||||
{
|
||||
if(GetFocus() != this)
|
||||
SetFocus();
|
||||
|
||||
CListCtrl::OnVScroll(nSBCode, nPos, pScrollBar);
|
||||
}
|
||||
|
||||
bool CListViewControl::SetColumnType(int ColNum, unsigned int Type)
|
||||
{
|
||||
if(ColNum < 0)
|
||||
return false;
|
||||
|
||||
m_ColType[ColNum] = Type;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
bool CListViewControl::SetColumnStringList(int ColNum, CStringList &StringList)
|
||||
{
|
||||
if(ColNum < 0)
|
||||
return false;
|
||||
|
||||
m_ColumnStringList[ColNum].RemoveAll();
|
||||
|
||||
POSITION Pos = StringList.GetHeadPosition();
|
||||
|
||||
while(Pos)
|
||||
m_ColumnStringList[ColNum].AddTail(StringList.GetNext(Pos));
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
int CListViewControl::HitTestEx(CPoint &point, int *col) const
|
||||
{
|
||||
int colnum = 0;
|
||||
int row = HitTest(point, NULL);
|
||||
|
||||
if(col)
|
||||
*col = 0;
|
||||
|
||||
if((GetWindowLong(m_hWnd, GWL_STYLE) & LVS_TYPEMASK) != LVS_REPORT)
|
||||
return row;
|
||||
|
||||
row = GetTopIndex();
|
||||
int bottom = row + GetCountPerPage();
|
||||
if(bottom > GetItemCount())
|
||||
bottom = GetItemCount();
|
||||
|
||||
CHeaderCtrl* pHeader = (CHeaderCtrl*)GetDlgItem(0);
|
||||
int nColumnCount = pHeader->GetItemCount();
|
||||
|
||||
INT* piColumnArray = new INT[nColumnCount];
|
||||
((CListCtrl*)this)->GetColumnOrderArray(piColumnArray);
|
||||
|
||||
for(;row <=bottom; row++)
|
||||
{
|
||||
CRect rect;
|
||||
GetItemRect(row, &rect, LVIR_BOUNDS);
|
||||
if(rect.PtInRect(point))
|
||||
{
|
||||
for(colnum = 0; colnum < nColumnCount; colnum++)
|
||||
{
|
||||
int colwidth = GetColumnWidth(piColumnArray[colnum]);
|
||||
if(point.x >= rect.left && point.x <= (rect.left + colwidth))
|
||||
{
|
||||
*col = piColumnArray[colnum];
|
||||
|
||||
delete [] piColumnArray;
|
||||
return row;
|
||||
}
|
||||
|
||||
rect.left += colwidth;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
delete [] piColumnArray;
|
||||
|
||||
return -1;
|
||||
}
|
||||
|
||||
CEdit* CListViewControl::EditSubLabel(int nItem, int nCol)
|
||||
{
|
||||
if(!EnsureVisible(nItem, TRUE))
|
||||
return NULL;
|
||||
|
||||
CHeaderCtrl* pHeader = (CHeaderCtrl*)GetDlgItem(0);
|
||||
int nColumnCount = pHeader->GetItemCount();
|
||||
if(nCol >= nColumnCount || GetColumnWidth(nCol) < 5)
|
||||
return NULL;
|
||||
|
||||
int offset = 0;
|
||||
|
||||
INT *piColumnArray = new INT[nColumnCount];
|
||||
((CListCtrl*)this)->GetColumnOrderArray(piColumnArray);
|
||||
|
||||
for(int i = 0; nCol != piColumnArray[i]; i++)
|
||||
offset += GetColumnWidth( piColumnArray[i]);
|
||||
|
||||
delete [] piColumnArray;
|
||||
|
||||
CRect rect;
|
||||
GetItemRect(nItem, &rect, LVIR_BOUNDS);
|
||||
|
||||
CRect rcClient;
|
||||
GetClientRect(&rcClient);
|
||||
if(offset + rect.left < 0 || offset + rect.left > rcClient.right)
|
||||
{
|
||||
CSize size;
|
||||
if(offset + rect.left < 0)
|
||||
size.cx = -(offset - rect.left);
|
||||
else
|
||||
size.cx = offset - rect.left;
|
||||
size.cy = 0;
|
||||
Scroll(size);
|
||||
GetItemRect(nItem, &rect, LVIR_BOUNDS);
|
||||
}
|
||||
|
||||
LV_COLUMN lvcol;
|
||||
lvcol.mask = LVCF_FMT;
|
||||
GetColumn(nCol, &lvcol);
|
||||
|
||||
DWORD dwStyle ;
|
||||
if((lvcol.fmt&LVCFMT_JUSTIFYMASK) == LVCFMT_LEFT)
|
||||
dwStyle = ES_LEFT;
|
||||
else if((lvcol.fmt&LVCFMT_JUSTIFYMASK) == LVCFMT_RIGHT)
|
||||
dwStyle = ES_RIGHT;
|
||||
else dwStyle = ES_CENTER;
|
||||
|
||||
rect.left += offset+4;
|
||||
rect.right = rect.left + GetColumnWidth(nCol) - 3 ;
|
||||
if(rect.right > rcClient.right)
|
||||
rect.right = rcClient.right;
|
||||
|
||||
dwStyle |= WS_BORDER|WS_CHILD|WS_VISIBLE|ES_AUTOHSCROLL;
|
||||
CEdit *pEdit = new CInPlaceEdit(nItem, nCol, GetItemText(nItem, nCol));
|
||||
pEdit->Create(dwStyle, rect, this, IDC_IPEDIT);
|
||||
|
||||
return pEdit;
|
||||
}
|
||||
|
||||
CComboBox* CListViewControl::ShowInPlaceList(int nItem, int nCol, CStringList &lstItems, int nSel)
|
||||
{
|
||||
if(!EnsureVisible(nItem, TRUE))
|
||||
return NULL;
|
||||
|
||||
CHeaderCtrl* pHeader = (CHeaderCtrl*)GetDlgItem(0);
|
||||
int nColumnCount = pHeader->GetItemCount();
|
||||
if(nCol >= nColumnCount || GetColumnWidth(nCol) < 10)
|
||||
return NULL;
|
||||
|
||||
int offset = 0;
|
||||
for(int i = 0; i < nCol; i++)
|
||||
offset += GetColumnWidth(i);
|
||||
|
||||
CRect rect;
|
||||
GetItemRect(nItem, &rect, LVIR_BOUNDS);
|
||||
|
||||
CRect rcClient;
|
||||
GetClientRect(&rcClient);
|
||||
if(offset + rect.left < 0 || offset + rect.left > rcClient.right)
|
||||
{
|
||||
CSize size;
|
||||
size.cx = offset + rect.left;
|
||||
size.cy = 0;
|
||||
Scroll( size );
|
||||
rect.left -= size.cx;
|
||||
}
|
||||
|
||||
rect.left += offset+4;
|
||||
rect.right = rect.left + GetColumnWidth(nCol) - 3 ;
|
||||
int height = rect.bottom-rect.top;
|
||||
rect.bottom += 5*height;
|
||||
if(rect.right > rcClient.right) rect.right = rcClient.right;
|
||||
|
||||
DWORD dwStyle = WS_BORDER|WS_CHILD|WS_VISIBLE|CBS_DROPDOWNLIST|CBS_DISABLENOSCROLL;
|
||||
|
||||
CComboBox *pList = new CInPlaceList(nItem, nCol, &lstItems, nSel);
|
||||
pList->Create(dwStyle, rect, this, IDC_IPEDIT);
|
||||
pList->SetItemHeight(-1, height);
|
||||
pList->SetHorizontalExtent(GetColumnWidth(nCol));
|
||||
|
||||
return pList;
|
||||
}
|
||||
@@ -0,0 +1,47 @@
|
||||
///////////////////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// CListViewControl
|
||||
//
|
||||
//////////////////////////////////////////////////////////////////////////////////////////////
|
||||
#ifndef _CListViewControl
|
||||
#define _CListViewControl
|
||||
|
||||
#include <afxcmn.h> // MFC support for Windows Common Controls
|
||||
#include "InPlaceEdit.h"
|
||||
#include "InPlaceList.h"
|
||||
|
||||
#define IDC_IPEDIT 4321
|
||||
|
||||
const unsigned int CT_NORMAL = 0;
|
||||
const unsigned int CT_EDIT = 1;
|
||||
const unsigned int CT_COMBO = 2;
|
||||
|
||||
class CListViewControl : public CListCtrl
|
||||
{
|
||||
public:
|
||||
CListViewControl();
|
||||
virtual ~CListViewControl();
|
||||
|
||||
protected:
|
||||
//{{AFX_MSG(CCharList)
|
||||
afx_msg void OnCustomDraw(NMHDR* pNMHDR, LRESULT* pResult);
|
||||
afx_msg void OnLButtonDblClk(UINT nFlags, CPoint point);
|
||||
afx_msg void OnHScroll(UINT nSBCode, UINT nPos, CScrollBar* pScrollBar);
|
||||
afx_msg void OnVScroll(UINT nSBCode, UINT nPos, CScrollBar* pScrollBar);
|
||||
//}}AFX_MSG
|
||||
|
||||
bool SetColumnType(int ColNum, unsigned int Type = CT_EDIT);
|
||||
bool SetColumnStringList(int ColNum, CStringList &StringList);
|
||||
|
||||
int HitTestEx(CPoint &point, int *col) const;
|
||||
CEdit* EditSubLabel(int nItem, int nCol);
|
||||
CComboBox* ShowInPlaceList(int nItem, int nCol, CStringList &lstItems, int nSel);
|
||||
|
||||
private:
|
||||
unsigned int m_ColType[100];
|
||||
CStringList m_ColumnStringList[100];
|
||||
|
||||
DECLARE_MESSAGE_MAP()
|
||||
};
|
||||
|
||||
#endif
|
||||
Reference in New Issue
Block a user