43 CTabCtrlEx(
void) : m_selectTextColor(CLR_INVALID), m_selectBackColor(CLR_INVALID), m_isAttachedSpin(false)
54 m_selectTextColor = text;
55 m_selectBackColor = back;
68 tci.pszText = s.GetBuffer(512);
70 if ( _super::GetItem(nItem, &tci) )
94 tci.pszText = s.GetBuffer(512);
96 BOOL r = _super::SetItem(nItem, &tci);
108 if ( ! m_isAttachedSpin && ! ::IsWindow(m_spin) )
110 m_spin.SubclassWindow(GetDlgItem(1)->
GetSafeHwnd());
124 m_isAttachedSpin =
false;
125 _super::ModifyStyle(0, TCS_OWNERDRAWFIXED);
126 _super::PreSubclassWindow();
138 virtual LRESULT
WindowProc(UINT message, WPARAM wParam, LPARAM lParam)
140 if ( message == WM_CREATE )
142 m_isAttachedSpin =
false;
144 if ( message == WM_DESTROY )
146 if ( ::IsWindow(m_spin) )
148 m_spin.UnsubclassWindow();
151 if ( ! m_isAttachedSpin && ! ::IsWindow(m_spin) )
153 HWND h = GetDlgItem(1)->GetSafeHwnd();
156 m_spin.SubclassWindow(h);
157 m_isAttachedSpin =
true;
160 if ( message == WM_ERASEBKGND )
162 HDC dc =
reinterpret_cast<HDC
>(wParam);
163 LRESULT res = _super::GetParent()->SendMessage(WM_CTLCOLORBTN,
reinterpret_cast<WPARAM
>(dc), _super::GetDlgCtrlID());
164 HBRUSH b =
reinterpret_cast<HBRUSH
>(res);
171 ::SetBrushOrgEx(dc, po.x, po.y, NULL);
172 ::FillRect(dc, &rc, b);
176 return _super::WindowProc(message, wParam, lParam);
186 if ( lpDrawItemStruct->CtlType != ODT_TAB || lpDrawItemStruct->hwndItem != _super::GetSafeHwnd() )
190 const CString& s =
GetItemText(lpDrawItemStruct->itemID);
191 RECT rc = lpDrawItemStruct->rcItem;
192 HDC dc = lpDrawItemStruct->hDC;
193 LRESULT res = _super::GetParent()->SendMessage(WM_CTLCOLORBTN,
reinterpret_cast<WPARAM
>(dc), _super::GetDlgCtrlID());
194 HBRUSH b =
reinterpret_cast<HBRUSH
>(res);
195 COLORREF c = ::GetTextColor(dc);
196 if ( (lpDrawItemStruct->itemState & ODS_SELECTED) != 0 )
198 if ( IS_RGBVALUE(m_selectBackColor) )
201 br.CreateSolidBrush(m_selectBackColor);
202 ::FillRect(dc, &rc, br);
206 ::FillRect(dc, &rc, b);
208 if ( IS_RGBVALUE(m_selectTextColor) )
210 c = m_selectTextColor;
215 ::FillRect(dc, &rc, b);
217 ::SetBkMode(dc, TRANSPARENT);
224 CFont* pFont = GetFont();
225 pFont->GetLogFont(&lf);
226 lf.lfEscapement = 900;
229 _tcscpy(lf.lfFaceName, s);
231 f.CreateFontIndirect(&lf);
232 HGDIOBJ h = ::SelectObject(dc, f);
234 ::SelectObject(dc, h);
243 COLORREF m_selectTextColor;
244 COLORREF m_selectBackColor;
245 CSpinButtonCtrl m_spin;
246 bool m_isAttachedSpin;
HWND GetSafeHwnd(void) const
[取得] ウィンドウハンドル取得.
static bool DrawTextRect(RECT &_rect, HDC dc, DWORD drawStyle, const POINT &offset, COLORREF color1, COLORREF color2, LPCTSTR str)
[表示] 範囲文字表示.
void SetSelectedColor(COLORREF text, COLORREF back=CLR_INVALID)
[設定] 選択タブカラー設定.
bool SetItemText(int nItem, LPCTSTR lpszText)
[設定] Item文字列設定.
CSpinButtonCtrl * GetSpinButtonCtrl(void)
[取得] スピンボタン取得.
CString GetItemText(int nItem) const
[取得] Item文字列取得.
virtual void PreSubclassWindow(void)
[通知] subclassing/unsubclassing functions.
virtual LRESULT WindowProc(UINT message, WPARAM wParam, LPARAM lParam)
[通知] for processing Windows messages.
void DrawItem(LPDRAWITEMSTRUCT lpDrawItemStruct)
[通知] オーナードロー処理.
bool GetControlPos(CWnd *pWnd, POINT &_po)
[取得] コントロール位置取得.