87 m_clientWidth = clientWidth;
112 virtual LRESULT
WindowProc(UINT message, WPARAM wParam, LPARAM lParam)
114 if ( message == WM_WINDOWPOSCHANGING )
116 WINDOWPOS* P =
reinterpret_cast<WINDOWPOS*
>(lParam);
118 P->cy = m_rect.Height();
119 if ( (P->flags & (SWP_NOSIZE | SWP_NOMOVE)) == 0 )
122 if ( P->cx < m_rect.Width() )
124 P->cx = m_rect.Width();
126 if ( (P->x) + (P->cx) > m_clientWidth )
129 int d = m_clientWidth - (P->cx);
137 P->cx = m_clientWidth;
142 return _super::WindowProc(message, wParam, lParam);
226 CSubEditListCtrl(
void) : m_currentSubItem(-1), m_pSubclassEdit(NULL), m_isAutoEdit(false), m_editingSubItem(-1)
237 m_isAutoEdit = isEnable;
249 m_currentSubItem = iSubItem;
250 return _super::EditLabel(iItem) != NULL;
260 int iItem = _super::GetSelectedItem();
261 int iSubItem = m_currentSubItem;
262 if ( iItem >= 0 && iSubItem >=0 )
264 return _super::EditLabel(iItem) != NULL;
276 return m_editingSubItem >= 0;
287 return _super::GetSelectedItem();
296 return m_currentSubItem;
307 m_currentSubItem = subItem;
308 _super::SetSelectedItem(item);
321 BOOL r = _super::EnsureVisible(item, FALSE);
322 m_ViewSubItem(subItem);
333 _super::SetDefaultMarkDrawer(base);
334 _super::SetSelectMarkDrawer(
335 CMySelectDrawer(
this, ::GetSysColor(COLOR_HIGHLIGHT), base,
true),
336 CMySelectDrawer(
this, ::GetSysColor(COLOR_BTNFACE), base,
false)
338 _super::SetFocusMarkDrawer(CMyFoucsDrawer(
this));
339 CTextDrawer tx(*GetFont(), RGB(0, 0, 0), _T(
""), DT_END_ELLIPSIS);
340 _super::SetTextDrawer(tx);
386 if ( m_pSubclassEdit != NULL )
388 return m_pSubclassEdit->
GetEdit();
418 return _super::OnItemPainting(P);
433 virtual BOOL
OnChildNotify(UINT message, WPARAM wParam, LPARAM lParam, LRESULT* _pResult)
435 if ( message == WM_NOTIFY )
437 LPNMHDR lpNmHdr =
reinterpret_cast<LPNMHDR
>(lParam);
438 if ( lpNmHdr->hwndFrom == m_hWnd)
440 NMLVDISPINFO* lpLv =
reinterpret_cast<NMLVDISPINFO*
>(lParam);
441 if ( lpLv->hdr.code == LVN_BEGINLABELEDIT )
443 LVITEM& item = lpLv->item;
444 if ( m_currentSubItem >= 0 )
446 item.iSubItem = m_currentSubItem;
447 m_editingSubItem = m_currentSubItem;
448 if ( _super::GetItemDrawer(item.iItem, item.iSubItem) != NULL )
455 if ( pIEdit == NULL )
461 m_ViewSubItem(m_currentSubItem);
463 _super::GetSubItemRect(item.iItem, m_currentSubItem, LVIR_LABEL, rect);
464 CSize sz(max(rect.Width() + 2, 50), rect.Height() + 3);
467 CPoint pos = rect.TopLeft();
470 if ( pos.x + sz.cx > clRc.right )
472 pos.x = clRc.right - sz.cx;
478 CEdit* pNowEdit = _super::GetEditControl();
479 pNowEdit->SetWindowText(GetItemText(item.iItem, m_currentSubItem));
481 pEdit->SubclassWindow(pNowEdit->m_hWnd);
482 m_pSubclassEdit = pIEdit;
486 else if ( lpLv->hdr.code == LVN_ENDLABELEDIT )
488 if ( m_pSubclassEdit != NULL )
491 LVITEM& item = lpLv->item;
492 if ( m_editingSubItem >= 0 && pEd->
GetSafeHwnd() != NULL )
494 item.iSubItem = m_editingSubItem;
495 m_editingSubItem = -1;
496 if ( m_isAutoEdit && (item.mask & LVIF_TEXT) != 0 )
500 pEd->GetWindowText(s);
501 _super::SetItemText(item.iItem, item.iSubItem, s);
503 pEd->UnsubclassWindow();
504 m_pSubclassEdit = NULL;
511 return _super::OnChildNotify(message, wParam, lParam, _pResult);
524 virtual LRESULT
WindowProc(UINT message, WPARAM wParam, LPARAM lParam)
528 case CMySelectDrawer::WM_SELC_DRAWINGSUBITEM:
529 return m_drawingSubItem;
532 if ( wParam == VK_F2 )
534 if ( m_currentSubItem >= 0 )
536 _super::EditLabel(_super::GetSelectedItem());
539 else if ( wParam == VK_RIGHT || wParam == VK_LEFT )
541 CWnd* P = _super::GetParent();
546 nm.hdr.code = LVN_KEYDOWN;
547 nm.hdr.hwndFrom = _super::GetSafeHwnd();
548 nm.hdr.idFrom = _super::GetDlgCtrlID();
549 nm.wVKey =
static_cast<WORD
>(wParam);
551 P->SendMessage(WM_NOTIFY, nm.hdr.idFrom,
reinterpret_cast<LPARAM
>(&nm));
553 CHeaderCtrl* H = _super::GetHeaderCtrl();
554 int m = H->GetItemCount();
555 int c = m_currentSubItem;
556 if ( wParam == VK_RIGHT )
558 if ( m_currentSubItem < 0 )
560 m_currentSubItem = 0;
562 else if ( m_currentSubItem < m - 1 )
569 if ( m_currentSubItem < 0 )
571 m_currentSubItem = m - 1;
573 else if ( m_currentSubItem > 0 )
578 if ( c != m_currentSubItem )
580 m_ViewSubItem(m_currentSubItem);
583 _super::InvalidateRect(rc, FALSE);
592 ht.pt = CPoint(lParam);
593 if ( _super::SubItemHitTest(&ht) >= 0 )
595 if ( m_currentSubItem != ht.iSubItem )
597 m_currentSubItem = ht.iSubItem;
598 DWORD ff = (_super::GetStyle() & LVS_EDITLABELS);
599 _super::ModifyStyle(ff, 0);
600 LRESULT r = _super::WindowProc(message, wParam, lParam);
601 _super::ModifyStyle(0, ff);
603 _super::GetItemRect(ht.iItem, rc, LVIR_BOUNDS);
604 _super::InvalidateRect(rc, FALSE);
611 return _super::WindowProc(message, wParam, lParam);
621 _super::PreSubclassWindow();
622 _super::ModifyStyle(0, LVS_SINGLESEL);
623 _super::SetExtendedStyle(LVS_EX_FULLROWSELECT | _super::GetExtendedStyle());
624 _super::SetAdjustWidthMode(
false);
634 void m_ViewSubItem(
int subItem)
639 int cx1 = rc.Width();
640 int x1 = GetScrollPos(SB_HORZ);
642 CHeaderCtrl* H = _super::GetHeaderCtrl();
643 H->GetItemRect(subItem, rc);
644 int cx2 = rc.Width();
648 if ( (x1 + cx1) < (x2 + cx2) )
650 xx = (x2 + cx2) - cx1;
656 Scroll(CSize(xx - x1, 0));
665 WM_SELC_DRAWINGSUBITEM = WM_APP,
667 CMySelectDrawer(
CSubEditListCtrl* H, COLORREF beltColor, COLORREF backColor,
bool isTextInvert =
true)
668 : m_pCtrl(H), _super(beltColor, backColor, isTextInvert)
674 CMySelectDrawer* P =
new CMySelectDrawer(m_pCtrl, 0, 0,
false);
679 virtual void Draw(HDC dc,
int x = 0,
int y = 0)
const
681 if ( m_pCtrl->SendMessage(WM_SELC_DRAWINGSUBITEM) == m_pCtrl->GetSelectedSubItem() )
683 _super::Draw(dc, x , y);
700 return new CMyFoucsDrawer(m_pCtrl);
703 virtual void Draw(HDC dc,
int x = 0,
int y = 0)
const
705 CHeaderCtrl* H = m_pCtrl->GetHeaderCtrl();
709 H->GetItemRect(m_pCtrl->GetSelectedSubItem(), rc);
711 rc.bottom = rc.top +
m_size.cy;
712 ::DrawFocusRect(dc, rc);
726 int m_currentSubItem;
727 int m_drawingSubItem;
728 int m_editingSubItem;
HWND GetSafeHwnd(void) const
[取得] ウィンドウハンドル取得.
ESelectMarkType
セレクトマークタイプ
サブアイテム編集リスト専用エディットコントロールテンプレート.
void SetStartRect(const RECT &rect, int clientWidth)
[設定] 開始表示位置指定.
virtual LRESULT WindowProc(UINT message, WPARAM wParam, LPARAM lParam)
[通知] for processing Windows messages.
CEdit * GetEdit(void)
[取得] CEdit取得.
virtual void OnEditEnd(void)
[通知] 編集終了通知.
CSelcEditFpT(void)
コンストラクタ
int GetSelectedSubItem(void) const
[取得] 選択サブアイテムNo取得.
virtual ISelcEditFp * GetSubItemEditControl(int item, int subItem)
[参照] サブアイテム編集コントロール取得.
void SetDefaultMarkDrawer(COLORREF base=::GetSysColor(COLOR_WINDOW))
[設定] デフォルトのマーク描画指定.
void SetAutoEditMode(bool isEnable)
[設定] 自動テキスト編集モード.
bool SetSelectMarkDrawer(const IDrawable &draw1, const IDrawable &draw2, ESelectMarkType type=OVERLAP)
[設定] 選択マーク描画指定.
bool SetSelectMarkDrawer(const IDrawable &draw, ESelectMarkType type=OVERLAP)
[設定] 選択マーク描画指定.
virtual BOOL OnChildNotify(UINT message, WPARAM wParam, LPARAM lParam, LRESULT *_pResult)
[通知] for notifications from parent
bool EditLabel(void)
[設定] アイテムラベル編集開始.
CSubEditListCtrl(void)
コンストラクタ
virtual void PreSubclassWindow(void)
[通知] subclassing/unsubclassing functions.
bool SetFocusMarkDrawer(const IDrawable &draw)
[設定] フォーカスマーク描画指定.
BOOL EnsureVisibleEx(int item, int subItem)
[設定] アイテム表示.
CEdit * GetEditControl(void) const
[取得] Editコントロール取得.
bool IsEditingLabel(void) const
[確認] 編集中確認.
virtual LRESULT WindowProc(UINT message, WPARAM wParam, LPARAM lParam)
[通知] for processing Windows messages.
int GetSelectedItem(void) const
[取得] 選択アイテム取得.
void SetSelectedItem(int item, int subItem)
[設定] 選択アイテム設定.
bool EditSubItemLabel(int iItem, int iSubItem)
[設定] サブアイテムラベル編集開始.
virtual LRESULT OnItemPainting(TDrawParam *P)
[通知] アイテム描画.
DWORD subItemNo
サブアイテムナンバー
サブアイテム編集リスト専用エディットインターフェース.
virtual void SetStartRect(const RECT &rect, int clientWidth)=0
[設定] 開始表示位置指定.
virtual CEdit * GetEdit(void)=0
[取得] CEdit取得.
virtual ~ISelcEditFp(void)
デストラクタ
virtual void OnEditEnd(void)=0
[通知] 編集終了通知.