63 return m_listBox.GetDrawing(index);
75 return _super::AddString(lpszItem);
88 int r = _super::AddString(_T(
""));
91 if ( m_listBox.ResetDrawing(r, draw) )
97 _super::DeleteString(r);
114 return _super::InsertString(index, lpszItem);
128 int r = _super::InsertString(index, _T(
""));
131 if ( m_listBox.ResetDrawing(r, draw) )
137 _super::DeleteString(r);
153 _super::DeleteString(index);
154 return m_listBox.DeleteDrawing(index);
174 _super::ResetContent();
175 m_listBox.ResetContent();
184 m_listBox.SetDefaultMarkDrawer();
195 return m_listBox.SetBackgroundDrawer(draw);
208 return m_listBox.SetSelectMarkDrawer(draw, type);
221 return m_listBox.SetSelectMarkDrawer(draw1, draw2, type);
232 return m_listBox.SetFocusMarkDrawer(draw);
241 m_listBox.SetBackColor(color);
251 m_listBox.SetTextDrawer(text);
273 m_isUseDrawingButton = r;
274 if ( ::IsWindow(m_button) )
278 m_button.DestroyWindow();
296 virtual LRESULT
WindowProc(UINT message, WPARAM wParam, LPARAM lParam)
307 m_listBox.ResetContent();
308 if ( m_listBox.GetSafeHwnd() != NULL )
310 m_listBox.UnsubclassWindow();
312 m_button.DestroyWindow();
314 case WM_CTLCOLORLISTBOX:
315 if ( m_listBox.GetSafeHwnd() == NULL )
317 m_listBox.SubclassWindow(
reinterpret_cast<HWND
>(lParam));
318 m_listBox.SetOwner(
this);
322 if ( m_listBox.GetSafeHwnd() != NULL )
324 m_listBox.SendMessage(WM_SETREDRAW, wParam, lParam);
328 case WM_LBUTTONDBLCLK:
329 if ( ::IsWindow(m_button) )
331 if ( ! m_validRect.PtInRect(CPoint(lParam)) )
338 if ( wParam == BUTTON_CTRLID )
342 m_listBox.RedrawWindow();
346 return _super::WindowProc(message, wParam, lParam);
357 DWORD dwStyle = _super::GetStyle();
358 ASSERT0(dwStyle & (CBS_OWNERDRAWFIXED | CBS_OWNERDRAWVARIABLE),
"CDrawingComboBox",
"[オーナー描画]を[なし]以外にしてください");
359 ASSERT0(dwStyle & CBS_DROPDOWNLIST,
"CDrawingComboBox",
"[]を[ドロップダウンリスト]にしてください");
360 ASSERT0(dwStyle & CBS_HASSTRINGS,
"CDrawingComboBox",
"[文字列]を[あり]にしてください");
361 ASSERT0((dwStyle & CBS_SORT) == 0,
"CDrawingComboBox",
"[ソート]を[false]にしてください");
363 _super::PreSubclassWindow();
364 const int _CB_GETCOMBOBOXINFO = 0x0164;
366 cbi.cbSize =
sizeof(cbi);
367 if ( SendMessage(_CB_GETCOMBOBOXINFO, 0,
reinterpret_cast<LPARAM
>(&cbi)) )
369 if ( m_listBox.GetSafeHwnd() == NULL )
371 HWND h = cbi.hwndList;
372 m_listBox.SubclassWindow(h);
373 m_listBox.SetOwner(
this);
383 virtual void DrawItem(LPDRAWITEMSTRUCT lpDrawItemStruct)
385 if ( lpDrawItemStruct->CtlType != ODT_COMBOBOX || lpDrawItemStruct->hwndItem != _super::GetSafeHwnd() )
389 const CRect& rc = lpDrawItemStruct->rcItem;
390 if ( m_isUseDrawingButton && ! ::IsWindow(m_button) )
393 DWORD style = BS_PUSHBUTTON | WS_CHILD | WS_VISIBLE;
394 int x = ::GetSystemMetrics(SM_CXVSCROLL);
395 CRect r(rc.right + 1, rc.top, rc.right + x + 1, rc.bottom + 1);
396 if ( (GetExStyle() & WS_EX_RIGHT) != 0 )
398 r.left = rc.left - x - 1;
399 r.right = rc.left - 1;
401 m_button.Create(_T(
"Button"), _T(
""), style, r,
this, BUTTON_CTRLID);
404 if ( ::IsWindow(m_listBox) )
406 lpDrawItemStruct->CtlType = ODT_LISTBOX;
407 lpDrawItemStruct->hwndItem = m_listBox.GetSafeHwnd();
408 lpDrawItemStruct->CtlID = m_listBox.GetDlgCtrlID();
409 m_listBox.MyDrawItem(lpDrawItemStruct);
420 if ( lpMeasureItemStruct->CtlType != ODT_COMBOBOX ||
ToInt(lpMeasureItemStruct->CtlID) != _super::GetDlgCtrlID() )
424 if ( ::IsWindow(m_listBox) )
426 lpMeasureItemStruct->CtlType = ODT_LISTBOX;
427 lpMeasureItemStruct->CtlID = m_listBox.GetDlgCtrlID();
428 m_listBox.MyMeasureItem(lpMeasureItemStruct);
438 virtual void MyMeasureItem(LPMEASUREITEMSTRUCT lpMeasureItemStruct)
440 _super::MeasureItem(lpMeasureItemStruct);
442 virtual void MyDrawItem(LPDRAWITEMSTRUCT lpDrawItemStruct)
444 _super::DrawItem(lpDrawItemStruct);
462 void m_InitListBox(
void)
464 if ( m_listBox.GetSafeHwnd() == NULL )
475 void m_CheckHeight(
const IDrawable& draw)
477 int h = _super::GetItemHeight(-1);
483 _super::SetItemHeight(-1, sz.cy);
484 m_button.DestroyWindow();
488 enum { BUTTON_CTRLID = 100 };
489 CMyListBox m_listBox;
491 bool m_isUseDrawingButton;
ESelectMarkType
セレクトマークタイプ
void SetTextDrawer(const CTextDrawer &text)
[設定] テキスト描画情報指定
int DeleteString(UINT index)
[削除] 一行削除.
int AddDrawing(const IDrawable &draw)
[追加] 描画情報一行追加.
int InsertString(int index, LPCTSTR lpszItem)
[追加] 文字列一行挿入.
int InsertDrawing(int index, const IDrawable &draw)
[追加] 描画情報一行挿入.
virtual void DrawItem(LPDRAWITEMSTRUCT lpDrawItemStruct)
[通知] オーナードロー処理.
void ResetContent(void)
[削除] 全描画情報削除.
bool SetBackgroundDrawer(const IDrawable &draw)
[設定] 背景描画指定.
virtual void MeasureItem(LPMEASUREITEMSTRUCT lpMeasureItemStruct)
オーナードロー時.
void SetBackColor(COLORREF color)
[設定] 背景色設定.
const IDrawable * GetDrawing(int index) const
[取得] 描画情報取得.
bool SetSelectMarkDrawer(const IDrawable &draw1, const IDrawable &draw2, CAbstractDrawingCtrl::ESelectMarkType type=CAbstractDrawingCtrl::OVERLAP)
[設定] 選択マーク描画指定.
void SetDefaultMarkDrawer(void)
[設定] デフォルトのマーク描画指定.
virtual void PreSubclassWindow(void)
[通知] subclassing/unsubclassing functions.
bool SetFocusMarkDrawer(const IDrawable &draw)
[設定] フォーカスマーク描画指定.
int DeleteDrawing(UINT index)
[削除] 一行削除.
virtual LRESULT WindowProc(UINT message, WPARAM wParam, LPARAM lParam)
[通知] for processing Windows messages.
CDrawingButton & ReferButtonControl(void)
[参照] ボタンコントロールクラス参照.
bool SetSelectMarkDrawer(const IDrawable &draw, CAbstractDrawingCtrl::ESelectMarkType type=CAbstractDrawingCtrl::OVERLAP)
[設定] 選択マーク描画指定.
~CDrawingComboBox(void)
デストラクタ
CDrawingComboBox(void)
コンストラクタ
int AddString(LPCTSTR lpszItem)
[追加] 文字列一行追加.
void UseDrawingButton(bool r=true)
[設定] ボタン設定.
bool ChangeClientSize(CWnd *pWnd, int cx=-1, int cy=-1)
[設定] クライアントサイズ設定.
int ToInt(LPCSTR lpsz, int iBase=10)
[変換] INT変換(ASCII/SJIS用).
virtual bool GetSize(SIZE &_size) const =0
[取得] サイズ取得.