72 return m_drawersList[index];
84 int r = _super::AddString(_T(
""));
87 if ( ! m_InsertDrawing(r, draw) )
104 return _super::AddString(lpszItem);
117 int r = _super::InsertString(index, _T(
""));
120 if ( ! m_InsertDrawing(r, draw) )
138 return _super::InsertString(index, lpszItem);
151 return m_ResetDrawing(index, draw);
162 int r = _super::DeleteString(index);
165 m_drawersList.
Remove(index);
189 _super::SetHorizontalExtent(m_itemsWidth);
190 _super::ResetContent();
218 virtual LRESULT
WindowProc(UINT message, WPARAM wParam, LPARAM lParam)
224 HDC hdc =
reinterpret_cast<HDC
>(wParam);
228 for (
int i = GetTopIndex(); i < GetCount(); i++ )
230 y += GetItemHeight(i);
232 int h = rect.Height();
241 if ( GetCount() == 0 )
249 LRESULT r = _super::WindowProc(message, wParam, lParam);
262 case LB_RESETCONTENT:
264 _super::SetHorizontalExtent(m_itemsWidth);
267 return _super::WindowProc(message, wParam, lParam);
278 DWORD dwStyle = _super::GetStyle();
279 ASSERT0(dwStyle & (LBS_OWNERDRAWVARIABLE | LBS_OWNERDRAWFIXED),
"CDrawingListBox",
"[オーナー描画]を[なし]以外にしてください");
280 ASSERT0((dwStyle & LBS_SORT) == 0,
"CDrawingListBox",
"[ソート]はOFFにしてください");
283 _super::PreSubclassWindow();
293 if ( lpMeasureItemStruct->CtlType != ODT_LISTBOX ||
ToInt(lpMeasureItemStruct->CtlID) != _super::GetDlgCtrlID() )
305 virtual void DrawItem(LPDRAWITEMSTRUCT lpDrawItemStruct)
307 if ( lpDrawItemStruct->CtlType != ODT_LISTBOX || lpDrawItemStruct->hwndItem != _super::GetSafeHwnd() )
311 UINT index = lpDrawItemStruct->itemID;
312 HDC dc = lpDrawItemStruct->hDC;
313 const CRect& rc = lpDrawItemStruct->rcItem;
314 CSize sz = rc.Size();
316 if ( bi.
Set(sz.cx, sz.cy) )
323 m_DrawSelectMaker(bmpDC, sz, lpDrawItemStruct->itemState, lParam);
330 pDraw->
DrawEx(bmpDC, 0, (sz.cy - s.cy) / 2, lParam);
332 else if ( ::IsWindow(m_hWnd) &&
static_cast<INDEX
>(GetCount()) > index )
341 m_DrawSelectMaker(bmpDC, sz, lpDrawItemStruct->itemState, lParam);
343 if ( (lpDrawItemStruct->itemState & ODS_FOCUS) != 0 )
351 bmpDC.
Draw(dc, rc.left, rc.top);
358 void m_ResetContent(
void)
364 void m_CalcItemWidth(
bool withReheight =
false)
371 if ( ! P.
IsNull() && m_drawersList[i]->GetSize(size) )
373 if ( m_itemsWidth <
static_cast<DWORD
>(size.cx) )
375 m_itemsWidth = size.cx;
379 _super::SetItemHeight(
ToInt(i), size.cy);
385 bool m_InsertDrawing(
int index,
const IDrawable& draw)
391 m_CalcItemWidth(
true);
392 _super::SetHorizontalExtent(m_itemsWidth);
393 _super::SetItemHeight(index, size.cy);
396 _super::DeleteString(index);
400 bool m_ResetDrawing(
int index,
const IDrawable& draw)
402 if ( m_drawersList.
Set(index, draw.
Clone()) )
407 _super::SetHorizontalExtent(m_itemsWidth);
408 _super::SetItemHeight(index, size.cy);
414 void m_DrawSelectMaker(HDC dc,
const SIZE& sz, UINT itemState, LPARAM lParam)
416 HWND hFocus = ::GetFocus();
417 bool r = (hFocus == m_hWnd);
418 if ( ! r && ::IsWindow(m_hWnd) )
420 CWnd* P = GetOwner();
426 if ( (itemState & CDIS_SELECTED) != 0 )
#define loop(VAR, CNT)
loop構文.
HWND GetSafeHwnd(void) const
[取得] ウィンドウハンドル取得.
virtual bool Insert(INDEX index, const TYP &t)
[追加] 要素一つ挿入
virtual bool Set(INDEX index, const TYP &t)
[設定] 要素の設定.
bool Set(int cx, int cy, COLORREF color=CLR_INVALID)
[設定] イメージ設定.
bool IsNull(void) const
[確認] NULLチェック
virtual size_t GetSize(void) const
[取得] サイズ取得
virtual bool Remove(INDEX index)
[削除] 要素一つ削除.
virtual bool RemoveAll(void)
[削除] 空化
bool EndItemPaint(void)
[処理] 描画終了.
void DrawBackground(HDC dc, const RECT &rect, LPARAM lParam=0)
[描画] 背景表示
void DrawText(HDC dc, const RECT &rect, LPCTSTR lpsz, LPARAM lParam=0)
[描画] 文字列描画
void DrawSelectMark(HDC dc, const RECT &rect, bool isActive, LPARAM lParam=0)
[描画] 選択マーク表示
ESelectMarkType GetSelectMarkType(void) const
[取得] セレクトマークタイプ
void DrawDisabledStyle(HDC dc, const RECT &rect, LPARAM lParam=0)
[描画] 無効状態描画.
void AllReset(void)
[設定] 全設定リセット.
void DrawFocusMark(HDC dc, const RECT &rect, LPARAM lParam=0)
[描画] フォーカスマーク表示
void BeginItemPaint(void)
[処理] 描画開始.
void DrawBackColor(HDC dc, const RECT &rect)
[描画] 背景色描画
void SetDefaultTextDrawer(CWnd *pWnd)
[設定] テキスト描画情報設定.
bool Draw(HDC dc, int x=0, int y=0) const
[処理] イメージ描画.
virtual LPARAM CalcDrawParam(DWORD_PTR itemNo) const
[取得] 描画用パラメータ計算.
CDrawingListBox(void)
コンストラクタ
int DeleteString(UINT index)
[削除] 一行削除.
int AddDrawing(const IDrawable &draw)
[追加] 描画情報一行追加.
int InsertString(int index, LPCTSTR lpszItem)
[追加] 文字列一行挿入.
~CDrawingListBox(void)
デストラクタ
int InsertDrawing(int index, const IDrawable &draw)
[追加] 描画情報一行挿入.
virtual void DrawItem(LPDRAWITEMSTRUCT lpDrawItemStruct)
[通知] オーナードロー処理.
void ResetContent(void)
[削除] 全描画情報削除.
virtual void MeasureItem(LPMEASUREITEMSTRUCT lpMeasureItemStruct)
オーナードロー時.
const IDrawable * GetDrawing(int index) const
[取得] 描画情報取得.
int ResetDrawing(int index, const IDrawable &draw)
[追加] 描画情報変更.
virtual void PreSubclassWindow(void)
[通知] subclassing/unsubclassing functions.
int DeleteDrawing(UINT index)
[削除] 一行削除.
virtual LRESULT WindowProc(UINT message, WPARAM wParam, LPARAM lParam)
[通知] for processing Windows messages.
int AddString(LPCTSTR lpszItem)
[追加] 文字列一行追加.
int ToInt(LPCSTR lpsz, int iBase=10)
[変換] INT変換(ASCII/SJIS用).
bool IsInRange(INDEX index) const
[確認] INDEXの有効確認.
virtual bool GetSize(SIZE &_size) const =0
[取得] サイズ取得.
virtual IDrawable * Clone(void) const =0
[作成] クローン作成.
virtual void DrawEx(HDC dc, int x, int y, LPARAM lParam) const
[描画] 描画.