ExtPaintManager2.cpp
上传用户:sesekoo
上传日期:2020-07-18
资源大小:21543k
文件大小:328k
- ASSERT( FALSE );
- ::DeleteObject(
- ::SelectObject(
- hDstDC,
- hOldDst
- )
- );
- ::DeleteDC( hDstDC );
- return NULL;
- } // if( hSrcDC == NULL )
- BITMAP _bmpInfoDstDIB;
- ::memset(
- &_bmpInfoDstDIB,
- 0,
- sizeof(BITMAP)
- );
- ::GetObject(
- hDstDIB,
- sizeof(BITMAP),
- &_bmpInfoDstDIB
- );
- for( ; (_bmpInfoDstDIB.bmWidthBytes % 4) != 0; _bmpInfoDstDIB.bmWidthBytes ++ );
- HBITMAP hOldSrc = (HBITMAP)
- ::SelectObject(
- hSrcDC,
- hBitmapSrc
- );
- ::BitBlt(
- hDstDC,
- 0,
- 0,
- _bmpInfoSrcBmp.bmWidth,
- _bmpInfoSrcBmp.bmHeight,
- hSrcDC,
- 0,
- 0,
- SRCCOPY
- );
- BYTE nLowRed = GetRValue( clrTransparent );
- BYTE nLowGreen = GetGValue( clrTransparent );
- BYTE nLowBlue = GetBValue( clrTransparent );
- BYTE nHighRed = BYTE( min( 0xff, ( nLowRed + GetRValue(clrTolerance) ) ) );
- BYTE nHighGreen = BYTE( min( 0xff, ( nLowGreen + GetGValue(clrTolerance) ) ) );
- BYTE nHighBlue = BYTE( min( 0xff, ( nLowBlue + GetBValue(clrTolerance) ) ) );
- BYTE * pDstColorSurface =
- (BYTE *)_bmpInfoDstDIB.bmBits
- + (_bmpInfoDstDIB.bmHeight - 1) * _bmpInfoDstDIB.bmWidthBytes;
- for( int nY = 0; nY < _bmpInfoSrcBmp.bmHeight; nY++ )
- {
- for( int nX = 0; nX < _bmpInfoSrcBmp.bmWidth; nX++ )
- {
- LPLONG ptrLinePart = (LPLONG)pDstColorSurface + nX;
- BYTE nColorPart = GetRValue( (*ptrLinePart) );
- if( nColorPart >= nLowRed && nColorPart <= nHighRed )
- {
- nColorPart = GetGValue( (*ptrLinePart) );
- if( nColorPart >= nLowGreen && nColorPart <= nHighGreen )
- {
- nColorPart = GetBValue( (*ptrLinePart) );
- if( nColorPart >= nLowBlue && nColorPart <= nHighBlue )
- continue;
- } // if( nColorPart >= nLowGreen && nColorPart <= nHighGreen )
- } // if( nColorPart >= nLowRed && nColorPart <= nHighRed )
- (*ptrLinePart) =
- CExtBitmap::stat_HLS_Adjust(
- (*ptrLinePart),
- percentH,
- percentL,
- percentS
- );
- } // for( int nX = 0; nX < _bmpInfoSrcBmp.bmWidth; nX++ )
- pDstColorSurface -= _bmpInfoDstDIB.bmWidthBytes;
- } // for( int nY = 0; nY < _bmpInfoSrcBmp.bmHeight; nY++ )
- ::SelectObject(
- hSrcDC,
- hOldSrc
- );
- ::DeleteDC( hSrcDC );
- ::SelectObject(
- hDstDC,
- hOldDst
- );
- ::DeleteDC( hDstDC );
- return hDstDIB;
- }
- bool CExtPaintManager::stat_HLS_Adjust_Bitmap(
- CBitmap & _bmp,
- COLORREF clrTransparent, // = RGB(0,0,0)
- COLORREF clrTolerance, // = RGB(0,0,0)
- double percentH, // = 0.0
- double percentL, // = 0.0
- double percentS // = 0.0
- )
- {
- HBITMAP hBitmapSrc = (HBITMAP)_bmp.GetSafeHandle();
- if( hBitmapSrc == NULL )
- return false;
- if( percentH == 0.0
- && percentL == 0.0
- && percentS == 0.0
- )
- return true;
- HBITMAP hBitmapDst =
- CExtPaintManager::stat_HLS_Adjust_Bitmap(
- hBitmapSrc,
- clrTransparent,
- clrTolerance,
- percentH,
- percentL,
- percentS
- );
- if( hBitmapDst == NULL )
- return false;
- _bmp.Detach();
- _bmp.Attach( hBitmapDst );
- ::DeleteObject( hBitmapSrc );
- return true;
- }
- // based on the source code by Jean-Edouard Lachand-Robert
- HRGN CExtPaintManager::stat_HBITMAPtoHRGN(
- HBITMAP hBitmap,
- COLORREF clrTransparent,
- COLORREF clrTolerance // = RGB(0,0,0)
- )
- {
- if( hBitmap == NULL )
- {
- ASSERT( FALSE );
- return NULL;
- } // if( hBitmap == NULL )
- HDC hDstDC = ::CreateCompatibleDC( NULL );
- if( hDstDC == NULL )
- {
- ASSERT( FALSE );
- return NULL;
- } // if( hDstDC == NULL )
- BITMAP _bmpInfoSrcBmp;
- ::memset( &_bmpInfoSrcBmp, 0, sizeof(BITMAP) );
- ::GetObject( hBitmap, sizeof(BITMAP), &_bmpInfoSrcBmp );
- BITMAPINFOHEADER _bmpInfoHdr =
- {
- sizeof(BITMAPINFOHEADER),
- _bmpInfoSrcBmp.bmWidth,
- _bmpInfoSrcBmp.bmHeight,
- 1,
- 32,
- BI_RGB,
- 0,
- 0,
- 0,
- 0,
- 0
- };
- LPVOID p32bitColorSurface = NULL;
- HBITMAP hDstDIB = ::CreateDIBSection( hDstDC, (BITMAPINFO *)&_bmpInfoHdr, DIB_RGB_COLORS, &p32bitColorSurface, NULL, 0 );
- if( hDstDIB == NULL )
- {
- ASSERT( FALSE );
- ::DeleteDC( hDstDC );
- return NULL;
- } // if( hDstDIB == NULL )
- ASSERT( p32bitColorSurface != NULL );
- HBITMAP hOldDst = (HBITMAP) ::SelectObject( hDstDC, hDstDIB );
- HDC hSrcDC = ::CreateCompatibleDC( hDstDC );
- if( hSrcDC == NULL )
- {
- ASSERT( FALSE );
- ::DeleteObject( ::SelectObject( hDstDC, hOldDst ) );
- ::DeleteDC( hDstDC );
- return NULL;
- } // if( hSrcDC == NULL )
- BITMAP _bmpInfoDstDIB;
- ::memset( &_bmpInfoDstDIB, 0, sizeof(BITMAP) );
- ::GetObject( hDstDIB, sizeof(BITMAP), &_bmpInfoDstDIB );
- for( ; (_bmpInfoDstDIB.bmWidthBytes % 4) != 0; _bmpInfoDstDIB.bmWidthBytes ++ );
- HBITMAP hOldSrc = (HBITMAP) ::SelectObject( hSrcDC, hBitmap );
- ::BitBlt( hDstDC, 0, 0, _bmpInfoSrcBmp.bmWidth, _bmpInfoSrcBmp.bmHeight, hSrcDC, 0, 0, SRCCOPY );
- static const DWORD g_nReallocSize = 200;
- DWORD nMaxParts = g_nReallocSize;
- HANDLE hGlobal = ::GlobalAlloc( GMEM_MOVEABLE, sizeof(RGNDATAHEADER) + ( sizeof(RECT) * nMaxParts ) );
- RGNDATA * pRgnData = (RGNDATA *) ::GlobalLock( hGlobal );
- ::memset( LPVOID(pRgnData), 0, sizeof(RGNDATAHEADER) + ( sizeof(RECT) * nMaxParts ) );
- pRgnData->rdh.dwSize = sizeof(RGNDATAHEADER);
- pRgnData->rdh.iType = RDH_RECTANGLES;
- pRgnData->rdh.nCount = pRgnData->rdh.nRgnSize = 0;
- ::SetRect( &pRgnData->rdh.rcBound, MAXLONG, MAXLONG, 0, 0 );
- BYTE nLowRed = GetRValue( clrTransparent );
- BYTE nLowGreen = GetGValue( clrTransparent );
- BYTE nLowBlue = GetBValue( clrTransparent );
- BYTE nHighRed = BYTE( min( 0xff, ( nLowRed + GetRValue(clrTolerance) ) ) );
- BYTE nHighGreen = BYTE( min( 0xff, ( nLowGreen + GetGValue(clrTolerance) ) ) );
- BYTE nHighBlue = BYTE( min( 0xff, ( nLowBlue + GetBValue(clrTolerance) ) ) );
- BYTE * pDstColorSurface = (BYTE *)_bmpInfoDstDIB.bmBits + (_bmpInfoDstDIB.bmHeight - 1) * _bmpInfoDstDIB.bmWidthBytes;
- HRGN hRgnResult = NULL;
- for( int nY = 0; nY < _bmpInfoSrcBmp.bmHeight; nY++ )
- {
- for( int nX = 0; nX < _bmpInfoSrcBmp.bmWidth; nX++ )
- {
- LPLONG ptrLinePart = (LPLONG)pDstColorSurface + nX;
- int nSavedX = nX;
- for( ; nX < _bmpInfoSrcBmp.bmWidth; ptrLinePart++, nX++ )
- {
- BYTE nColorPart = GetRValue( (*ptrLinePart) );
- if( nColorPart >= nLowRed && nColorPart <= nHighRed )
- {
- nColorPart = GetGValue( (*ptrLinePart) );
- if( nColorPart >= nLowGreen && nColorPart <= nHighGreen )
- {
- nColorPart = GetBValue( (*ptrLinePart) );
- if( nColorPart >= nLowBlue && nColorPart <= nHighBlue )
- break;
- } // if( nColorPart >= nLowGreen && nColorPart <= nHighGreen )
- } // if( nColorPart >= nLowRed && nColorPart <= nHighRed )
- } // for( ; nX < _bmpInfoSrcBmp.bmWidth; ptrLinePart++, nX++ )
- if( nX > nSavedX )
- {
- if( pRgnData->rdh.nCount >= nMaxParts )
- {
- ::GlobalUnlock( hGlobal );
- DWORD dwPrevParts = nMaxParts;
- nMaxParts += g_nReallocSize;
- hGlobal = ::GlobalReAlloc( hGlobal, sizeof(RGNDATAHEADER) + (sizeof(RECT) * nMaxParts), GMEM_MOVEABLE );
- pRgnData = (RGNDATA *) ::GlobalLock( hGlobal );
- ::memset( LPVOID( LPBYTE(pRgnData) + sizeof(RGNDATAHEADER) + ( sizeof(RECT) * dwPrevParts ) ), 0, sizeof(RECT) * ( nMaxParts - dwPrevParts ) );
- } // if( pRgnData->rdh.nCount >= nMaxParts )
- LPRECT pRect = (LPRECT)&pRgnData->Buffer;
- ::SetRect( &pRect[pRgnData->rdh.nCount], nSavedX, nY, nX, nY + 1 );
- if( nSavedX < pRgnData->rdh.rcBound.left )
- pRgnData->rdh.rcBound.left = nSavedX;
- if( nY < pRgnData->rdh.rcBound.top )
- pRgnData->rdh.rcBound.top = nY;
- if( nX > pRgnData->rdh.rcBound.right )
- pRgnData->rdh.rcBound.right = nX;
- if( (nY + 1) > pRgnData->rdh.rcBound.bottom )
- pRgnData->rdh.rcBound.bottom = nY+1;
- pRgnData->rdh.nCount ++;
- if( pRgnData->rdh.nCount == 2000 )
- {
- HRGN hRgnPart = ::ExtCreateRegion( NULL, sizeof(RGNDATAHEADER) + (sizeof(RECT) * nMaxParts), pRgnData );
- if( hRgnResult != NULL )
- {
- ::CombineRgn( hRgnResult, hRgnResult, hRgnPart, RGN_OR );
- ::DeleteObject( hRgnPart );
- } // if( hRgnResult != NULL )
- else
- hRgnResult = hRgnPart;
- pRgnData->rdh.nCount = 0;
- ::SetRect( &pRgnData->rdh.rcBound, MAXLONG, MAXLONG, 0, 0 );
- } // if( pRgnData->rdh.nCount == 2000 )
- } // if( nX > nSavedX )
- } // for( int nX = 0; nX < _bmpInfoSrcBmp.bmWidth; nX++ )
- pDstColorSurface -= _bmpInfoDstDIB.bmWidthBytes;
- } // for( int nY = 0; nY < _bmpInfoSrcBmp.bmHeight; nY++ )
- HRGN hRgnPart =
- ::ExtCreateRegion( NULL, sizeof(RGNDATAHEADER) + (sizeof(RECT) * nMaxParts), pRgnData );
- if( hRgnResult != NULL )
- {
- ::CombineRgn( hRgnResult, hRgnResult, hRgnPart, RGN_OR );
- ::DeleteObject( hRgnPart );
- } // if( hRgnResult != NULL )
- else
- hRgnResult = hRgnPart;
- ::GlobalFree( hGlobal );
- ::SelectObject( hSrcDC, hOldSrc );
- ::DeleteDC( hSrcDC );
- ::DeleteObject( ::SelectObject( hDstDC, hOldDst ) );
- ::DeleteDC( hDstDC );
- return hRgnResult;
- }
- #endif // __EXT_PM_BACK_COMPATIBILITY_BITMAP_API
- #if (!defined __EXT_MFC_NO_DOCK_MARKERS)
- CExtPaintManager::DockMarkerBase * CExtPaintManager::DockMarker_CreateObject(
- int eResizablePanelDockingType
- )
- {
- ASSERT_VALID( this );
- if( eResizablePanelDockingType == INT(CExtControlBar::__RESIZABLE_DOCKING_TYPE_STUDIO_2008_XP) )
- return (new DockMarker2008XP( this, eResizablePanelDockingType ) );
- if( eResizablePanelDockingType == INT(CExtControlBar::__RESIZABLE_DOCKING_TYPE_STUDIO_2008_VISTA) )
- return (new DockMarker2008Vista( this, eResizablePanelDockingType ) );
- switch( m_eStyle2005 )
- {
- case __ES2005_BETA1:
- return (new DockMarkerBase( this, eResizablePanelDockingType ) );
- case __ES2005_BETA2:
- case __ES2005_RC:
- return (new DockMarkerBeta2( this, eResizablePanelDockingType ) );
- default:
- {
- ASSERT( FALSE );
- AfxThrowNotSupportedException();
- }
- #if _MFC_VER < 0x710
- return NULL;
- #endif // #if _MFC_VER < 0x710
- } // switch( m_eStyle2005 )
- }
- CExtPaintManager::DockMarkerBase::DockMarkerBase(
- CExtPaintManager * pPM,
- int eResizablePanelDockingType,
- eDockMarkerType_t eDockMarkerType, // = __EDMT_EMPTY
- CRect rcScreen // = CRect( 0, 0, 0, 0 )
- )
- : m_eDockMarkerType( __EDMT_EMPTY )
- , m_size( 0, 0 )
- , m_rcScreen( 0, 0, 0, 0 )
- , m_bSparsedMode( false )
- , m_ptOffsetInner( 0, 0 )
- , m_pPM( pPM )
- , m_eResizablePanelDockingType( eResizablePanelDockingType )
- {
- ASSERT_VALID( pPM );
- ASSERT(
- INT(CExtControlBar::__RESIZABLE_DOCKING_TYPE_MIN_VALUE) <= m_eResizablePanelDockingType
- && m_eResizablePanelDockingType <= INT(CExtControlBar::__RESIZABLE_DOCKING_TYPE_MAX_VALUE)
- );
- if( m_eResizablePanelDockingType == INT(CExtControlBar::__RESIZABLE_DOCKING_TYPE_STUDIO_2008_AUTO) )
- {
- m_eResizablePanelDockingType = INT(CExtControlBar::__RESIZABLE_DOCKING_TYPE_STUDIO_2008_XP);
- if( g_PaintManager.m_bIsWinVistaOrLater
- && g_PaintManager.m_DWM.IsCompositionEnabled()
- )
- m_eResizablePanelDockingType = INT(CExtControlBar::__RESIZABLE_DOCKING_TYPE_STUDIO_2008_VISTA);
- }
- if( m_eResizablePanelDockingType == INT(CExtControlBar::__RESIZABLE_DOCKING_TYPE_STUDIO_2008_XP)
- && (!(
- g_PaintManager.m_bIsWin2000orLater
- && CExtPaintManager::stat_GetBPP() >= 24
- ))
- )
- m_eResizablePanelDockingType = INT(CExtControlBar::__RESIZABLE_DOCKING_TYPE_STUDIO_2005);
- if( eDockMarkerType != __EDMT_EMPTY )
- {
- VERIFY(
- Create(
- false,
- eDockMarkerType,
- rcScreen
- )
- );
- }
- }
- CExtPaintManager::DockMarkerBeta2::DockMarkerBeta2(
- CExtPaintManager * pPM,
- int eResizablePanelDockingType,
- eDockMarkerType_t eDockMarkerType, // = __EDMT_EMPTY
- CRect rcScreen // = CRect( 0, 0, 0, 0 )
- )
- : CExtPaintManager::DockMarkerBase(
- pPM,
- eResizablePanelDockingType
- )
- {
- if( eDockMarkerType != __EDMT_EMPTY )
- {
- VERIFY(
- Create(
- false,
- eDockMarkerType,
- rcScreen
- )
- );
- }
- }
- CExtPaintManager::DockMarker2008XP::DockMarker2008XP(
- CExtPaintManager * pPM,
- int eResizablePanelDockingType,
- eDockMarkerType_t eDockMarkerType, // = __EDMT_EMPTY
- CRect rcScreen // = CRect( 0, 0, 0, 0 )
- )
- : CExtPaintManager::DockMarkerBase(
- pPM,
- eResizablePanelDockingType
- )
- {
- if( eDockMarkerType != __EDMT_EMPTY )
- {
- VERIFY(
- Create(
- false,
- eDockMarkerType,
- rcScreen
- )
- );
- }
- }
- CExtPaintManager::DockMarker2008Vista::DockMarker2008Vista(
- CExtPaintManager * pPM,
- int eResizablePanelDockingType,
- eDockMarkerType_t eDockMarkerType, // = __EDMT_EMPTY
- CRect rcScreen // = CRect( 0, 0, 0, 0 )
- )
- : CExtPaintManager::DockMarkerBase(
- pPM,
- eResizablePanelDockingType
- )
- {
- if( eDockMarkerType != __EDMT_EMPTY )
- {
- VERIFY(
- Create(
- false,
- eDockMarkerType,
- rcScreen
- )
- );
- }
- }
- CExtPaintManager::DockMarkerBase::~DockMarkerBase()
- {
- Empty();
- }
- CExtPaintManager::DockMarkerBeta2::~DockMarkerBeta2()
- {
- Empty();
- }
- CExtPaintManager::DockMarker2008XP::~DockMarker2008XP()
- {
- Empty();
- }
- CExtPaintManager::DockMarker2008Vista::~DockMarker2008Vista()
- {
- Empty();
- }
- bool CExtPaintManager::DockMarkerBase::IsEmpty() const
- {
- if( m_eDockMarkerType == __EDMT_EMPTY )
- {
- ASSERT( m_bmpIn.IsEmpty() );
- ASSERT( m_bmpOut.IsEmpty() );
- ASSERT( m_rgn.GetSafeHandle() == NULL );
- ASSERT( m_size.cx == 0 );
- ASSERT( m_size.cy == 0 );
- ASSERT( m_arrChildren.GetSize() == 0 );
- return true;
- } // if( m_rgn.GetSafeHandle() == NULL )
- return false;
- }
- bool CExtPaintManager::DockMarkerBase::CreateFromBitmapResources(
- CRect rcScreen,
- CExtPaintManager::eDockMarkerType_t eDockMarkerType,
- COLORREF clrTransparentIn,
- UINT nResourceBmpIn,
- UINT nResourceBmpOut,
- __EXT_MFC_SAFE_LPCTSTR strResourceTypeBmpIn, // = RT_BITMAP // default bitmap section
- __EXT_MFC_SAFE_LPCTSTR strResourceTypeBmpOut, // = RT_BITMAP // default bitmap section
- HINSTANCE hInstBmpIn, // = NULL // find it automatically
- HINSTANCE hInstBmpOut // = NULL // find it automatically
- )
- {
- return
- CreateFromBitmapResources(
- rcScreen,
- eDockMarkerType,
- clrTransparentIn,
- __EXT_MFC_SAFE_LPCTSTR( MAKEINTRESOURCE(nResourceBmpIn) ),
- __EXT_MFC_SAFE_LPCTSTR( MAKEINTRESOURCE(nResourceBmpOut) ),
- strResourceTypeBmpIn,
- strResourceTypeBmpOut,
- hInstBmpIn,
- hInstBmpOut
- );
- }
- bool CExtPaintManager::DockMarkerBase::CreateFromBitmapResources(
- CRect rcScreen,
- CExtPaintManager::eDockMarkerType_t eDockMarkerType,
- COLORREF clrTransparentIn,
- __EXT_MFC_SAFE_LPCTSTR strResourceBmpIn,
- __EXT_MFC_SAFE_LPCTSTR strResourceBmpOut, // = NULL
- __EXT_MFC_SAFE_LPCTSTR strResourceTypeBmpIn, // = RT_BITMAP // default bitmap section
- __EXT_MFC_SAFE_LPCTSTR strResourceTypeBmpOut, // = RT_BITMAP // default bitmap section
- HINSTANCE hInstBmpIn, // = NULL // find it automatically
- HINSTANCE hInstBmpOut // = NULL // find it automatically
- )
- {
- ASSERT( IsEmpty() );
- ASSERT( eDockMarkerType != __EDMT_EMPTY );
- ASSERT( strResourceBmpIn != NULL );
- if( strResourceBmpOut == NULL )
- {
- strResourceBmpOut = strResourceBmpIn;
- strResourceTypeBmpOut = strResourceTypeBmpIn;
- hInstBmpOut = hInstBmpIn;
- } // if( strResourceBmpOut == NULL )
- CExtBitmap _bmpIn;
- if( ! _bmpIn.LoadBMP_Resource(
- strResourceBmpIn,
- strResourceTypeBmpIn,
- hInstBmpIn
- )
- )
- {
- ASSERT( FALSE );
- return false;
- }
- CExtBitmap _bmpOut;
- if( ! _bmpOut.LoadBMP_Resource(
- strResourceBmpOut,
- strResourceTypeBmpOut,
- hInstBmpOut
- )
- )
- {
- ASSERT( FALSE );
- return false;
- }
- return
- CreateFromBitmaps(
- rcScreen,
- eDockMarkerType,
- clrTransparentIn,
- _bmpIn,
- _bmpOut
- );
- }
- bool CExtPaintManager::DockMarkerBase::CreateFromBitmapData(
- CRect rcScreen,
- eDockMarkerType_t eDockMarkerType,
- COLORREF clrTransparentIn,
- const BYTE * pDataBmpIn,
- DWORD dwSizeDataBmpIn,
- const BYTE * pDataBmpOut, // = NULL
- DWORD dwSizeDataBmpOut // = 0
- )
- {
- ASSERT( IsEmpty() );
- ASSERT( eDockMarkerType != __EDMT_EMPTY );
- ASSERT(
- pDataBmpIn != NULL && dwSizeDataBmpIn > 0
- );
- ASSERT(
- ( pDataBmpOut != NULL && dwSizeDataBmpOut > 0 )
- || pDataBmpOut == NULL && dwSizeDataBmpOut == 0
- );
- if( pDataBmpOut == NULL )
- {
- pDataBmpOut = pDataBmpIn;
- dwSizeDataBmpOut = dwSizeDataBmpIn;
- } // if( pDataBmpOut == NULL )
- CExtBitmap _bmpIn;
- if( ! _bmpIn.LoadBMP_Buffer(
- pDataBmpIn,
- dwSizeDataBmpIn
- )
- )
- {
- ASSERT( FALSE );
- return false;
- }
- CExtBitmap _bmpOut;
- if( ! _bmpOut.LoadBMP_Buffer(
- pDataBmpOut,
- dwSizeDataBmpOut
- )
- )
- {
- ASSERT( FALSE );
- return false;
- }
- return
- CreateFromBitmaps(
- rcScreen,
- eDockMarkerType,
- clrTransparentIn,
- _bmpIn,
- _bmpOut
- );
- }
- bool CExtPaintManager::DockMarkerBase::CreateFromBitmaps(
- CRect rcScreen,
- CExtPaintManager::eDockMarkerType_t eDockMarkerType,
- COLORREF clrTransparentIn,
- const CExtBitmap & _bmpIn,
- const CExtBitmap & _bmpOut
- )
- {
- ASSERT( IsEmpty() );
- ASSERT( eDockMarkerType != __EDMT_EMPTY );
- ASSERT( ! _bmpIn.IsEmpty() );
- ASSERT( ! _bmpOut.IsEmpty() );
- CSize _sizeBmpInfoIn = _bmpIn.GetSize(), _sizeBmpInfoOut = _bmpOut.GetSize();
- ASSERT( _sizeBmpInfoIn.cx > 0 && _sizeBmpInfoIn.cy > 0 );
- ASSERT( _sizeBmpInfoOut.cx > 0 && _sizeBmpInfoOut.cy > 0 );
- if( _sizeBmpInfoIn.cx != _sizeBmpInfoOut.cx
- || _sizeBmpInfoIn.cy != _sizeBmpInfoOut.cy
- )
- {
- ASSERT( FALSE );
- return false;
- }
- // HRGN hRgn =
- // CExtPaintManager::stat_HBITMAPtoHRGN(
- // hBmpIn,
- // clrTransparentIn
- // );
- HRGN hRgn =
- _bmpIn.GenerateColorHRGN( false, clrTransparentIn );
- if( hRgn == NULL )
- {
- ASSERT( FALSE );
- return false;
- } // if( hRgn == NULL )
- m_size.cx = _sizeBmpInfoIn.cx;
- m_size.cy = _sizeBmpInfoIn.cy;
- m_bmpIn = _bmpIn;
- m_bmpOut = _bmpOut;
- m_rgn.Attach( hRgn );
- m_eDockMarkerType = eDockMarkerType;
- OnCalcScreenRect(
- eDockMarkerType,
- rcScreen
- );
- g_PaintManager->DockMarker_AdjustBmps(
- eDockMarkerType,
- m_bmpIn,
- clrTransparentIn,
- m_bmpOut,
- clrTransparentIn
- );
- return true;
- }
- void CExtPaintManager::DockMarkerBase::OnCalcScreenRect(
- CExtPaintManager::eDockMarkerType_t eDockMarkerType,
- CRect rcScreen,
- DockMarkerBase * pCenterMarker // = NULL
- )
- {
- pCenterMarker;
- m_rcScreen = rcScreen;
- switch( eDockMarkerType )
- {
- case __EDMT_2005_TOP:
- m_rcScreen.bottom = m_rcScreen.top + m_size.cy;
- m_rcScreen.OffsetRect(
- ( m_rcScreen.Width() - m_size.cx ) / 2,
- 0
- );
- m_rcScreen.right = m_rcScreen.left + m_size.cx;
- break;
- case __EDMT_2005_BOTTOM:
- m_rcScreen.top = m_rcScreen.bottom - m_size.cy;
- m_rcScreen.OffsetRect(
- ( m_rcScreen.Width() - m_size.cx ) / 2,
- 0
- );
- m_rcScreen.right = m_rcScreen.left + m_size.cx;
- break;
- case __EDMT_2005_LEFT:
- m_rcScreen.right = m_rcScreen.left + m_size.cx;
- m_rcScreen.OffsetRect(
- 0,
- ( m_rcScreen.Height() - m_size.cy ) / 2
- );
- m_rcScreen.bottom = m_rcScreen.top + m_size.cy;
- break;
- case __EDMT_2005_RIGHT:
- m_rcScreen.left = m_rcScreen.right - m_size.cx;
- m_rcScreen.OffsetRect(
- 0,
- ( m_rcScreen.Height() - m_size.cy ) / 2
- );
- m_rcScreen.bottom = m_rcScreen.top + m_size.cy;
- break;
- case __EDMT_2005_CENTER:
- #if (!defined __EXT_MFC_NO_TAB_CONTROLBARS )
- case __EDMT_2005_TAB:
- #endif // (!defined __EXT_MFC_NO_TAB_CONTROLBARS )
- m_rcScreen.OffsetRect(
- ( m_rcScreen.Width() - m_size.cx ) / 2,
- ( m_rcScreen.Height() - m_size.cy ) / 2
- );
- m_rcScreen.right = m_rcScreen.left + m_size.cx;
- m_rcScreen.bottom = m_rcScreen.top + m_size.cy;
- break;
- #ifdef _DEBUG
- default:
- ASSERT( FALSE );
- break;
- #endif // _DEBUG
- } // switch( eDockMarkerType )
- }
- void CExtPaintManager::DockMarkerBeta2::OnCalcScreenRect(
- CExtPaintManager::eDockMarkerType_t eDockMarkerType,
- CRect rcScreen,
- DockMarkerBase * pCenterMarker // = NULL
- )
- {
- DockMarkerBase::OnCalcScreenRect(
- eDockMarkerType,
- rcScreen,
- pCenterMarker
- );
- if( m_bSparsedMode && m_bmpOuterBk.IsEmpty() )
- {
- CRect rcOuterMargins = g_PaintManager->DockMarker_GetOuterDistance();
- switch( eDockMarkerType )
- {
- case __EDMT_2005_LEFT:
- {
- CExtBitmap _bitmap;
- _bitmap.LoadBMP_Resource(
- MAKEINTRESOURCE(
- IDB_EXT_RESIZABLE_DOCK_MARKER_2005B2_OUTER_BK_LEFT
- )
- );
- if( ! _bitmap.IsEmpty() )
- {
- m_size = _bitmap.GetSize();
- m_ptOffsetInner.x = 4;
- m_ptOffsetInner.y = ( m_size.cy - m_rcScreen.Height() ) / 2;
- m_rcScreen.right = m_rcScreen.left + m_size.cx;
- m_rcScreen.top -= m_ptOffsetInner.y;
- m_rcScreen.bottom = m_rcScreen.top + m_size.cy;
- m_ptOffsetInner.y ++;
- m_rcScreen.OffsetRect( rcOuterMargins.left, 0 );
- m_bmpOuterBk = _bitmap;
- HRGN hRgn = _bitmap.GenerateColorHRGN( false, RGB(0,255,0) );
- if( hRgn != NULL )
- {
- if( m_rgn.GetSafeHandle() != NULL )
- m_rgn.DeleteObject();
- m_rgn.Attach( hRgn );
- } // if( hRgn != NULL )
- } // if( ! _bitmap.IsEmpty() )
- #ifdef _DEBUG
- else
- {
- ASSERT( FALSE );
- } // else from if( ! _bitmap.IsEmpty() )
- #endif // _DEBUG
- }
- break;
- case __EDMT_2005_RIGHT:
- {
- CExtBitmap _bitmap;
- _bitmap.LoadBMP_Resource(
- MAKEINTRESOURCE(
- IDB_EXT_RESIZABLE_DOCK_MARKER_2005B2_OUTER_BK_RIGHT
- )
- );
- if( ! _bitmap.IsEmpty() )
- {
- m_size = _bitmap.GetSize();
- m_ptOffsetInner.x = 3;
- m_ptOffsetInner.y = ( m_size.cy - m_rcScreen.Height() ) / 2;
- m_rcScreen.left = m_rcScreen.right - m_size.cx;
- m_rcScreen.top -= m_ptOffsetInner.y;
- m_rcScreen.bottom = m_rcScreen.top + m_size.cy;
- m_ptOffsetInner.y ++;
- m_rcScreen.OffsetRect( - rcOuterMargins.right, 0 );
- m_bmpOuterBk = _bitmap;
- HRGN hRgn = _bitmap.GenerateColorHRGN( false, RGB(0,255,0) );
- if( hRgn != NULL )
- {
- if( m_rgn.GetSafeHandle() != NULL )
- m_rgn.DeleteObject();
- m_rgn.Attach( hRgn );
- } // if( hRgn != NULL )
- } // if( ! _bitmap.IsEmpty() )
- #ifdef _DEBUG
- else
- {
- ASSERT( FALSE );
- } // else from if( ! _bitmap.IsEmpty() )
- #endif // _DEBUG
- }
- break;
- case __EDMT_2005_TOP:
- {
- CExtBitmap _bitmap;
- _bitmap.LoadBMP_Resource(
- MAKEINTRESOURCE(
- IDB_EXT_RESIZABLE_DOCK_MARKER_2005B2_OUTER_BK_TOP
- )
- );
- if( ! _bitmap.IsEmpty() )
- {
- m_size = _bitmap.GetSize();
- m_ptOffsetInner.y = 4;
- m_ptOffsetInner.x = ( m_size.cx - m_rcScreen.Width() ) / 2;
- m_rcScreen.bottom = m_rcScreen.top + m_size.cy;
- m_rcScreen.left -= m_ptOffsetInner.x;
- m_rcScreen.right = m_rcScreen.left + m_size.cx;
- m_ptOffsetInner.x ++;
- m_rcScreen.OffsetRect( 0, rcOuterMargins.top );
- m_bmpOuterBk = _bitmap;
- HRGN hRgn = _bitmap.GenerateColorHRGN( false, RGB(0,255,0) );
- if( hRgn != NULL )
- {
- if( m_rgn.GetSafeHandle() != NULL )
- m_rgn.DeleteObject();
- m_rgn.Attach( hRgn );
- } // if( hRgn != NULL )
- } // if( ! _bitmap.IsEmpty() )
- #ifdef _DEBUG
- else
- {
- ASSERT( FALSE );
- } // else from if( ! _bitmap.IsEmpty() )
- #endif // _DEBUG
- }
- break;
- case __EDMT_2005_BOTTOM:
- {
- CExtBitmap _bitmap;
- _bitmap.LoadBMP_Resource(
- MAKEINTRESOURCE(
- IDB_EXT_RESIZABLE_DOCK_MARKER_2005B2_OUTER_BK_BOTTOM
- )
- );
- if( ! _bitmap.IsEmpty() )
- {
- m_size = _bitmap.GetSize();
- m_ptOffsetInner.y = 3;
- m_ptOffsetInner.x = ( m_size.cx - m_rcScreen.Width() ) / 2;
- m_rcScreen.top = m_rcScreen.bottom - m_size.cy;
- m_rcScreen.left -= m_ptOffsetInner.x;
- m_rcScreen.right = m_rcScreen.left + m_size.cx;
- m_ptOffsetInner.x ++;
- m_rcScreen.OffsetRect( 0, - rcOuterMargins.bottom );
- m_bmpOuterBk = _bitmap;
- HRGN hRgn = _bitmap.GenerateColorHRGN( false, RGB(0,255,0) );
- if( hRgn != NULL )
- {
- if( m_rgn.GetSafeHandle() != NULL )
- m_rgn.DeleteObject();
- m_rgn.Attach( hRgn );
- } // if( hRgn != NULL )
- } // if( ! _bitmap.IsEmpty() )
- #ifdef _DEBUG
- else
- {
- ASSERT( FALSE );
- } // else from if( ! _bitmap.IsEmpty() )
- #endif // _DEBUG
- }
- break;
- } // switch( pDM->m_eDockMarkerType )
- } // if( m_bSparsedMode && m_bmpOuterBk.IsEmpty() )
- if( pCenterMarker != NULL )
- {
- switch( eDockMarkerType )
- {
- case __EDMT_2005_LEFT:
- m_rcScreen.OffsetRect( 10, 1 );
- break;
- case __EDMT_2005_RIGHT:
- m_rcScreen.OffsetRect( -8, 1 );
- break;
- case __EDMT_2005_TOP:
- m_rcScreen.OffsetRect( 1, 10 );
- break;
- case __EDMT_2005_BOTTOM:
- m_rcScreen.OffsetRect( 1, -8 );
- break;
- #if (!defined __EXT_MFC_NO_TAB_CONTROLBARS )
- case __EDMT_2005_TAB:
- m_rcScreen.OffsetRect( 1, 1 );
- break;
- #endif // (!defined __EXT_MFC_NO_TAB_CONTROLBARS )
- } // switch( pDM->m_eDockMarkerType )
- } // if( pCenterMarker != NULL )
- else
- {
- #if (!defined __EXT_MFC_NO_TAB_CONTROLBARS )
- switch( eDockMarkerType )
- {
- case __EDMT_2005_TAB:
- m_rcScreen.OffsetRect( 1, 1 );
- break;
- } // switch( pDM->m_eDockMarkerType )
- #endif // (!defined __EXT_MFC_NO_TAB_CONTROLBARS )
- } // else from if( pCenterMarker != NULL )
- }
- void CExtPaintManager::DockMarker2008XP::OnCalcScreenRect(
- CExtPaintManager::eDockMarkerType_t eDockMarkerType,
- CRect rcScreen,
- DockMarkerBase * pCenterMarker // = NULL
- )
- {
- DockMarkerBase::OnCalcScreenRect(
- eDockMarkerType,
- rcScreen,
- pCenterMarker
- );
- if( m_bSparsedMode && m_bmpOuterBk.IsEmpty() )
- {
- CRect rcOuterMargins = g_PaintManager->DockMarker_GetOuterDistance();
- switch( eDockMarkerType )
- {
- case __EDMT_2005_LEFT:
- {
- CExtBitmap _bitmap;
- _bitmap.LoadBMP_Resource(
- ( m_bSparsedMode )
- ? __EXT_MFC_SAFE_LPCTSTR( MAKEINTRESOURCE( IDB_EXT_RESIZABLE_DOCK_MARKER_2008_XP_OUTER_IN_LEFT ) )
- : __EXT_MFC_SAFE_LPCTSTR( MAKEINTRESOURCE( IDB_EXT_RESIZABLE_DOCK_MARKER_2008_XP_INNER_IN_LEFT ) )
- );
- if( ! _bitmap.IsEmpty() )
- {
- m_size = _bitmap.GetSize();
- m_rcScreen.right = m_rcScreen.left + m_size.cx;
- m_rcScreen.bottom = m_rcScreen.top + m_size.cy;
- m_rcScreen.OffsetRect( rcOuterMargins.left, 0 );
- m_bmpOuterBk = _bitmap;
- HRGN hRgn = _bitmap.GenerateColorHRGN( false, RGB(255,0,255) );
- if( hRgn != NULL )
- {
- if( m_rgn.GetSafeHandle() != NULL )
- m_rgn.DeleteObject();
- m_rgn.Attach( hRgn );
- } // if( hRgn != NULL )
- } // if( ! _bitmap.IsEmpty() )
- #ifdef _DEBUG
- else
- {
- ASSERT( FALSE );
- } // else from if( ! _bitmap.IsEmpty() )
- #endif // _DEBUG
- }
- break;
- case __EDMT_2005_RIGHT:
- {
- CExtBitmap _bitmap;
- _bitmap.LoadBMP_Resource(
- ( m_bSparsedMode )
- ? __EXT_MFC_SAFE_LPCTSTR( MAKEINTRESOURCE( IDB_EXT_RESIZABLE_DOCK_MARKER_2008_XP_OUTER_IN_RIGHT ) )
- : __EXT_MFC_SAFE_LPCTSTR( MAKEINTRESOURCE( IDB_EXT_RESIZABLE_DOCK_MARKER_2008_XP_INNER_IN_RIGHT ) )
- );
- if( ! _bitmap.IsEmpty() )
- {
- m_size = _bitmap.GetSize();
- m_rcScreen.left = m_rcScreen.right - m_size.cx;
- m_rcScreen.bottom = m_rcScreen.top + m_size.cy;
- m_rcScreen.OffsetRect( - rcOuterMargins.right, 0 );
- m_bmpOuterBk = _bitmap;
- HRGN hRgn = _bitmap.GenerateColorHRGN( false, RGB(255,0,255) );
- if( hRgn != NULL )
- {
- if( m_rgn.GetSafeHandle() != NULL )
- m_rgn.DeleteObject();
- m_rgn.Attach( hRgn );
- } // if( hRgn != NULL )
- } // if( ! _bitmap.IsEmpty() )
- #ifdef _DEBUG
- else
- {
- ASSERT( FALSE );
- } // else from if( ! _bitmap.IsEmpty() )
- #endif // _DEBUG
- }
- break;
- case __EDMT_2005_TOP:
- {
- CExtBitmap _bitmap;
- _bitmap.LoadBMP_Resource(
- ( m_bSparsedMode )
- ? __EXT_MFC_SAFE_LPCTSTR( MAKEINTRESOURCE( IDB_EXT_RESIZABLE_DOCK_MARKER_2008_XP_OUTER_IN_TOP ) )
- : __EXT_MFC_SAFE_LPCTSTR( MAKEINTRESOURCE( IDB_EXT_RESIZABLE_DOCK_MARKER_2008_XP_INNER_IN_TOP ) )
- );
- if( ! _bitmap.IsEmpty() )
- {
- m_size = _bitmap.GetSize();
- m_rcScreen.bottom = m_rcScreen.top + m_size.cy;
- m_rcScreen.right = m_rcScreen.left + m_size.cx;
- m_rcScreen.OffsetRect( 0, rcOuterMargins.top );
- m_bmpOuterBk = _bitmap;
- HRGN hRgn = _bitmap.GenerateColorHRGN( false, RGB(255,0,255) );
- if( hRgn != NULL )
- {
- if( m_rgn.GetSafeHandle() != NULL )
- m_rgn.DeleteObject();
- m_rgn.Attach( hRgn );
- } // if( hRgn != NULL )
- } // if( ! _bitmap.IsEmpty() )
- #ifdef _DEBUG
- else
- {
- ASSERT( FALSE );
- } // else from if( ! _bitmap.IsEmpty() )
- #endif // _DEBUG
- }
- break;
- case __EDMT_2005_BOTTOM:
- {
- CExtBitmap _bitmap;
- _bitmap.LoadBMP_Resource(
- ( m_bSparsedMode )
- ? __EXT_MFC_SAFE_LPCTSTR( MAKEINTRESOURCE( IDB_EXT_RESIZABLE_DOCK_MARKER_2008_XP_OUTER_IN_BOTTOM ) )
- : __EXT_MFC_SAFE_LPCTSTR( MAKEINTRESOURCE( IDB_EXT_RESIZABLE_DOCK_MARKER_2008_XP_INNER_IN_BOTTOM ) )
- );
- if( ! _bitmap.IsEmpty() )
- {
- m_size = _bitmap.GetSize();
- m_rcScreen.top = m_rcScreen.bottom - m_size.cy;
- m_rcScreen.right = m_rcScreen.left + m_size.cx;
- m_rcScreen.OffsetRect( 0, - rcOuterMargins.bottom );
- m_bmpOuterBk = _bitmap;
- HRGN hRgn = _bitmap.GenerateColorHRGN( false, RGB(255,0,255) );
- if( hRgn != NULL )
- {
- if( m_rgn.GetSafeHandle() != NULL )
- m_rgn.DeleteObject();
- m_rgn.Attach( hRgn );
- } // if( hRgn != NULL )
- } // if( ! _bitmap.IsEmpty() )
- #ifdef _DEBUG
- else
- {
- ASSERT( FALSE );
- } // else from if( ! _bitmap.IsEmpty() )
- #endif // _DEBUG
- }
- break;
- } // switch( pDM->m_eDockMarkerType )
- } // if( m_bSparsedMode && m_bmpOuterBk.IsEmpty() )
- if( pCenterMarker != NULL )
- {
- switch( eDockMarkerType )
- {
- case __EDMT_2005_LEFT:
- m_rcScreen.OffsetRect( -18, 0 );
- break;
- case __EDMT_2005_RIGHT:
- m_rcScreen.OffsetRect( 18, 0 );
- break;
- case __EDMT_2005_TOP:
- m_rcScreen.OffsetRect( 0, -18 );
- break;
- case __EDMT_2005_BOTTOM:
- m_rcScreen.OffsetRect( 0, 18 );
- break;
- #if (!defined __EXT_MFC_NO_TAB_CONTROLBARS )
- case __EDMT_2005_TAB:
- break;
- #endif // (!defined __EXT_MFC_NO_TAB_CONTROLBARS )
- } // switch( pDM->m_eDockMarkerType )
- } // if( pCenterMarker != NULL )
- else
- {
- #if (!defined __EXT_MFC_NO_TAB_CONTROLBARS )
- switch( eDockMarkerType )
- {
- case __EDMT_2005_TAB:
- break;
- } // switch( pDM->m_eDockMarkerType )
- #endif // (!defined __EXT_MFC_NO_TAB_CONTROLBARS )
- } // else from if( pCenterMarker != NULL )
- }
- void CExtPaintManager::DockMarker2008Vista::OnCalcScreenRect(
- CExtPaintManager::eDockMarkerType_t eDockMarkerType,
- CRect rcScreen,
- DockMarkerBase * pCenterMarker // = NULL
- )
- {
- DockMarkerBase::OnCalcScreenRect(
- eDockMarkerType,
- rcScreen,
- pCenterMarker
- );
- if( m_bSparsedMode && m_bmpOuterBk.IsEmpty() )
- {
- CRect rcOuterMargins = g_PaintManager->DockMarker_GetOuterDistance();
- switch( eDockMarkerType )
- {
- case __EDMT_2005_LEFT:
- {
- CExtBitmap _bitmap;
- _bitmap.LoadBMP_Resource(
- ( m_bSparsedMode )
- ? __EXT_MFC_SAFE_LPCTSTR( MAKEINTRESOURCE( IDB_EXT_RESIZABLE_DOCK_MARKER_2008_VISTA_OUTER_IN_LEFT ) )
- : __EXT_MFC_SAFE_LPCTSTR( MAKEINTRESOURCE( IDB_EXT_RESIZABLE_DOCK_MARKER_2008_VISTA_INNER_IN_LEFT ) )
- );
- if( ! _bitmap.IsEmpty() )
- {
- m_size = _bitmap.GetSize();
- m_rcScreen.right = m_rcScreen.left + m_size.cx;
- m_rcScreen.bottom = m_rcScreen.top + m_size.cy;
- m_rcScreen.OffsetRect( rcOuterMargins.left, 0 );
- m_bmpOuterBk = _bitmap;
- HRGN hRgn = _bitmap.GenerateColorHRGN( false, RGB(255,0,255) );
- if( hRgn != NULL )
- {
- if( m_rgn.GetSafeHandle() != NULL )
- m_rgn.DeleteObject();
- m_rgn.Attach( hRgn );
- } // if( hRgn != NULL )
- } // if( ! _bitmap.IsEmpty() )
- #ifdef _DEBUG
- else
- {
- ASSERT( FALSE );
- } // else from if( ! _bitmap.IsEmpty() )
- #endif // _DEBUG
- }
- break;
- case __EDMT_2005_RIGHT:
- {
- CExtBitmap _bitmap;
- _bitmap.LoadBMP_Resource(
- ( m_bSparsedMode )
- ? __EXT_MFC_SAFE_LPCTSTR( MAKEINTRESOURCE( IDB_EXT_RESIZABLE_DOCK_MARKER_2008_VISTA_OUTER_IN_RIGHT ) )
- : __EXT_MFC_SAFE_LPCTSTR( MAKEINTRESOURCE( IDB_EXT_RESIZABLE_DOCK_MARKER_2008_VISTA_INNER_IN_RIGHT ) )
- );
- if( ! _bitmap.IsEmpty() )
- {
- m_size = _bitmap.GetSize();
- m_rcScreen.left = m_rcScreen.right - m_size.cx;
- m_rcScreen.bottom = m_rcScreen.top + m_size.cy;
- m_rcScreen.OffsetRect( - rcOuterMargins.right, 0 );
- m_bmpOuterBk = _bitmap;
- HRGN hRgn = _bitmap.GenerateColorHRGN( false, RGB(255,0,255) );
- if( hRgn != NULL )
- {
- if( m_rgn.GetSafeHandle() != NULL )
- m_rgn.DeleteObject();
- m_rgn.Attach( hRgn );
- } // if( hRgn != NULL )
- } // if( ! _bitmap.IsEmpty() )
- #ifdef _DEBUG
- else
- {
- ASSERT( FALSE );
- } // else from if( ! _bitmap.IsEmpty() )
- #endif // _DEBUG
- }
- break;
- case __EDMT_2005_TOP:
- {
- CExtBitmap _bitmap;
- _bitmap.LoadBMP_Resource(
- ( m_bSparsedMode )
- ? __EXT_MFC_SAFE_LPCTSTR( MAKEINTRESOURCE( IDB_EXT_RESIZABLE_DOCK_MARKER_2008_VISTA_OUTER_IN_TOP ) )
- : __EXT_MFC_SAFE_LPCTSTR( MAKEINTRESOURCE( IDB_EXT_RESIZABLE_DOCK_MARKER_2008_VISTA_INNER_IN_TOP ) )
- );
- if( ! _bitmap.IsEmpty() )
- {
- m_size = _bitmap.GetSize();
- m_rcScreen.bottom = m_rcScreen.top + m_size.cy;
- m_rcScreen.right = m_rcScreen.left + m_size.cx;
- m_rcScreen.OffsetRect( 0, rcOuterMargins.top );
- m_bmpOuterBk = _bitmap;
- HRGN hRgn = _bitmap.GenerateColorHRGN( false, RGB(255,0,255) );
- if( hRgn != NULL )
- {
- if( m_rgn.GetSafeHandle() != NULL )
- m_rgn.DeleteObject();
- m_rgn.Attach( hRgn );
- } // if( hRgn != NULL )
- } // if( ! _bitmap.IsEmpty() )
- #ifdef _DEBUG
- else
- {
- ASSERT( FALSE );
- } // else from if( ! _bitmap.IsEmpty() )
- #endif // _DEBUG
- }
- break;
- case __EDMT_2005_BOTTOM:
- {
- CExtBitmap _bitmap;
- _bitmap.LoadBMP_Resource(
- ( m_bSparsedMode )
- ? __EXT_MFC_SAFE_LPCTSTR( MAKEINTRESOURCE( IDB_EXT_RESIZABLE_DOCK_MARKER_2008_VISTA_OUTER_IN_BOTTOM ) )
- : __EXT_MFC_SAFE_LPCTSTR( MAKEINTRESOURCE( IDB_EXT_RESIZABLE_DOCK_MARKER_2008_VISTA_INNER_IN_BOTTOM ) )
- );
- if( ! _bitmap.IsEmpty() )
- {
- m_size = _bitmap.GetSize();
- m_rcScreen.top = m_rcScreen.bottom - m_size.cy;
- m_rcScreen.right = m_rcScreen.left + m_size.cx;
- m_rcScreen.OffsetRect( 0, - rcOuterMargins.bottom );
- m_bmpOuterBk = _bitmap;
- HRGN hRgn = _bitmap.GenerateColorHRGN( false, RGB(255,0,255) );
- if( hRgn != NULL )
- {
- if( m_rgn.GetSafeHandle() != NULL )
- m_rgn.DeleteObject();
- m_rgn.Attach( hRgn );
- } // if( hRgn != NULL )
- } // if( ! _bitmap.IsEmpty() )
- #ifdef _DEBUG
- else
- {
- ASSERT( FALSE );
- } // else from if( ! _bitmap.IsEmpty() )
- #endif // _DEBUG
- }
- break;
- } // switch( pDM->m_eDockMarkerType )
- } // if( m_bSparsedMode && m_bmpOuterBk.IsEmpty() )
- if( pCenterMarker != NULL )
- {
- switch( eDockMarkerType )
- {
- case __EDMT_2005_LEFT:
- m_rcScreen.OffsetRect( -9, 0 );
- break;
- case __EDMT_2005_RIGHT:
- m_rcScreen.OffsetRect( 9, 0 );
- break;
- case __EDMT_2005_TOP:
- m_rcScreen.OffsetRect( 0, -9 );
- break;
- case __EDMT_2005_BOTTOM:
- m_rcScreen.OffsetRect( 0, 9 );
- break;
- #if (!defined __EXT_MFC_NO_TAB_CONTROLBARS )
- case __EDMT_2005_TAB:
- break;
- #endif // (!defined __EXT_MFC_NO_TAB_CONTROLBARS )
- } // switch( pDM->m_eDockMarkerType )
- } // if( pCenterMarker != NULL )
- else
- {
- #if (!defined __EXT_MFC_NO_TAB_CONTROLBARS )
- switch( eDockMarkerType )
- {
- case __EDMT_2005_TAB:
- break;
- } // switch( pDM->m_eDockMarkerType )
- #endif // (!defined __EXT_MFC_NO_TAB_CONTROLBARS )
- } // else from if( pCenterMarker != NULL )
- }
- void CExtPaintManager::DockMarkerBase::_EmptyChildren()
- {
- int nCount = (int)m_arrChildren.GetSize();
- for( int nIndex = 0; nIndex < nCount; nIndex ++ )
- {
- DockMarkerBase * pDM = m_arrChildren[ nIndex ];
- ASSERT( pDM != NULL );
- delete pDM;
- } // for( int nIndex = 0; nIndex < nCount; nIndex ++ )
- m_arrChildren.RemoveAll();
- }
- void CExtPaintManager::DockMarkerBase::Empty()
- {
- m_bmpIn.Empty();
- m_bmpOut.Empty();
- if( m_rgn.GetSafeHandle() != NULL )
- m_rgn.DeleteObject();
- m_eDockMarkerType = __EDMT_EMPTY;
- m_size.cx = m_size.cy = 0;
- m_rcScreen.SetRect( 0, 0, 0, 0 );
- _EmptyChildren();
- }
- void CExtPaintManager::DockMarkerBase::_DetachHandles()
- {
- m_bmpIn.Empty();
- m_bmpOut.Empty();
- if( m_rgn.GetSafeHandle() != NULL )
- m_rgn.Detach();
- }
- bool CExtPaintManager::DockMarkerBase::Create(
- bool bCentralMode,
- CExtPaintManager::eDockMarkerType_t eDockMarkerType, // = CExtPaintManager::DockMarkerBase::__EDMT_EMPTY
- CRect rcScreen // = CRect( 0, 0, 0, 0 )
- )
- {
- Empty();
- if( eDockMarkerType == __EDMT_EMPTY )
- return true;
- switch( eDockMarkerType )
- {
- case __EDMT_2005_TOP:
- return
- CreateFromBitmapResources(
- rcScreen,
- eDockMarkerType,
- RGB(0,255,0),
- __EXT_MFC_SAFE_LPCTSTR(
- MAKEINTRESOURCE(
- IDB_EXT_RESIZABLE_DOCK_MARKER_2005B1_TOP
- )
- )
- );
- case __EDMT_2005_BOTTOM:
- return
- CreateFromBitmapResources(
- rcScreen,
- eDockMarkerType,
- RGB(0,255,0),
- __EXT_MFC_SAFE_LPCTSTR(
- MAKEINTRESOURCE(
- IDB_EXT_RESIZABLE_DOCK_MARKER_2005B1_BOTTOM
- )
- )
- );
- case __EDMT_2005_LEFT:
- return
- CreateFromBitmapResources(
- rcScreen,
- eDockMarkerType,
- RGB(0,255,0),
- __EXT_MFC_SAFE_LPCTSTR(
- MAKEINTRESOURCE(
- IDB_EXT_RESIZABLE_DOCK_MARKER_2005B1_LEFT
- )
- )
- );
- case __EDMT_2005_RIGHT:
- return
- CreateFromBitmapResources(
- rcScreen,
- eDockMarkerType,
- RGB(0,255,0),
- __EXT_MFC_SAFE_LPCTSTR(
- MAKEINTRESOURCE(
- IDB_EXT_RESIZABLE_DOCK_MARKER_2005B1_RIGHT
- )
- )
- );
- case __EDMT_2005_CENTER:
- return
- CreateFromBitmapResources(
- rcScreen,
- eDockMarkerType,
- RGB(0,255,0),
- __EXT_MFC_SAFE_LPCTSTR(
- MAKEINTRESOURCE(
- IDB_EXT_RESIZABLE_DOCK_MARKER_2005B1_CENTER
- )
- )
- );
- case __EDMT_2005_GROUP_SPARSED:
- {
- DockMarkerBase * pDmTop = NULL, * pDmBottom = NULL,
- * pDmLeft = NULL, * pDmRight = NULL;
- try
- {
- pDmTop = m_pPM->DockMarker_CreateObject( m_eResizablePanelDockingType );
- pDmBottom = m_pPM->DockMarker_CreateObject( m_eResizablePanelDockingType );
- pDmLeft = m_pPM->DockMarker_CreateObject( m_eResizablePanelDockingType );
- pDmRight = m_pPM->DockMarker_CreateObject( m_eResizablePanelDockingType );
- if( ! bCentralMode )
- {
- pDmTop->m_bSparsedMode = true;
- pDmBottom->m_bSparsedMode = true;
- pDmLeft->m_bSparsedMode = true;
- pDmRight->m_bSparsedMode = true;
- } // if( ! bCentralMode )
- if( pDmTop->Create( bCentralMode, __EDMT_2005_TOP, rcScreen )
- && pDmBottom->Create( bCentralMode, __EDMT_2005_BOTTOM, rcScreen )
- && pDmLeft->Create( bCentralMode, __EDMT_2005_LEFT, rcScreen )
- && pDmRight->Create( bCentralMode, __EDMT_2005_RIGHT, rcScreen )
- )
- {
- m_eDockMarkerType = eDockMarkerType;
- m_arrChildren.Add( pDmTop );
- m_arrChildren.Add( pDmBottom );
- m_arrChildren.Add( pDmLeft );
- m_arrChildren.Add( pDmRight );
- return true;
- }
- ASSERT( FALSE );
- } // try
- catch( ... )
- {
- ASSERT( FALSE );
- } // catch( .... )
- if( pDmTop != NULL )
- delete pDmTop;
- if( pDmBottom != NULL )
- delete pDmBottom;
- if( pDmLeft != NULL )
- delete pDmLeft;
- if( pDmRight != NULL )
- delete pDmRight;
- }
- return false;
- case __EDMT_2005_GROUP_CENTRAL:
- {
- if( ! Create(
- true,
- __EDMT_2005_GROUP_SPARSED,
- rcScreen
- )
- )
- {
- ASSERT( FALSE );
- return false;
- }
- DockMarkerBase * pDmCenter = NULL;
- try
- {
- pDmCenter = m_pPM->DockMarker_CreateObject( m_eResizablePanelDockingType );
- if( pDmCenter->Create(
- true,
- __EDMT_2005_CENTER,
- rcScreen
- )
- )
- {
- CRect _rcScreen( rcScreen );
- CSize _size( pDmCenter->m_size );
- _size.cx += 12;
- _size.cy += 12;
- _rcScreen.OffsetRect(
- ( _rcScreen.Width() - _size.cx ) / 2,
- ( _rcScreen.Height() - _size.cy ) / 2
- );
- _rcScreen.right = _rcScreen.left + _size.cx;
- _rcScreen.bottom = _rcScreen.top + _size.cy;
- int nCount = (int)m_arrChildren.GetSize();
- for( int nIndex = 0; nIndex < nCount; nIndex ++ )
- {
- DockMarkerBase * pDM = m_arrChildren[ nIndex ];
- ASSERT( pDM != NULL );
- pDM->m_bSparsedMode = false;
- pDM->OnCalcScreenRect(
- pDM->m_eDockMarkerType,
- _rcScreen,
- pDmCenter
- );
- } // for( int nIndex = 0; nIndex < nCount; nIndex ++ )
- m_eDockMarkerType = eDockMarkerType;
- m_arrChildren.InsertAt( 0, pDmCenter );
- return true;
- }
- ASSERT( FALSE );
- } // try
- catch( ... )
- {
- ASSERT( FALSE );
- } // catch( .... )
- if( pDmCenter != NULL )
- delete pDmCenter;
- Empty();
- }
- return false;
- #if (!defined __EXT_MFC_NO_TAB_CONTROLBARS )
- case __EDMT_2005_GROUP_TAB:
- {
- if( ! Create(
- true,
- __EDMT_2005_GROUP_CENTRAL,
- rcScreen
- )
- )
- {
- ASSERT( FALSE );
- return false;
- }
- DockMarkerBase * pDmTab = NULL;
- try
- {
- pDmTab = m_pPM->DockMarker_CreateObject( m_eResizablePanelDockingType );
- if( pDmTab->Create(
- true,
- __EDMT_2005_TAB,
- rcScreen
- )
- )
- {
- m_eDockMarkerType = eDockMarkerType;
- // m_arrChildren.Add( pDmTab );
- ASSERT( m_arrChildren.GetSize() >= 1 );
- m_arrChildren.InsertAt( 1, pDmTab );
- return true;
- }
- ASSERT( FALSE );
- } // try
- catch( ... )
- {
- ASSERT( FALSE );
- } // catch( .... )
- if( pDmTab != NULL )
- delete pDmTab;
- Empty();
- }
- return false;
- case __EDMT_2005_TAB:
- return
- CreateFromBitmapResources(
- rcScreen,
- eDockMarkerType,
- RGB(0,255,0),
- __EXT_MFC_SAFE_LPCTSTR(
- MAKEINTRESOURCE(
- IDB_EXT_RESIZABLE_DOCK_MARKER_2005B1_TAB
- )
- )
- );
- #endif // (!defined __EXT_MFC_NO_TAB_CONTROLBARS )
- } // switch( eDockMarkerType )
- ASSERT( FALSE );
- return false;
- }
- bool CExtPaintManager::DockMarkerBeta2::Create(
- bool bCentralMode,
- CExtPaintManager::eDockMarkerType_t eDockMarkerType, // = CExtPaintManager::DockMarkerBase::__EDMT_EMPTY
- CRect rcScreen // = CRect( 0, 0, 0, 0 )
- )
- {
- Empty();
- if( eDockMarkerType == __EDMT_EMPTY )
- return true;
- switch( eDockMarkerType )
- {
- case __EDMT_2005_TOP:
- return
- CreateFromBitmapResources(
- rcScreen,
- eDockMarkerType,
- RGB(0,255,0),
- __EXT_MFC_SAFE_LPCTSTR(
- MAKEINTRESOURCE(
- IDB_EXT_RESIZABLE_DOCK_MARKER_2005B2_TOP
- )
- )
- );
- case __EDMT_2005_BOTTOM:
- return
- CreateFromBitmapResources(
- rcScreen,
- eDockMarkerType,
- RGB(0,255,0),
- __EXT_MFC_SAFE_LPCTSTR(
- MAKEINTRESOURCE(
- IDB_EXT_RESIZABLE_DOCK_MARKER_2005B2_BOTTOM
- )
- )
- );
- case __EDMT_2005_LEFT:
- return
- CreateFromBitmapResources(
- rcScreen,
- eDockMarkerType,
- RGB(0,255,0),
- __EXT_MFC_SAFE_LPCTSTR(
- MAKEINTRESOURCE(
- IDB_EXT_RESIZABLE_DOCK_MARKER_2005B2_LEFT
- )
- )
- );
- case __EDMT_2005_RIGHT:
- return
- CreateFromBitmapResources(
- rcScreen,
- eDockMarkerType,
- RGB(0,255,0),
- __EXT_MFC_SAFE_LPCTSTR(
- MAKEINTRESOURCE(
- IDB_EXT_RESIZABLE_DOCK_MARKER_2005B2_RIGHT
- )
- )
- );
- case __EDMT_2005_CENTER:
- return
- CreateFromBitmapResources(
- rcScreen,
- eDockMarkerType,
- RGB(0,255,0),
- __EXT_MFC_SAFE_LPCTSTR(
- MAKEINTRESOURCE(
- IDB_EXT_RESIZABLE_DOCK_MARKER_2005B2_CENTER
- )
- )
- );
- case __EDMT_2005_GROUP_SPARSED:
- {
- DockMarkerBase * pDmTop = NULL, * pDmBottom = NULL,
- * pDmLeft = NULL, * pDmRight = NULL;
- try
- {
- pDmTop = m_pPM->DockMarker_CreateObject( m_eResizablePanelDockingType );
- pDmBottom = m_pPM->DockMarker_CreateObject( m_eResizablePanelDockingType );
- pDmLeft = m_pPM->DockMarker_CreateObject( m_eResizablePanelDockingType );
- pDmRight = m_pPM->DockMarker_CreateObject( m_eResizablePanelDockingType );
- if( ! bCentralMode )
- {
- pDmTop->m_bSparsedMode = true;
- pDmBottom->m_bSparsedMode = true;
- pDmLeft->m_bSparsedMode = true;
- pDmRight->m_bSparsedMode = true;
- } // if( ! bCentralMode )
- if( pDmTop->Create( bCentralMode, __EDMT_2005_TOP, rcScreen )
- && pDmBottom->Create( bCentralMode, __EDMT_2005_BOTTOM, rcScreen )
- && pDmLeft->Create( bCentralMode, __EDMT_2005_LEFT, rcScreen )
- && pDmRight->Create( bCentralMode, __EDMT_2005_RIGHT, rcScreen )
- )
- {
- m_eDockMarkerType = eDockMarkerType;
- m_arrChildren.Add( pDmTop );
- m_arrChildren.Add( pDmBottom );
- m_arrChildren.Add( pDmLeft );
- m_arrChildren.Add( pDmRight );
- return true;
- }
- ASSERT( FALSE );
- } // try
- catch( ... )
- {
- ASSERT( FALSE );
- } // catch( .... )
- if( pDmTop != NULL )
- delete pDmTop;
- if( pDmBottom != NULL )
- delete pDmBottom;
- if( pDmLeft != NULL )
- delete pDmLeft;
- if( pDmRight != NULL )
- delete pDmRight;
- }
- return false;
- case __EDMT_2005_GROUP_CENTRAL:
- {
- if( ! Create(
- true,
- __EDMT_2005_GROUP_SPARSED,
- rcScreen
- )
- )
- {
- ASSERT( FALSE );
- return false;
- }
- DockMarkerBase * pDmCenter = NULL;
- try
- {
- pDmCenter = m_pPM->DockMarker_CreateObject( m_eResizablePanelDockingType );
- if( pDmCenter->Create(
- true,
- __EDMT_2005_CENTER,
- rcScreen
- )
- )
- {
- CRect _rcScreen( rcScreen );
- CSize _size( pDmCenter->m_size );
- _size.cx += 12;
- _size.cy += 12;
- _rcScreen.OffsetRect(
- ( _rcScreen.Width() - _size.cx ) / 2,
- ( _rcScreen.Height() - _size.cy ) / 2
- );
- _rcScreen.right = _rcScreen.left + _size.cx;
- _rcScreen.bottom = _rcScreen.top + _size.cy;
- int nCount = (int)m_arrChildren.GetSize();
- for( int nIndex = 0; nIndex < nCount; nIndex ++ )
- {
- DockMarkerBase * pDM = m_arrChildren[ nIndex ];
- ASSERT( pDM != NULL );
- pDM->m_bSparsedMode = false;
- pDM->OnCalcScreenRect(
- pDM->m_eDockMarkerType,
- _rcScreen,
- pDmCenter
- );
- } // for( int nIndex = 0; nIndex < nCount; nIndex ++ )
- m_eDockMarkerType = eDockMarkerType;
- m_arrChildren.InsertAt( 0, pDmCenter );
- return true;
- }
- ASSERT( FALSE );
- } // try
- catch( ... )
- {
- ASSERT( FALSE );
- } // catch( .... )
- if( pDmCenter != NULL )
- delete pDmCenter;
- Empty();
- }
- return false;
- #if (!defined __EXT_MFC_NO_TAB_CONTROLBARS )
- case __EDMT_2005_GROUP_TAB:
- {
- if( ! Create(
- true,
- __EDMT_2005_GROUP_CENTRAL,
- rcScreen
- )
- )
- {
- ASSERT( FALSE );
- return false;
- }
- DockMarkerBase * pDmTab = NULL;
- try
- {
- pDmTab = m_pPM->DockMarker_CreateObject( m_eResizablePanelDockingType );
- if( pDmTab->Create(
- true,
- __EDMT_2005_TAB,
- rcScreen
- )
- )
- {
- m_eDockMarkerType = eDockMarkerType;
- // m_arrChildren.Add( pDmTab );
- ASSERT( m_arrChildren.GetSize() >= 1 );
- m_arrChildren.InsertAt( 1, pDmTab );
- return true;
- }
- ASSERT( FALSE );
- } // try
- catch( ... )
- {
- ASSERT( FALSE );
- } // catch( .... )
- if( pDmTab != NULL )
- delete pDmTab;
- Empty();
- }
- return false;
- case __EDMT_2005_TAB:
- return
- CreateFromBitmapResources(
- rcScreen,
- eDockMarkerType,
- RGB(0,255,0),
- __EXT_MFC_SAFE_LPCTSTR(
- MAKEINTRESOURCE(
- IDB_EXT_RESIZABLE_DOCK_MARKER_2005B2_TAB
- )
- )
- );
- #endif // (!defined __EXT_MFC_NO_TAB_CONTROLBARS )
- } // switch( eDockMarkerType )
- ASSERT( FALSE );
- return false;
- }
- bool CExtPaintManager::DockMarker2008XP::Create(
- bool bCentralMode,
- CExtPaintManager::eDockMarkerType_t eDockMarkerType, // = CExtPaintManager::DockMarkerBase::__EDMT_EMPTY
- CRect rcScreen // = CRect( 0, 0, 0, 0 )
- )
- {
- Empty();
- if( eDockMarkerType == __EDMT_EMPTY )
- return true;
- switch( eDockMarkerType )
- {
- case __EDMT_2005_TOP:
- return
- CreateFromBitmapResources(
- rcScreen,
- eDockMarkerType,
- RGB(255,0,255),
- ( m_bSparsedMode )
- ? __EXT_MFC_SAFE_LPCTSTR( MAKEINTRESOURCE( IDB_EXT_RESIZABLE_DOCK_MARKER_2008_XP_OUTER_IN_TOP ) )
- : __EXT_MFC_SAFE_LPCTSTR( MAKEINTRESOURCE( IDB_EXT_RESIZABLE_DOCK_MARKER_2008_XP_INNER_IN_TOP ) )
- ,
- ( m_bSparsedMode )
- ? __EXT_MFC_SAFE_LPCTSTR( MAKEINTRESOURCE( IDB_EXT_RESIZABLE_DOCK_MARKER_2008_XP_OUTER_OUT_TOP ) )
- : __EXT_MFC_SAFE_LPCTSTR( MAKEINTRESOURCE( IDB_EXT_RESIZABLE_DOCK_MARKER_2008_XP_INNER_OUT_TOP ) )
- );
- case __EDMT_2005_BOTTOM:
- return
- CreateFromBitmapResources(
- rcScreen,
- eDockMarkerType,
- RGB(255,0,255),
- ( m_bSparsedMode )
- ? __EXT_MFC_SAFE_LPCTSTR( MAKEINTRESOURCE( IDB_EXT_RESIZABLE_DOCK_MARKER_2008_XP_OUTER_IN_BOTTOM ) )
- : __EXT_MFC_SAFE_LPCTSTR( MAKEINTRESOURCE( IDB_EXT_RESIZABLE_DOCK_MARKER_2008_XP_INNER_IN_BOTTOM ) )
- ,
- ( m_bSparsedMode )
- ? __EXT_MFC_SAFE_LPCTSTR( MAKEINTRESOURCE( IDB_EXT_RESIZABLE_DOCK_MARKER_2008_XP_OUTER_OUT_BOTTOM ) )
- : __EXT_MFC_SAFE_LPCTSTR( MAKEINTRESOURCE( IDB_EXT_RESIZABLE_DOCK_MARKER_2008_XP_INNER_OUT_BOTTOM ) )
- );
- case __EDMT_2005_LEFT:
- return
- CreateFromBitmapResources(
- rcScreen,
- eDockMarkerType,
- RGB(255,0,255),
- ( m_bSparsedMode )
- ? __EXT_MFC_SAFE_LPCTSTR( MAKEINTRESOURCE( IDB_EXT_RESIZABLE_DOCK_MARKER_2008_XP_OUTER_IN_LEFT ) )
- : __EXT_MFC_SAFE_LPCTSTR( MAKEINTRESOURCE( IDB_EXT_RESIZABLE_DOCK_MARKER_2008_XP_INNER_IN_LEFT ) )
- ,
- ( m_bSparsedMode )
- ? __EXT_MFC_SAFE_LPCTSTR( MAKEINTRESOURCE( IDB_EXT_RESIZABLE_DOCK_MARKER_2008_XP_OUTER_OUT_LEFT ) )
- : __EXT_MFC_SAFE_LPCTSTR( MAKEINTRESOURCE( IDB_EXT_RESIZABLE_DOCK_MARKER_2008_XP_INNER_OUT_LEFT ) )
- );
- case __EDMT_2005_RIGHT:
- return
- CreateFromBitmapResources(
- rcScreen,
- eDockMarkerType,
- RGB(255,0,255),
- ( m_bSparsedMode )
- ? __EXT_MFC_SAFE_LPCTSTR( MAKEINTRESOURCE( IDB_EXT_RESIZABLE_DOCK_MARKER_2008_XP_OUTER_IN_RIGHT ) )
- : __EXT_MFC_SAFE_LPCTSTR( MAKEINTRESOURCE( IDB_EXT_RESIZABLE_DOCK_MARKER_2008_XP_INNER_IN_RIGHT ) )
- ,
- ( m_bSparsedMode )
- ? __EXT_MFC_SAFE_LPCTSTR( MAKEINTRESOURCE( IDB_EXT_RESIZABLE_DOCK_MARKER_2008_XP_OUTER_OUT_RIGHT ) )
- : __EXT_MFC_SAFE_LPCTSTR( MAKEINTRESOURCE( IDB_EXT_RESIZABLE_DOCK_MARKER_2008_XP_INNER_OUT_RIGHT ) )
- );
- case __EDMT_2005_CENTER:
- return
- CreateFromBitmapResources(
- rcScreen,
- eDockMarkerType,
- RGB(255,0,255),
- __EXT_MFC_SAFE_LPCTSTR( MAKEINTRESOURCE( IDB_EXT_RESIZABLE_DOCK_MARKER_2008_XP_INNER_IN_EMPTY ) ),
- __EXT_MFC_SAFE_LPCTSTR( MAKEINTRESOURCE( IDB_EXT_RESIZABLE_DOCK_MARKER_2008_XP_INNER_OUT_EMPTY ) )
- );
- case __EDMT_2005_GROUP_SPARSED:
- {
- DockMarkerBase * pDmTop = NULL, * pDmBottom = NULL,
- * pDmLeft = NULL, * pDmRight = NULL;
- try
- {
- pDmTop = m_pPM->DockMarker_CreateObject( m_eResizablePanelDockingType );
- pDmBottom = m_pPM->DockMarker_CreateObject( m_eResizablePanelDockingType );
- pDmLeft = m_pPM->DockMarker_CreateObject( m_eResizablePanelDockingType );
- pDmRight = m_pPM->DockMarker_CreateObject( m_eResizablePanelDockingType );
- if( ! bCentralMode )
- {
- pDmTop->m_bSparsedMode = true;
- pDmBottom->m_bSparsedMode = true;
- pDmLeft->m_bSparsedMode = true;
- pDmRight->m_bSparsedMode = true;
- } // if( ! bCentralMode )
- if( pDmTop->Create( bCentralMode, __EDMT_2005_TOP, rcScreen )
- && pDmBottom->Create( bCentralMode, __EDMT_2005_BOTTOM, rcScreen )
- && pDmLeft->Create( bCentralMode, __EDMT_2005_LEFT, rcScreen )
- && pDmRight->Create( bCentralMode, __EDMT_2005_RIGHT, rcScreen )
- )
- {
- m_eDockMarkerType = eDockMarkerType;
- m_arrChildren.Add( pDmTop );
- m_arrChildren.Add( pDmBottom );
- m_arrChildren.Add( pDmLeft );
- m_arrChildren.Add( pDmRight );
- return true;
- }
- ASSERT( FALSE );
- } // try
- catch( ... )
- {
- ASSERT( FALSE );
- } // catch( .... )
- if( pDmTop != NULL )
- delete pDmTop;
- if( pDmBottom != NULL )
- delete pDmBottom;
- if( pDmLeft != NULL )
- delete pDmLeft;
- if( pDmRight != NULL )
- delete pDmRight;
- }
- return false;
- case __EDMT_2005_GROUP_CENTRAL:
- {
- if( ! Create(
- true,
- __EDMT_2005_GROUP_SPARSED,
- rcScreen
- )
- )
- {
- ASSERT( FALSE );
- return false;
- }
- DockMarkerBase * pDmCenter = NULL;
- try
- {
- pDmCenter = m_pPM->DockMarker_CreateObject( m_eResizablePanelDockingType );
- if( pDmCenter->Create(
- true,
- __EDMT_2005_CENTER,
- rcScreen
- )
- )
- {
- CRect _rcScreen( rcScreen );
- CSize _size( pDmCenter->m_size );
- _size.cx += 12;
- _size.cy += 12;
- _rcScreen.OffsetRect(
- ( _rcScreen.Width() - _size.cx ) / 2,
- ( _rcScreen.Height() - _size.cy ) / 2
- );
- _rcScreen.right = _rcScreen.left + _size.cx;
- _rcScreen.bottom = _rcScreen.top + _size.cy;
- int nCount = (int)m_arrChildren.GetSize();
- for( int nIndex = 0; nIndex < nCount; nIndex ++ )
- {
- DockMarkerBase * pDM = m_arrChildren[ nIndex ];
- ASSERT( pDM != NULL );
- pDM->m_bSparsedMode = false;
- pDM->OnCalcScreenRect(
- pDM->m_eDockMarkerType,
- _rcScreen,
- pDmCenter
- );
- } // for( int nIndex = 0; nIndex < nCount; nIndex ++ )
- m_eDockMarkerType = eDockMarkerType;
- m_arrChildren.InsertAt( 0, pDmCenter );
- return true;
- }
- ASSERT( FALSE );
- } // try
- catch( ... )
- {
- ASSERT( FALSE );
- } // catch( .... )
- if( pDmCenter != NULL )
- delete pDmCenter;
- Empty();
- }
- return false;
- #if (!defined __EXT_MFC_NO_TAB_CONTROLBARS )
- case __EDMT_2005_GROUP_TAB:
- {
- if( ! Create(
- true,
- __EDMT_2005_GROUP_CENTRAL,
- rcScreen
- )
- )
- {
- ASSERT( FALSE );
- return false;
- }
- DockMarkerBase * pDmTab = NULL;
- try
- {
- pDmTab = m_pPM->DockMarker_CreateObject( m_eResizablePanelDockingType );
- if( pDmTab->Create(
- true,
- __EDMT_2005_TAB,
- rcScreen
- )
- )
- {
- m_eDockMarkerType = eDockMarkerType;
- // m_arrChildren.Add( pDmTab );
- ASSERT( m_arrChildren.GetSize() >= 1 );
- m_arrChildren.InsertAt( 1, pDmTab );
- return true;
- }
- ASSERT( FALSE );
- } // try
- catch( ... )
- {
- ASSERT( FALSE );
- } // catch( .... )
- if( pDmTab != NULL )
- delete pDmTab;
- Empty();
- }
- return false;
- case __EDMT_2005_TAB:
- return
- CreateFromBitmapResources(
- rcScreen,
- eDockMarkerType,
- RGB(255,0,255),
- __EXT_MFC_SAFE_LPCTSTR( MAKEINTRESOURCE( IDB_EXT_RESIZABLE_DOCK_MARKER_2008_XP_INNER_IN_TAB ) ),
- __EXT_MFC_SAFE_LPCTSTR( MAKEINTRESOURCE( IDB_EXT_RESIZABLE_DOCK_MARKER_2008_XP_INNER_OUT_TAB ) )
- );
- #endif // (!defined __EXT_MFC_NO_TAB_CONTROLBARS )
- } // switch( eDockMarkerType )
- ASSERT( FALSE );
- return false;
- }
- bool CExtPaintManager::DockMarker2008Vista::Create(
- bool bCentralMode,
- CExtPaintManager::eDockMarkerType_t eDockMarkerType, // = CExtPaintManager::DockMarkerBase::__EDMT_EMPTY
- CRect rcScreen // = CRect( 0, 0, 0, 0 )
- )
- {
- Empty();
- if( eDockMarkerType == __EDMT_EMPTY )
- return true;
- switch( eDockMarkerType )
- {
- case __EDMT_2005_TOP:
- return
- CreateFromBitmapResources(
- rcScreen,
- eDockMarkerType,
- RGB(255,0,255),
- ( m_bSparsedMode )
- ? __EXT_MFC_SAFE_LPCTSTR( MAKEINTRESOURCE( IDB_EXT_RESIZABLE_DOCK_MARKER_2008_VISTA_OUTER_IN_TOP ) )
- : __EXT_MFC_SAFE_LPCTSTR( MAKEINTRESOURCE( IDB_EXT_RESIZABLE_DOCK_MARKER_2008_VISTA_INNER_IN_TOP ) )
- ,
- ( m_bSparsedMode )
- ? __EXT_MFC_SAFE_LPCTSTR( MAKEINTRESOURCE( IDB_EXT_RESIZABLE_DOCK_MARKER_2008_VISTA_OUTER_OUT_TOP ) )
- : __EXT_MFC_SAFE_LPCTSTR( MAKEINTRESOURCE( IDB_EXT_RESIZABLE_DOCK_MARKER_2008_VISTA_INNER_OUT_TOP ) )
- );
- case __EDMT_2005_BOTTOM:
- return
- CreateFromBitmapResources(
- rcScreen,
- eDockMarkerType,
- RGB(255,0,255),
- ( m_bSparsedMode )
- ? __EXT_MFC_SAFE_LPCTSTR( MAKEINTRESOURCE( IDB_EXT_RESIZABLE_DOCK_MARKER_2008_VISTA_OUTER_IN_BOTTOM ) )
- : __EXT_MFC_SAFE_LPCTSTR( MAKEINTRESOURCE( IDB_EXT_RESIZABLE_DOCK_MARKER_2008_VISTA_INNER_IN_BOTTOM ) )
- ,
- ( m_bSparsedMode )
- ? __EXT_MFC_SAFE_LPCTSTR( MAKEINTRESOURCE( IDB_EXT_RESIZABLE_DOCK_MARKER_2008_VISTA_OUTER_OUT_BOTTOM ) )
- : __EXT_MFC_SAFE_LPCTSTR( MAKEINTRESOURCE( IDB_EXT_RESIZABLE_DOCK_MARKER_2008_VISTA_INNER_OUT_BOTTOM ) )
- );
- case __EDMT_2005_LEFT:
- return
- CreateFromBitmapResources(
- rcScreen,
- eDockMarkerType,
- RGB(255,0,255),
- ( m_bSparsedMode )
- ? __EXT_MFC_SAFE_LPCTSTR( MAKEINTRESOURCE( IDB_EXT_RESIZABLE_DOCK_MARKER_2008_VISTA_OUTER_IN_LEFT ) )
- : __EXT_MFC_SAFE_LPCTSTR( MAKEINTRESOURCE( IDB_EXT_RESIZABLE_DOCK_MARKER_2008_VISTA_INNER_IN_LEFT ) )
- ,
- ( m_bSparsedMode )
- ? __EXT_MFC_SAFE_LPCTSTR( MAKEINTRESOURCE( IDB_EXT_RESIZABLE_DOCK_MARKER_2008_VISTA_OUTER_OUT_LEFT ) )
- : __EXT_MFC_SAFE_LPCTSTR( MAKEINTRESOURCE( IDB_EXT_RESIZABLE_DOCK_MARKER_2008_VISTA_INNER_OUT_LEFT ) )
- );
- case __EDMT_2005_RIGHT:
- return
- CreateFromBitmapResources(
- rcScreen,
- eDockMarkerType,
- RGB(255,0,255),
- ( m_bSparsedMode )
- ? __EXT_MFC_SAFE_LPCTSTR( MAKEINTRESOURCE( IDB_EXT_RESIZABLE_DOCK_MARKER_2008_VISTA_OUTER_IN_RIGHT ) )
- : __EXT_MFC_SAFE_LPCTSTR( MAKEINTRESOURCE( IDB_EXT_RESIZABLE_DOCK_MARKER_2008_VISTA_INNER_IN_RIGHT ) )
- ,
- ( m_bSparsedMode )
- ? __EXT_MFC_SAFE_LPCTSTR( MAKEINTRESOURCE( IDB_EXT_RESIZABLE_DOCK_MARKER_2008_VISTA_OUTER_OUT_RIGHT ) )
- : __EXT_MFC_SAFE_LPCTSTR( MAKEINTRESOURCE( IDB_EXT_RESIZABLE_DOCK_MARKER_2008_VISTA_INNER_OUT_RIGHT ) )
- );
- case __EDMT_2005_CENTER:
- return
- CreateFromBitmapResources(
- rcScreen,
- eDockMarkerType,
- RGB(255,0,255),
- __EXT_MFC_SAFE_LPCTSTR( MAKEINTRESOURCE( IDB_EXT_RESIZABLE_DOCK_MARKER_2008_VISTA_INNER_IN_EMPTY ) ),
- __EXT_MFC_SAFE_LPCTSTR( MAKEINTRESOURCE( IDB_EXT_RESIZABLE_DOCK_MARKER_2008_VISTA_INNER_OUT_EMPTY ) )
- );
- case __EDMT_2005_GROUP_SPARSED:
- {
- DockMarkerBase * pDmTop = NULL, * pDmBottom = NULL,
- * pDmLeft = NULL, * pDmRight = NULL;
- try
- {
- pDmTop = m_pPM->DockMarker_CreateObject( m_eResizablePanelDockingType );
- pDmBottom = m_pPM->DockMarker_CreateObject( m_eResizablePanelDockingType );
- pDmLeft = m_pPM->DockMarker_CreateObject( m_eResizablePanelDockingType );
- pDmRight = m_pPM->DockMarker_CreateObject( m_eResizablePanelDockingType );
- if( ! bCentralMode )
- {
- pDmTop->m_bSparsedMode = true;
- pDmBottom->m_bSparsedMode = true;
- pDmLeft->m_bSparsedMode = true;
- pDmRight->m_bSparsedMode = true;
- } // if( ! bCentralMode )
- if( pDmTop->Create( bCentralMode, __EDMT_2005_TOP, rcScreen )
- && pDmBottom->Create( bCentralMode, __EDMT_2005_BOTTOM, rcScreen )
- && pDmLeft->Create( bCentralMode, __EDMT_2005_LEFT, rcScreen )
- && pDmRight->Create( bCentralMode, __EDMT_2005_RIGHT, rcScreen )
- )
- {
- m_eDockMarkerType = eDockMarkerType;
- m_arrChildren.Add( pDmTop );
- m_arrChildren.Add( pDmBottom );
- m_arrChildren.Add( pDmLeft );
- m_arrChildren.Add( pDmRight );
- return true;
- }
- ASSERT( FALSE );
- } // try
- catch( ... )
- {
- ASSERT( FALSE );
- } // catch( .... )
- if( pDmTop != NULL )
- delete pDmTop;
- if( pDmBottom != NULL )
- delete pDmBottom;
- if( pDmLeft != NULL )
- delete pDmLeft;
- if( pDmRight != NULL )
- delete pDmRight;
- }
- return false;
- case __EDMT_2005_GROUP_CENTRAL:
- {
- if( ! Create(
- true,
- __EDMT_2005_GROUP_SPARSED,
- rcScreen
- )
- )
- {
- ASSERT( FALSE );
- return false;
- }
- DockMarkerBase * pDmCenter = NULL;
- try
- {
- pDmCenter = m_pPM->DockMarker_CreateObject( m_eResizablePanelDockingType );
- if( pDmCenter->Create(
- true,
- __EDMT_2005_CENTER,
- rcScreen
- )
- )
- {
- CRect _rcScreen( rcScreen );
- CSize _size( pDmCenter->m_size );
- _size.cx += 12;
- _size.cy += 12;
- _rcScreen.OffsetRect(
- ( _rcScreen.Width() - _size.cx ) / 2,
- ( _rcScreen.Height() - _size.cy ) / 2
- );
- _rcScreen.right = _rcScreen.left + _size.cx;
- _rcScreen.bottom = _rcScreen.top + _size.cy;
- int nCount = (int)m_arrChildren.GetSize();
- for( int nIndex = 0; nIndex < nCount; nIndex ++ )
- {
- DockMarkerBase * pDM = m_arrChildren[ nIndex ];
- ASSERT( pDM != NULL );
- pDM->m_bSparsedMode = false;
- pDM->OnCalcScreenRect(
- pDM->m_eDockMarkerType,
- _rcScreen,
- pDmCenter
- );
- } // for( int nIndex = 0; nIndex < nCount; nIndex ++ )
- m_eDockMarkerType = eDockMarkerType;
- m_arrChildren.InsertAt( 0, pDmCenter );
- return true;
- }
- ASSERT( FALSE );
- } // try
- catch( ... )
- {
- ASSERT( FALSE );
- } // catch( .... )
- if( pDmCenter != NULL )
- delete pDmCenter;
- Empty();
- }
- return false;
- #if (!defined __EXT_MFC_NO_TAB_CONTROLBARS )
- case __EDMT_2005_GROUP_TAB:
- {
- if( ! Create(
- true,
- __EDMT_2005_GROUP_CENTRAL,
- rcScreen
- )
- )
- {
- ASSERT( FALSE );
- return false;
- }
- DockMarkerBase * pDmTab = NULL;
- try
- {
- pDmTab = m_pPM->DockMarker_CreateObject( m_eResizablePanelDockingType );
- if( pDmTab->Create(
- true,
- __EDMT_2005_TAB,
- rcScreen
- )
- )
- {
- m_eDockMarkerType = eDockMarkerType;
- // m_arrChildren.Add( pDmTab );
- ASSERT( m_arrChildren.GetSize() >= 1 );
- m_arrChildren.InsertAt( 1, pDmTab );
- return true;
- }
- ASSERT( FALSE );
- } // try
- catch( ... )
- {
- ASSERT( FALSE );
- } // catch( .... )
- if( pDmTab != NULL )
- delete pDmTab;
- Empty();
- }
- return false;
- case __EDMT_2005_TAB:
- return
- CreateFromBitmapResources(
- rcScreen,
- eDockMarkerType,
- RGB(255,0,255),
- __EXT_MFC_SAFE_LPCTSTR( MAKEINTRESOURCE( IDB_EXT_RESIZABLE_DOCK_MARKER_2008_VISTA_INNER_IN_TAB ) ),
- __EXT_MFC_SAFE_LPCTSTR( MAKEINTRESOURCE( IDB_EXT_RESIZABLE_DOCK_MARKER_2008_VISTA_INNER_OUT_TAB ) )
- );
- #endif // (!defined __EXT_MFC_NO_TAB_CONTROLBARS )
- } // switch( eDockMarkerType )
- ASSERT( FALSE );
- return false;
- }
- bool CExtPaintManager::DockMarkerBase::DockMarker_CreateWnds(
- HWND hWndLastDynamicTarget,
- CTypedPtrArray < CPtrArray, CExtDynDockMarkerWnd * > & arrDockMarkerWnds,
- CExtDynDockMarkerWnd * pWndParentMarker
- )
- {
- bool bRetVal = true;
- if( ! m_bmpIn.IsEmpty() )
- {
- ASSERT( ! m_bmpOut.IsEmpty() );
- ASSERT( m_rgn.GetSafeHandle() != NULL );
- CExtDynDockMarkerWnd * pDynDockMarkerWnd =
- new CExtDynDockMarkerWnd(
- pWndParentMarker,
- hWndLastDynamicTarget,
- int(m_eDockMarkerType),
- m_bmpIn,
- m_bmpOut,
- (HRGN)m_rgn.GetSafeHandle(),
- m_rcScreen,
- & m_bmpOuterBk,
- m_ptOffsetInner.x,
- m_ptOffsetInner.y,
- m_bSparsedMode
- );
- pWndParentMarker = pDynDockMarkerWnd;
- _DetachHandles();
- Empty();
- if( pDynDockMarkerWnd->GetSafeHwnd() != NULL )
- arrDockMarkerWnds.Add(
- pDynDockMarkerWnd
- );
- else
- {
- ASSERT( FALSE );
- bRetVal = false;
- } // else from if( pDynDockMarkerWnd->GetSafeHwnd() != NULL )
- } // if( ! m_bmpIn.IsEmpty() )
- int nCount = (int)m_arrChildren.GetSize();
- bool bChainMode = ( pWndParentMarker == NULL ) ? true : false;
- for( int nIndex = 0; nIndex < nCount; nIndex++ )
- {
- DockMarkerBase * pDM = m_arrChildren[ nIndex ];
- ASSERT( pDM != NULL );
- if ( bChainMode && nIndex > 0 && arrDockMarkerWnds.GetSize() > 0 )
- pWndParentMarker = arrDockMarkerWnds[ arrDockMarkerWnds.GetSize() - 1 ];
- bool bChildrenRetVal =
- pDM->DockMarker_CreateWnds(
- hWndLastDynamicTarget,
- arrDockMarkerWnds,
- pWndParentMarker
- );
- if( !bChildrenRetVal )
- bRetVal = false;
- } // for( int nIndex = 0; nIndex < nCount; nIndex++ )
- return bRetVal;
- }
- bool CExtPaintManager::DockMarker_CreateWnds(
- HWND hWndLastDynamicTarget,
- CExtPaintManager::eDockMarkerType_t eDockMarkerType,
- CRect rcScreen,
- CTypedPtrArray < CPtrArray, CExtDynDockMarkerWnd * > & arrDockMarkerWnds,
- int eResizablePanelDockingType,
- CExtDynDockMarkerWnd * pWndParentMarker
- )
- {
- ASSERT_VALID( this );
- ASSERT( eDockMarkerType != __EDMT_EMPTY );
- CExtDynDockMarkerWnd::DestroyMarkers( arrDockMarkerWnds );
- DockMarkerBase _DM( this, eResizablePanelDockingType );
- if( ! _DM.Create( false, eDockMarkerType, rcScreen ) )
- {
- ASSERT( FALSE );
- return false;
- } // if( ! _DM.Create( eDockMarkerType, rcScreen ) )
- return
- _DM.DockMarker_CreateWnds(
- hWndLastDynamicTarget,
- arrDockMarkerWnds,
- pWndParentMarker
- );
- }
- void CExtPaintManager::DockMarker_PostRender(
- CDC & dc,
- CRect rcItem,
- CExtPaintManager::eDockMarkerType_t eMarkerType,
- bool bHover,
- CObject * pHelperSrc,
- LPARAM lParam // = 0L
- )
- {
- ASSERT_VALID( this );
- ASSERT_VALID( (&dc) );
- ASSERT( dc.GetSafeHdc() != NULL );
- lParam;
- if( pHelperSrc == NULL )
- return;
- ASSERT_VALID( pHelperSrc );
- if( ! pHelperSrc->IsKindOf( RUNTIME_CLASS(CExtControlBar) ) )
- return;
- if( INT(((CExtControlBar*)(pHelperSrc))->OnQueryDockingType()) != INT(CExtControlBar::__RESIZABLE_DOCKING_TYPE_STUDIO_2005) )
- return;
- switch( m_eStyle2005 )
- {
- case __ES2005_BETA1:
- break;
- case __ES2005_BETA2:
- case __ES2005_RC:
- if( pHelperSrc != NULL )
- {
- ASSERT_VALID( pHelperSrc );
- CExtDynDockMarkerWnd * pDynDockMarkerWnd =
- DYNAMIC_DOWNCAST( CExtDynDockMarkerWnd, pHelperSrc );
- if( pDynDockMarkerWnd != NULL )
- {
- static const COLORREF stat_clrHoverBorderBeta2 = RGB(0,96,196);
- if( bHover && pDynDockMarkerWnd->m_bSparsedMode )
- {
- COLORREF clrHoverBorderBeta2 = dc.GetNearestColor( stat_clrHoverBorderBeta2 );
- switch( eMarkerType )
- {
- case __EDMT_2005_LEFT:
- dc.FillSolidRect(
- rcItem.left,
- rcItem.top,
- rcItem.Width(),
- 1,
- clrHoverBorderBeta2
- );
- dc.FillSolidRect(
- rcItem.left,
- rcItem.bottom-1,
- rcItem.Width(),
- 1,
- clrHoverBorderBeta2
- );
- dc.FillSolidRect(
- rcItem.left,
- rcItem.top,
- 1,
- rcItem.Height(),
- clrHoverBorderBeta2
- );
- break;
- case __EDMT_2005_RIGHT:
- dc.FillSolidRect(
- rcItem.left,
- rcItem.top,
- rcItem.Width(),
- 1,
- clrHoverBorderBeta2
- );
- dc.FillSolidRect(
- rcItem.left,
- rcItem.bottom-1,
- rcItem.Width(),
- 1,
- clrHoverBorderBeta2
- );
- dc.FillSolidRect(
- rcItem.right-1,
- rcItem.top,
- 1,
- rcItem.Height(),
- clrHoverBorderBeta2
- );
- break;
- case __EDMT_2005_TOP:
- dc.FillSolidRect(
- rcItem.left,
- rcItem.top,
- rcItem.Width(),
- 1,
- clrHoverBorderBeta2
- );
- dc.FillSolidRect(
- rcItem.left,
- rcItem.top,
- 1,
- rcItem.Height(),
- clrHoverBorderBeta2
- );
- dc.FillSolidRect(
- rcItem.right-1,
- rcItem.top,
- 1,
- rcItem.Height(),
- clrHoverBorderBeta2
- );
- break;
- case __EDMT_2005_BOTTOM:
- dc.FillSolidRect(
- rcItem.left,
- rcItem.bottom-1,
- rcItem.Width(),
- 1,
- clrHoverBorderBeta2
- );
- dc.FillSolidRect(
- rcItem.left,
- rcItem.top,
- 1,
- rcItem.Height(),
- clrHoverBorderBeta2
- );
- dc.FillSolidRect(
- rcItem.right-1,
- rcItem.top,
- 1,
- rcItem.Height(),
- clrHoverBorderBeta2
- );
- break;
- } // switch( eMarkerType )
- } // if( bHover && pDynDockMarkerWnd->m_bSparsedMode )
- else if( eMarkerType == __EDMT_2005_CENTER )
- {
- if( pDynDockMarkerWnd->m_hWndLastHoverDepenentMarker != NULL
- && ::IsWindow(
- pDynDockMarkerWnd->m_hWndLastHoverDepenentMarker
- )
- )
- { // if hover dependent marker window is valid
- CWnd * pWndPermanent =
- CWnd::FromHandlePermanent(
- pDynDockMarkerWnd->m_hWndLastHoverDepenentMarker
- );
- if( pWndPermanent != NULL )
- {
- CExtDynDockMarkerWnd * pWndLastHoverDepenentMarker =
- DYNAMIC_DOWNCAST(
- CExtDynDockMarkerWnd,
- pWndPermanent
- );
- if( pWndLastHoverDepenentMarker != NULL )
- {
- switch( pWndLastHoverDepenentMarker->m_eMarkerType )
- {
- case int(__EDMT_2005_LEFT):
- {
- COLORREF clrHoverBorderBeta2 = dc.GetNearestColor( stat_clrHoverBorderBeta2 );
- CRect rc( 0, 29, 23, 58 );
- dc.FillSolidRect(
- rc.left,
- rc.top,
- rc.Width(),
- 1,
- clrHoverBorderBeta2
- );
- dc.FillSolidRect(
- rc.left,
- rc.bottom-1,
- rc.Width(),
- 1,
- clrHoverBorderBeta2
- );
- dc.FillSolidRect(
- rc.left,
- rc.top,
- 1,
- rc.Height(),
- clrHoverBorderBeta2
- );
- }
- break;
- case int(__EDMT_2005_RIGHT):
- {
- COLORREF clrHoverBorderBeta2 = dc.GetNearestColor( stat_clrHoverBorderBeta2 );
- CRect rc( 64, 29, 88, 58 );
- dc.FillSolidRect(
- rc.left,
- rc.top,
- rc.Width(),
- 1,
- clrHoverBorderBeta2
- );
- dc.FillSolidRect(
- rc.left,
- rc.bottom-1,
- rc.Width(),
- 1,
- clrHoverBorderBeta2
- );
- dc.FillSolidRect(
- rc.right-1,
- rc.top,
- 1,
- rc.Height(),
- clrHoverBorderBeta2
- );
- }
- break;
- case int(__EDMT_2005_TOP):
- {
- COLORREF clrHoverBorderBeta2 = dc.GetNearestColor( stat_clrHoverBorderBeta2 );
- CRect rc( 29, 0, 58, 23 );
- dc.FillSolidRect(
- rc.left,
- rc.top,
- rc.Width(),
- 1,
- clrHoverBorderBeta2
- );
- dc.FillSolidRect(
- rc.left,
- rc.top,
- 1,
- rc.Height(),
- clrHoverBorderBeta2
- );
- dc.FillSolidRect(
- rc.right-1,
- rc.top,
- 1,
- rc.Height(),
- clrHoverBorderBeta2
- );
- }
- break;
- case int(__EDMT_2005_BOTTOM):
- {
- COLORREF clrHoverBorderBeta2 = dc.GetNearestColor( stat_clrHoverBorderBeta2 );
- CRect rc( 29, 64, 58, 88 );
- dc.FillSolidRect(
- rc.left,
- rc.bottom-1,
- rc.Width(),
- 1,
- clrHoverBorderBeta2
- );
- dc.FillSolidRect(
- rc.left,
- rc.top,
- 1,
- rc.Height(),
- clrHoverBorderBeta2
- );
- dc.FillSolidRect(
- rc.right-1,
- rc.top,
- 1,
- rc.Height(),
- clrHoverBorderBeta2
- );
- }
- break;
- #if (!defined __EXT_MFC_NO_TAB_CONTROLBARS )
- case int(__EDMT_2005_TAB):
- {
- COLORREF clrHoverBorderBeta2 = dc.GetNearestColor( stat_clrHoverBorderBeta2 );
- CPen _pen( PS_SOLID, 1, clrHoverBorderBeta2 );
- CPen * pOldPen = dc.SelectObject( &_pen );
- dc.MoveTo( 23, 28 );
- dc.LineTo( 29, 22 );
- dc.MoveTo( 58, 23 );
- dc.LineTo( 64, 29 );
- dc.MoveTo( 58, 63 );
- dc.LineTo( 64, 57 );
- dc.MoveTo( 23, 58 );
- dc.LineTo( 29, 64 );
- dc.SelectObject( pOldPen );
- }
- break;
- #endif // (!defined __EXT_MFC_NO_TAB_CONTROLBARS )
- } // switch( pWndLastHoverDepenentMarker->m_eMarkerType )
- } // if( pWndLastHoverDepenentMarker != NULL )
- } // if( pWndPermanent != NULL )
- } // if hover dependent marker window is valid
- } // else if( eMarkerType == __EDMT_2005_CENTER )
- } // if( pDynDockMarkerWnd != NULL )
- } // if( pHelperSrc != NULL )
- break;
- default:
- {
- ASSERT( FALSE );
- }
- } // switch( m_eStyle2005 )
- }
- CRect CExtPaintManager::DockMarker_GetOuterDistance()
- {
- ASSERT_VALID( this );
- switch( m_eStyle2005 )
- {
- case __ES2005_BETA1:
- return CRect( 0, 0, 0, 0 );
- case __ES2005_BETA2:
- case __ES2005_RC:
- return CRect( 5, 5, 5, 5 );
- default:
- {
- ASSERT( FALSE );
- }
- return CRect( 0, 0, 0, 0 );
- } // switch( m_eStyle2005 )
- }
- BYTE CExtPaintManager::DockMarker_GetAlpha(
- bool bHighlight,
- CObject * pHelperSrc,
- LPARAM lParam // = 0L
- )
- {
- ASSERT_VALID( this );
- bHighlight;
- pHelperSrc;
- lParam;
- return BYTE(255);
- }
- bool CExtPaintManager::DockMarker_IsAdjustBmpsRequired(
- eDockMarkerType_t eDockMarkerType
- ) const
- {
- ASSERT_VALID( this );
- eDockMarkerType;
- switch( m_eStyle2005 )
- {
- case __ES2005_BETA1:
- return true;
- case __ES2005_BETA2:
- case __ES2005_RC:
- return false;
- default:
- {
- ASSERT( FALSE );
- }
- return false;
- } // switch( m_eStyle2005 )
- }
- void CExtPaintManager::DockMarker_AdjustBmps(
- CExtPaintManager::eDockMarkerType_t eDockMarkerType,
- CExtBitmap & bmpIn,
- COLORREF clrTransparentIn,
- CExtBitmap & bmpOut,
- COLORREF clrTransparentOut
- )
- {
- ASSERT_VALID( this );
- ASSERT( ! bmpIn.IsEmpty() );
- ASSERT( ! bmpOut.IsEmpty() );
- if( ! DockMarker_IsAdjustBmpsRequired( eDockMarkerType ) )
- return;
- if( eDockMarkerType == CExtPaintManager::__EDMT_2005_CENTER )
- return;
- if( stat_GetBPP() <= 8 )
- {
- VERIFY(
- bmpOut.AdjustHLS(
- clrTransparentOut,
- RGB(0,0,0),
- 0.0,
- 0.30,
- -1.0
- )
- );
- VERIFY(
- bmpIn.AdjustHLS(
- clrTransparentIn,
- RGB(0,0,0),
- 0.0,
- -0.15,
- -1.0
- )
- );
- } // if( stat_GetBPP() <= 8 )
- else
- {
- VERIFY(
- bmpOut.AdjustHLS(
- clrTransparentOut,
- RGB(0,0,0),
- 0.0,
- 0.35,
- 0.0
- )
- );
- } // else from if( stat_GetBPP() <= 8 )
- }
- void CExtPaintManagerXP::DockMarker_AdjustBmps(
- CExtPaintManager::eDockMarkerType_t eDockMarkerType,
- CExtBitmap & bmpIn,
- COLORREF clrTransparentIn,
- CExtBitmap & bmpOut,
- COLORREF clrTransparentOut
- )
- {
- ASSERT_VALID( this );
- ASSERT( ! bmpIn.IsEmpty() );
- ASSERT( ! bmpOut.IsEmpty() );
- if( ! DockMarker_IsAdjustBmpsRequired( eDockMarkerType ) )
- return;
- CExtPaintManager::DockMarker_AdjustBmps(
- eDockMarkerType,
- bmpIn,
- clrTransparentIn,
- bmpOut,
- clrTransparentOut
- );
- }
- void CExtPaintManagerOffice2003::DockMarker_AdjustBmps(
- CExtPaintManager::eDockMarkerType_t eDockMarkerType,
- CExtBitmap & bmpIn,
- COLORREF clrTransparentIn,
- CExtBitmap & bmpOut,
- COLORREF clrTransparentOut
- )
- {
- ASSERT_VALID( this );
- if( IsHighContrast() )
- {
- CExtPaintManagerXP::DockMarker_AdjustBmps(
- eDockMarkerType,
- bmpIn,
- clrTransparentIn,
- bmpOut,
- clrTransparentOut
- );
- return;
- }
- if( ! DockMarker_IsAdjustBmpsRequired( eDockMarkerType ) )
- return;
- e_system_theme_t eCurrentTheme = OnQuerySystemTheme();
- if( eCurrentTheme == ThemeUnknown
- || stat_GetBPP() <= 8
- )
- {
- CExtPaintManagerXP::DockMarker_AdjustBmps(
- eDockMarkerType,
- bmpIn,
- clrTransparentIn,
- bmpOut,
- clrTransparentOut
- );
- return;
- } // if( eCurrentTheme == ThemeUnknown )
- if( eDockMarkerType == CExtPaintManager::__EDMT_2005_CENTER )
- return;
- VERIFY(
- bmpOut.AdjustHLS(
- clrTransparentOut,
- RGB(0,0,0),
- 0.0,
- 0.35,
- 0.0
- )
- );
- if( eCurrentTheme == ThemeLunaOlive )
- {
- VERIFY(
- bmpIn.AdjustHLS(
- clrTransparentIn,
- RGB(0,0,0),
- 0.60,
- 0.0,
- -0.45
- )
- );
- VERIFY(
- bmpOut.AdjustHLS(
- clrTransparentOut,
- RGB(0,0,0),
- 0.60,
- 0.0,
- -0.45
- )
- );
- return;
- } // if( eCurrentTheme == ThemeLunaOlive )
- if( eCurrentTheme == ThemeLunaSilver )
- {
- VERIFY(
- bmpIn.AdjustHLS(
- clrTransparentIn,
- RGB(0,0,0),
- 0.0,
- 0.0,
- -0.85
- )
- );
- VERIFY(
- bmpOut.AdjustHLS(
- clrTransparentOut,
- RGB(0,0,0),
- 0.0,
- 0.0,
- -0.85
- )
- );
- return;
- } // if( eCurrentTheme == ThemeLunaSilver )
- }
- void CExtPaintManagerStudio2005::DockMarker_AdjustBmps(
- CExtPaintManager::eDockMarkerType_t eDockMarkerType,
- CExtBitmap & bmpIn,
- COLORREF clrTransparentIn,
- CExtBitmap & bmpOut,
- COLORREF clrTransparentOut
- )
- {
- ASSERT_VALID( this );
- ASSERT( ! bmpIn.IsEmpty() );
- ASSERT( ! bmpOut.IsEmpty() );
- if( IsHighContrast() )
- {
- CExtPaintManagerXP::DockMarker_AdjustBmps(
- eDockMarkerType,
- bmpIn,
- clrTransparentIn,
- bmpOut,
- clrTransparentOut
- );
- return;
- }
- if( ! DockMarker_IsAdjustBmpsRequired( eDockMarkerType ) )
- return;
- CExtPaintManagerOffice2003::DockMarker_AdjustBmps(
- eDockMarkerType,
- bmpIn,
- clrTransparentIn,
- bmpOut,
- clrTransparentOut
- );
- }
- void CExtPaintManager::DockMarker_AdjustHighlightedArea(
- COLORREF * pClrSurface,
- int nClrSurfaceDX,
- int nClrSurfaceDY,
- bool bTabShape,
- bool bTabsAtTop,
- const CRect & rcTabMainArea,
- const CRect & rcTabBottomMiddleArea,
- COLORREF clrAdjustMain, // = COLORREF(-1L)
- COLORREF clrAdjustBorder, // = COLORREF(-1L)
- int nBorderMetric // = 2
- )
- {
- ASSERT_VALID( this );
- ASSERT( nBorderMetric >= 0 );
- ASSERT( pClrSurface != NULL );
- ASSERT( nClrSurfaceDX > 0 );
- ASSERT( nClrSurfaceDY > 0 );
- CRect rcMainArea( 0, 0, nClrSurfaceDX, nClrSurfaceDY );
- if( bTabShape )
- rcMainArea = rcTabMainArea;
- if( stat_GetBPP() > 8 )
- {
- if( clrAdjustMain == COLORREF(-1L) )
- clrAdjustMain = ::GetSysColor( COLOR_HIGHLIGHT );
- if( m_eStyle2005 == __ES2005_BETA2
- || m_eStyle2005 == __ES2005_RC
- )
- clrAdjustMain = RGB(0,64,196);
- if( nBorderMetric > 0 && clrAdjustBorder == COLORREF(-1L) )
- clrAdjustBorder = ::GetSysColor( COLOR_ACTIVEBORDER );
- unsigned nPixelIdx = 0;
- for( int nY = 0; nY < nClrSurfaceDY; nY++ )
- {
- for( int nX = 0; nX < nClrSurfaceDX; nX++, nPixelIdx++ )
- {
- if( bTabShape )
- {
- CPoint ptTest( nX, nClrSurfaceDY - nY - 1 );
- if( (! rcTabMainArea.PtInRect( ptTest ) )
- && (! rcTabBottomMiddleArea.PtInRect( ptTest ) )
- )
- continue;
- } // if( bTabShape )
- COLORREF clrAdjustMix = clrAdjustMain;
- if( nBorderMetric > 0 )
- {
- CPoint ptTest( nX, nClrSurfaceDY - nY - 1 );
- if( bTabShape
- && rcTabBottomMiddleArea.PtInRect( ptTest )
- && (
- ( bTabsAtTop
- ? ( ptTest.y <= ( rcTabBottomMiddleArea.top + nBorderMetric ) )
- : ( ptTest.y >= ( rcTabBottomMiddleArea.bottom - nBorderMetric ) )
- )
- || ptTest.x < (rcTabBottomMiddleArea.left + nBorderMetric)
- || nX >= (rcTabBottomMiddleArea.right - nBorderMetric)
- )
- )
- clrAdjustMix = clrAdjustBorder;
- else if( rcMainArea.PtInRect( ptTest )
- && (
- ( bTabsAtTop
- ? ( ptTest.y > ( rcMainArea.bottom - nBorderMetric ) )
- : ( ptTest.y < ( rcMainArea.top + nBorderMetric ) )
- )
- || ptTest.x < (rcMainArea.left + nBorderMetric)
- || ptTest.x >= (rcMainArea.right - nBorderMetric)
- || (
- ( bTabsAtTop
- ? ( ptTest.y <= ( rcMainArea.top + nBorderMetric ) )
- : ( ptTest.y >= ( rcMainArea.bottom - nBorderMetric ) )
- )
- && ( (!bTabShape)
- || ( bTabShape
- && ( ptTest.x < (rcTabBottomMiddleArea.left + nBorderMetric )
- || ptTest.x >= (rcTabBottomMiddleArea.right - nBorderMetric )
- )
- )
- )
- )
- )
- )
- clrAdjustMix = clrAdjustBorder;
- } // if( nBorderMetric > 0 )
- COLORREF clrTemp = pClrSurface[ nPixelIdx ];
- clrTemp =
- RGB(
- min(
- 255,
- GetRValue( clrTemp )
- + ( ( GetBValue( clrAdjustMix ) - GetRValue( clrTemp ) ) / 2 ) ),
- min(
- 255,
- GetGValue( clrTemp )
- + ( ( GetGValue( clrAdjustMix ) - GetGValue( clrTemp ) ) / 2 ) ),
- min(
- 255,
- GetBValue( clrTemp )
- + ( ( GetRValue( clrAdjustMix ) - GetBValue( clrTemp ) ) / 2 ) )
- );
- pClrSurface[ nPixelIdx ] =
- CExtBitmap::stat_HLS_Adjust(
- clrTemp,
- 0.0,
- 0.10,
- 0.0
- );
- } // for( int nX = 0; nX < bih.biWidth; nX++, nPixelIdx++ )
- } // for( int nY = 0; nY < bih.biHeight; nY++ )
- } // if( stat_GetBPP() > 8 )
- else
- {
- COLORREF clrDark = GetColor( COLOR_3DSHADOW, this );
- unsigned nPixelIdx = 0;
- for( int nY = 0; nY < nClrSurfaceDY; nY++ )
- {
- for( int nX = 0; nX < nClrSurfaceDX; nX++, nPixelIdx++ )
- {
- if( bTabShape )
- {
- CPoint ptTest( nX, nClrSurfaceDY - nY );
- if( (! rcTabMainArea.PtInRect( ptTest ) )
- && (! rcTabBottomMiddleArea.PtInRect( ptTest ) )
- )
- continue;
- } // if( bTabShape )
- if( ( (nY&0x01) != 0 && (nX&0x01) == 0 )
- || ( (nY&0x01) == 0 && (nX&0x01) != 0 )
- )
- pClrSurface[ nPixelIdx ] = clrDark;
- } // for( int nX = 0; nX < bih.biWidth; nX++, nPixelIdx++ )
- } // for( int nY = 0; nY < bih.biHeight; nY++ )
- } // else from if( stat_GetBPP() > 8 )
- }
- void CExtPaintManagerOffice2003::DockMarker_AdjustHighlightedArea(
- COLORREF * pClrSurface,
- int nClrSurfaceDX,
- int nClrSurfaceDY,
- bool bTabShape,
- bool bTabsAtTop,
- const CRect & rcTabMainArea,
- const CRect & rcTabBottomMiddleArea,
- COLORREF clrAdjustMain, // = COLORREF(-1L)
- COLORREF clrAdjustBorder, // = COLORREF(-1L)
- int nBorderMetric // = 2
- )
- {
- ASSERT_VALID( this );
- ASSERT( nBorderMetric >= 0 );
- if( IsHighContrast() )
- {
- CExtPaintManagerXP::DockMarker_AdjustHighlightedArea(
- pClrSurface,
- nClrSurfaceDX,
- nClrSurfaceDY,
- bTabShape,
- bTabsAtTop,
- rcTabMainArea,
- rcTabBottomMiddleArea,
- clrAdjustMain,
- clrAdjustBorder,
- nBorderMetric
- );
- return;
- }
- if( clrAdjustMain == COLORREF(-1L) && stat_GetBPP() > 8 )
- {
- e_system_theme_t eCurrentTheme = OnQuerySystemTheme();
- if( eCurrentTheme == ThemeLunaBlue
- || eCurrentTheme == ThemeLunaRoyale // +2.87
- || eCurrentTheme == ThemeVistaOrLaterUX // +2.87
- || eCurrentTheme == ThemeVistaOrLaterDWM // +2.87
- )
- clrAdjustMain = RGB( 0, 0, 128 );
- else if( eCurrentTheme == ThemeLunaOlive )
- clrAdjustMain = RGB( 0x0AA, 0x0BB, 0x083 );
- else if( eCurrentTheme == ThemeLunaSilver )
- clrAdjustMain = RGB( 96, 96, 144 );
- }
- CExtPaintManagerXP::DockMarker_AdjustHighlightedArea(
- pClrSurface,
- nClrSurfaceDX,
- nClrSurfaceDY,
- bTabShape,
- bTabsAtTop,
- rcTabMainArea,
- rcTabBottomMiddleArea,
- clrAdjustMain,
- clrAdjustBorder,
- nBorderMetric
- );
- }
- void CExtPaintManager::DockMarker_AdjustHighlightedLayer(
- HWND hWnd,
- int nDX,
- int nDY,
- bool bTabShape,
- bool bTabsAtTop,
- const CRect & rcTabMainArea,
- const CRect & rcTabBottomMiddleArea,
- COLORREF clrAdjustMain, // = COLORREF(-1L)
- COLORREF clrAdjustBorder, // = COLORREF(-1L)
- int nBorderMetric // = 2
- )
- {
- ASSERT_VALID( this );
- ASSERT( hWnd != NULL && ::IsWindow( hWnd ) );
- ASSERT( nBorderMetric >= 0 );
- ASSERT( g_PaintManager.m_pfnUpdateLayeredWindow != NULL );
- ASSERT( nDX > 0 );
- ASSERT( nDY > 0 );
- CWindowDC dcDesktop(NULL);
- BITMAPINFOHEADER bih;
- bih.biSize = sizeof(BITMAPINFOHEADER);
- bih.biWidth = nDX;
- bih.biHeight = nDY;
- bih.biPlanes = 1;
- bih.biBitCount = 32;
- bih.biCompression = BI_RGB;
- bih.biSizeImage = bih.biWidth*bih.biHeight;
- bih.biXPelsPerMeter = 0;
- bih.biYPelsPerMeter = 0;
- bih.biClrUsed = 0;
- bih.biClrImportant = 0;
- COLORREF * pClrSurface = NULL;
- HBITMAP hDIB =
- ::CreateDIBSection(
- dcDesktop.GetSafeHdc(),
- (LPBITMAPINFO)&bih,
- DIB_RGB_COLORS,
- (void **)&pClrSurface,
- NULL,
- NULL
- );
- if( hDIB == NULL )
- {
- ASSERT( FALSE );
- return;
- }
- ASSERT( pClrSurface != NULL );
- CBitmap _bmpLayerData;
- _bmpLayerData.Attach( hDIB );
- CDC dc;
- if( ! dc.CreateCompatibleDC( &dcDesktop ) )
- {
- ASSERT( FALSE );
- return;
- }
- HGDIOBJ hOld = dc.SelectObject( hDIB );
- CRect rcMainArea( 0, 0, nDX, nDY );
- if( bTabShape )
- rcMainArea = rcTabMainArea;
- if( clrAdjustMain == COLORREF(-1L) )
- clrAdjustMain = ::GetSysColor( COLOR_HIGHLIGHT );
- if( m_eStyle2005 == __ES2005_BETA2
- || m_eStyle2005 == __ES2005_RC
- )
- clrAdjustMain = RGB(0,64,196);
- if( nBorderMetric > 0 && clrAdjustBorder == COLORREF(-1L) )
- clrAdjustBorder = ::GetSysColor( COLOR_ACTIVEBORDER );
- unsigned nPixelIdx = 0;
- for( int nY = 0; nY < nDY; nY++ )
- {
- for( int nX = 0; nX < nDX; nX++, nPixelIdx++ )
- {
- if( bTabShape )
- {
- CPoint ptTest( nX, nDY - nY - 1 );
- if( (! rcTabMainArea.PtInRect( ptTest ) )
- && (! rcTabBottomMiddleArea.PtInRect( ptTest ) )
- )
- continue;
- } // if( bTabShape )
- COLORREF clrAdjustMix = clrAdjustMain;
- if( nBorderMetric > 0 )
- {
- CPoint ptTest( nX, nDY - nY - 1 );
- if( bTabShape
- && rcTabBottomMiddleArea.PtInRect( ptTest )
- && (
- ( bTabsAtTop
- ? ( ptTest.y <= ( rcTabBottomMiddleArea.top + nBorderMetric ) )
- : ( ptTest.y >= ( rcTabBottomMiddleArea.bottom - nBorderMetric ) )
- )
- || ptTest.x < (rcTabBottomMiddleArea.left + nBorderMetric)
- || nX >= (rcTabBottomMiddleArea.right - nBorderMetric)
- )
- )
- clrAdjustMix = clrAdjustBorder;
- else if( rcMainArea.PtInRect( ptTest )
- && (
- ( bTabsAtTop
- ? ( ptTest.y > ( rcMainArea.bottom - nBorderMetric ) )
- : ( ptTest.y < ( rcMainArea.top + nBorderMetric ) )
- )
- || ptTest.x < (rcMainArea.left + nBorderMetric)
- || ptTest.x >= (rcMainArea.right - nBorderMetric)
- || (
- ( bTabsAtTop
- ? ( ptTest.y <= ( rcMainArea.top + nBorderMetric ) )
- : ( ptTest.y >= ( rcMainArea.bottom - nBorderMetric ) )
- )
- && ( (!bTabShape)
- || ( bTabShape
- && ( ptTest.x < (rcTabBottomMiddleArea.left + nBorderMetric )
- || ptTest.x >= (rcTabBottomMiddleArea.right - nBorderMetric )
- )
- )
- )
- )
- )
- )
- clrAdjustMix = clrAdjustBorder;
- } // if( nBorderMetric > 0 )
- COLORREF clrTemp =
- //pClrSurface[ nPixelIdx ];
- 0;
- clrTemp =
- RGB(
- min(
- 255,
- GetRValue( clrTemp )
- + ( ( GetBValue( clrAdjustMix ) - GetRValue( clrTemp ) ) / 2 ) ),
- min(
- 255,
- GetGValue( clrTemp )
- + ( ( GetGValue( clrAdjustMix ) - GetGValue( clrTemp ) ) / 2 ) ),
- min(
- 255,
- GetBValue( clrTemp )
- + ( ( GetRValue( clrAdjustMix ) - GetBValue( clrTemp ) ) / 2 ) )
- );
- clrTemp =
- __EXT_MFC_RGBA(
- GetRValue( clrTemp ),
- GetGValue( clrTemp ),
- GetBValue( clrTemp ),
- 128
- );
- pClrSurface[ nPixelIdx ] = clrTemp;
- } // for( int nX = 0; nX < bih.biWidth; nX++, nPixelIdx++ )
- } // for( int nY = 0; nY < bih.biHeight; nY++ )
- CExtPaintManager::CExtPaintManagerAutoPtr::__EXT_MFC_BLENDFUNCTION _bf =
- { __EXT_MFC_AC_SRC_OVER,
- 0,
- 255,
- __EXT_MFC_AC_SRC_ALPHA
- };
- CRect rcWnd;
- ::GetWindowRect( hWnd, &rcWnd );
- CPoint ptSrc( 0, 0 ), ptDst( rcWnd.TopLeft() );
- CSize sizeDst = rcWnd.Size();
- bool bRetVal =
- g_PaintManager.m_pfnUpdateLayeredWindow(
- hWnd,
- dcDesktop,
- &ptDst,
- &sizeDst,
- dc,
- &ptSrc,
- 0,
- &_bf,
- __EXT_MFC_ULW_ALPHA
- ) ? true : false;
- // ASSERT( bRetVal );
- bRetVal;
- dc.SelectObject( hOld );
- }
- void CExtPaintManagerOffice2003::DockMarker_AdjustHighlightedLayer(
- HWND hWnd,
- int nDX,
- int nDY,
- bool bTabShape,
- bool bTabsAtTop,
- const CRect & rcTabMainArea,
- const CRect & rcTabBottomMiddleArea,
- COLORREF clrAdjustMain, // = COLORREF(-1L)
- COLORREF clrAdjustBorder, // = COLORREF(-1L)
- int nBorderMetric // = 2
- )
- {
- ASSERT_VALID( this );
- ASSERT( hWnd != NULL && ::IsWindow( hWnd ) );
- ASSERT( nBorderMetric >= 0 );
- ASSERT( g_PaintManager.m_pfnUpdateLayeredWindow != NULL );
- if( IsHighContrast() )
- {
- CExtPaintManagerXP::DockMarker_AdjustHighlightedLayer(
- hWnd,
- nDX,
- nDY,
- bTabShape,
- bTabsAtTop,
- rcTabMainArea,
- rcTabBottomMiddleArea,
- clrAdjustMain,
- clrAdjustBorder,
- nBorderMetric
- );
- return;
- }
- if( clrAdjustMain == COLORREF(-1L) && stat_GetBPP() > 8 )
- {
- e_system_theme_t eCurrentTheme = OnQuerySystemTheme();
- if( eCurrentTheme == ThemeLunaBlue
- || eCurrentTheme == ThemeLunaRoyale // +2.87
- || eCurrentTheme == ThemeVistaOrLaterUX // +2.87
- || eCurrentTheme == ThemeVistaOrLaterDWM // +2.87
- )
- clrAdjustMain = RGB( 0, 0, 128 );
- else if( eCurrentTheme == ThemeLunaOlive )
- clrAdjustMain = RGB( 0x0AA, 0x0BB, 0x083 );
- else if( eCurrentTheme == ThemeLunaSilver )
- clrAdjustMain = RGB( 96, 96, 144 );
- }
- CExtPaintManagerXP::DockMarker_AdjustHighlightedLayer(
- hWnd,
- nDX,
- nDY,
- bTabShape,
- bTabsAtTop,
- rcTabMainArea,
- rcTabBottomMiddleArea,
- clrAdjustMain,
- clrAdjustBorder,
- nBorderMetric
- );
- }
- BYTE CExtPaintManagerStudio2008::DockMarker_GetAlpha(
- bool bHighlight,
- CObject * pHelperSrc,
- LPARAM lParam // = 0L
- )
- {
- ASSERT_VALID( this );
- ASSERT_VALID( this );
- if( (! g_PaintManager.m_bIsWin2000orLater )
- || stat_GetBPP() < 24
- || IsHighContrast()
- )
- return
- CExtPaintManagerStudio2005::DockMarker_GetAlpha(
- bHighlight,
- pHelperSrc,
- lParam
- );
- return bHighlight ? BYTE(255) : BYTE(144);
- }
- bool CExtPaintManagerStudio2008::DockMarker_IsAdjustBmpsRequired(
- eDockMarkerType_t eDockMarkerType
- ) const
- {
- ASSERT_VALID( this );
- if( (! g_PaintManager.m_bIsWin2000orLater )
- || stat_GetBPP() < 24
- || IsHighContrast()
- )
- return CExtPaintManagerStudio2005::DockMarker_IsAdjustBmpsRequired( eDockMarkerType );
- return false;
- }
- void CExtPaintManagerStudio2008::DockMarker_AdjustBmps(
- eDockMarkerType_t eDockMarkerType,
- CExtBitmap & bmpIn,
- COLORREF clrTransparentIn,
- CExtBitmap & bmpOut,
- COLORREF clrTransparentOut
- )
- {
- ASSERT_VALID( this );
- if( (! g_PaintManager.m_bIsWin2000orLater )
- || stat_GetBPP() < 24
- || IsHighContrast()
- )
- CExtPaintManagerStudio2005::DockMarker_AdjustBmps(
- eDockMarkerType,
- bmpIn,
- clrTransparentIn,
- bmpOut,
- clrTransparentOut
- );
- }
- #endif // (!defined __EXT_MFC_NO_DOCK_MARKERS)
- void CExtPaintManager::Header_GetButtonPadding(
- INT & nButtonPaddingBefore,
- INT & nButtonPaddingAfter,
- INT nColNo,
- INT nColCount,
- CObject * pHelperSrc,
- LPARAM lParam // = 0L
- ) const
- {
- ASSERT_VALID( this );
- nColNo; nColCount; pHelperSrc; lParam;
- nButtonPaddingBefore = nButtonPaddingAfter = 3;
- }
- INT CExtPaintManager::Header_GetDistanceBetweenIconAndSortArrow(
- INT nColNo,
- INT nColCount,
- CObject * pHelperSrc,
- LPARAM lParam // = 0L
- ) const
- {
- ASSERT_VALID( this );
- nColNo; nColCount; pHelperSrc; lParam;
- return 3;
- }
- INT CExtPaintManager::Header_GetDistanceBetweenIconAndText(
- INT nColNo,
- INT nColCount,
- CObject * pHelperSrc,
- LPARAM lParam // = 0L
- ) const
- {
- ASSERT_VALID( this );
- nColNo; nColCount; pHelperSrc; lParam;
- return 3;
- }
- INT CExtPaintManager::Header_GetDistanceBetweenTextAndButton(
- INT nColNo,
- INT nColCount,
- CObject * pHelperSrc,
- LPARAM lParam // = 0L
- ) const
- {
- ASSERT_VALID( this );
- nColNo; nColCount; pHelperSrc; lParam;
- return 3;
- }
- INT CExtPaintManager::Header_GetSortArrowWidth(
- INT nColNo,
- INT nColCount,
- CObject * pHelperSrc,
- LPARAM lParam // = 0L
- ) const
- {
- ASSERT_VALID( this );
- nColNo; nColCount; pHelperSrc; lParam;
- return 15;
- }
- CRect CExtPaintManager::Header_GetItemPadding(
- INT nColNo,
- INT nColCount,
- CObject * pHelperSrc,
- LPARAM lParam // = 0L
- ) const
- {
- ASSERT_VALID( this );
- nColNo; nColCount; pHelperSrc; lParam;
- return CRect( 3, 2, 3, 2 );
- }
- void CExtPaintManager::Header_PaintBackground(
- CDC & dc,
- CRect rc,
- CObject * pHelperSrc,
- LPARAM lParam // = 0L
- )
- {
- ASSERT_VALID( this );
- ASSERT( dc.GetSafeHdc() != NULL );
- COLORREF clrHeaderBackground = GetColor( CLR_3DFACE_OUT, pHelperSrc, lParam );
- dc.FillSolidRect( rc, clrHeaderBackground );
- }
- void CExtPaintManagerXP::Header_PaintBackground(
- CDC & dc,
- CRect rc,
- CObject * pHelperSrc,
- LPARAM lParam // = 0L
- )
- {
- ASSERT_VALID( this );
- ASSERT( dc.GetSafeHdc() != NULL );
- if( IsHighContrast() )
- {
- CExtPaintManager::Header_PaintBackground( dc, rc, pHelperSrc, lParam );
- return;
- }
- COLORREF clrHeaderBackground = GetColor( XPCLR_3DFACE_DARK, pHelperSrc, lParam );
- dc.FillSolidRect( rc, clrHeaderBackground );
- }
- void CExtPaintManagerOffice2003::Header_PaintBackground(
- CDC & dc,
- CRect rc,
- CObject * pHelperSrc,
- LPARAM lParam // = 0L
- )
- {
- ASSERT_VALID( this );
- ASSERT( dc.GetSafeHdc() != NULL );
- if( IsHighContrast() )
- {
- CExtPaintManagerXP::Header_PaintBackground( dc, rc, pHelperSrc, lParam );
- return;
- }
- COLORREF clrHeaderBackground1 = GetColor( XPCLR_3DFACE_NORMAL, pHelperSrc, lParam );
- COLORREF clrHeaderBackground2 = clrHeaderBackground1;
- clrHeaderBackground1 = stat_HLS_Adjust( clrHeaderBackground1, 0.0, +0.05 );
- clrHeaderBackground2 = stat_HLS_Adjust( clrHeaderBackground2, 0.0, -0.25 );
- stat_PaintGradientRect( dc, rc, clrHeaderBackground2, clrHeaderBackground1, true );
- }
- bool CExtPaintManagerNativeXP::stat_PaintHeaderPartUsingUxTheme(
- CDC & dc,
- CRect rc,
- CObject * pHelperSrc,
- LPARAM lParam,
- bool bDrawItemLikeBackground, // = false
- bool bHover, // = false
- bool bPressed // = false
- )
- {
- ASSERT( dc.GetSafeHdc() != NULL );
- lParam;
- if( pHelperSrc == NULL )
- return false;
- ASSERT_VALID( pHelperSrc );
- if( ! g_PaintManager.m_UxTheme.IsControlsThemed() )
- return false;
- HWND hWnd = NULL;
- if( pHelperSrc->IsKindOf( RUNTIME_CLASS(CWnd) ) )
- hWnd = ((CWnd*)pHelperSrc)->GetSafeHwnd();
- if( hWnd == NULL )
- hWnd = ::GetDesktopWindow();
- if( hWnd == NULL )
- return false;
- if( ! g_PaintManager.m_UxTheme.OpenThemeData( hWnd, VSCLASS_HEADER ) != NULL )
- return false;
- bool bRetVal =
- ( g_PaintManager.m_UxTheme.DrawThemeBackground(
- dc.GetSafeHdc(),
- HP_HEADERITEMRIGHT,
- HIRS_NORMAL,
- &rc,
- &rc
- ) == S_OK ) ? true : false;
- g_PaintManager.m_UxTheme.CloseThemeData( true );
- if( ! bRetVal )
- return false;
- if( ! bDrawItemLikeBackground )
- return true;
- if( ! g_PaintManager.m_UxTheme.OpenThemeData( hWnd, VSCLASS_HEADER ) != NULL )
- return false;
- INT nStateID = HIS_NORMAL;
- if( bPressed )
- nStateID = HIS_PRESSED;
- else if( bHover )
- nStateID = HIS_HOT;
- bRetVal =
- ( g_PaintManager.m_UxTheme.DrawThemeBackground(
- dc.GetSafeHdc(),
- HP_HEADERITEM,
- nStateID,
- &rc,
- &rc
- ) == S_OK ) ? true : false;
- g_PaintManager.m_UxTheme.CloseThemeData( true );
- return bRetVal;
- }
- void CExtPaintManagerNativeXP::Header_PaintBackground(
- CDC & dc,
- CRect rc,
- CObject * pHelperSrc,
- LPARAM lParam // = 0L
- )
- {
- ASSERT_VALID( this );
- ASSERT( dc.GetSafeHdc() != NULL );
- if( IsHighContrast() )
- {
- CExtPaintManager::Header_PaintBackground( dc, rc, pHelperSrc, lParam );
- return;
- }
- if( ! stat_PaintHeaderPartUsingUxTheme( dc, rc, pHelperSrc, lParam ) )
- CExtPaintManager::Header_PaintBackground( dc, rc, pHelperSrc, lParam );
- }
- void CExtPaintManagerOffice2007_Impl::Header_PaintBackground(
- CDC & dc,
- CRect rc,
- CObject * pHelperSrc,
- LPARAM lParam // = 0L
- )
- {
- ASSERT_VALID( this );
- ASSERT( dc.GetSafeHdc() != NULL );
- if( IsHighContrast() )
- {
- CExtPaintManagerOffice2003::Header_PaintBackground( dc, rc, pHelperSrc, lParam );
- return;
- }
- stat_PaintGradientRect( dc, rc, m_clrGridHeaderBkBottom, m_clrGridHeaderBkTop, true );
- }
- void CExtPaintManager::Header_PaintItem(
- CDC & dc,
- CRect rcItemEntire,
- CRect rcItemData,
- CRect rcIcon,
- CRect rcText,
- CRect rcSortArrow,
- CRect rcButton,
- CRect rcButtonIcon,
- bool bSorted,
- bool bSortedAscending,
- INT nColNo,
- INT nColCount,
- const CExtCmdIcon & iconItem,
- const CExtCmdIcon & iconButton,
- bool bHover,
- bool bPressed,
- bool bButtonEvent,
- __EXT_MFC_SAFE_LPCTSTR strItemText,
- CObject * pHelperSrc,
- LPARAM lParam // = 0L
- )
- {
- ASSERT_VALID( this );
- ASSERT( dc.GetSafeHdc() != NULL );
- nColNo; nColCount; pHelperSrc; lParam;
- rcItemData;
- COLORREF clrLT1 = GetColor( COLOR_3DHIGHLIGHT, pHelperSrc, lParam );
- COLORREF clrRB1 = GetColor( COLOR_3DDKSHADOW, pHelperSrc, lParam );
- COLORREF clrLT2 = GetColor( COLOR_3DFACE, pHelperSrc, lParam );
- COLORREF clrRB2 = GetColor( CLR_3DSHADOW_OUT, pHelperSrc, lParam );
- CRect rcDraw = rcItemEntire;
- if( ! rcButton.IsRectEmpty() )
- rcDraw.right = rcButton.left;
- bool bSwapColors = false;
- if( (!bButtonEvent) && ( bHover || bPressed ) )
- {
- bSwapColors = bPressed;
- if( bPressed && bHover )
- dc.FillRect( &rcDraw, &m_brushDarkerDefault );
- else if( bPressed )
- dc.FillRect( &rcDraw, &m_brushDarkDefault );
- else if( bHover )
- dc.FillRect( &rcDraw, &m_brushLightDefault );
- }
- COLORREF _clrLT1 = bSwapColors ? clrRB1 : clrLT1;
- COLORREF _clrRB1 = bSwapColors ? clrLT1 : clrRB1;
- COLORREF _clrLT2 = bSwapColors ? clrRB2 : clrLT2;
- COLORREF _clrRB2 = bSwapColors ? clrLT2 : clrRB2;
- dc.Draw3dRect( &rcDraw, _clrLT1, _clrRB1 );
- rcDraw.DeflateRect( 1, 1, 1, 1 );
- dc.Draw3dRect( &rcDraw, _clrLT2, _clrRB2 );
- if( (! rcButton.IsRectEmpty() )
- && dc.RectVisible( &rcButton )
- )
- {
- bSwapColors = false;
- rcDraw = rcButton;
- if( bButtonEvent && ( bHover || bPressed ) )
- {
- bSwapColors = bPressed;
- if( bPressed && bHover )
- dc.FillRect( &rcDraw, &m_brushDarkerDefault );
- else if( bPressed )
- dc.FillRect( &rcDraw, &m_brushDarkDefault );
- else if( bHover )
- dc.FillRect( &rcDraw, &m_brushLightDefault );
- }
- _clrLT1 = bSwapColors ? clrRB1 : clrLT1;
- _clrRB1 = bSwapColors ? clrLT1 : clrRB1;
- _clrLT2 = bSwapColors ? clrRB2 : clrLT2;
- _clrRB2 = bSwapColors ? clrLT2 : clrRB2;
- dc.Draw3dRect( &rcDraw, _clrLT1, _clrRB1 );
- rcDraw.DeflateRect( 1, 1, 1, 1 );
- dc.Draw3dRect( &rcDraw, _clrLT2, _clrRB2 );
- if( (! iconButton.IsEmpty() )
- && (! rcButtonIcon.IsRectEmpty() )
- && dc.RectVisible( &rcButtonIcon )
- )
- iconButton.Paint( this, dc, rcButtonIcon );
- }
- if( (! iconItem.IsEmpty() )
- && (! rcIcon.IsRectEmpty() )
- && dc.RectVisible( &rcIcon )
- )
- iconItem.Paint( this, dc, rcIcon );
- if( bSorted
- && (! rcSortArrow.IsRectEmpty() )
- && dc.RectVisible( &rcSortArrow )
- )
- {
- COLORREF ColorValues[4] =
- {
- RGB(0,0,0),
- GetColor( COLOR_3DSHADOW, pHelperSrc, lParam ),
- GetColor( COLOR_3DHIGHLIGHT, pHelperSrc, lParam ),
- GetColor( COLOR_3DDKSHADOW, pHelperSrc, lParam ),
- };
- PaintGlyphCentered(
- dc,
- rcSortArrow,
- *( g_DockingCaptionGlyphs[ bSortedAscending ? __DCBT_ARROW_SORT_UP : __DCBT_ARROW_SORT_DOWN ] ),
- ColorValues
- );
- }
- INT nTextLen = ( LPCTSTR(strItemText) != NULL ) ? INT( _tcslen(LPCTSTR(strItemText)) ) : 0;
- if( nTextLen > 0
- && (! rcText.IsRectEmpty() )
- && dc.RectVisible( &rcText )
- )
- {
- COLORREF clrTextColor = GetColor( CLR_TEXT_OUT, pHelperSrc, lParam );
- CFont * pItemFont = & m_FontNormal;
- int nOldBkMode = dc.SetBkMode( TRANSPARENT );
- COLORREF clrOldText = dc.SetTextColor( clrTextColor );
- CFont * pOldFont = dc.SelectObject( pItemFont );
- dc.DrawText( LPCTSTR(strItemText), nTextLen, (LPRECT)&rcText, DT_LEFT|DT_VCENTER|DT_SINGLELINE|DT_END_ELLIPSIS );
- dc.SelectObject( pOldFont );
- dc.SetTextColor( clrOldText );
- dc.SetBkMode( nOldBkMode );
- }
- }
- void CExtPaintManagerXP::Header_PaintItem(
- CDC & dc,
- CRect rcItemEntire,
- CRect rcItemData,
- CRect rcIcon,
- CRect rcText,
- CRect rcSortArrow,
- CRect rcButton,
- CRect rcButtonIcon,
- bool bSorted,
- bool bSortedAscending,
- INT nColNo,
- INT nColCount,
- const CExtCmdIcon & iconItem,
- const CExtCmdIcon & iconButton,
- bool bHover,
- bool bPressed,
- bool bButtonEvent,
- __EXT_MFC_SAFE_LPCTSTR strItemText,
- CObject * pHelperSrc,
- LPARAM lParam // = 0L
- )
- {
- ASSERT_VALID( this );
- ASSERT( dc.GetSafeHdc() != NULL );
- if( IsHighContrast() )
- {
- CExtPaintManager::Header_PaintItem(
- dc, rcItemEntire, rcItemData, rcIcon, rcText, rcSortArrow, rcButton, rcButtonIcon,
- bSorted, bSortedAscending, nColNo, nColCount, iconItem, iconButton, bHover, bPressed, bButtonEvent,
- strItemText, pHelperSrc, lParam
- );
- return;
- }
- COLORREF clrLT1 = GetColor( COLOR_3DHIGHLIGHT, pHelperSrc, lParam );
- COLORREF clrRB1 = GetColor( COLOR_3DSHADOW, pHelperSrc, lParam );
- CRect rcDraw = rcItemEntire;
- if( ! rcButton.IsRectEmpty() )
- rcDraw.right = rcButton.left;
- bool bDrawBorder = true;
- if( (!bButtonEvent) && ( bHover || bPressed ) )
- {
- bDrawBorder = !bPressed;
- if( bPressed && bHover )
- dc.FillRect( &rcDraw, &m_brushDarkerDefault );
- else if( bPressed )
- dc.FillRect( &rcDraw, &m_brushDarkDefault );
- else if( bHover )
- dc.FillRect( &rcDraw, &m_brushLighterDefault );
- }
- if( bDrawBorder )
- dc.Draw3dRect( &rcDraw, clrLT1, clrRB1 );
- if( (! rcButton.IsRectEmpty() )
- && dc.RectVisible( &rcButton )
- )
- {
- bDrawBorder = true;
- rcDraw = rcButton;
- if( bButtonEvent && ( bHover || bPressed ) )
- {
- bDrawBorder = !bPressed;
- if( bPressed && bHover )
- dc.FillRect( &rcDraw, &m_brushDarkerDefault );
- else if( bPressed )
- dc.FillRect( &rcDraw, &m_brushDarkDefault );
- else if( bHover )
- dc.FillRect( &rcDraw, &m_brushLighterDefault );
- }
- if( bDrawBorder )
- dc.Draw3dRect( &rcDraw, clrLT1, clrRB1 );
- if( (! iconButton.IsEmpty() )
- && (! rcButtonIcon.IsRectEmpty() )
- && dc.RectVisible( &rcButtonIcon )
- )
- iconButton.Paint( this, dc, rcButtonIcon );
- }
- if( (! iconItem.IsEmpty() )
- && (! rcIcon.IsRectEmpty() )
- && dc.RectVisible( &rcIcon )
- )
- iconItem.Paint( this, dc, rcIcon );
- if( bSorted
- && (! rcSortArrow.IsRectEmpty() )
- && dc.RectVisible( &rcSortArrow )
- )
- {
- COLORREF clr =
- GetColor(
- ( bPressed && (!bButtonEvent) ) ? COLOR_3DHIGHLIGHT : COLOR_3DSHADOW,
- pHelperSrc,
- lParam
- );
- COLORREF ColorValues[2] =
- {
- RGB(0,0,0),
- clr,
- };
- PaintGlyphCentered(
- dc,
- rcSortArrow,
- *( g_DockingCaptionGlyphs[ bSortedAscending ? __DCBT_ARROW_UP : __DCBT_ARROW_DOWN ] ),
- ColorValues
- );
- }
- INT nTextLen = ( LPCTSTR(strItemText) != NULL ) ? INT( _tcslen(LPCTSTR(strItemText)) ) : 0;
- if( nTextLen > 0
- && (! rcText.IsRectEmpty() )
- && dc.RectVisible( &rcText )
- )
- {
- COLORREF clrTextColor = GetColor( CLR_TEXT_OUT, pHelperSrc, lParam );
- CFont * pItemFont = & m_FontNormal;
- int nOldBkMode = dc.SetBkMode( TRANSPARENT );
- COLORREF clrOldText = dc.SetTextColor( clrTextColor );
- CFont * pOldFont = dc.SelectObject( pItemFont );
- dc.DrawText( LPCTSTR(strItemText), nTextLen, (LPRECT)&rcText, DT_LEFT|DT_VCENTER|DT_SINGLELINE|DT_END_ELLIPSIS );
- dc.SelectObject( pOldFont );
- dc.SetTextColor( clrOldText );
- dc.SetBkMode( nOldBkMode );
- }
- }
- void CExtPaintManagerOffice2003::Header_PaintItem(
- CDC & dc,
- CRect rcItemEntire,
- CRect rcItemData,
- CRect rcIcon,
- CRect rcText,
- CRect rcSortArrow,
- CRect rcButton,
- CRect rcButtonIcon,
- bool bSorted,
- bool bSortedAscending,
- INT nColNo,
- INT nColCount,
- const CExtCmdIcon & iconItem,
- const CExtCmdIcon & iconButton,
- bool bHover,
- bool bPressed,
- bool bButtonEvent,
- __EXT_MFC_SAFE_LPCTSTR strItemText,
- CObject * pHelperSrc,
- LPARAM lParam // = 0L
- )
- {
- ASSERT_VALID( this );
- ASSERT( dc.GetSafeHdc() != NULL );
- if( IsHighContrast() )
- {
- CExtPaintManagerXP::Header_PaintItem(
- dc, rcItemEntire, rcItemData, rcIcon, rcText, rcSortArrow, rcButton, rcButtonIcon,
- bSorted, bSortedAscending, nColNo, nColCount, iconItem, iconButton, bHover, bPressed, bButtonEvent,
- strItemText, pHelperSrc, lParam
- );
- return;
- }
- CExtPaintManagerXP::Header_PaintItem(
- dc, rcItemEntire, rcItemData, rcIcon, rcText, rcSortArrow, rcButton, rcButtonIcon,
- bSorted, bSortedAscending, nColNo, nColCount, iconItem, iconButton, bHover, bPressed, bButtonEvent,
- strItemText, pHelperSrc, lParam
- );
- }
- void CExtPaintManagerNativeXP::Header_PaintItem(
- CDC & dc,
- CRect rcItemEntire,
- CRect rcItemData,
- CRect rcIcon,
- CRect rcText,
- CRect rcSortArrow,
- CRect rcButton,
- CRect rcButtonIcon,
- bool bSorted,
- bool bSortedAscending,
- INT nColNo,
- INT nColCount,
- const CExtCmdIcon & iconItem,
- const CExtCmdIcon & iconButton,
- bool bHover,
- bool bPressed,
- bool bButtonEvent,
- __EXT_MFC_SAFE_LPCTSTR strItemText,
- CObject * pHelperSrc,
- LPARAM lParam // = 0L
- )
- {
- ASSERT_VALID( this );
- ASSERT( dc.GetSafeHdc() != NULL );
- if( IsHighContrast() )
- {
- CExtPaintManager::Header_PaintItem(
- dc, rcItemEntire, rcItemData, rcIcon, rcText, rcSortArrow, rcButton, rcButtonIcon,
- bSorted, bSortedAscending, nColNo, nColCount, iconItem, iconButton, bHover, bPressed, bButtonEvent,
- strItemText, pHelperSrc, lParam
- );
- return;
- }
- COLORREF clrLT1 = GetColor( COLOR_3DHIGHLIGHT, pHelperSrc, lParam );
- COLORREF clrRB1 = GetColor( COLOR_3DSHADOW, pHelperSrc, lParam );
- CRect rcDraw = rcItemEntire;
- if( ! rcButton.IsRectEmpty() )
- rcDraw.right = rcButton.left;
- if( ! stat_PaintHeaderPartUsingUxTheme(
- dc, rcDraw, pHelperSrc, lParam, true,
- bHover && (!bButtonEvent),
- bPressed && (!bButtonEvent) )
- )
- {
- bool bDrawBorder = true;
- if( (!bButtonEvent) && ( bHover || bPressed ) )
- {
- bDrawBorder = !bPressed;
- if( bPressed && bHover )
- dc.FillRect( &rcDraw, &m_brushDarkerDefault );
- else if( bPressed )
- dc.FillRect( &rcDraw, &m_brushDarkDefault );
- else if( bHover )
- dc.FillRect( &rcDraw, &m_brushLighterDefault );
- }
- if( bDrawBorder )
- dc.Draw3dRect( &rcDraw, clrLT1, clrRB1 );
- }
- if( (! rcButton.IsRectEmpty() )
- && dc.RectVisible( &rcButton )
- )
- {
- rcDraw = rcButton;
- if( ! stat_PaintHeaderPartUsingUxTheme(
- dc, rcDraw, pHelperSrc, lParam, true,
- bHover && bButtonEvent,
- bPressed && bButtonEvent
- )
- )
- {
- bool bDrawBorder = true;
- if( bButtonEvent && ( bHover || bPressed ) )
- {
- bDrawBorder = !bPressed;
- if( bPressed && bHover )
- dc.FillRect( &rcDraw, &m_brushDarkerDefault );
- else if( bPressed )
- dc.FillRect( &rcDraw, &m_brushDarkDefault );
- else if( bHover )
- dc.FillRect( &rcDraw, &m_brushLighterDefault );
- }
- if( bDrawBorder )
- dc.Draw3dRect( &rcDraw, clrLT1, clrRB1 );
- }
- if( (! iconButton.IsEmpty() )
- && (! rcButtonIcon.IsRectEmpty() )
- && dc.RectVisible( &rcButtonIcon )
- )
- iconButton.Paint( this, dc, rcButtonIcon );
- }
- if( (! iconItem.IsEmpty() )
- && (! rcIcon.IsRectEmpty() )
- && dc.RectVisible( &rcIcon )
- )
- iconItem.Paint( this, dc, rcIcon );
- if( bSorted
- && (! rcSortArrow.IsRectEmpty() )
- && dc.RectVisible( &rcSortArrow )
- )
- {
- COLORREF ColorValues[2] =
- {
- RGB(0,0,0),
- GetColor( COLOR_3DSHADOW, pHelperSrc, lParam ),
- };
- PaintGlyphCentered(
- dc,
- rcSortArrow,
- *( g_DockingCaptionGlyphs[ bSortedAscending ? __DCBT_ARROW_UP : __DCBT_ARROW_DOWN ] ),
- ColorValues
- );
- }
- INT nTextLen = ( LPCTSTR(strItemText) != NULL ) ? INT( _tcslen(LPCTSTR(strItemText)) ) : 0;
- if( nTextLen > 0
- && (! rcText.IsRectEmpty() )
- && dc.RectVisible( &rcText )
- )
- {
- COLORREF clrTextColor = GetColor( CLR_TEXT_OUT, pHelperSrc, lParam );
- CFont * pItemFont = & m_FontNormal;
- int nOldBkMode = dc.SetBkMode( TRANSPARENT );
- COLORREF clrOldText = dc.SetTextColor( clrTextColor );
- CFont * pOldFont = dc.SelectObject( pItemFont );
- dc.DrawText( LPCTSTR(strItemText), nTextLen, (LPRECT)&rcText, DT_LEFT|DT_VCENTER|DT_SINGLELINE|DT_END_ELLIPSIS );
- dc.SelectObject( pOldFont );
- dc.SetTextColor( clrOldText );
- dc.SetBkMode( nOldBkMode );
- }
- }
- void CExtPaintManagerOffice2007_Impl::Header_PaintItem(
- CDC & dc,
- CRect rcItemEntire,
- CRect rcItemData,
- CRect rcIcon,
- CRect rcText,
- CRect rcSortArrow,
- CRect rcButton,
- CRect rcButtonIcon,
- bool bSorted,
- bool bSortedAscending,
- INT nColNo,
- INT nColCount,
- const CExtCmdIcon & iconItem,
- const CExtCmdIcon & iconButton,
- bool bHover,
- bool bPressed,
- bool bButtonEvent,
- __EXT_MFC_SAFE_LPCTSTR strItemText,
- CObject * pHelperSrc,
- LPARAM lParam // = 0L
- )
- {
- ASSERT_VALID( this );
- ASSERT( dc.GetSafeHdc() != NULL );
- if( IsHighContrast() )
- {
- CExtPaintManagerOffice2003::Header_PaintItem(
- dc, rcItemEntire, rcItemData, rcIcon, rcText, rcSortArrow, rcButton, rcButtonIcon,
- bSorted, bSortedAscending, nColNo, nColCount, iconItem, iconButton, bHover, bPressed, bButtonEvent,
- strItemText, pHelperSrc, lParam
- );
- return;
- }
- CExtPaintManagerOffice2003::Header_PaintItem(
- dc, rcItemEntire, rcItemData, rcIcon, rcText, rcSortArrow, rcButton, rcButtonIcon,
- bSorted, bSortedAscending, nColNo, nColCount, iconItem, iconButton, bHover, bPressed, bButtonEvent,
- strItemText, pHelperSrc, lParam
- );
- }