13 #pragma managed( push, off ) 40 , m_hTabControl(
nullptr )
50 , m_hTabControl(
nullptr )
92 if ( 0 == ::IsWindowVisible(
m_hWnd ) ) {
101 RECT sClientRect = {};
102 ::GetClientRect(
m_hWnd, &sClientRect );
107 int nLeft = sClientRect.left;
108 int nTop = sClientRect.top;
109 int nWidth = ( sClientRect.right - nLeft );
113 ::SetWindowPos(
m_cTitleBar.
GetHandle(), HWND_TOP, nLeft, nTop, nWidth, nHeight, ( SWP_NOACTIVATE | SWP_SHOWWINDOW ) );
128 int nTabCount =
static_cast< int >( ::SendMessageW(
m_hTabControl, TCM_GETITEMCOUNT, 0, 0 ) );
129 if ( 0 < nTabCount ) {
131 RECT sTabRect = sClientRect;
132 ::SendMessageW(
m_hTabControl, TCM_ADJUSTRECT, 0, reinterpret_cast< LPARAM >( &sTabRect ) );
137 int nLeft = sClientRect.left;
138 int nTop = sClientRect.top;
139 int nWidth = ( sClientRect.right - nLeft );
140 int nHeight = ( sTabRect.top - nTop );
141 ::SetWindowPos(
m_hTabControl, HWND_TOP, nLeft, nTop, nWidth, nHeight, ( SWP_NOACTIVATE | SWP_SHOWWINDOW ) );
148 else if ( 1 < nTabCount ) {
150 int nHeight = ( ( sClientRect.bottom - sClientRect.top ) - ( sTabRect.bottom - sTabRect.top ) );
151 int nLeft = sClientRect.left;
152 int nTop = ( sClientRect.bottom - nHeight );
153 int nWidth = ( sClientRect.right - nLeft );
154 ::SetWindowPos(
m_hTabControl, HWND_TOP, nLeft, nTop, nWidth, nHeight, ( SWP_NOACTIVATE | SWP_SHOWWINDOW ) );
167 if (
nullptr != pcElement ) {
169 int nLeft = sClientRect.left;
170 int nTop = sClientRect.top;
171 int nWidth = ( sClientRect.right - nLeft );
172 int nHeight = ( sClientRect.bottom - nTop );
173 ::SetWindowPos( pcElement->
GetHandle(), HWND_TOP, nLeft, nTop, nWidth, nHeight, ( SWP_NOACTIVATE | SWP_SHOWWINDOW ) );
174 ::UpdateWindow( pcElement->
GetHandle() );
189 if (
nullptr != pcElement ) {
191 if ( nCurrent != nIndex ) {
193 ::ShowWindow( pcElement->
GetHandle(), SW_HIDE );
210 LPDRAWITEMSTRUCT lpDraw =
reinterpret_cast< LPDRAWITEMSTRUCT
>(
m_lParam );
244 NMHDR* psNmHdr =
reinterpret_cast< LPNMHDR
>(
m_lParam );
249 int nIndex =
static_cast< int >( ::SendMessageW(
m_hTabControl, TCM_GETCURSEL, 0, 0 ) );
252 TCITEMW sTcItem = {};
253 sTcItem.mask = TCIF_PARAM;
254 if ( TRUE == ::SendMessageW(
m_hTabControl, TCM_GETITEM, nIndex, reinterpret_cast< LPARAM >( &sTcItem ) ) ) {
256 HWND hElement =
reinterpret_cast< HWND
>( sTcItem.lParam );
258 if (
nullptr != pcElement ) {
262 ::SendMessageW(
m_hWnd, WM_SIZE, 0, 0 );
294 NMHDR* psNmHdr =
reinterpret_cast< LPNMHDR
>(
m_lParam );
320 HWND hCtrl =
reinterpret_cast< HWND
>(
m_lParam );
350 int nTabCount =
static_cast< int >( ::SendMessageW(
m_hTabControl, TCM_GETITEMCOUNT, 0, 0 ) );
353 for (
int nIndex = 0;; ++nIndex ) {
355 if ( nTabCount <= nIndex ) {
363 if ( TRUE == ::SendMessageW(
m_hTabControl, TCM_GETITEMRECT, nIndex, reinterpret_cast< LPARAM >( &sRect ) ) ) {
365 if ( 0 != ::PtInRect( &sRect, sPoint ) ) {
367 TCITEMW sTcItem = {};
368 sTcItem.mask = TCIF_PARAM;
369 if ( TRUE == ::SendMessageW(
m_hTabControl, TCM_GETITEM, nIndex, reinterpret_cast< LPARAM >( &sTcItem ) ) ) {
371 HWND hElement =
reinterpret_cast< HWND
>( sTcItem.lParam );
373 if (
nullptr != pcElement ) {
375 ::SendMessageW( pcElement->
GetHandle(), WM_CONTEXTMENU,
reinterpret_cast< WPARAM
>( hElement ),
m_lParam );
423 if ( 0 == ::GetClientRect(
m_hWnd, &rsRect ) ) {
451 if (
nullptr != pcElement ) {
482 if (
nullptr != pcElement ) {
484 if ( !pcElement->
IsShow() ) {
489 result = max( result, nMinWidth );
513 if (
nullptr != pcElement ) {
515 if ( !pcElement->
IsShow() ) {
520 result = max( result, nMinHeight );
532 result += ( sRect.bottom - sRect.top );
542 result += ( sRect.bottom - sRect.top );
557 wchar_t szBuffer[ MAX_PATH ];
559 if ( 0 <= nCurrent ) {
562 if (
nullptr != pcElement ) {
564 ::GetWindowTextW( pcElement->
GetHandle(), szBuffer, MAX_PATH );
567 ::SetWindowTextW(
m_hWnd, szBuffer );
572 UINT uFlags = DC_SMALLCAP | DC_TEXT | DC_GRADIENT;
579 ::DrawCaption( lpDraw->hwndItem, lpDraw->hDC, &lpDraw->rcItem, uFlags );
583 ::SelectObject( lpDraw->hDC, hPen );
586 int nLeft = lpDraw->rcItem.left;
587 int nTop = ( lpDraw->rcItem.bottom - 1 );
588 int nWidth = ( lpDraw->rcItem.right - nLeft );
589 ::MoveToEx( lpDraw->hDC, nLeft, nTop,
nullptr );
590 ::LineTo( lpDraw->hDC, ( nLeft + nWidth ), nTop );
593 ::DeleteObject( hPen );
610 DWORD dwStyle = ( WS_CHILD | WS_CLIPSIBLINGS | WS_CLIPCHILDREN | TCS_FOCUSNEVER | TCS_OWNERDRAWFIXED );
613 m_hTabControl = ::CreateWindowExW( 0, WC_TABCONTROLW,
nullptr, dwStyle, 0, 0, 0, 0,
m_hWnd,
nullptr, ::GetModuleHandleW(
nullptr ),
nullptr );
620 ::SendMessageW(
m_hTabControl, WM_SETFONT, reinterpret_cast< WPARAM >( ::GetStockObject( DEFAULT_GUI_FONT ) ), 0 );
637 LONG_PTR nStyle = ::GetWindowLongPtrW(
m_hTabControl, GWL_STYLE );
642 nStyle |= TCS_BOTTOM;
646 nStyle &= ~TCS_BOTTOM;
653 wchar_t szTitle[ MAX_PATH ];
663 int nTabCount =
static_cast< int >( ::SendMessageW(
m_hTabControl, TCM_GETITEMCOUNT, 0, 0 ) );
669 for (
int nIndex = 0; nCount > nIndex; ++nIndex ) {
672 if (
nullptr != pcElement ) {
674 if ( pcElement->
IsShow() ) {
676 wchar_t szBuffer[ MAX_PATH ];
677 ::GetWindowTextW( pcElement->
GetHandle(), szBuffer, MAX_PATH );
680 TCITEMW sTcItem = {};
681 sTcItem.mask = ( TCIF_TEXT | TCIF_PARAM );
682 sTcItem.pszText = szBuffer;
683 sTcItem.lParam =
reinterpret_cast< LPARAM
>( pcElement->
GetHandle() );
686 if ( nTabCount > nShowCount ) {
688 ::SendMessageW(
m_hTabControl, TCM_SETITEM, nShowCount, reinterpret_cast< LPARAM >( &sTcItem ) );
692 ::SendMessageW(
m_hTabControl, TCM_INSERTITEMW, nShowCount, reinterpret_cast< LPARAM >( &sTcItem ) );
699 if ( nCurrent == nIndex ) {
701 ::wcscpy_s( szTitle, szBuffer );
704 ::SendMessageW(
m_hTabControl, TCM_SETCURSEL, nShowCount, 0 );
714 for ( ; nShowCount < nTabCount; --nTabCount ) {
716 ::SendMessageW(
m_hTabControl, TCM_DELETEITEM, ( nTabCount - 1 ), 0 );
737 TCITEMW sTcItem = {};
738 wchar_t szBuffer[ MAX_PATH ];
739 sTcItem.mask = ( TCIF_TEXT | TCIF_PARAM );
740 sTcItem.pszText = szBuffer;
741 sTcItem.cchTextMax = MAX_PATH;
742 if ( TRUE != ::SendMessageW( lpDraw->hwndItem, TCM_GETITEM, lpDraw->itemID, reinterpret_cast< LPARAM >( &sTcItem ) ) ) {
748 HWND hElement =
reinterpret_cast< HWND
>( sTcItem.lParam );
758 HBRUSH hBrush = ::CreateSolidBrush( dwColor );
761 ::FillRect( lpDraw->hDC, &lpDraw->rcItem, hBrush );
764 ::DeleteObject( hBrush );
767 lpDraw->rcItem.left += 4;
768 ::SetTextColor( lpDraw->hDC, ::GetSysColor( COLOR_WINDOWTEXT ) );
769 ::SetBkMode( lpDraw->hDC, TRANSPARENT );
770 ::DrawTextW( lpDraw->hDC, szBuffer, -1, &lpDraw->rcItem, ( DT_LEFT | DT_SINGLELINE | DT_VCENTER ) );
781 #pragma managed( pop ) virtual int GetMinWidth() noexcept override
最小水平サイズ取得関数
virtual HWND & GetHandle() noexcept
ウィンドウハンドル取得関数
virtual LRESULT TcnSelChange() noexcept override
virtual int GetShowCurrentIndex() const noexcept
表示状態カレントインデックス取得関数
virtual bool IsShow() noexcept
表示フラグ取得関数
virtual bool UpdateClientRect() noexcept override
クライアント領域更新関数
virtual CWndElement * GetElementWindow(HWND hWnd) const noexcept
エレメントウィンドウ取得関数
virtual int GetMinHeight() noexcept
最小垂直サイズ取得関数
virtual LRESULT StnClicked() noexcept override
virtual LRESULT NmClick() noexcept
virtual bool CreateTabControl() noexcept
タブコントロール作成関数
virtual LRESULT WmDrawItem() noexcept
virtual bool IsTabBottom() const noexcept
タブ下端表示状態取得関数
virtual bool Create(HWND hParent, HMENU hMenu=nullptr) noexcept override
ウィンドウ作成関数
CWndTitleBar m_cTitleBar
タイトルバー
virtual bool SubtractChildRect(HWND hChild, RECT &rsRect) noexcept
子ウィンドウ表示領域減算関数
virtual bool DrawTitleBar(LPDRAWITEMSTRUCT lpDraw) noexcept
タイトルバー描画関数
virtual LRESULT StnClicked() noexcept
static int const TITLE_BAR_HEIGHT
タイトルバー垂直サイズ
virtual int GetMinWidth() noexcept
最小水平サイズ取得関数
virtual LRESULT WmContextMenu() noexcept override
static HWND s_hFocus
フォーカスウィンドウ保存ハンドル
CWndList m_cElementList
エレメントウィンドウリスト
virtual LRESULT WmContextMenu() noexcept override
HWND m_hTabControl
タブコントロールハンドル
virtual bool DrawTabControl(LPDRAWITEMSTRUCT lpDraw) noexcept
タブコントロール描画関数
CWndDocumentTab(CWndElement *(*pfnCreateElement)()=&CreateDocumentWindow, wchar_t const *pszElementName=L"ドキュメントウィンドウ") noexcept
コンストラクタ
virtual bool UpdateTabControl() noexcept
タブコントロール更新関数
virtual bool UpdateClientRect() noexcept
クライアント領域更新関数
virtual LRESULT WmDrawItem() noexcept override
virtual LRESULT TcnSelChange() noexcept
static COLORREF const COLOR_TAB_FOCUS
フォーカス所有タブ項目背景色
virtual bool Create(HWND hParent, HMENU hMenu=nullptr) noexcept override
ウィンドウ作成関数
virtual int GetMinHeight() noexcept override
最小垂直サイズ取得関数
virtual bool SetCurrentElement(CWndElement *pcElement) noexcept
カレントエレメントウィンドウ設定関数
virtual bool Create(HWND hParent=nullptr, HMENU hMenu=nullptr) noexcept override
ウィンドウ作成関数
virtual wchar_t const * GetSectionName() const noexcept override
セクション名取得関数
static COLORREF const COLOR_TITLE_SEPARATOR
タイトルバー境界色
virtual bool GetPaintRect(RECT &rsRect) noexcept override
クライアント描画領域取得関数
virtual LRESULT WmSize() noexcept override
各種メッセージ処理関数
static COLORREF const COLOR_TAB_NORMAL
通常タブ項目背景色
virtual int GetCount() const noexcept
配列要素数取得関数
virtual LRESULT NmClick() noexcept override
LIB_WINDOW_API bool IsOwnOrChild(HWND hWnd, HWND hChild) noexcept
自分または子ウィンドウ判定関数