24#define TVC_CHECKCHANGED 0xFFFF
50 void m_DrawSelectMaker(HDC dc,
const RECT& rect, HTREEITEM h)
52 if ( (GetItemState(h, TVIS_SELECTED ) & TVIS_SELECTED) != 0 )
59 void m_DeleteItem(HTREEITEM h)
61 HTREEITEM hh = _super::GetChildItem(h);
65 hh = _super::GetNextSiblingItem(hh);
70 void m_NotifyParent(HTREEITEM h)
72 NMTREEVIEW nm = { 0 };
73 nm.hdr.hwndFrom = *
this;
74 nm.hdr.idFrom = GetDlgCtrlID();
75 nm.hdr.code = TVN_SELCHANGED;
79 GetParent()->SendMessage(WM_NOTIFY, GetDlgCtrlID(),
reinterpret_cast<LPARAM
>(&nm));
130 HRGN rgn = ::CreateRectRgnIndirect(&P->
rect);
131 ::ExtSelectClipRgn(P->
dc, rgn, RGN_DIFF);
136 return CDRF_NOTIFYITEMDRAW;
146 HTREEITEM h =
reinterpret_cast<HTREEITEM
>(P->
itemNo);
147 ::SelectClipRgn(P->
dc, NULL);
149 CString str = GetItemText(h);
153 if ( pDraw != NULL && ! str.IsEmpty() )
157 pDraw->
Draw(P->
dc, rc.left, rc.top);
158 pDraw->
Draw(NULL, rc.left, rc.top);
161 m_DrawSelectMaker(P->
dc, rc, h);
163 if ( (P->
state & CDIS_FOCUS) != 0 )
169 rc.OffsetRect(-rc.TopLeft());
178 m_DrawSelectMaker(dc, rc, h);
183 pDraw->
Draw(dc, 0, 0);
192 m_DrawSelectMaker(dc, rc, h);
194 if ( (P->
state & CDIS_FOCUS) != 0 )
226 _super::GetItemRect(
reinterpret_cast<HTREEITEM
>(_pa.
itemNo), rc, TRUE);
227 _pa.
rect.left = rc.left;
242 virtual BOOL
OnChildNotify(UINT message, WPARAM wParam, LPARAM lParam, LRESULT* _pResult)
244 if ( message == WM_NOTIFY )
246 LPNMHDR lpNmHdr =
reinterpret_cast<LPNMHDR
>(lParam);
247 if ( lpNmHdr->hwndFrom == m_hWnd)
255 return _super::OnChildNotify(message, wParam, lParam, _pResult);
268 virtual LRESULT
WindowProc(UINT message, WPARAM wParam, LPARAM lParam)
274 HTREEITEM h =
reinterpret_cast<HTREEITEM
>(lParam);
288 HTREEITEM h = _super::GetSelectedItem();
291 BOOL old = GetCheck(h);
292 LRESULT r =_super::WindowProc(message, wParam, lParam);
293 if ( old != GetCheck(h) )
306 HTREEITEM h = _super::HitTest(pos, &fg);
309 if ( (fg & TVHT_ONITEMRIGHT) != 0 )
311 _super::SelectItem(h);
313 else if ( (fg & TVHT_ONITEMSTATEICON) != 0 )
315 BOOL old = GetCheck(h);
316 LRESULT r =_super::WindowProc(message, wParam, lParam);
317 ASSERT( old != GetCheck(h) );
332 _super::SetRedraw(FALSE);
333 LRESULT r = _super::WindowProc(message, wParam, lParam);
334 _super::SetRedraw(TRUE);
347 return _super::WindowProc(message, wParam, lParam);
357 _super::PreSubclassWindow();
358 if ( (_super::GetStyle() & TVS_CHECKBOXES) != 0 )
361 _super::ModifyStyle(TVS_CHECKBOXES, 0, 0);
362 _super::ModifyStyle(0, TVS_CHECKBOXES, 0);
364 _super::ModifyStyle(0, TVS_NONEVENHEIGHT, 0);
387 HTREEITEM
InsertItem(
const IDrawable &draw, HTREEITEM hParent = TVI_ROOT, HTREEITEM hInsertAfter = TVI_LAST,
bool hasBg =
false)
389 HTREEITEM h = _super::InsertItem(hasBg ? _T(
"*") : _T(
""), hParent, hInsertAfter);
405 HTREEITEM
InsertItem(LPCTSTR lpszItem, HTREEITEM hParent = TVI_ROOT, HTREEITEM hInsertAfter = TVI_LAST)
407 return _super::InsertItem(lpszItem, hParent, hInsertAfter);
428 return TreeView_SetLineColor(*
this, clrNew);
438 ASSERT(::IsWindow(m_hWnd));
440 item.mask = TVIF_HANDLE | TVIF_STATE;
442 item.stateMask = TVIS_STATEIMAGEMASK;
443 VERIFY(::SendMessage(m_hWnd, TVM_GETITEM, 0, (LPARAM)&item));
444 return item.state >> 12;
456 ASSERT(::IsWindow(m_hWnd));
458 item.mask = TVIF_HANDLE | TVIF_STATE;
460 item.stateMask = TVIS_STATEIMAGEMASK;
461 item.state = INDEXTOSTATEIMAGEMASK(state);
462 return !! ::SendMessage(m_hWnd, TVM_SETITEM, 0, (LPARAM)&item);
#define TVC_CHECKCHANGED
チェックボックスの変更
bool IsEmpty(void) const
[確認] Empty状態確認.
bool Set(int cx, int cy, COLORREF color=CLR_INVALID)
[設定] イメージ設定.
BOOL OnChildNotify(UINT message, WPARAM wParam, LPARAM lParam, LRESULT *_pResult)
[通知] for notifications from parent
bool EndItemPaint(void)
[処理] 描画終了.
COLORREF GetBackColor(void) const
[取得] 背景色取得.
void DrawBackground(HDC dc, const RECT &rect, LPARAM lParam=0)
[描画] 背景表示
void DrawText(HDC dc, const RECT &rect, LPCTSTR lpsz, LPARAM lParam=0)
[描画] 文字列描画
void SetBackColor(COLORREF color)
[設定] 背景色設定.
void DrawSelectMark(HDC dc, const RECT &rect, bool isActive, LPARAM lParam=0)
[描画] 選択マーク表示
ESelectMarkType GetSelectMarkType(void) const
[取得] セレクトマークタイプ
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
[処理] イメージ描画.
HTREEITEM InsertItem(LPCTSTR lpszItem, HTREEITEM hParent=TVI_ROOT, HTREEITEM hInsertAfter=TVI_LAST)
[追加] アイテム追加.
virtual void OnEndItemPaint(HDC dc)
[通知] 描画終了.
COLORREF SetLineColor(COLORREF clrNew=CLR_DEFAULT)
[設定] 線色指定
bool SetState(HTREEITEM hItem, UINT state)
[設定] アイテム状態設定
CDrawingTreeCtrl(void)
コンストラクタ
virtual void OnBeginItemPaint(HDC dc)
[通知] 描画開始.
virtual BOOL OnChildNotify(UINT message, WPARAM wParam, LPARAM lParam, LRESULT *_pResult)
[通知] for notifications from parent
virtual bool HasSubItem(void) const
[確認] サブアイテム概念の有無
HTREEITEM InsertItem(const IDrawable &draw, HTREEITEM hParent=TVI_ROOT, HTREEITEM hInsertAfter=TVI_LAST, bool hasBg=false)
[追加] アイテム追加
virtual void OnItemPainted(const TDrawParam *P)
[通知] アイテム描画終わり.
virtual void PreSubclassWindow(void)
[通知] subclassing/unsubclassing functions.
virtual LRESULT WindowProc(UINT message, WPARAM wParam, LPARAM lParam)
[通知] for processing Windows messages.
virtual void OnCalcItemRect(TDrawParam &_pa, bool isSub)
[確認] アイテムRECT計算
UINT GetState(HTREEITEM hItem) const
[取得] アイテム状態取得
CMapT< HTREEITEM, IDrawable::Ptr > m_map
HTREEITEM と 描画情報の関連
virtual LRESULT OnItemPainting(TDrawParam *P)
[通知] アイテム描画.
IDrawable * GetItemDrawer(HTREEITEM item)
[取得] アイテムの描画情報取得.
virtual bool Resize(const SIZE &size)=0
[設定] サイズ設定.
virtual IDrawable * Clone(void) const =0
[作成] クローン作成.
virtual void Draw(HDC dc, int x=0, int y=0) const =0
[描画] 描画.