85 int iItemCount = _super::GetCount();
88 _super::SelItemRange(TRUE, 0, iItemCount - 1);
101 int iItemCount = _super::GetCount();
102 if ( 0 < iItemCount )
105 for (
int i = 0; i < iItemCount; i++ )
107 if ( ! boIsSelectOnly || _super::GetSel(i) > 0 )
112 strText += _T(
"\r\n");
116 return CString(strText);
124 void Copy(
bool boIsSelectOnly =
true)
126 CString strText =
ToString(boIsSelectOnly);
127 if ( ! strText.IsEmpty() )
143 if ( ! ::IsWindow(m_hWnd) ) {
return; }
144 CString* P =
new CString(lpszItem);
145 if ( ! _super::PostMessage(WM_CLB_POSTSTRING, nIndex,
reinterpret_cast<LPARAM
>(P)) )
163 return _super::InsertString(nIndex, lpszItem);
176 return _super::AddString(lpszItem);
188 return _super::DeleteString(nIndex);
200 _super::SetRedraw(FALSE);
201 int sel = _super::GetTopIndex();
202 int r = _super::DeleteString(nIndex);
203 _super::SetTopIndex(sel);
204 _super::SetRedraw(TRUE);
205 _super::RedrawWindow(NULL, NULL, RDW_INVALIDATE);
216 virtual int GetText(
int nIndex, LPTSTR lpszBuffer)
const
218 return _super::GetText(nIndex, lpszBuffer);
226 virtual void GetText(
int nIndex, CString& rString)
const
228 _super::GetText(nIndex, rString);
232 enum { WM_CLB_POSTSTRING = WM_APP };
242 DWORD dwStyle = _super::GetStyle();
243 ASSERT(dwStyle & LBS_EXTENDEDSEL);
245 _super::PreSubclassWindow();
257 virtual LRESULT
WindowProc(UINT message, WPARAM wParam, LPARAM lParam)
262 if ( m_CheckCtrlKey(wParam, lParam) )
267 case WM_CLB_POSTSTRING:
269 CString* P =
reinterpret_cast<CString*
>(lParam);
270 if ( ::IsWindow(m_hWnd) )
272 int iIndex =
ToInt(wParam);
273 if ( m_maxLine >= 0 && _super::GetCount() >= m_maxLine )
275 _super::SetRedraw(FALSE);
276 _super::DeleteString(0);
277 LRESULT r = _super::InsertString(iIndex, *P);
278 _super::SetTopIndex(
ToInt(r));
279 _super::SetRedraw(TRUE);
280 _super::RedrawWindow(NULL, NULL, RDW_INVALIDATE);
284 LRESULT r = _super::InsertString(iIndex, *P);
285 _super::SetTopIndex(
ToInt(r));
295 _super::SetRedraw(FALSE);
296 int top1 = _super::GetTopIndex();
297 LRESULT r = _super::WindowProc(message, wParam, lParam);
298 int top2 = _super::GetTopIndex();
299 _super::SetTopIndex(top1);
300 _super::SetRedraw(TRUE);
303 _super::RedrawWindow(NULL, NULL, RDW_UPDATENOW | RDW_INVALIDATE | RDW_ERASE);
307 _super::SetTopIndex(top2);
309 CWnd* pWnd = GetParent();
312 if ( message == WM_VSCROLL )
314 pWnd->SendMessage(WM_VSCROLL, wParam,
reinterpret_cast<LPARAM
>(
GetSafeHwnd()));
318 WPARAM w = MAKELONG(SB_THUMBPOSITION, GetTopIndex());
319 pWnd->SendMessage(WM_VSCROLL, w,
reinterpret_cast<LPARAM
>(
GetSafeHwnd()));
326 return _super::WindowProc(message, wParam, lParam);
338 bool m_CheckCtrlKey(WPARAM wParam, LPARAM lParam)
340 LPARAM lp = lParam & 0x00FFFFFF;
341 if ( lp == 0x002e0001 && wParam == 0x03 )
348 if ( lp == 0x001e0001 && wParam == 0x01 )
359 void m_CheckMaxLine(
void)
361 if ( m_maxLine >= 0 && _super::GetCount() >= m_maxLine )
363 _super::DeleteString(0);
HWND GetSafeHwnd(void) const
[取得] ウィンドウハンドル取得.
bool SetString(LPCTSTR lpszText, bool isAdd=false)
[設定] 文字列登録.
void SetMaxLine(int maxLine)
[設定] 最大ライン数設定.
void PostString(int nIndex, LPCTSTR lpszItem)
[追加] 文字列追加.
virtual int GetText(int nIndex, LPTSTR lpszBuffer) const
[取得] 文字列取得.
void Copy(bool boIsSelectOnly=true)
[処理] 選択項目コピー.
int GetMaxLine(void) const
[取得] 最大ライン数取得.
int DeleteStringEx(UINT nIndex)
[削除] 文字列削除.
virtual void PreSubclassWindow(void)
[通知] subclassing/unsubclassing functions.
int InsertString(int nIndex, LPCTSTR lpszItem)
[追加] 文字列追加.
virtual LRESULT WindowProc(UINT message, WPARAM wParam, LPARAM lParam)
[通知] for processing Windows messages.
void AllSetSel(void)
[選択] 全項目選択.
int DeleteString(UINT nIndex)
[削除] 文字列削除.
CString ToString(bool boIsSelectOnly=true)
[処理] 文字列取得.
int AddString(LPCTSTR lpszItem)
[追加] 文字列追加.
virtual void GetText(int nIndex, CString &rString) const
[取得] 文字列取得.
LRESULT SendCommandMessage(CWnd *pCtrl, UINT cmd)
[処理] WM_COMMAND送信.
int ToInt(LPCSTR lpsz, int iBase=10)
[変換] INT変換(ASCII/SJIS用).