ExtPaintManager2.cpp
上传用户:sesekoo
上传日期:2020-07-18
资源大小:21543k
文件大小:328k
- // This is part of the Professional User Interface Suite library.
- // Copyright (C) 2001-2009 FOSS Software, Inc.
- // All rights reserved.
- //
- // http://www.prof-uis.com
- // mailto:support@prof-uis.com
- //
- // This source code can be used, modified and redistributed
- // under the terms of the license agreement that is included
- // in the Professional User Interface Suite package.
- //
- // Warranties and Disclaimers:
- // THIS SOFTWARE IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND
- // INCLUDING, BUT NOT LIMITED TO, WARRANTIES OF MERCHANTABILITY,
- // FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT.
- // IN NO EVENT WILL FOSS SOFTWARE INC. BE LIABLE FOR ANY DIRECT,
- // INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY OR CONSEQUENTIAL DAMAGES,
- // INCLUDING DAMAGES FOR LOSS OF PROFITS, LOSS OR INACCURACY OF DATA,
- // INCURRED BY ANY PERSON FROM SUCH PERSON'S USAGE OF THIS SOFTWARE
- // EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
- #include "StdAfx.h"
- #if (defined __PROF_UIS_BUILTIN_MULTIMON_STUB)
- #define COMPILE_MULTIMON_STUBS
- #endif // __PROF_UIS_BUILTIN_MULTIMON_STUB
- // disable warning 4706
- #pragma warning( push )
- #pragma warning ( disable : 4706 )
- #include <multimon.h>
- // rollback warning 4706
- #pragma warning( pop )
- #if _MFC_VER < 0x700
- #include <../src/AfxImpl.h>
- #else
- #include <../src/mfc/AfxImpl.h>
- #endif
- #if (!defined __EXT_PAINT_MANAGER_H)
- #include <ExtPaintManager.h>
- #endif
- #if (!defined __ExtCmdManager_H)
- #include <ExtCmdManager.h>
- #endif
- #if (!defined __EXT_MEMORY_DC_H)
- #include <../Src/ExtMemoryDC.h>
- #endif
- #if (!defined __EXT_POPUP_MENU_WND_H)
- #include <ExtPopupMenuWnd.h>
- #endif
- #if (!defined __EXT_MENUCONTROLBAR_H)
- #include <ExtMenuControlBar.h>
- #endif
- #if (!defined __EXTDOCKBAR_H)
- #include <../Src/ExtDockBar.h>
- #endif
- #if (!defined __EXT_STATUSCONTROLBAR_H)
- #include <ExtStatusControlBar.h>
- #endif
- #if (!defined __EXT_MFC_NO_TAB_CONTROLBARS)
- #if (!defined __EXT_CONTROLBAR_TABBED_FEATURES_H)
- #include "ExtControlBarTabbedFeatures.h"
- #endif // __EXT_CONTROLBAR_TABBED_FEATURES_H
- #endif
- #if( !defined __EXTMINIDOCKFRAMEWND_H)
- #include "ExtMiniDockFrameWnd.h"
- #endif
- #if (!defined __EXT_MFC_NO_SHORTCUTLIST_CTRL)
- #if (!defined __EXTSHORTCUTLISTWND_H)
- #include <ExtShortcutListWnd.h>
- #endif
- #endif // (!defined __EXT_MFC_NO_SHORTCUTLIST_CTRL)
- #if (!defined __EXT_BUTTON_H)
- #include <ExtButton.h>
- #endif
- #if (!defined __EXT_GROUPBOX_H)
- #include <ExtGroupBox.h>
- #endif
- #if (!defined __PROF_UIS_RES_2007_H)
- #include <Resources/Res2007/Res2007.h>
- #endif
- #if (!defined __PROF_UIS_RES_2010_OFFICE_H)
- #include <Resources/Res2010office/Res2010office.h>
- #endif
- #if (!defined __EXT_SCROLLWND_H)
- #include <ExtScrollWnd.h>
- #endif
- #if (!defined __EXT_MFC_NO_REPORTGRIDWND)
- #if (!defined __EXT_REPORT_GRID_WND_H)
- #include <ExtReportGridWnd.h>
- #endif
- #endif
- #if (!defined __EXT_MFC_NO_DATE_PICKER)
- #if (!defined __EXT_DATE_PICKER_H)
- #include <ExtDatePicker.h>
- #endif
- #endif
- #if (!defined __EXT_MFC_NO_TOOLBOX_CTRL)
- #if (!defined __EXTTOOLBOXWND_H)
- #include <ExtToolBoxWnd.h>
- #endif
- #endif
- #if (!defined __EXT_MFC_NO_RIBBON_BAR)
- #if (!defined __EXT_RIBBON_BAR_H)
- #include <ExtRibbonBar.h>
- #endif // (!defined __EXT_RIBBON_BAR_H)
- #endif
- #if (!defined __EXT_MFC_NO_BUILTIN_TEXTFIELD)
- #if (!defined __EXT_POPUP_CTRL_MENU_H)
- #include <ExtPopupCtrlMenu.h>
- #endif
- #endif
- #if (!defined __EXT_MFC_NO_GRIDWND)
- #if (!defined __EXT_GRIDWND_H)
- #include <ExtGridWnd.h>
- #endif
- #endif
- #if (!defined __EXT_TEMPL_H)
- #include <ExtTempl.h>
- #endif
- #if (!defined __EXT_SPIN_H)
- #include <ExtSpinWnd.h>
- #endif
- #if (!defined __EXT_MFC_NO_CUSTOMIZE)
- #if (!defined __EXTCUSTOMIZE_H)
- #include <ExtCustomize.h>
- #endif
- #endif // (!defined __EXT_MFC_NO_CUSTOMIZE)
- #if (!defined __EXT_MFC_NO_DURATIONWND)
- #if (!defined __EXT_DURATIONWND_H)
- #include "ExtDurationWnd.h"
- #endif
- #endif
- #if (!defined __EXT_MFC_NO_PAGECONTAINER_CTRL)
- #if (!defined __EXT_PAGECONTAINERWND_H)
- #include <ExtPageContainerWnd.h>
- #endif
- #endif
- #if (!defined __EXT_RESIZABLE_DIALOG_H)
- #include <ExtResizableDialog.h>
- #endif
- #if (!defined __EXT_EDIT_H)
- #include <ExtEdit.h>
- #endif
- #if (!defined __EXT_COMBO_BOX_H)
- #include <ExtComboBox.h>
- #endif
- #if (! defined __VSSYM32_H__)
- #include <vssym32/vssym32.h>
- #endif // (! defined __VSSYM32_H__)
- #include <math.h>
- #include <shlwapi.h>
- #include <Resources/Resource.h>
- #if (! defined CLEARTYPE_QUALITY )
- #define CLEARTYPE_QUALITY 5
- #endif
- #ifdef _DEBUG
- #define new DEBUG_NEW
- #undef THIS_FILE
- static char THIS_FILE[] = __FILE__;
- #endif
- // VC+ 6.0 static builds specific: disable warnings 4305, 4309
- // warning C4305: 'initializing' : truncation from 'int' to 'short'
- // warning C4309: 'initializing' : truncation of constant value
- #if _MFC_VER < 0x700
- #ifdef __EXT_PROFUIS_STATIC_LINK
- #pragma warning( push )
- #pragma warning ( disable : 4305 )
- #pragma warning ( disable : 4309 )
- #endif
- #endif
- IMPLEMENT_SERIAL( CExtPaintManager, CObject, VERSIONABLE_SCHEMA|1 );
- IMPLEMENT_SERIAL( CExtPaintManagerXP, CExtPaintManager, VERSIONABLE_SCHEMA|1 );
- IMPLEMENT_SERIAL( CExtPaintManagerOffice2003, CExtPaintManagerXP, VERSIONABLE_SCHEMA|1 );
- IMPLEMENT_SERIAL( CExtPaintManagerOffice2003NoThemes, CExtPaintManagerOffice2003, VERSIONABLE_SCHEMA|1 );
- IMPLEMENT_SERIAL( CExtPaintManagerStudio2005, CExtPaintManagerOffice2003, VERSIONABLE_SCHEMA|1 );
- IMPLEMENT_SERIAL( CExtPaintManagerStudio2008, CExtPaintManagerStudio2005, VERSIONABLE_SCHEMA|1 );
- IMPLEMENT_SERIAL( CExtPaintManagerNativeXP, CExtPaintManager, VERSIONABLE_SCHEMA|1 );
- IMPLEMENT_DYNAMIC( CExtPaintManagerOffice2007_Impl, CExtPaintManagerOffice2003 )
- IMPLEMENT_SERIAL( CExtPaintManagerOffice2007_R1, CExtPaintManagerOffice2007_Impl, VERSIONABLE_SCHEMA|1 );
- IMPLEMENT_SERIAL( CExtPaintManagerOffice2007_R2_LunaBlue, CExtPaintManagerOffice2007_Impl, VERSIONABLE_SCHEMA|1 );
- IMPLEMENT_SERIAL( CExtPaintManagerOffice2007_R2_Obsidian, CExtPaintManagerOffice2007_Impl, VERSIONABLE_SCHEMA|1 );
- IMPLEMENT_SERIAL( CExtPaintManagerOffice2007_R2_Silver, CExtPaintManagerOffice2007_Impl, VERSIONABLE_SCHEMA|1 );
- IMPLEMENT_SERIAL( CExtPaintManagerOffice2007_R3_LunaBlue, CExtPaintManagerOffice2007_R2_LunaBlue, VERSIONABLE_SCHEMA|1 );
- IMPLEMENT_SERIAL( CExtPaintManagerOffice2007_R3_Obsidian, CExtPaintManagerOffice2007_R2_Obsidian, VERSIONABLE_SCHEMA|1 );
- IMPLEMENT_SERIAL( CExtPaintManagerOffice2007_R3_Silver, CExtPaintManagerOffice2007_R2_Silver, VERSIONABLE_SCHEMA|1 );
- IMPLEMENT_SERIAL( CExtPaintManagerOffice2007_Blue, CExtPaintManagerOffice2007_R3_LunaBlue, VERSIONABLE_SCHEMA|1 );
- IMPLEMENT_SERIAL( CExtPaintManagerOffice2007_Black, CExtPaintManagerOffice2007_R3_Obsidian, VERSIONABLE_SCHEMA|1 );
- IMPLEMENT_SERIAL( CExtPaintManagerOffice2007_Silver, CExtPaintManagerOffice2007_R3_Silver, VERSIONABLE_SCHEMA|1 );
- IMPLEMENT_DYNAMIC( CExtPaintManagerOffice2010_Impl, CExtPaintManagerOffice2007_Impl )
- IMPLEMENT_SERIAL( CExtPaintManagerOffice2010_R1, CExtPaintManagerOffice2010_Impl, VERSIONABLE_SCHEMA|1 );
- IMPLEMENT_SERIAL( CExtPaintManagerOffice2010_R2_Blue, CExtPaintManagerOffice2010_Impl, VERSIONABLE_SCHEMA|1 );
- IMPLEMENT_SERIAL( CExtPaintManagerOffice2010_R2_Silver, CExtPaintManagerOffice2010_Impl, VERSIONABLE_SCHEMA|1 );
- IMPLEMENT_SERIAL( CExtPaintManagerOffice2010_R2_Black, CExtPaintManagerOffice2010_Impl, VERSIONABLE_SCHEMA|1 );
- CExtPaintManager::CExtPaintManagerAutoPtr g_PaintManager;
- // CExtSWMR::CExtSWMR(
- // __EXT_MFC_SAFE_LPCTSTR strName // = NULL
- // )
- // : m_bConstructed( false )
- // , m_hProtectWriter( NULL )
- // , m_hProtectReaders( NULL )
- // , m_hEnumReaders( NULL )
- // {
- // Create( strName );
- // }
- //
- // CExtSWMR::~CExtSWMR()
- // {
- // Destroy();
- // }
- //
- // LPCTSTR CExtSWMR::stat_GenerateObjectName(
- // __EXT_MFC_SAFE_LPCTSTR strPrefix,
- // __EXT_MFC_SAFE_LPCTSTR strSuffix,
- // __EXT_MFC_SAFE_LPTSTR strOutNameBuffer,
- // size_t nBufferSize,
- // bool & bConstructed
- // )
- // {
- // bConstructed = true;
- // if( strSuffix == NULL )
- // return NULL;
- // if( strPrefix == NULL )
- // strPrefix = _T("");
- // size_t nLenPrefix = size_t( _tcslen( strPrefix ) );
- // size_t nLenSuffix = size_t( _tcslen( strSuffix ) );
- // if( ( nLenPrefix + nLenSuffix ) >= nBufferSize )
- // {
- // bConstructed = false;
- // return NULL;
- // }
- // __EXT_MFC_STRCPY( strOutNameBuffer, nBufferSize, strPrefix );
- // __EXT_MFC_STRCAT( strOutNameBuffer, nBufferSize, strSuffix );
- // return strOutNameBuffer;
- // }
- //
- // bool CExtSWMR::Create(
- // __EXT_MFC_SAFE_LPCTSTR strName // = NULL
- // )
- // {
- // Destroy();
- // TCHAR strObjectNameBuffer[ 512 ];
- // LPCTSTR strObjectName =
- // stat_GenerateObjectName(
- // _T("~CExtSWMR~ProtectWriter~"),
- // strName,
- // strObjectNameBuffer,
- // sizeof(strObjectNameBuffer)/sizeof(strObjectNameBuffer[0]),
- // m_bConstructed
- // );
- // if( m_bConstructed )
- // m_hProtectWriter =
- // ::CreateMutex(
- // NULL,
- // FALSE,
- // strObjectName
- // );
- // strObjectName =
- // stat_GenerateObjectName(
- // _T("~CExtSWMR~EventsNoReaders~"),
- // strName,
- // strObjectNameBuffer,
- // sizeof(strObjectNameBuffer)/sizeof(strObjectNameBuffer[0]),
- // m_bConstructed
- // );
- // if( m_bConstructed )
- // m_hProtectReaders =
- // ::CreateEvent(
- // NULL,
- // TRUE,
- // TRUE,
- // strObjectName
- // );
- // strObjectName =
- // stat_GenerateObjectName(
- // _T("~CExtSWMR~EnumReaders~"),
- // strName,
- // strObjectNameBuffer,
- // sizeof(strObjectNameBuffer)/sizeof(strObjectNameBuffer[0]),
- // m_bConstructed
- // );
- // if( m_bConstructed )
- // m_hEnumReaders =
- // ::CreateSemaphore(
- // NULL,
- // 0,
- // 0x7FFFFFFF,
- // strObjectName
- // );
- // if( m_hEnumReaders == NULL
- // || m_hProtectReaders == NULL
- // || m_hProtectWriter == NULL
- // )
- // {
- // Destroy();
- // m_bConstructed = false;
- // }
- // else
- // m_bConstructed = true;
- // return m_bConstructed;
- // }
- //
- // void CExtSWMR::Destroy()
- // {
- // if( m_hEnumReaders != NULL )
- // {
- // ::CloseHandle( m_hEnumReaders );
- // m_hEnumReaders = NULL;
- // }
- // if( m_hProtectReaders != NULL )
- // {
- // ::CloseHandle( m_hProtectReaders );
- // m_hProtectReaders = NULL;
- // }
- // if( m_hProtectWriter != NULL )
- // {
- // ::CloseHandle( m_hProtectWriter );
- // m_hProtectWriter = NULL;
- // }
- // m_bConstructed = false;
- // }
- //
- // bool CExtSWMR::IsConstructed() const
- // {
- // return m_bConstructed;
- // }
- //
- // CExtSWMR::LockSection::LockSection(
- // CExtSWMR & _SWMR,
- // bool bRead,
- // DWORD dwTimeout // = INFINITE
- // )
- // : m_SWMR( _SWMR )
- // , m_bRead( bRead )
- // , m_bLocked( false )
- // {
- // if( ! m_SWMR.IsConstructed() )
- // return;
- // DWORD dwWaitResult = WAIT_ABANDONED;
- // if( m_bRead )
- // dwWaitResult = m_SWMR.WaitToRead( dwTimeout );
- // else
- // dwWaitResult = m_SWMR.WaitToWrite( dwTimeout );
- // m_bLocked = ( dwWaitResult == WAIT_ABANDONED || dwWaitResult == WAIT_TIMEOUT ) ? false : true;
- // }
- //
- // CExtSWMR::LockSection::~LockSection()
- // {
- // if( ! m_bLocked )
- // return;
- // if( m_bRead )
- // m_SWMR.DoneReading();
- // else
- // m_SWMR.DoneWriting();
- // }
- //
- // bool CExtSWMR::LockSection::IsLocked() const
- // {
- // return m_bLocked;
- // }
- //
- // DWORD CExtSWMR::WaitToWrite(
- // DWORD dwTimeout // = INFINITE
- // )
- // {
- // HANDLE arrToWait[2];
- // arrToWait[0] = m_hProtectWriter;
- // arrToWait[1] = m_hProtectReaders;
- // DWORD dwWaitResult =
- // ::WaitForMultipleObjects(
- // 2,
- // arrToWait,
- // TRUE,
- // dwTimeout
- // );
- // return dwWaitResult;
- // }
- //
- // void CExtSWMR::DoneWriting()
- // {
- // ::ReleaseMutex( m_hProtectWriter );
- // }
- //
- // DWORD CExtSWMR::WaitToRead(
- // DWORD dwTimeout // = INFINITE
- // )
- // {
- // DWORD dwWaitResult =
- // ::WaitForSingleObject(
- // m_hProtectWriter,
- // dwTimeout
- // );
- // if( dwWaitResult != WAIT_TIMEOUT )
- // {
- // LONG nPrev = 0;
- // ::ReleaseSemaphore(
- // m_hEnumReaders,
- // 1,
- // &nPrev
- // );
- // if( nPrev == 0)
- // ::ResetEvent( m_hProtectReaders );
- // } // if( dwWaitResult != WAIT_TIMEOUT )
- // ::ReleaseMutex( m_hProtectWriter );
- // return dwWaitResult;
- // }
- //
- // void CExtSWMR::DoneReading()
- // {
- // HANDLE arrToWait[2];
- // arrToWait[0] = m_hProtectWriter;
- // arrToWait[1] = m_hEnumReaders;
- // ::WaitForMultipleObjects(
- // 2,
- // arrToWait,
- // TRUE,
- // INFINITE
- // );
- // DWORD dwWaitResult =
- // ::WaitForSingleObject(
- // m_hEnumReaders,
- // 0
- // );
- // bool bLast = ( dwWaitResult == WAIT_TIMEOUT ) ? true : false;
- // if( bLast )
- // ::SetEvent( m_hProtectReaders );
- // else
- // ::ReleaseSemaphore(
- // m_hEnumReaders,
- // 1,
- // NULL
- // );
- // ::ReleaseMutex( m_hProtectWriter );
- // }
- CExtPmSynchronizeSink::CExtPmSynchronizeSink()
- : m_bPmSynchronizeSinkIsSynchronizing( false )
- , m_dwPmSynchronizeSinkThreadID( ::GetCurrentThreadId() )
- {
- }
- CExtPmSynchronizeSink::~CExtPmSynchronizeSink()
- {
- }
- DWORD CExtPmSynchronizeSink::PmSynchronizeSink_GetThreadID()
- {
- return m_dwPmSynchronizeSinkThreadID;
- }
- bool CExtPmSynchronizeSink::PmSynchronizeSink_IsSynchronizing()
- {
- return m_bPmSynchronizeSinkIsSynchronizing;
- }
- bool CExtPmSynchronizeSink::PmSynchronizeSink_IsEqual(
- CExtPmSynchronizeSink * pOther
- )
- {
- if( this == pOther )
- return true;
- return false;
- }
- INT CExtPmSynchronizeSink::GetIndexOfPmSynchronizeSink(
- CExtPmSynchronizeSink * pPmSynchronizeSink
- )
- {
- __PROF_UIS_MANAGE_STATE;
- if( pPmSynchronizeSink == NULL )
- return -1;
- INT nIndex, nCount = INT( m_arrPmSynchronizeSink.GetSize() );
- for( nIndex = 0; nIndex < nCount; nIndex ++ )
- {
- CExtPmSynchronizeSink * pRegistered = m_arrPmSynchronizeSink[ nIndex ];
- ASSERT( pRegistered != NULL );
- if( pRegistered->PmSynchronizeSink_IsEqual( pPmSynchronizeSink ) )
- return nIndex;
- } // for( nIndex = 0; nIndex < nCount; nIndex ++ )
- return -1;
- }
- bool CExtPaintManager::CExtPaintManagerAutoPtr::PmSynchronizeSink_PerformSynchronizationWith(
- CExtPmSynchronizeSink * pPmSynchronizeSink,
- bool bRegister, // = true
- bool bSynchronizeItNow // = true
- )
- {
- __PROF_UIS_MANAGE_STATE;
- if( bRegister )
- {
- if( pPmSynchronizeSink == NULL )
- return false;
- if( pPmSynchronizeSink->PmSynchronizeSink_IsEqual( this ) )
- return false;
- DWORD dwOwnThreadID = PmSynchronizeSink_GetThreadID();
- DWORD dwOtherThreadID = PmSynchronizeSink_GetThreadID();
- if( dwOwnThreadID != dwOtherThreadID )
- return false;
- INT nIndex = GetIndexOfPmSynchronizeSink( pPmSynchronizeSink );
- if( nIndex < 0 )
- m_arrPmSynchronizeSink.Add( pPmSynchronizeSink );
- if( bSynchronizeItNow )
- {
- LPSTREAM pStream = PmSynchronizeSink_GetData();
- if( pStream != NULL )
- {
- pPmSynchronizeSink ->
- PmSynchronizeSink_SynchronizeFrom(
- pStream
- );
- pStream->Release();
- } // if( pStream != NULL )
- } // if( bSynchronizeItNow )
- return true;
- } // if( bRegister )
- else
- {
- if( pPmSynchronizeSink == NULL )
- {
- m_arrPmSynchronizeSink.RemoveAll();
- return true;
- }
- INT nIndex = GetIndexOfPmSynchronizeSink( pPmSynchronizeSink );
- if( nIndex < 0 )
- return false;
- m_arrPmSynchronizeSink.RemoveAt( nIndex );
- return true;
- } // else from if( bRegister )
- }
- LPSTREAM CExtPaintManager::CExtPaintManagerAutoPtr::PmSynchronizeSink_GetData(
- HGLOBAL hGlobal // = NULL
- )
- {
- __PROF_UIS_MANAGE_STATE;
- CExtPaintManager * pPM = GetPM();
- if( pPM == NULL )
- return NULL;
- LPSTREAM pStream = NULL;
- SCODE sc =
- ::CreateStreamOnHGlobal(
- hGlobal,
- ( hGlobal != NULL ) ? FALSE : TRUE,
- &pStream
- );
- if( sc != S_OK )
- {
- ASSERT( FALSE );
- return NULL;
- }
- ASSERT( pStream != NULL );
- COleStreamFile _file;
- try
- {
- _file.Attach( pStream );
- CArchive ar( &_file, CArchive::store|CArchive::bNoFlushOnDelete );
- CRuntimeClass * pRTC = pPM->GetRuntimeClass();
- ASSERT( pRTC != NULL );
- ar.WriteClass( pRTC );
- pPM->SerializeSynchronizationData( ar );
- ar.Flush();
- ULARGE_INTEGER liNewPosition;
- LARGE_INTEGER liOff;
- LISet32( liOff, 0 );
- sc = pStream->Seek( liOff, STREAM_SEEK_SET, &liNewPosition );
- if( sc != S_OK )
- {
- ASSERT( FALSE );
- ::AfxThrowUserException();
- }
- return pStream;
- } // try
- catch( CException * pException )
- {
- pException->Delete();
- } // catch( CException * pException )
- catch( ... )
- {
- } // catch( ... )
- _file.Detach();
- pStream->Release();
- return NULL;
- }
- void CExtPaintManager::CExtPaintManagerAutoPtr::PmSynchronizeSink_SynchronizeFrom(
- LPSTREAM pStream
- )
- {
- __PROF_UIS_MANAGE_STATE;
- if( pStream == NULL )
- return;
- if( PmSynchronizeSink_IsSynchronizing() )
- return;
- m_bPmSynchronizeSinkIsSynchronizing = true;
- COleStreamFile _file;
- _file.Attach( pStream );
- try
- {
- CArchive ar( &_file, CArchive::load|CArchive::bNoFlushOnDelete, 0 );
- CRuntimeClass * pRTC = ar.ReadClass();
- ASSERT( pRTC != NULL );
- CObject * pObj = pRTC->CreateObject();
- if( pObj != NULL )
- {
- ASSERT_VALID( pObj );
- CExtPaintManager * pPaintManager =
- DYNAMIC_DOWNCAST( CExtPaintManager, pObj );
- if( pPaintManager == NULL )
- {
- ASSERT( FALSE );
- delete pObj;
- } // if( pPaintManager == NULL )
- else
- {
- pPaintManager->SerializeSynchronizationData( ar );
- InstallPaintManager( pPaintManager );
- PmSynchronizeSink_SynchronizeOthers();
- } // else from if( pPaintManager == NULL )
- } // if( pObj != NULL )
- } // try
- catch( CException * pException )
- {
- pException->Delete();
- } // catch( CException * pException )
- catch( ... )
- {
- } // catch( ... )
- _file.Detach();
- m_bPmSynchronizeSinkIsSynchronizing = false;
- }
- void CExtPmSynchronizeSink::PmSynchronizeSink_SynchronizeOthers(
- HGLOBAL hGlobal // = NULL
- )
- {
- __PROF_UIS_MANAGE_STATE;
- LPSTREAM pStream = PmSynchronizeSink_GetData( hGlobal );
- if( pStream == NULL )
- return;
- ULARGE_INTEGER liNewPosition;
- LARGE_INTEGER liOff;
- INT nIndex, nCount = INT( m_arrPmSynchronizeSink.GetSize() );
- for( nIndex = 0; nIndex < nCount; nIndex ++ )
- {
- CExtPmSynchronizeSink * pRegistered = m_arrPmSynchronizeSink[ nIndex ];
- ASSERT( pRegistered != NULL );
- pRegistered->PmSynchronizeSink_SynchronizeFrom( pStream );
- LISet32( liOff, 0 );
- SCODE sc = pStream->Seek( liOff, STREAM_SEEK_SET, &liNewPosition );
- if( sc != S_OK )
- {
- ASSERT( FALSE );
- break;
- }
- } // for( nIndex = 0; nIndex < nCount; nIndex ++ )
- pStream->Release();
- }
- CExtPaintManager::CExtPaintManagerAutoPtr::CExtPaintManagerAutoPtr()
- : m_pPaintManager( NULL )
- , m_bHaveScrollLines( false )
- , m_uCachedScrollLines( 0 )
- , m_bUxValidColorsExtracted( false )
- , m_eCurrentTheme( ThemeUnknown )
- , m_strOsVer( _T("Unknown") )
- , m_bIsWin32s( false )
- , m_bIsWin9x( false )
- , m_bIsWin95( false )
- , m_bIsWin98( false )
- , m_bIsWin98orLater( false )
- , m_bIsWinNT( false )
- , m_bIsWinNT4( false )
- , m_bIsWin2000( false )
- , m_bIsWinXP( false )
- , m_bIsWinNT4orLater( false )
- , m_bIsWin2000orLater( false )
- , m_bIsWinXPorLater( false )
- , m_bIsWinVista( false )
- , m_bIsWinVistaOrLater( false )
- , m_bIsWin7( false )
- , m_bIsWin7OrLater( false )
- , m_hDllMsImg( NULL )
- , m_hDllUser32( NULL )
- , m_pfnMsImgGradientFill( NULL )
- , m_pfnMsImgAlphaBlend( NULL )
- , m_pfnMsImgTransparentBlt( NULL )
- , m_pfnAnimateWindow( NULL )
- , m_pfnSetLayeredWindowAttributes( NULL )
- , m_pfnUpdateLayeredWindow( NULL )
- , m_pfnPrintWindow( NULL )
- , m_nLPX( 96 )
- , m_nLPY( 96 )
- , m_nLPZ( ( m_nLPX + m_nLPY ) / 2 )
- , m_bEnableUiScalingX( true )
- , m_bEnableUiScalingY( true )
- , m_bEnableUiScalingZ( true )
- , m_bLayeredHighlighting2005( false )
- , m_bAllowWndUpdateSourceDetection( true )
- , m_bAutoSkinScrollBars( true )
- , m_nInsallPaintManagerCounter( 0 )
- , m_nMsgPaintManagerChanged( ::RegisterWindowMessage( _T("CExtPaintManager::CExtPaintManagerAutoPtr::m_nMsgPaintManagerChanged") ) )
- {
- #ifdef WM_THEMECHANGED
- ASSERT( __ExtMfc_WM_THEMECHANGED == WM_THEMECHANGED );
- #endif // WM_THEMECHANGED
-
- memset((char *)&m_osVerData,0,sizeof(OSVERSIONINFO));
- m_osVerData.dwOSVersionInfoSize = sizeof(OSVERSIONINFO);
- CExtSafeString sTmp( _T("") );
- VERIFY( ::GetVersionEx(&m_osVerData) );
- switch(m_osVerData.dwPlatformId)
- {
- case VER_PLATFORM_WIN32s:
- m_bIsWin32s = true;
- sTmp = _T("Win32s");
- break;
- case VER_PLATFORM_WIN32_WINDOWS:
- {
- m_bIsWin9x = true;
- m_bIsWin95 =
- ( ( m_osVerData.dwMajorVersion == 4 )
- && ( m_osVerData.dwMinorVersion == 0 )
- );
- m_bIsWin98orLater =
- ( ( m_osVerData.dwMajorVersion > 4 )
- || ( ( m_osVerData.dwMajorVersion == 4 )
- && ( m_osVerData.dwMinorVersion > 0 )
- )
- );
- sTmp = _T("Windows ");
- if( m_bIsWin98orLater )
- {
- if( ( m_osVerData.dwMajorVersion == 4 )
- && ( m_osVerData.dwMinorVersion > 0 )
- )
- {
- m_bIsWin98 = true;
- sTmp += _T("98");
- }
- else
- sTmp += _T("98 or later");
- }
- else
- {
- sTmp += _T("95");
- }
- }
- break;
- case VER_PLATFORM_WIN32_NT:
- m_bIsWinNT = true;
- if( m_osVerData.dwMajorVersion == 6 )
- {
- if( m_osVerData.dwMinorVersion == 0 )
- {
- m_bIsWinVista = true;
- sTmp = _T("Windows Vista");
- }
- else
- {
- m_bIsWin7 = true;
- sTmp = _T("Windows 7");
- }
- }
- else if( m_osVerData.dwMajorVersion == 5 )
- {
- if( m_osVerData.dwMinorVersion == 0 )
- {
- m_bIsWin2000 = true;
- sTmp = _T("Windows 2000");
- }
- else if( m_osVerData.dwMinorVersion == 1 )
- {
- m_bIsWinXP = true;
- sTmp = _T("Windows XP");
- }
- }
- else if( m_osVerData.dwMajorVersion == 4 )
- {
- m_bIsWinNT4 = true;
- sTmp = _T("Windows NT");
- }
- else
- sTmp = _T("Windows NT");
-
- if( m_osVerData.dwMajorVersion >= 4 )
- m_bIsWinNT4orLater = true;
- if( m_osVerData.dwMajorVersion >= 5 )
- {
- m_bIsWin2000orLater = true;
- if( ! ( m_osVerData.dwMajorVersion == 5
- && m_osVerData.dwMinorVersion == 0
- )
- )
- m_bIsWinXPorLater = true;
- if( m_osVerData.dwMajorVersion >= 6 )
- {
- m_bIsWinVistaOrLater = true;
- if( m_osVerData.dwMinorVersion >= 1 )
- m_bIsWin7OrLater = true;
- }
- }
- break;
- } // switch(m_osVerData.dwPlatformId)
- if( ! m_bIsWin2000orLater )
- m_bAutoSkinScrollBars = false;
- m_strOsVer.Format(
- _T("%s v.%lu.%lu (build %lu) %s"),
- sTmp,
- m_osVerData.dwMajorVersion,
- m_osVerData.dwMinorVersion,
- m_osVerData.dwBuildNumber,
- m_osVerData.szCSDVersion
- );
-
- // init uxtheme.dll data
- InitUserExApi();
- // init msimg32.dll data
- if( m_bIsWin2000orLater )
- {
- m_hDllMsImg = ::LoadLibrary(_T("msimg32.dll"));
- if( m_hDllMsImg != NULL )
- {
- m_pfnMsImgGradientFill = (PFNGRADIENTFILL)
- ::GetProcAddress(
- m_hDllMsImg,
- "GradientFill"
- );
- m_pfnMsImgAlphaBlend = (PFNALPHABLEND)
- ::GetProcAddress(
- m_hDllMsImg,
- "AlphaBlend"
- );
- m_pfnMsImgAlphaDIBBlend = (PFNALPHADIBBLEND)
- ::GetProcAddress(
- m_hDllMsImg,
- "AlphaDIBBlend"
- );
- m_pfnMsImgTransparentBlt = (PFNTRANSPARENTBLT)
- ::GetProcAddress(
- m_hDllMsImg,
- "TransparentBlt"
- );
- m_pfnMsImgTransparentDIBits = (PFNTRANSPARENTDIBITS)
- ::GetProcAddress(
- m_hDllMsImg,
- "TransparentDIBits"
- );
- }
- } // if( m_bIsWin2000orLater )
- // init user32.dll data
- m_hDllUser32 = ::LoadLibrary(_T("user32.dll"));
- if( m_hDllUser32 != NULL )
- {
- m_pfnAnimateWindow = (PFNANIMATEWINDOW)
- ::GetProcAddress(
- m_hDllUser32,
- "AnimateWindow"
- );
- m_pfnSetLayeredWindowAttributes = (PFNSETLAYEREDWINDOWATTRIBUTES)
- ::GetProcAddress(
- m_hDllUser32,
- "SetLayeredWindowAttributes"
- );
- m_pfnUpdateLayeredWindow = (PFNUPDATELAYEREDWINDOW)
- ::GetProcAddress(
- m_hDllUser32,
- "UpdateLayeredWindow"
- );
- m_pfnPrintWindow = (PFNPRINTWINDOW)
- ::GetProcAddress(
- m_hDllUser32,
- "PrintWindow"
- );
- BOOL ( WINAPI * pfnSetProcessDPIAware )( VOID ) =
- ( BOOL ( WINAPI * )( VOID ) )
- ::GetProcAddress(
- m_hDllUser32,
- "SetProcessDPIAware"
- );
- if( pfnSetProcessDPIAware != NULL )
- pfnSetProcessDPIAware();
- // VOID ( WINAPI * pfnDisableProcessWindowsGhosting )( VOID ) =
- // ( VOID ( WINAPI * )( VOID ) )
- // ::GetProcAddress(
- // m_hDllUser32,
- // "DisableProcessWindowsGhosting"
- // );
- // if( pfnDisableProcessWindowsGhosting != NULL )
- // pfnDisableProcessWindowsGhosting();
- } // if( m_hDllUser32 != NULL )
- // VERIFY(
- // InitPaintManagerInstance()
- // );
- CWindowDC dcDesktop( NULL );
- m_nLPX = ::GetDeviceCaps( dcDesktop.m_hDC, LOGPIXELSX );
- m_nLPY = ::GetDeviceCaps( dcDesktop.m_hDC, LOGPIXELSY );
- m_nLPZ = ( m_nLPX + m_nLPY ) / 2;
- if( m_bIsWin2000orLater
- && CExtPaintManager::stat_GetBPP() >= 15
- && m_pfnUpdateLayeredWindow != NULL
- )
- m_bLayeredHighlighting2005 = true;
- }
- void CExtPaintManager::CExtPaintManagerAutoPtr::InitUserExApi()
- {
- m_bUxValidColorsExtracted = false;
- m_eCurrentTheme = ThemeUnknown;
- if( m_UxTheme.IsAppThemed() )
- {
- // theme name
- WCHAR pszThemeName[MAX_PATH] = L"";
- WCHAR pszColor[MAX_PATH] = L"";
- if( m_UxTheme.GetCurrentThemeName(
- pszThemeName,
- MAX_PATH,
- pszColor,
- MAX_PATH,
- NULL,
- 0
- ) == S_OK
- )
- {
- if( wcsstr( __EXT_MFC_WCSLWR( pszThemeName, wcslen( pszThemeName ) + 1 ), L"luna.msstyles") != 0 )
- {
- if( wcscmp( __EXT_MFC_WCSLWR( pszColor, wcslen( pszColor ) + 1 ), L"normalcolor") == 0 )
- m_eCurrentTheme = ThemeLunaBlue;
- else if( wcscmp( __EXT_MFC_WCSLWR( pszColor, wcslen( pszColor ) + 1 ), L"homestead") == 0 )
- m_eCurrentTheme = ThemeLunaOlive;
- else if( wcscmp( __EXT_MFC_WCSLWR( pszColor, wcslen( pszColor ) + 1 ), L"metallic") == 0 )
- m_eCurrentTheme = ThemeLunaSilver;
- }
- else if( wcsstr( __EXT_MFC_WCSLWR( pszThemeName, wcslen( pszThemeName ) + 1 ), L"royale.msstyles") != 0 )
- {
- if( wcscmp( __EXT_MFC_WCSLWR( pszColor, wcslen( pszColor ) + 1 ), L"normalcolor") == 0 )
- m_eCurrentTheme = ThemeLunaRoyale;
- }
- }
-
- HWND hWndDesktop = ::GetDesktopWindow();
- ASSERT( hWndDesktop != NULL );
- if( m_UxTheme.OpenThemeData( hWndDesktop, L"TASKBAND" ) != NULL )
- {
- if( m_UxTheme.GetThemeColor(TDP_FLASHBUTTON,0,TMT_EDGELIGHTCOLOR,&m_clrUxTaskBandEdgeLightColor) == S_OK
- && m_UxTheme.GetThemeColor(TDP_FLASHBUTTON,0,TMT_EDGEHIGHLIGHTCOLOR,&m_clrUxTaskBandEdgeHighLightColor) == S_OK
- && m_UxTheme.GetThemeColor(TDP_FLASHBUTTON,0,TMT_EDGESHADOWCOLOR,&m_clrUxTaskBandEdgeShadowColor) == S_OK
- && m_UxTheme.GetThemeColor(TDP_FLASHBUTTON,0,TMT_EDGEDKSHADOWCOLOR,&m_clrUxTaskBandEdgeDkShadowColor) == S_OK
- && m_UxTheme.GetThemeColor(TDP_FLASHBUTTON,0,TMT_EDGEFILLCOLOR,&m_clrUxTaskBandEdgeFillColor) == S_OK
- && m_UxTheme.GetThemeColor(TDP_FLASHBUTTON,0,TMT_FILLCOLORHINT,&m_clrUxTaskBandFillColorHint) == S_OK
- && m_UxTheme.GetThemeColor(TDP_FLASHBUTTON,0,TMT_ACCENTCOLORHINT,&m_clrUxTaskBandAccentColorHint) == S_OK
- )
- m_bUxValidColorsExtracted = true;
- m_UxTheme.CloseThemeData();
- }
- } // if( m_UxTheme.IsAppThemed() )
- }
- CExtPaintManager::CExtPaintManagerAutoPtr::~CExtPaintManagerAutoPtr()
- {
- UnadviseAll();
- if( m_hDllMsImg != NULL )
- ::FreeLibrary( m_hDllMsImg );
- if( m_hDllUser32 != NULL )
- ::FreeLibrary( m_hDllUser32 );
- if( m_pPaintManager != NULL )
- delete m_pPaintManager;
- m_pPaintManager = NULL;
- }
- void CExtPaintManager::CExtPaintManagerAutoPtr::Advise(
- CExtPmBridge * pPmBridge,
- bool bAddTail // = true
- )
- {
- ASSERT( pPmBridge != NULL );
- if( bAddTail )
- m_listBridges.AddTail( pPmBridge );
- else
- m_listBridges.AddHead( pPmBridge );
- }
- void CExtPaintManager::CExtPaintManagerAutoPtr::Unadvise( CExtPmBridge * pPmBridge )
- {
- ASSERT( pPmBridge != NULL );
- POSITION pos = m_listBridges.Find( pPmBridge );
- if( pos != NULL )
- m_listBridges.RemoveAt( pos );
- }
- void CExtPaintManager::CExtPaintManagerAutoPtr::UnadviseAll()
- {
- m_listBridges.RemoveAll();
- }
- bool CExtPaintManager::CExtPaintManagerAutoPtr::InitPaintManagerInstance()
- {
- if( m_pPaintManager != NULL )
- return true;
- return
- InstallPaintManager(
- (CExtPaintManager *)NULL
- );
- }
- CExtPaintManager * CExtPaintManager::CExtPaintManagerAutoPtr::GetPM()
- {
- InitPaintManagerInstance();
- ASSERT( m_pPaintManager != NULL );
- return m_pPaintManager;
- }
- CExtPaintManager *
- CExtPaintManager::CExtPaintManagerAutoPtr::
- operator -> ()
- {
- return GetPM();
- }
- bool CExtPaintManager::CExtPaintManagerAutoPtr::
- InstallPaintManager(
- CExtPaintManager * pPaintManager
- )
- {
- ASSERT( m_nInsallPaintManagerCounter >= 0 );
- if( m_nInsallPaintManagerCounter != 0 )
- return false;
- if( m_pPaintManager != NULL )
- {
- if( pPaintManager == m_pPaintManager )
- return true;
- if( m_pPaintManager != NULL )
- {
- delete m_pPaintManager;
- m_pPaintManager = NULL;
- }
- } // if( m_pPaintManager != NULL )
- if( pPaintManager != NULL )
- m_pPaintManager = pPaintManager;
- else
- {
- try
- {
- m_pPaintManager = new __DEFAULT_PAINT_MANAGER_CLASS;
- }
- catch( CException * pException )
- {
- pException->Delete();
- }
- catch( ... )
- {
- }
- if( m_pPaintManager == NULL )
- return false;
- }
- m_nInsallPaintManagerCounter ++;
- m_pPaintManager->SyncSysColors();
- m_pPaintManager->InitTranslatedColors();
- m_pPaintManager->InitHelperBrushes();
- g_CmdManager.OnGlobalPaintManagerChanged();
- POSITION pos = m_listBridges.GetHeadPosition();
- for( ; pos != NULL; )
- {
- CExtPmBridge * pPmBridge = m_listBridges.GetNext( pos );
- ASSERT( pPmBridge != NULL );
- pPmBridge->PmBridge_OnPaintManagerChanged(
- m_pPaintManager
- );
- } // for( ; pos != NULL; )
- PmSynchronizeSink_SynchronizeOthers();
- m_nInsallPaintManagerCounter --;
- return true;
- }
- bool CExtPaintManager::CExtPaintManagerAutoPtr::
- InstallPaintManager(
- CRuntimeClass * pRtcPaintManager
- )
- {
- if( pRtcPaintManager == NULL )
- return InitPaintManagerInstance();
- CObject* pObj = pRtcPaintManager->CreateObject();
- if( pObj == NULL )
- {
- ASSERT( FALSE );
- return false;
- }
- ASSERT_VALID( pObj );
- CExtPaintManager * pPaintManager =
- DYNAMIC_DOWNCAST( CExtPaintManager, pObj );
- if( pPaintManager == NULL )
- {
- delete pObj;
- ASSERT( FALSE );
- return false;
- }
- return InstallPaintManager( pPaintManager );
- }
- bool CExtPaintManager::CExtPaintManagerAutoPtr::PaintManagerStateLoad(
- __EXT_MFC_SAFE_LPCTSTR sSectionNameCompany, // under HKEY_CURRENT_USERSoftware
- __EXT_MFC_SAFE_LPCTSTR sSectionNameProduct, // under HKEY_CURRENT_USERSoftware%sSectionNameCompany%
- __EXT_MFC_SAFE_LPCTSTR sSectionNameProfile, // under HKEY_CURRENT_USERSoftware%sSectionNameCompany%%sSectionNameProfile%
- HKEY hKeyRoot, // = HKEY_CURRENT_USER
- bool bEnableThrowExceptions // = false
- )
- {
- ASSERT( sSectionNameCompany != NULL );
- ASSERT( sSectionNameProduct != NULL );
- ASSERT( sSectionNameProfile != NULL );
- bool bRetVal = false;
- try
- {
- CExtSafeString sRegKeyPath =
- CExtCmdManager::GetSubSystemRegKeyPath(
- __PROF_UIS_REG_PAINT_MANAGER,
- sSectionNameProfile,
- sSectionNameCompany,
- sSectionNameProduct
- );
- CMemFile _file;
- if( ! CExtCmdManager::FileObjFromRegistry(
- _file,
- LPCTSTR(sRegKeyPath),
- hKeyRoot,
- bEnableThrowExceptions
- )
- )
- {
- ASSERT( ! bEnableThrowExceptions );
- return false;
- }
- CArchive ar(
- &_file,
- CArchive::load
- );
- bRetVal =
- PaintManagerStateSerialize(
- ar,
- bEnableThrowExceptions
- );
- ar.Close();
- ASSERT( bRetVal || (! bEnableThrowExceptions ) );
- }
- catch( CException * pXept )
- {
- if( bEnableThrowExceptions )
- throw;
- pXept->Delete();
- }
- catch( ... )
- {
- if( bEnableThrowExceptions )
- throw;
- }
- return bRetVal;
- }
- bool CExtPaintManager::CExtPaintManagerAutoPtr::PaintManagerStateSave(
- __EXT_MFC_SAFE_LPCTSTR sSectionNameCompany, // under HKEY_CURRENT_USERSoftware
- __EXT_MFC_SAFE_LPCTSTR sSectionNameProduct, // under HKEY_CURRENT_USERSoftware%sSectionNameCompany%
- __EXT_MFC_SAFE_LPCTSTR sSectionNameProfile, // under HKEY_CURRENT_USERSoftware%sSectionNameCompany%%sSectionNameProfile%%sSectionNameProfile%
- HKEY hKeyRoot, // = HKEY_CURRENT_USER
- bool bEnableThrowExceptions // = false
- )
- {
- ASSERT( sSectionNameCompany != NULL );
- ASSERT( sSectionNameProduct != NULL );
- ASSERT( sSectionNameProfile != NULL );
- bool bRetVal = false;
- try
- {
- CExtSafeString sRegKeyPath =
- CExtCmdManager::GetSubSystemRegKeyPath(
- __PROF_UIS_REG_PAINT_MANAGER,
- sSectionNameProfile,
- sSectionNameCompany,
- sSectionNameProduct
- );
- CMemFile _file;
- CArchive ar(
- &_file,
- CArchive::store
- );
- bRetVal =
- PaintManagerStateSerialize(
- ar,
- bEnableThrowExceptions
- );
- ASSERT( bRetVal || (! bEnableThrowExceptions ) );
- if( ! bRetVal )
- return false;
- ar.Flush();
- ar.Close();
- bRetVal =
- CExtCmdManager::FileObjToRegistry(
- _file,
- sRegKeyPath,
- hKeyRoot,
- bEnableThrowExceptions
- );
- ASSERT( bRetVal || (! bEnableThrowExceptions ) );
- }
- catch( CException * pXept )
- {
- if( bEnableThrowExceptions )
- throw;
- pXept->Delete();
- }
- catch( ... )
- {
- if( bEnableThrowExceptions )
- throw;
- }
- return bRetVal;
- }
- bool CExtPaintManager::CExtPaintManagerAutoPtr::PaintManagerStateSerialize(
- CArchive & ar,
- bool bEnableThrowExceptions // = false
- )
- {
- try
- {
- DWORD dwGeneralFlags = 0;
- DWORD dwReserved = 0L;
- if( ar.IsStoring() )
- {
- ar << dwGeneralFlags;
- ar << dwReserved;
- ar << dwReserved;
- ar << dwReserved;
- ar << dwReserved;
- CExtPaintManager * pPM = g_PaintManager.GetPM();
- CRuntimeClass * pRTC = pPM->GetRuntimeClass();
- ASSERT( pRTC != NULL );
- ar.WriteClass( pRTC );
- pPM->OnStateSerialize(
- ar,
- bEnableThrowExceptions
- );
- } // if( ar.IsStoring() )
- else
- {
- ar >> dwGeneralFlags;
- ar >> dwReserved;
- ar >> dwReserved;
- ar >> dwReserved;
- ar >> dwReserved;
- CRuntimeClass * pRTC = ar.ReadClass();
- ASSERT( pRTC != NULL );
- CExtPaintManager * pPM =
- STATIC_DOWNCAST( CExtPaintManager, pRTC->CreateObject() );
- ASSERT_VALID( pPM );
- ASSERT_KINDOF( CExtPaintManager, pPM );
- pPM->OnStateSerialize(
- ar,
- bEnableThrowExceptions
- );
-
- InstallPaintManager( pPM );
- } // else from if( ar.IsStoring() )
- dwGeneralFlags;
- dwReserved;
- return true;
- }
- catch( CException * pXept )
- {
- if( bEnableThrowExceptions )
- throw;
- pXept->Delete();
- }
- catch( ... )
- {
- if( bEnableThrowExceptions )
- throw;
- }
- return false;
- }
- UINT CExtPaintManager::CExtPaintManagerAutoPtr::GetMouseWheelScrollLines()
- {
- if( m_bHaveScrollLines )
- return m_uCachedScrollLines;
- m_bHaveScrollLines = true;
- m_uCachedScrollLines = 3;
- #if _MFC_VER < 0x700
- if( ! afxData.bWin4 )
- {
- HKEY hKey;
- if( ::RegOpenKeyEx(
- HKEY_CURRENT_USER,
- _T("Control Panel\Desktop"),
- 0,
- KEY_QUERY_VALUE, &hKey) == ERROR_SUCCESS
- )
- {
- TCHAR szData[256];
- DWORD dwKeyDataType;
- DWORD dwDataBufSize = _countof(szData);
- if( RegQueryValueEx(
- hKey,
- _T("WheelScrollLines"),
- NULL,
- &dwKeyDataType,
- (LPBYTE) &szData,
- &dwDataBufSize
- ) == ERROR_SUCCESS
- )
- {
- m_uCachedScrollLines =
- _tcstoul( szData, NULL, 10 );
- }
- RegCloseKey(hKey);
- }
- }
- else
- #endif // _MFC_VER < 0x700
- if( ! m_bIsWin95 )
- ::SystemParametersInfo(
- SPI_GETWHEELSCROLLLINES,
- 0,
- &m_uCachedScrollLines,
- 0
- );
- if( m_uCachedScrollLines < 2 )
- m_uCachedScrollLines = 2;
- return m_uCachedScrollLines;
- }
- bool CExtPaintManager::CExtPaintManagerAutoPtr::IsWndUpdateSource(
- CWnd * pWndNotifySrc
- )
- {
- ASSERT_VALID( pWndNotifySrc );
- ASSERT( pWndNotifySrc->GetSafeHwnd() != NULL && ::IsWindow(pWndNotifySrc->GetSafeHwnd()) );
- ASSERT( m_pPaintManager != NULL );
- if( ! m_bAllowWndUpdateSourceDetection )
- return false;
- #ifndef __EXT_MFC_NO_STATUSBAR
- if( pWndNotifySrc->IsKindOf(RUNTIME_CLASS(CExtStatusControlBar)) )
- return true;
- #endif // __EXT_MFC_NO_STATUSBAR
- CFrameWnd * pFrame = DYNAMIC_DOWNCAST( CFrameWnd, pWndNotifySrc );
- if( pFrame == NULL )
- pFrame = pWndNotifySrc->GetParentFrame();
- if( pFrame == NULL )
- return true;
- if( pFrame->IsKindOf(RUNTIME_CLASS(CExtMiniDockFrameWnd)) )
- pFrame = pFrame->GetParentFrame();
- if( pFrame == NULL
- || pFrame->IsKindOf(RUNTIME_CLASS(CMiniFrameWnd))
- )
- return true;
- CWnd * pWnd = pFrame->GetControlBar( AFX_IDW_STATUS_BAR );
- #ifndef __EXT_MFC_NO_STATUSBAR
- if( pWnd != NULL
- && pWnd->IsKindOf(RUNTIME_CLASS(CExtStatusControlBar))
- )
- {
- if( pWnd == pWndNotifySrc )
- return true;
- return false;
- }
- #endif // __EXT_MFC_NO_STATUSBAR
- pWnd = pFrame->GetControlBar( AFX_IDW_DOCKBAR_TOP );
- if( pWnd != NULL
- && pWnd->IsKindOf(RUNTIME_CLASS(CExtDockOuterBar))
- )
- {
- if( pWnd == pWndNotifySrc )
- return true;
- return false;
- }
- pWnd = pFrame->GetControlBar( AFX_IDW_DOCKBAR_BOTTOM );
- if( pWnd != NULL
- && pWnd->IsKindOf(RUNTIME_CLASS(CExtDockOuterBar))
- )
- {
- if( pWnd == pWndNotifySrc )
- return true;
- return false;
- }
- pWnd = pFrame->GetControlBar( AFX_IDW_DOCKBAR_LEFT );
- if( pWnd != NULL
- && pWnd->IsKindOf(RUNTIME_CLASS(CExtDockOuterBar))
- )
- {
- if( pWnd == pWndNotifySrc )
- return true;
- return false;
- }
- pWnd = pFrame->GetControlBar( AFX_IDW_DOCKBAR_RIGHT );
- if( pWnd != NULL
- && pWnd->IsKindOf(RUNTIME_CLASS(CExtDockOuterBar))
- )
- {
- if( pWnd == pWndNotifySrc )
- return true;
- return false;
- }
- #if (!defined __EXT_MFC_NO_TABMDI_CTRL)
- for( pWnd = pFrame->GetWindow(GW_CHILD);
- pWnd != NULL;
- pWnd = pWnd->GetWindow(GW_HWNDNEXT)
- )
- {
- CExtTabWnd * pExtTabWnd = DYNAMIC_DOWNCAST( CExtTabMdiWnd, pWnd );
- if( pExtTabWnd != NULL
- && pExtTabWnd->_IsMdiTabCtrl()
- )
- {
- if( pWnd == pWndNotifySrc )
- return true;
- return false;
- }
- }
- #endif // if (!defined __EXT_MFC_NO_TABMDI_CTRL)
- return true;
- }
- void CExtPaintManager::CExtPaintManagerAutoPtr::OnSysColorChange(
- CWnd * pWndNotifySrc
- )
- {
- ASSERT_VALID( pWndNotifySrc );
- ASSERT( pWndNotifySrc->GetSafeHwnd() != NULL && ::IsWindow(pWndNotifySrc->GetSafeHwnd()) );
- ASSERT( m_pPaintManager != NULL );
- if( ! IsWndUpdateSource( pWndNotifySrc ) )
- return;
- m_pPaintManager->OnSysColorChange();
- POSITION pos = m_listBridges.GetHeadPosition();
- for( ; pos != NULL; )
- {
- CExtPmBridge * pPmBridge = m_listBridges.GetNext( pos );
- ASSERT( pPmBridge != NULL );
- pPmBridge->PmBridge_OnSysColorChange(
- m_pPaintManager,
- pWndNotifySrc
- );
- } // for( ; pos != NULL; )
- }
- void CExtPaintManager::CExtPaintManagerAutoPtr::OnSettingChange(
- CWnd * pWndNotifySrc,
- UINT uFlags,
- __EXT_MFC_SAFE_LPCTSTR lpszSection
- )
- {
- ASSERT_VALID( pWndNotifySrc );
- ASSERT( pWndNotifySrc->GetSafeHwnd() != NULL && ::IsWindow(pWndNotifySrc->GetSafeHwnd()) );
- ASSERT( m_pPaintManager != NULL );
- if( ! IsWndUpdateSource( pWndNotifySrc ) )
- return;
- if( m_bIsWin2000orLater
- && CExtPaintManager::stat_GetBPP() >= 15
- && m_pfnUpdateLayeredWindow != NULL
- )
- m_bLayeredHighlighting2005 = true;
- m_bHaveScrollLines = false;
- m_pPaintManager->OnSettingChange( uFlags, lpszSection );
- POSITION pos = m_listBridges.GetHeadPosition();
- for( ; pos != NULL; )
- {
- CExtPmBridge * pPmBridge = m_listBridges.GetNext( pos );
- ASSERT( pPmBridge != NULL );
- pPmBridge->PmBridge_OnSettingChange(
- m_pPaintManager,
- pWndNotifySrc,
- uFlags,
- lpszSection
- );
- } // for( ; pos != NULL; )
- }
- void CExtPaintManager::CExtPaintManagerAutoPtr::OnDisplayChange(
- CWnd * pWndNotifySrc,
- INT nDepthBPP,
- CPoint ptSizes
- )
- {
- ASSERT_VALID( pWndNotifySrc );
- ASSERT( pWndNotifySrc->GetSafeHwnd() != NULL && ::IsWindow(pWndNotifySrc->GetSafeHwnd()) );
- ASSERT( m_pPaintManager != NULL );
- if( ! IsWndUpdateSource( pWndNotifySrc ) )
- return;
- if( m_bIsWin2000orLater
- && CExtPaintManager::stat_GetBPP() >= 15
- && m_pfnUpdateLayeredWindow != NULL
- )
- m_bLayeredHighlighting2005 = true;
- m_bHaveScrollLines = false;
- m_pPaintManager->OnDisplayChange( nDepthBPP, ptSizes );
- POSITION pos = m_listBridges.GetHeadPosition();
- for( ; pos != NULL; )
- {
- CExtPmBridge * pPmBridge = m_listBridges.GetNext( pos );
- ASSERT( pPmBridge != NULL );
- pPmBridge->PmBridge_OnDisplayChange(
- m_pPaintManager,
- pWndNotifySrc,
- nDepthBPP,
- ptSizes
- );
- } // for( ; pos != NULL; )
- }
- void CExtPaintManager::CExtPaintManagerAutoPtr::OnThemeChanged(
- CWnd * pWndNotifySrc,
- WPARAM wParam,
- LPARAM lParam
- )
- {
- ASSERT_VALID( pWndNotifySrc );
- ASSERT( pWndNotifySrc->GetSafeHwnd() != NULL && ::IsWindow(pWndNotifySrc->GetSafeHwnd()) );
- ASSERT( m_pPaintManager != NULL );
- if( ! IsWndUpdateSource( pWndNotifySrc ) )
- return;
- m_bHaveScrollLines = false;
- m_pPaintManager->OnThemeChanged( wParam, lParam );
- POSITION pos = m_listBridges.GetHeadPosition();
- for( ; pos != NULL; )
- {
- CExtPmBridge * pPmBridge = m_listBridges.GetNext( pos );
- ASSERT( pPmBridge != NULL );
- pPmBridge->PmBridge_OnThemeChanged(
- m_pPaintManager,
- pWndNotifySrc,
- wParam,
- lParam
- );
- } // for( ; pos != NULL; )
- }
- const BYTE CExtPaintManager::g_arrWinXpTreeBoxExpandedBmpData_small[] = {
- 0x42, 0x4D, 0x32, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x36, 0x00, 0x00, 0x00, 0x28, 0x00,
- 0x00, 0x00, 0x09, 0x00, 0x00, 0x00, 0x09, 0x00, 0x00, 0x00, 0x01, 0x00, 0x18, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0xFC, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xD3, 0xC2, 0xB0, 0xB5, 0x98, 0x78, 0xB5, 0x98, 0x78, 0xB5,
- 0x98, 0x78, 0xB5, 0x98, 0x78, 0xB5, 0x98, 0x78, 0xB5, 0x98, 0x78, 0xB5, 0x98, 0x78, 0xD3, 0xC2,
- 0xB0, 0x00, 0xB5, 0x98, 0x78, 0xBF, 0xCC, 0xD2, 0xAE, 0xBE, 0xC6, 0xA8, 0xB8, 0xC2, 0xA7, 0xB8,
- 0xC1, 0xA7, 0xB8, 0xC1, 0xA6, 0xB7, 0xC0, 0xAA, 0xBA, 0xC3, 0xB5, 0x98, 0x78, 0x00, 0xB5, 0x98,
- 0x78, 0xD9, 0xE1, 0xE4, 0xCF, 0xD8, 0xDC, 0xC9, 0xD3, 0xD8, 0xC7, 0xD2, 0xD7, 0xC6, 0xD1, 0xD6,
- 0xC0, 0xCC, 0xD2, 0xBB, 0xC8, 0xCF, 0xB5, 0x98, 0x78, 0x00, 0xB5, 0x98, 0x78, 0xEE, 0xF2, 0xF2,
- 0xEC, 0xF0, 0xF0, 0xE7, 0xED, 0xED, 0xE6, 0xEB, 0xEC, 0xE3, 0xE9, 0xEA, 0xD9, 0xE0, 0xE3, 0xCC,
- 0xD6, 0xDB, 0xB5, 0x98, 0x78, 0x00, 0xB5, 0x98, 0x78, 0xF1, 0xF5, 0xF5, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xD2, 0xDB, 0xDF, 0xB5, 0x98,
- 0x78, 0x00, 0xB5, 0x98, 0x78, 0xF5, 0xF7, 0xF7, 0xF5, 0xF7, 0xF7, 0xF4, 0xF7, 0xF7, 0xF4, 0xF7,
- 0xF7, 0xF4, 0xF6, 0xF6, 0xEB, 0xF0, 0xF1, 0xDA, 0xE1, 0xE5, 0xB5, 0x98, 0x78, 0x00, 0xB5, 0x98,
- 0x78, 0xFB, 0xFC, 0xFC, 0xFB, 0xFD, 0xFD, 0xFB, 0xFD, 0xFD, 0xFB, 0xFD, 0xFD, 0xFB, 0xFC, 0xFC,
- 0xFA, 0xFC, 0xFC, 0xF3, 0xF6, 0xF7, 0xB5, 0x98, 0x78, 0x00, 0xB5, 0x98, 0x78, 0xFF, 0xFF, 0xFF,
- 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
- 0xFF, 0xFF, 0xB5, 0x98, 0x78, 0x00, 0xD3, 0xC2, 0xB0, 0xB5, 0x98, 0x78, 0xB5, 0x98, 0x78, 0xB5,
- 0x98, 0x78, 0xB5, 0x98, 0x78, 0xB5, 0x98, 0x78, 0xB5, 0x98, 0x78, 0xB5, 0x98, 0x78, 0xD3, 0xC2,
- 0xB0, 0x00,
- };
- const BYTE CExtPaintManager::g_arrWinXpTreeBoxCollapsedBmpData_small[] = {
- 0x42, 0x4D, 0x32, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x36, 0x00, 0x00, 0x00, 0x28, 0x00,
- 0x00, 0x00, 0x09, 0x00, 0x00, 0x00, 0x09, 0x00, 0x00, 0x00, 0x01, 0x00, 0x18, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0xFC, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xD3, 0xC2, 0xB0, 0xB5, 0x98, 0x78, 0xB5, 0x98, 0x78, 0xB5,
- 0x98, 0x78, 0xB5, 0x98, 0x78, 0xB5, 0x98, 0x78, 0xB5, 0x98, 0x78, 0xB5, 0x98, 0x78, 0xD3, 0xC2,
- 0xB0, 0x00, 0xB5, 0x98, 0x78, 0xBF, 0xCC, 0xD2, 0xAE, 0xBE, 0xC6, 0xA8, 0xB8, 0xC2, 0xA7, 0xB8,
- 0xC1, 0xA7, 0xB8, 0xC1, 0xA6, 0xB7, 0xC0, 0xAA, 0xBA, 0xC3, 0xB5, 0x98, 0x78, 0x00, 0xB5, 0x98,
- 0x78, 0xD9, 0xE1, 0xE4, 0xCF, 0xD8, 0xDC, 0xC9, 0xD3, 0xD8, 0x00, 0x00, 0x00, 0xC6, 0xD1, 0xD6,
- 0xC0, 0xCC, 0xD2, 0xBB, 0xC8, 0xCF, 0xB5, 0x98, 0x78, 0x00, 0xB5, 0x98, 0x78, 0xEE, 0xF2, 0xF2,
- 0xEC, 0xF0, 0xF0, 0xE7, 0xED, 0xED, 0x00, 0x00, 0x00, 0xE3, 0xE9, 0xEA, 0xD9, 0xE0, 0xE3, 0xCC,
- 0xD6, 0xDB, 0xB5, 0x98, 0x78, 0x00, 0xB5, 0x98, 0x78, 0xF1, 0xF5, 0xF5, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xD2, 0xDB, 0xDF, 0xB5, 0x98,
- 0x78, 0x00, 0xB5, 0x98, 0x78, 0xF5, 0xF7, 0xF7, 0xF5, 0xF7, 0xF7, 0xF4, 0xF7, 0xF7, 0x00, 0x00,
- 0x00, 0xF4, 0xF6, 0xF6, 0xEB, 0xF0, 0xF1, 0xDA, 0xE1, 0xE5, 0xB5, 0x98, 0x78, 0x00, 0xB5, 0x98,
- 0x78, 0xFB, 0xFC, 0xFC, 0xFB, 0xFD, 0xFD, 0xFB, 0xFD, 0xFD, 0x00, 0x00, 0x00, 0xFB, 0xFC, 0xFC,
- 0xFA, 0xFC, 0xFC, 0xF3, 0xF6, 0xF7, 0xB5, 0x98, 0x78, 0x00, 0xB5, 0x98, 0x78, 0xFF, 0xFF, 0xFF,
- 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
- 0xFF, 0xFF, 0xB5, 0x98, 0x78, 0x00, 0xD3, 0xC2, 0xB0, 0xB5, 0x98, 0x78, 0xB5, 0x98, 0x78, 0xB5,
- 0x98, 0x78, 0xB5, 0x98, 0x78, 0xB5, 0x98, 0x78, 0xB5, 0x98, 0x78, 0xB5, 0x98, 0x78, 0xD3, 0xC2,
- 0xB0, 0x00,
- };
- const BYTE CExtPaintManager::g_arrWinXpTreeBoxExpandedBmpData_big[] = {
- 0x42,0x4D,0xC2,0x01,0x00,0x00,0x00,0x00,0x00,0x00,0x36,0x00,0x00,0x00,0x28,0x00,
- 0x00,0x00,0x0B,0x00,0x00,0x00,0x0B,0x00,0x00,0x00,0x01,0x00,0x18,0x00,0x00,0x00,
- 0x00,0x00,0x8C,0x01,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
- 0x00,0x00,0x00,0x00,0x00,0x00,0xD7,0xD1,0xCB,0x60,0x48,0x30,0x60,0x48,0x30,0x60,
- 0x48,0x30,0x60,0x48,0x30,0x60,0x48,0x30,0x60,0x48,0x30,0x60,0x48,0x30,0x60,0x48,
- 0x30,0x60,0x48,0x30,0xD7,0xD1,0xCB,0x00,0x00,0x00,0xC0,0xA8,0x90,0xF0,0xE0,0xE0,
- 0xF0,0xE0,0xD0,0xF0,0xD8,0xD0,0xF0,0xD8,0xD0,0xF0,0xD0,0xC0,0xF0,0xD0,0xC0,0xF0,
- 0xD0,0xC0,0xF0,0xC8,0xC0,0xF0,0xC8,0xB0,0x60,0x48,0x30,0x00,0x00,0x00,0xC0,0xA8,
- 0x90,0xF0,0xE8,0xE0,0xF0,0xE0,0xE0,0xF0,0xE0,0xD0,0xF0,0xD8,0xD0,0xF0,0xD8,0xD0,
- 0xF0,0xD0,0xC0,0xF0,0xD0,0xC0,0xF0,0xD0,0xC0,0xF0,0xC8,0xC0,0x60,0x48,0x30,0x00,
- 0x00,0x00,0xC0,0xA8,0x90,0xFF,0xF0,0xE0,0xF0,0xE8,0xE0,0xF0,0xE0,0xE0,0xF0,0xE0,
- 0xD0,0xF0,0xD8,0xD0,0xF0,0xD8,0xD0,0xF0,0xD0,0xC0,0xF0,0xD0,0xC0,0xF0,0xD0,0xC0,
- 0x60,0x48,0x30,0x00,0x00,0x00,0xC0,0xA8,0x90,0xFF,0xF0,0xF0,0xFF,0xF0,0xE0,0xF0,
- 0xE8,0xE0,0xF0,0xE0,0xE0,0xF0,0xE0,0xD0,0xF0,0xD8,0xD0,0xF0,0xD8,0xD0,0xF0,0xD0,
- 0xC0,0xF0,0xD0,0xC0,0x60,0x48,0x30,0x00,0x00,0x00,0xC0,0xA8,0x90,0xFF,0xF8,0xF0,
- 0xFF,0xF0,0xF0,0x60,0x48,0x30,0x60,0x48,0x30,0x60,0x48,0x30,0x60,0x48,0x30,0x60,
- 0x48,0x30,0xF0,0xD8,0xD0,0xF0,0xD0,0xC0,0x60,0x48,0x30,0x00,0x00,0x00,0xC0,0xA8,
- 0xA0,0xFF,0xF8,0xF0,0xFF,0xF8,0xF0,0xFF,0xF0,0xF0,0xFF,0xF0,0xE0,0xF0,0xE8,0xE0,
- 0xF0,0xE0,0xE0,0xF0,0xE0,0xD0,0xF0,0xD8,0xD0,0xF0,0xD8,0xD0,0x60,0x48,0x30,0x00,
- 0x00,0x00,0xC0,0xA8,0xA0,0xFF,0xF8,0xFF,0xFF,0xF8,0xF0,0xFF,0xF8,0xF0,0xFF,0xF0,
- 0xF0,0xFF,0xF0,0xE0,0xF0,0xE8,0xE0,0xF0,0xE0,0xE0,0xF0,0xE0,0xD0,0xF0,0xD8,0xD0,
- 0x60,0x48,0x30,0x00,0x00,0x00,0xC0,0xB0,0xA0,0xFF,0xFF,0xFF,0xFF,0xF8,0xFF,0xFF,
- 0xF8,0xF0,0xFF,0xF8,0xF0,0xFF,0xF0,0xF0,0xFF,0xF0,0xE0,0xF0,0xE8,0xE0,0xF0,0xE0,
- 0xE0,0xF0,0xE0,0xD0,0x60,0x48,0x30,0x00,0x00,0x00,0xC0,0xB0,0xA0,0xFF,0xFF,0xFF,
- 0xFF,0xFF,0xFF,0xFF,0xF8,0xFF,0xFF,0xF8,0xF0,0xFF,0xF8,0xF0,0xFF,0xF0,0xF0,0xFF,
- 0xF0,0xE0,0xF0,0xE8,0xE0,0xF0,0xE0,0xE0,0x60,0x48,0x30,0x00,0x00,0x00,0xEF,0xEB,
- 0xE7,0xC0,0xB0,0xA0,0xC0,0xB0,0xA0,0xC0,0xA8,0xA0,0xC0,0xA8,0xA0,0xC0,0xA8,0xA0,
- 0xC0,0xA8,0x90,0xC0,0xA0,0x90,0xC0,0xA0,0x90,0xC0,0xA0,0x90,0xD7,0xD1,0xCB,0x00,
- 0x00,0x00,0x00
- };
- const BYTE CExtPaintManager::g_arrWinXpTreeBoxCollapsedBmpData_big[] = {
- 0x42,0x4D,0xC2,0x01,0x00,0x00,0x00,0x00,0x00,0x00,0x36,0x00,0x00,0x00,0x28,0x00,
- 0x00,0x00,0x0B,0x00,0x00,0x00,0x0B,0x00,0x00,0x00,0x01,0x00,0x18,0x00,0x00,0x00,
- 0x00,0x00,0x8C,0x01,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
- 0x00,0x00,0x00,0x00,0x00,0x00,0xD7,0xD1,0xCB,0x60,0x48,0x30,0x60,0x48,0x30,0x60,
- 0x48,0x30,0x60,0x48,0x30,0x60,0x48,0x30,0x60,0x48,0x30,0x60,0x48,0x30,0x60,0x48,
- 0x30,0x60,0x48,0x30,0xD7,0xD1,0xCB,0x00,0x00,0x00,0xC0,0xA8,0x90,0xF0,0xE0,0xE0,
- 0xE0,0xD0,0xC0,0xE0,0xC8,0xB0,0xE0,0xC0,0xB0,0xE0,0xC0,0xB0,0xD0,0xB8,0xA0,0xD0,
- 0xB8,0xA0,0xD0,0xB8,0xA0,0xD0,0xB8,0xA0,0x60,0x48,0x30,0x00,0x00,0x00,0xC0,0xA8,
- 0x90,0xF0,0xE8,0xE0,0xF0,0xE0,0xE0,0xF0,0xE0,0xD0,0xF0,0xD8,0xD0,0xF0,0xD8,0xD0,
- 0xF0,0xD0,0xC0,0xF0,0xD0,0xC0,0xF0,0xD0,0xC0,0xD0,0xB8,0xA0,0x60,0x48,0x30,0x00,
- 0x00,0x00,0xC0,0xA8,0x90,0xFF,0xF0,0xE0,0xF0,0xE8,0xE0,0xF0,0xE0,0xE0,0xF0,0xE0,
- 0xD0,0x60,0x48,0x30,0xF0,0xD8,0xD0,0xF0,0xD0,0xC0,0xF0,0xD0,0xC0,0xD0,0xB8,0xA0,
- 0x60,0x48,0x30,0x00,0x00,0x00,0xC0,0xA8,0x90,0xFF,0xF0,0xF0,0xFF,0xF0,0xE0,0xF0,
- 0xE8,0xE0,0xF0,0xE0,0xE0,0x60,0x48,0x30,0xF0,0xD8,0xD0,0xF0,0xD8,0xD0,0xF0,0xD0,
- 0xC0,0xD0,0xB8,0xA0,0x60,0x48,0x30,0x00,0x00,0x00,0xC0,0xA8,0x90,0xFF,0xF8,0xF0,
- 0xFF,0xF0,0xF0,0x60,0x48,0x30,0x60,0x48,0x30,0x60,0x48,0x30,0x60,0x48,0x30,0x60,
- 0x48,0x30,0xF0,0xD8,0xD0,0xE0,0xC0,0xB0,0x60,0x48,0x30,0x00,0x00,0x00,0xC0,0xA8,
- 0xA0,0xFF,0xF8,0xF0,0xFF,0xF8,0xF0,0xFF,0xF0,0xF0,0xFF,0xF0,0xE0,0x60,0x48,0x30,
- 0xF0,0xE0,0xE0,0xF0,0xE0,0xD0,0xF0,0xD8,0xD0,0xE0,0xC0,0xB0,0x60,0x48,0x30,0x00,
- 0x00,0x00,0xC0,0xA8,0xA0,0xFF,0xF8,0xFF,0xFF,0xF8,0xF0,0xFF,0xF8,0xF0,0xFF,0xF0,
- 0xF0,0x60,0x48,0x30,0xF0,0xE8,0xE0,0xF0,0xE0,0xE0,0xF0,0xE0,0xD0,0xE0,0xC0,0xB0,
- 0x60,0x48,0x30,0x00,0x00,0x00,0xC0,0xB0,0xA0,0xFF,0xFF,0xFF,0xFF,0xF8,0xFF,0xFF,
- 0xF8,0xF0,0xFF,0xF8,0xF0,0xFF,0xF0,0xF0,0xFF,0xF0,0xE0,0xF0,0xE8,0xE0,0xF0,0xE0,
- 0xE0,0xE0,0xD0,0xC0,0x60,0x48,0x30,0x00,0x00,0x00,0xC0,0xB0,0xA0,0xFF,0xFF,0xFF,
- 0xFF,0xFF,0xFF,0xFF,0xF8,0xFF,0xFF,0xF8,0xF0,0xFF,0xF8,0xF0,0xFF,0xF0,0xF0,0xFF,
- 0xF0,0xE0,0xF0,0xE8,0xE0,0xF0,0xE0,0xE0,0x60,0x48,0x30,0x00,0x00,0x00,0xEF,0xEB,
- 0xE7,0xC0,0xB0,0xA0,0xC0,0xB0,0xA0,0xC0,0xA8,0xA0,0xC0,0xA8,0xA0,0xC0,0xA8,0xA0,
- 0xC0,0xA8,0x90,0xC0,0xA0,0x90,0xC0,0xA0,0x90,0xC0,0xA0,0x90,0xD7,0xD1,0xCB,0x00,
- 0x00,0x00,0x00
- };
- void CExtPaintManager::LoadWinXpTreeBox(
- CExtCmdIcon & _icon,
- bool bExpanded,
- bool bBig // = false
- )
- {
- ASSERT_VALID( this );
- _icon.Empty();
- if( bBig )
- {
- if( bExpanded )
- _icon.m_bmpNormal.LoadBMP_Buffer(
- g_arrWinXpTreeBoxExpandedBmpData_big,
- sizeof(g_arrWinXpTreeBoxExpandedBmpData_big) / sizeof( g_arrWinXpTreeBoxExpandedBmpData_big[0] ),
- true
- );
- else
- _icon.m_bmpNormal.LoadBMP_Buffer(
- g_arrWinXpTreeBoxCollapsedBmpData_big,
- sizeof(g_arrWinXpTreeBoxCollapsedBmpData_big) / sizeof( g_arrWinXpTreeBoxCollapsedBmpData_big[0] ),
- true
- );
- CSize _size = _icon.m_bmpNormal.GetSize();
- RECT rc;
- ::SetRect( &rc, 0, 0, 1, 1 );
- _icon.m_bmpNormal.AlphaRect( rc, 0x20 );
- ::SetRect( &rc, _size.cx-1, 0, _size.cx, 1 );
- _icon.m_bmpNormal.AlphaRect( rc, 0x20 );
- ::SetRect( &rc, 0, _size.cy-1, 1, _size.cy );
- _icon.m_bmpNormal.AlphaRect( rc, 0x20 );
- ::SetRect( &rc, _size.cx-1, _size.cy-1, _size.cx, _size.cy );
- _icon.m_bmpNormal.AlphaRect( rc, 0x20 );
- }
- else
- {
- if( bExpanded )
- _icon.m_bmpNormal.LoadBMP_Buffer(
- g_arrWinXpTreeBoxExpandedBmpData_small,
- sizeof(g_arrWinXpTreeBoxExpandedBmpData_small) / sizeof( g_arrWinXpTreeBoxExpandedBmpData_small[0] ),
- true
- );
- else
- _icon.m_bmpNormal.LoadBMP_Buffer(
- g_arrWinXpTreeBoxCollapsedBmpData_small,
- sizeof(g_arrWinXpTreeBoxCollapsedBmpData_small) / sizeof( g_arrWinXpTreeBoxCollapsedBmpData_small[0] ),
- true
- );
- _icon.m_bmpNormal.AlphaColor( RGB(255,0,255), RGB(0,0,0), 0 );
- }
- }
- bool CExtPaintManager::glyph_t::stat_DefGlyphRgnTransparencyFunc(
- const glyph_t & _glyph,
- int x,
- int y,
- UINT nColor,
- LPVOID lpCookie
- )
- {
- _glyph;
- x;
- y;
- lpCookie;
- return (nColor == 0) ? true : false;
- }
- CExtPaintManager::glyph_t::glyph_t()
- {
- _Init();
- }
- CExtPaintManager::glyph_t::glyph_t(
- const SIZE & _size,
- UINT nColors,
- const UINT * pColorIndexes
- )
- {
- m_bDynamicData = false;
- ASSERT( _size.cx > 0 );
- ASSERT( _size.cy > 0 );
- m_size.cx = _size.cx;
- m_size.cy = _size.cy;
-
- ASSERT( nColors > 0 );
- m_nColors = nColors;
-
- ASSERT( pColorIndexes != NULL );
- m_pColorIndexes = pColorIndexes;
- }
- CExtPaintManager::glyph_t::glyph_t(
- int cx,
- int cy,
- UINT nColors,
- const UINT * pColorIndexes
- )
- {
- m_bDynamicData = false;
-
- ASSERT( cx > 0 );
- ASSERT( cy > 0 );
- m_size.cx = cx;
- m_size.cy = cy;
-
- ASSERT( nColors > 0 );
- m_nColors = nColors;
- ASSERT( pColorIndexes != NULL );
- m_pColorIndexes = pColorIndexes;
- }
- CExtPaintManager::glyph_t::glyph_t(
- const glyph_t & other,
- UINT nRotateAngle // = 0
- )
- {
- _Init();
- _CopyFromOther(other);
- #ifdef _DEBUG
- if( other.m_pColorIndexes != NULL )
- {
- ASSERT( m_pColorIndexes != NULL );
- ASSERT( m_pColorIndexes != other.m_pColorIndexes );
- ASSERT( m_bDynamicData );
- }
- #endif // _DEBUG
- ASSERT(
- nRotateAngle == 0
- || nRotateAngle == 90
- || nRotateAngle == 180
- || nRotateAngle == 270
- );
- Rotate(nRotateAngle);
- }
- CExtPaintManager::glyph_t::~glyph_t()
- {
- _Done();
- }
- UINT CExtPaintManager::glyph_t::GetColorPixel(
- int x,
- int y
- ) const
- {
- ASSERT( x >= 0 && x < m_size.cx );
- ASSERT( y >= 0 && y < m_size.cy );
- ASSERT( m_size.cx > 0 );
- ASSERT( m_size.cy > 0 );
- ASSERT( m_nColors > 0 );
- ASSERT( m_pColorIndexes != NULL );
- int nOffset =
- y * m_size.cx + x;
- UINT nValue =
- *( m_pColorIndexes + nOffset );
- return nValue;
- }
- void CExtPaintManager::glyph_t::Rotate(UINT nRotateAngle)
- {
- ASSERT(
- nRotateAngle == 0
- || nRotateAngle == 90
- || nRotateAngle == 180
- || nRotateAngle == 270
- );
- ASSERT( m_bDynamicData );
- ASSERT( m_size.cx > 0 );
- ASSERT( m_size.cy > 0 );
- ASSERT( m_nColors > 0 );
- ASSERT( m_pColorIndexes != NULL );
- if( nRotateAngle == 0 )
- return;
-
- int nBufferSize =
- m_size.cx * m_size.cy;
- ASSERT( nBufferSize > 0 );
- UINT * pNew = new UINT[nBufferSize];
- ASSERT( pNew != NULL );
- if( pNew == NULL )
- return;
- int x, y;
- UINT * pOld = (UINT *)m_pColorIndexes;
- switch( nRotateAngle )
- {
- case 90:
- {
- for( y = 0; y<m_size.cy; y++ )
- {
- for( x = 0; x<m_size.cx; x++, pOld++ )
- {
- int nNewOffset =
- x*m_size.cy + (m_size.cy - y - 1);
- ASSERT(
- nNewOffset >= 0
- &&
- nNewOffset < nBufferSize
- );
- UINT * p = pNew + nNewOffset;
- *p = *pOld;
- } // for( x = 0; x<m_size.cx; x++, pOld++ )
- } // for( y = 0; y<m_size.cy; y++ )
- m_size = CSize(m_size.cy,m_size.cx);
- }
- break; // case 90
- case 180:
- {
- for( y = 0; y<m_size.cy; y++ )
- {
- for( x = 0; x<m_size.cx; x++, pOld++ )
- {
- int nNewOffset =
- (m_size.cy-y-1)*m_size.cx
- + (m_size.cx-x-1);
- ASSERT(
- nNewOffset >= 0
- &&
- nNewOffset < nBufferSize
- );
- UINT * p = pNew + nNewOffset;
- *p = *pOld;
- } // for( x = 0; x<m_size.cx; x++, pOld++ )
- } // for( y = 0; y<m_size.cy; y++ )
- }
- break; // case 180
- case 270:
- {
- for( y = 0; y<m_size.cy; y++ )
- {
- for( x = 0; x<m_size.cx; x++, pOld++ )
- {
- int nNewOffset =
- (m_size.cx-x-1)*m_size.cy + y;
- ASSERT(
- nNewOffset >= 0
- &&
- nNewOffset < nBufferSize
- );
- UINT * p = pNew + nNewOffset;
- *p = *pOld;
- } // for( x = 0; x<m_size.cx; x++, pOld++ )
- } // for( y = 0; y<m_size.cy; y++ )
- m_size = CSize(m_size.cy,m_size.cx);
- }
- break; // case 270
- } // switch( nRotateAngle )
- UINT nSizeInBytes =
- nBufferSize * sizeof(UINT);
- __EXT_MFC_MEMCPY(
- (UINT *)m_pColorIndexes,
- nSizeInBytes,
- pNew,
- nSizeInBytes
- );
- delete [] pNew; // ::free(pNew);
- }
- CSize CExtPaintManager::glyph_t::Size() const
- {
- return m_size;
- }
- const UINT * CExtPaintManager::glyph_t::GetSurface() const
- {
- ASSERT( m_size.cx > 0 );
- ASSERT( m_size.cy > 0 );
- ASSERT( m_nColors > 0 );
- ASSERT( m_pColorIndexes != NULL );
- return m_pColorIndexes;
- }
- UINT CExtPaintManager::glyph_t::GetColorsCount() const
- {
- ASSERT( m_size.cx > 0 );
- ASSERT( m_size.cy > 0 );
- ASSERT( m_nColors > 0 );
- ASSERT( m_pColorIndexes != NULL );
- return m_nColors;
- }
- void CExtPaintManager::glyph_t::_Init()
- {
- m_size.cx = m_size.cy = 0;
- m_nColors = 1;
- m_pColorIndexes = NULL;
- m_bDynamicData = false;
- }
- void CExtPaintManager::glyph_t::_Done()
- {
- if( m_bDynamicData )
- {
- ASSERT( m_pColorIndexes != NULL );
- delete [] ((UINT *)m_pColorIndexes); // ::free( (void *)m_pColorIndexes );
- m_pColorIndexes = NULL;
- }
- _Init();
- }
- bool CExtPaintManager::glyph_t::_CopyFromOther( const glyph_t & other )
- {
- _Done();
- if( other.m_pColorIndexes != NULL )
- {
- int nBufferSize =
- other.m_size.cx * other.m_size.cy;
- ASSERT( nBufferSize > 0 );
- m_pColorIndexes = new UINT[nBufferSize];
- ASSERT( m_pColorIndexes != NULL );
- if( m_pColorIndexes == NULL )
- return false;
- UINT nSizeInBytes =
- nBufferSize * sizeof(UINT);
- __EXT_MFC_MEMCPY(
- (void *)m_pColorIndexes,
- nSizeInBytes,
- other.m_pColorIndexes,
- nSizeInBytes
- );
- m_bDynamicData = true;
- }
- m_size.cx = other.m_size.cx;
- m_size.cy = other.m_size.cy;
-
- m_nColors = other.m_nColors;
- return true;
- }
- void CExtPaintManager::glyph_t::_SetColorPixel(
- int x,
- int y,
- UINT nValue
- )
- {
- ASSERT( x >= 0 && x < m_size.cx );
- ASSERT( y >= 0 && y < m_size.cy );
- ASSERT( m_bDynamicData );
- ASSERT( m_size.cx > 0 );
- ASSERT( m_size.cy > 0 );
- ASSERT( m_nColors > 0 );
- ASSERT( m_pColorIndexes != NULL );
- int nOffset =
- y * m_size.cx + x;
- UINT * ptr =
- (UINT *)m_pColorIndexes + nOffset;
- *ptr = nValue;
- }
- CRgn & CExtPaintManager::glyph_t::GenerateRgn(
- CRgn & rgn,
- bool (*pGlyphRgnTransparencyFunc)(
- const glyph_t & _glyph,
- int x,
- int y,
- UINT nColor,
- LPVOID lpCookie
- ), // = stat_DefGlyphRgnTransparencyFunc
- LPVOID lpCallbackCookie, // = NULL
- LPLONG pMinNonTransparentX, // = NULL
- LPLONG pMinNonTransparentY, // = NULL
- LPLONG pMaxNonTransparentX, // = NULL
- LPLONG pMaxNonTransparentY, // = NULL
- LPLONG pMinTransparentX, // = NULL
- LPLONG pMinTransparentY, // = NULL
- LPLONG pMaxTransparentX, // = NULL
- LPLONG pMaxTransparentY // = NULL
- ) const
- {
- if( pMinNonTransparentX != NULL )
- *pMinNonTransparentX = 0;
- if( pMinNonTransparentY != NULL )
- *pMinNonTransparentY = 0;
- if( pMaxNonTransparentX != NULL )
- *pMaxNonTransparentX = 0;
- if( pMaxNonTransparentY != NULL )
- *pMaxNonTransparentY;
- if( pMinTransparentX != NULL )
- *pMinTransparentX = 0;
- if( pMinTransparentY != NULL )
- *pMinTransparentY = 0;
- if( pMaxTransparentX != NULL )
- *pMaxTransparentX = 0;
- if( pMaxTransparentY != NULL )
- *pMaxTransparentY;
- if( rgn.GetSafeHandle() != NULL )
- rgn.DeleteObject();
- ASSERT( rgn.GetSafeHandle() == NULL );
-
- CSize _size = Size();
- if( _size.cx == 0 || _size.cy == 0 )
- {
- ASSERT( FALSE );
- return rgn;
- }
-
- if( !rgn.CreateRectRgn(0,0,0,0) )
- {
- ASSERT( FALSE );
- return rgn;
- }
- for( int x = 0; x < _size.cx; x++ )
- {
- for( int y = 0; y < _size.cy; y++ )
- {
- UINT nColor = GetColorPixel( x, y );
- if( pGlyphRgnTransparencyFunc(
- *this,
- x,
- y,
- nColor,
- lpCallbackCookie
- )
- )
- { // if pixel transparent
- if( pMinTransparentX != NULL
- && (*pMinTransparentX) > x
- )
- (*pMinTransparentX) = x;
- if( pMinTransparentY != NULL
- && (*pMinTransparentY) > y
- )
- (*pMinTransparentY) = y;
- if( pMaxTransparentX != NULL
- && (*pMaxTransparentX) < x
- )
- (*pMaxTransparentX) = x;
- if( pMaxTransparentY != NULL
- && (*pMaxTransparentY) < y
- )
- (*pMaxTransparentY) = y;
- continue;
- } // if pixel transparent
- if( pMinNonTransparentX != NULL
- && (*pMinNonTransparentX) > x
- )
- (*pMinNonTransparentX) = x;
- if( pMinNonTransparentY != NULL
- && (*pMinNonTransparentY) > y
- )
- (*pMinNonTransparentY) = y;
- if( pMaxNonTransparentX != NULL
- && (*pMaxNonTransparentX) < x
- )
- (*pMaxNonTransparentX) = x;
- if( pMaxNonTransparentY != NULL
- && (*pMaxNonTransparentY) < y
- )
- (*pMaxNonTransparentY) = y;
- CRgn rgnPixel;
- if( !rgnPixel.CreateRectRgn(
- x,
- y,
- x+1,
- y+1
- )
- )
- {
- ASSERT( FALSE );
- return rgn;
- }
- rgn.CombineRgn( &rgn, &rgnPixel, RGN_OR );
- } // for( int y = 0; y < _size.cy; y++ )
- } // for( int x = 0; x < _size.cx; x++ )
-
- return rgn;
- }
- DWORD CExtPaintManager::stat_DllGetVersion( __EXT_MFC_SAFE_LPCTSTR lpszDllName )
- {
- HINSTANCE hinstDll = NULL;
- DWORD dwVersion = 0;
- // For security purposes, LoadLibrary should be provided with a
- // fully-qualified path to the DLL. The lpszDllName variable should be
- // tested to ensure that it is a fully qualified path before it is used.
- hinstDll = ::LoadLibrary(lpszDllName);
- if( hinstDll != NULL )
- {
- DLLGETVERSIONPROC pDllGetVersion;
- pDllGetVersion =
- (DLLGETVERSIONPROC) ::GetProcAddress( hinstDll, "DllGetVersion" );
- // Because some DLLs might not implement this function, you
- // must test for it explicitly. Depending on the particular
- // DLL, the lack of a DllGetVersion function can be a useful
- // indicator of the version.
- if( pDllGetVersion != NULL )
- {
- DLLVERSIONINFO dvi;
- HRESULT hr = 0;
- ZeroMemory(&dvi, sizeof(dvi));
- dvi.cbSize = sizeof(dvi);
- hr = (*pDllGetVersion)(&dvi);
- if( SUCCEEDED(hr) )
- dwVersion = MAKELONG( dvi.dwMinorVersion, dvi.dwMajorVersion );
- }
- ::FreeLibrary( hinstDll );
- }
- return dwVersion;
- }
- HBITMAP CExtPaintManager::stat_GetScreenSurfacePart(
- const RECT & rcScreenSurfacePart,
- COLORREF ** ppClrSurface // = NULL
- )
- {
- if( ppClrSurface != NULL )
- (*ppClrSurface) = NULL;
- INT cx = rcScreenSurfacePart.right - rcScreenSurfacePart.left;
- if( cx <= 0 )
- return NULL;
- INT cy = rcScreenSurfacePart.bottom - rcScreenSurfacePart.top;
- if( cy <= 0 )
- return NULL;
- CDC dcmm;
- if( ! dcmm.CreateCompatibleDC( NULL ) )
- return NULL;
- BITMAPINFOHEADER bih;
- bih.biSize = sizeof(BITMAPINFOHEADER);
- bih.biWidth = cx;
- bih.biHeight = cy;
- bih.biPlanes = 1;
- bih.biBitCount = 32;
- bih.biCompression = BI_RGB;
- bih.biSizeImage = cx * cy;
- bih.biXPelsPerMeter = 0;
- bih.biYPelsPerMeter = 0;
- bih.biClrUsed = 0;
- bih.biClrImportant = 0;
- HBITMAP hDIB =
- ::CreateDIBSection(
- dcmm.GetSafeHdc(),
- (LPBITMAPINFO)&bih,
- DIB_RGB_COLORS,
- (void **)ppClrSurface,
- NULL,
- NULL
- );
- if( hDIB == NULL )
- return NULL;
- HGDIOBJ hOldBmp = ::SelectObject( dcmm.m_hDC, ((HGDIOBJ)hDIB) );
- CWindowDC dcDesktop( NULL );
- VERIFY(
- dcmm.BitBlt(
- 0,
- 0,
- cx,
- cy,
- &dcDesktop,
- rcScreenSurfacePart.left,
- rcScreenSurfacePart.top,
- SRCCOPY
- )
- );
- ::SelectObject( dcmm.m_hDC, hOldBmp );
- dcmm.DeleteDC();
- return hDIB;
- }
- HBITMAP CExtPaintManager::stat_PrintWnd(
- HWND hWnd,
- UINT nMessage, // = WM_PRINTCLIENT
- LPARAM lParamPrint, // = PRF_NONCLIENT|PRF_CLIENT|PRF_ERASEBKGND|PRF_CHILDREN
- HDC hSrcDC, // = NULL
- const RECT * pRectFillSrc // = NULL
- )
- {
- ASSERT( hWnd != NULL && ::IsWindow(hWnd) );
- ASSERT( nMessage == WM_PRINT || nMessage == WM_PRINTCLIENT );
- CRect rcWnd, rcClient;
- ::GetWindowRect( hWnd, &rcWnd );
- ::GetClientRect( hWnd, &rcClient );
- CSize _sizeDest =
- ( (lParamPrint&PRF_NONCLIENT) != 0 )
- ? rcWnd.Size()
- : rcClient.Size()
- ;
- HDC hDC = ::CreateCompatibleDC( NULL );
- if( hDC == NULL )
- {
- ASSERT( FALSE );
- return NULL;
- }
- BITMAPINFOHEADER bih;
- ::memset( &bih, 0, sizeof(BITMAPINFOHEADER) );
- bih.biSize = sizeof(BITMAPINFOHEADER);
- bih.biWidth = _sizeDest.cx;
- bih.biHeight = _sizeDest.cy;
- bih.biPlanes = 1;
- bih.biBitCount = 32;
- bih.biCompression = BI_RGB;
- bih.biSizeImage = _sizeDest.cx * _sizeDest.cy;
- COLORREF * pSurface = NULL;
- HBITMAP hBmpSufrace =
- ::CreateDIBSection(
- hDC,
- (LPBITMAPINFO)&bih,
- DIB_RGB_COLORS,
- (void **)&pSurface,
- NULL,
- NULL
- );
- ASSERT( hBmpSufrace != NULL );
- if( hBmpSufrace == NULL )
- {
- ::DeleteDC( hDC );
- ASSERT( FALSE );
- return NULL;
- }
- ASSERT( pSurface != NULL );
- HGDIOBJ hBmpOld = ::SelectObject( hDC, (HGDIOBJ)hBmpSufrace );
- if( hSrcDC != NULL
- && pRectFillSrc != NULL
- && pRectFillSrc->left < pRectFillSrc->right
- && pRectFillSrc->top < pRectFillSrc->bottom
- )
- ::BitBlt(
- hDC,
- 0,
- 0,
- pRectFillSrc->right - pRectFillSrc->left,
- pRectFillSrc->bottom - pRectFillSrc->top,
- hSrcDC,
- pRectFillSrc->left,
- pRectFillSrc->top,
- SRCCOPY
- );
- LRESULT lResult =
- ::SendMessage(
- hWnd,
- nMessage,
- (WPARAM)hDC,
- lParamPrint
- );
- lResult;
- // if( lResult != 0 )
- // {
- // bool bOverPaint = true;
- // CWnd * pWnd = CWnd::FromHandlePermanent( hWnd );
- // if( pWnd != NULL )
- // {
- // CRuntimeClass * pRTC = pWnd->GetRuntimeClass();
- // ASSERT( pRTC != NULL );
- // if( ::strncmp( pRTC->m_lpszClassName, "CExt", 4 ) == 0 )
- // bOverPaint = false;
- // }
- // if( bOverPaint )
- // {
- // COLORREF clrBk = ::GetSysColor( COLOR_WINDOW );
- // COLORREF clrBkOld = ::SetBkColor( hDC, clrBk );
- // CRect rect( 0, 0, _sizeDest.cx, _sizeDest.cy );
- // ::ExtTextOut( hDC, 0, 0, ETO_OPAQUE, &rect, NULL, 0, NULL );
- // ::SetBkColor( hDC, clrBkOld );
- // }
- // }
- ::SelectObject( hDC, (HGDIOBJ)hBmpOld );
- ::DeleteDC( hDC );
- return hBmpSufrace;
- }
- void CExtPaintManager::stat_PrintChildren(
- HWND hWndStart,
- UINT nMessage,
- HDC hDC,
- LPARAM lParamPrint,
- bool bDeepTreeWalk, // = true
- CObject * pHelperSrc, // = NULL
- LPARAM lParam // = 0L
- )
- {
- ASSERT( hWndStart != NULL && ::IsWindow(hWndStart) );
- ASSERT( nMessage == WM_PRINT || nMessage == WM_PRINTCLIENT );
- ASSERT( hDC != NULL );
- ASSERT( (lParamPrint&PRF_CHILDREN) != 0 );
- CRect rcStartWnd, rcStartClient;
- ::GetWindowRect( hWndStart, &rcStartWnd );
- ::GetClientRect( hWndStart, &rcStartClient );
- ::ClientToScreen( hWndStart, ((LPPOINT)(&rcStartClient)) );
- ::ClientToScreen( hWndStart, ((LPPOINT)(&rcStartClient))+1 );
- CPoint ptStartNcOffset(
- rcStartWnd.left - rcStartClient.left,
- rcStartWnd.top - rcStartClient.top
- );
- if( (lParamPrint&PRF_NONCLIENT) != 0
- && ( ptStartNcOffset.x != 0
- || ptStartNcOffset.y != 0
- )
- )
- ::OffsetViewportOrgEx(
- hDC,
- -ptStartNcOffset.x,
- -ptStartNcOffset.y,
- NULL
- );
- HWND hWndChild = ::GetWindow( hWndStart, GW_CHILD );
- for( ; hWndChild != NULL; hWndChild = ::GetWindow( hWndChild, GW_HWNDNEXT ) )
- {
- __EXT_MFC_LONG_PTR dwChildStyle = ::__EXT_MFC_GetWindowLong( hWndChild, GWL_STYLE );
- if( (dwChildStyle&WS_VISIBLE) == 0 )
- continue;
- CRect rcChildWnd, rcChildClient;
- ::GetWindowRect( hWndChild, &rcChildWnd );
- ::GetClientRect( hWndChild, &rcChildClient );
- ::ClientToScreen( hWndChild, ((LPPOINT)(&rcChildClient)) );
- ::ClientToScreen( hWndChild, ((LPPOINT)(&rcChildClient))+1 );
- CPoint ptChildNcOffset(
- rcChildWnd.left - rcChildClient.left,
- rcChildWnd.top - rcChildClient.top
- );
- CPoint ptChildRenderOffset( 0, 0 );
- if( (lParamPrint&PRF_NONCLIENT) != 0 )
- {
- ptChildRenderOffset.x = rcStartClient.left - rcChildWnd.left;
- ptChildRenderOffset.y = rcStartClient.top - rcChildWnd.top;
- }
- else
- {
- ptChildRenderOffset.x = rcStartClient.left - rcChildClient.left;
- ptChildRenderOffset.y = rcStartClient.top - rcChildClient.top;
- }
- if( ptChildRenderOffset.x != 0
- || ptChildRenderOffset.y != 0
- )
- ::OffsetViewportOrgEx(
- hDC,
- -ptChildRenderOffset.x,
- -ptChildRenderOffset.y,
- NULL
- );
- ::SendMessage(
- hWndChild,
- nMessage,
- (WPARAM)hDC,
- lParamPrint
- );
- if( bDeepTreeWalk )
- stat_PrintChildren(
- hWndChild,
- nMessage,
- hDC,
- lParamPrint,
- bDeepTreeWalk,
- pHelperSrc,
- lParam
- );
- if( ptChildRenderOffset.x != 0
- || ptChildRenderOffset.y != 0
- )
- ::OffsetViewportOrgEx(
- hDC,
- ptChildRenderOffset.x,
- ptChildRenderOffset.y,
- NULL
- );
- } // for( ; hWndChild != NULL; hWndChild = ::GetWindow( hWndChild, GW_HWNDNEXT ) )
- if( (lParamPrint&PRF_NONCLIENT) != 0
- && ( ptStartNcOffset.x != 0
- || ptStartNcOffset.y != 0
- )
- )
- ::OffsetViewportOrgEx(
- hDC,
- ptStartNcOffset.x,
- ptStartNcOffset.y,
- NULL
- );
- }
- CExtPaintManager::SCROLLBARSKINDATA::SCROLLBARSKINDATA()
- {
- Empty();
- }
- CExtPaintManager::SCROLLBARSKINDATA::~SCROLLBARSKINDATA()
- {
- Empty();
- }
- void CExtPaintManager::SCROLLBARSKINDATA::Empty()
- {
- m_clrZsLineLightEnabled = COLORREF(-1L);
- m_clrZsLineDarkEnabled = COLORREF(-1L);
- m_clrZsLineLightDisabled = COLORREF(-1L);
- m_clrZsLineDarkDisabled = COLORREF(-1L);
- m_bmpEntireArea.Empty();
- m_rcEntirePaddingR.SetRect( 0, 0, 0, 0 );
- m_rcEntirePaddingC.SetRect( 0, 0, 0, 0 );
- INT i, j;
- for( i = 0; i < INT(__ESBSPT_PART_COUNT); i++ )
- {
- for( j = 0; j < INT(__ESBMHT_PART_COUNT); j++ )
- {
- CRect & rcPadding = m_arrPartPadding[i][j];
- rcPadding.SetRect( 0, 0, 0, 0 );
- CExtBitmap & _bmp = m_arrPartBmp[i][j];
- _bmp.Empty();
- m_arrClrSolidBackground[i][j] = COLORREF(-1L);
- }
- }
- }
- CExtBitmap & CExtPaintManager::SCROLLBARSKINDATA::GetPart(
- CExtPaintManager::e_scroll_bar_skin_part_t ePartState,
- CExtPaintManager::e_scroll_bar_mouse_hover_type_t eSBMHT, // part type
- RECT * pRectPadding, // = NULL
- COLORREF * pClrSolidBackground // = NULL
- )
- {
- CExtBitmap & _bmp =
- m_arrPartBmp
- [ INT(ePartState) ]
- [ INT(eSBMHT) ]
- ;
- COLORREF clrSolidBackground =
- m_arrClrSolidBackground
- [ INT(ePartState) ]
- [ INT(eSBMHT) ]
- ;
- if( pClrSolidBackground != NULL )
- (*pClrSolidBackground) = clrSolidBackground;
- if( pRectPadding != NULL )
- {
- const RECT & rcPadding =
- m_arrPartPadding
- [ INT(ePartState) ]
- [ INT(eSBMHT) ]
- ;
- ::CopyRect( pRectPadding, &rcPadding );
- } // if( pRectPadding != NULL )
- if( _bmp.IsEmpty() && INT(ePartState) > 0 )
- {
- return
- GetPart(
- (CExtPaintManager::e_scroll_bar_skin_part_t)(INT(ePartState)-1),
- eSBMHT,
- pRectPadding,
- ( clrSolidBackground == COLORREF(-1L) )
- ? pClrSolidBackground
- : NULL
- );
- } // if( _bmp.IsEmpty() && INT(ePartState) > 0 )
- return _bmp;
- }
- const CExtBitmap & CExtPaintManager::SCROLLBARSKINDATA::GetPart(
- CExtPaintManager::e_scroll_bar_skin_part_t ePartState,
- CExtPaintManager::e_scroll_bar_mouse_hover_type_t eSBMHT, // part type
- RECT * pRectPadding, // = NULL
- COLORREF * pClrSolidBackground // = NULL
- ) const
- {
- return
- ( const_cast < SCROLLBARSKINDATA * > ( this ) )
- -> GetPart( ePartState, eSBMHT, pRectPadding, pClrSolidBackground );
- }
- void CExtPaintManager::SCROLLBARSKINDATA::Load2007_R2(
- UINT nResourceID_BumpyGlyphStack,
- INT nBumpyGlyphStackItemHeight,
- UINT nResourceID_GripperStack,
- INT nGripperStackItemHeight,
- const RECT & rcBumpyGlyphStackItemPadding,
- COLORREF clrSolidBackground,
- COLORREF clrPressedPageAreas,
- UINT nResourceID_ArrowUp_Normal,
- UINT nResourceID_ArrowUp_Disabled,
- UINT nResourceID_ArrowDown_Normal,
- UINT nResourceID_ArrowDown_Disabled,
- bool bRotateArrowsAndBk270,
- UINT nResourceID_BkEntire,
- UINT nResourceID_BkPage,
- const RECT & rcEntirePaddingR,
- const RECT & rcEntirePaddingC
- )
- {
- Empty();
- INT i, j;
- for( i = 0; i < INT(__ESBSPT_PART_COUNT); i++ )
- {
- for( j = 0; j < INT(__ESBMHT_PART_COUNT); j++ )
- {
- CRect & rcPadding = m_arrPartPadding[i][j];
- rcPadding.SetRect( 0, 0, 0, 0 );
- CExtBitmap & _bmp = m_arrPartBmp[i][j];
- _bmp.Empty();
- m_arrClrSolidBackground[i][j] = clrSolidBackground;
- if( ( j == INT(__ESBMHT_PAGE_UP) || j == INT(__ESBMHT_PAGE_DOWN) )
- && i == INT(__ESBSPT_PRESSED)
- )
- m_arrClrSolidBackground[i][j] = clrPressedPageAreas;
- }
- }
- CExtBitmap _bmpBumpyGlyphStack, _bmpGripperStack;
- VERIFY( _bmpBumpyGlyphStack.LoadBMP_Resource( MAKEINTRESOURCE(nResourceID_BumpyGlyphStack) ) );
- VERIFY( _bmpGripperStack.LoadBMP_Resource( MAKEINTRESOURCE(nResourceID_GripperStack) ) );
- _bmpBumpyGlyphStack.PreMultipliedRGBChannelsSet( true );
- _bmpGripperStack.PreMultipliedRGBChannelsSet( true );
- CSize _sizeBumpyGlyph = _bmpBumpyGlyphStack.GetSize();
- CSize _sizeGripper = _bmpGripperStack.GetSize();
- CRect rcBumpyGlyph( 0, 0, _sizeBumpyGlyph.cx, nBumpyGlyphStackItemHeight );
- CRect rcGripper( 0, 0, _sizeGripper.cx, nGripperStackItemHeight );
- // cold parts
- VERIFY(
- m_arrPartBmp[INT(__ESBSPT_COLD)][INT(__ESBMHT_THUMB)].
- FromBitmap( _bmpBumpyGlyphStack, rcBumpyGlyph )
- );
- m_arrPartPadding[INT(__ESBSPT_COLD)][INT(__ESBMHT_THUMB)] = rcBumpyGlyphStackItemPadding;
- VERIFY(
- m_arrPartBmp[INT(__ESBSPT_COLD)][INT(__ESBMHT_GLYPH_THUMB_GRIPPER)].
- FromBitmap( _bmpGripperStack, rcGripper )
- );
- // normal parts
- VERIFY(
- m_arrPartBmp[INT(__ESBSPT_NORMAL)][INT(__ESBMHT_BUTTON_UP)].
- FromBitmap( _bmpBumpyGlyphStack, rcBumpyGlyph )
- );
- m_arrPartPadding[INT(__ESBSPT_NORMAL)][INT(__ESBMHT_BUTTON_UP)] = rcBumpyGlyphStackItemPadding;
- VERIFY(
- m_arrPartBmp[INT(__ESBSPT_NORMAL)][INT(__ESBMHT_BUTTON_DOWN)].
- FromBitmap( _bmpBumpyGlyphStack, rcBumpyGlyph )
- );
- m_arrPartPadding[INT(__ESBSPT_NORMAL)][INT(__ESBMHT_BUTTON_DOWN)] = rcBumpyGlyphStackItemPadding;
- // hot parts
- rcBumpyGlyph.OffsetRect( 0, nBumpyGlyphStackItemHeight );
- rcGripper.OffsetRect( 0, nGripperStackItemHeight );
- VERIFY(
- m_arrPartBmp[INT(__ESBSPT_HOT)][INT(__ESBMHT_BUTTON_UP)].
- FromBitmap( _bmpBumpyGlyphStack, rcBumpyGlyph )
- );
- m_arrPartPadding[INT(__ESBSPT_HOT)][INT(__ESBMHT_BUTTON_UP)] = rcBumpyGlyphStackItemPadding;
- VERIFY(
- m_arrPartBmp[INT(__ESBSPT_HOT)][INT(__ESBMHT_BUTTON_DOWN)].
- FromBitmap( _bmpBumpyGlyphStack, rcBumpyGlyph )
- );
- m_arrPartPadding[INT(__ESBSPT_HOT)][INT(__ESBMHT_BUTTON_DOWN)] = rcBumpyGlyphStackItemPadding;
- VERIFY(
- m_arrPartBmp[INT(__ESBSPT_HOT)][INT(__ESBMHT_THUMB)].
- FromBitmap( _bmpBumpyGlyphStack, rcBumpyGlyph )
- );
- m_arrPartPadding[INT(__ESBSPT_HOT)][INT(__ESBMHT_THUMB)] = rcBumpyGlyphStackItemPadding;
- VERIFY(
- m_arrPartBmp[INT(__ESBSPT_HOT)][INT(__ESBMHT_GLYPH_THUMB_GRIPPER)].
- FromBitmap( _bmpGripperStack, rcGripper )
- );
- // pressed parts
- rcBumpyGlyph.OffsetRect( 0, nBumpyGlyphStackItemHeight );
- rcGripper.OffsetRect( 0, nGripperStackItemHeight );
- VERIFY(
- m_arrPartBmp[INT(__ESBSPT_PRESSED)][INT(__ESBMHT_BUTTON_UP)].
- FromBitmap( _bmpBumpyGlyphStack, rcBumpyGlyph )
- );
- m_arrPartPadding[INT(__ESBSPT_PRESSED)][INT(__ESBMHT_BUTTON_UP)] = rcBumpyGlyphStackItemPadding;
- VERIFY(
- m_arrPartBmp[INT(__ESBSPT_PRESSED)][INT(__ESBMHT_BUTTON_DOWN)].
- FromBitmap( _bmpBumpyGlyphStack, rcBumpyGlyph )
- );
- m_arrPartPadding[INT(__ESBSPT_PRESSED)][INT(__ESBMHT_BUTTON_DOWN)] = rcBumpyGlyphStackItemPadding;
- VERIFY(
- m_arrPartBmp[INT(__ESBSPT_PRESSED)][INT(__ESBMHT_THUMB)].
- FromBitmap( _bmpBumpyGlyphStack, rcBumpyGlyph )
- );
- m_arrPartPadding[INT(__ESBSPT_PRESSED)][INT(__ESBMHT_THUMB)] = rcBumpyGlyphStackItemPadding;
- VERIFY(
- m_arrPartBmp[INT(__ESBSPT_PRESSED)][INT(__ESBMHT_GLYPH_THUMB_GRIPPER)].
- FromBitmap( _bmpGripperStack, rcGripper )
- );
- // arrows
- CExtBitmap _bmpArrowUpNormal, _bmpArrowUpDisabled, _bmpArrowDownNormal, _bmpArrowDownDisabled;
- VERIFY( _bmpArrowUpNormal.LoadBMP_Resource( MAKEINTRESOURCE(nResourceID_ArrowUp_Normal) ) );
- VERIFY( _bmpArrowUpDisabled.LoadBMP_Resource( MAKEINTRESOURCE(nResourceID_ArrowUp_Disabled) ) );
- VERIFY( _bmpArrowDownNormal.LoadBMP_Resource( MAKEINTRESOURCE(nResourceID_ArrowDown_Normal) ) );
- VERIFY( _bmpArrowDownDisabled.LoadBMP_Resource( MAKEINTRESOURCE(nResourceID_ArrowDown_Disabled) ) );
- _bmpArrowUpNormal.PreMultipliedRGBChannelsSet( true );
- _bmpArrowUpDisabled.PreMultipliedRGBChannelsSet( true );
- _bmpArrowDownNormal.PreMultipliedRGBChannelsSet( true );
- _bmpArrowDownDisabled.PreMultipliedRGBChannelsSet( true );
- CSize _sizeArrowUpNormal = _bmpArrowUpNormal.GetSize();
- CSize _sizeArrowUpDisabled = _bmpArrowUpDisabled.GetSize();
- CSize _sizeArrowDownNormal = _bmpArrowDownNormal.GetSize();
- CSize _sizeArrowDownDisabled = _bmpArrowDownDisabled.GetSize();
- VERIFY(
- m_arrPartBmp[INT(__ESBSPT_COLD)][INT(__ESBMHT_GLYPH_ARROW_UP)].
- CreateRotated9xStack(
- _bmpArrowUpNormal,
- bRotateArrowsAndBk270 ? 270 : 0,
- 1,
- _sizeArrowUpNormal.cx,
- _sizeArrowUpNormal.cy,
- false,
- false
- )
- );
- VERIFY(
- m_arrPartBmp[INT(__ESBSPT_DISABLED)][INT(__ESBMHT_GLYPH_ARROW_UP)].
- CreateRotated9xStack(
- _bmpArrowUpDisabled,
- bRotateArrowsAndBk270 ? 270 : 0,
- 1,
- _sizeArrowUpDisabled.cx,
- _sizeArrowUpDisabled.cy,
- false,
- false
- )
- );
- VERIFY(
- m_arrPartBmp[INT(__ESBSPT_COLD)][INT(__ESBMHT_GLYPH_ARROW_DOWN)].
- CreateRotated9xStack(
- _bmpArrowDownNormal,
- bRotateArrowsAndBk270 ? 270 : 0,
- 1,
- _sizeArrowDownNormal.cx,
- _sizeArrowDownNormal.cy,
- false,
- false
- )
- );
- VERIFY(
- m_arrPartBmp[INT(__ESBSPT_DISABLED)][INT(__ESBMHT_GLYPH_ARROW_DOWN)].
- CreateRotated9xStack(
- _bmpArrowDownDisabled,
- bRotateArrowsAndBk270 ? 270 : 0,
- 1,
- _sizeArrowDownDisabled.cx,
- _sizeArrowDownDisabled.cy,
- false,
- false
- )
- );
- // backgrounds
- CExtBitmap _bmpBkEntire, _bmpBkPage;
- VERIFY( _bmpBkEntire.LoadBMP_Resource( MAKEINTRESOURCE(nResourceID_BkEntire) ) );
- VERIFY( _bmpBkPage.LoadBMP_Resource( MAKEINTRESOURCE(nResourceID_BkPage) ) );
- _bmpBkEntire.PreMultipliedRGBChannelsSet( true );
- _bmpBkPage.PreMultipliedRGBChannelsSet( true );
- CSize _sizeBkEntire = _bmpBkEntire.GetSize();
- CSize _sizeBkPage = _bmpBkPage.GetSize();
- VERIFY(
- m_bmpEntireArea.
- CreateRotated9xStack(
- _bmpBkEntire,
- bRotateArrowsAndBk270 ? 270 : 0,
- 1,
- _sizeBkEntire.cx,
- _sizeBkEntire.cy,
- false,
- false
- )
- );
- VERIFY(
- m_arrPartBmp[INT(__ESBSPT_PRESSED)][INT(__ESBMHT_PAGE_DOWN)].
- CreateRotated9xStack(
- _bmpBkPage,
- bRotateArrowsAndBk270 ? 270 : 0,
- 1,
- _sizeBkPage.cx,
- _sizeBkPage.cy,
- false,
- false
- )
- );
- VERIFY(
- m_arrPartBmp[INT(__ESBSPT_PRESSED)][INT(__ESBMHT_PAGE_UP)].AssignFromOther(
- m_arrPartBmp[INT(__ESBSPT_PRESSED)][INT(__ESBMHT_PAGE_DOWN)]
- )
- );
- m_rcEntirePaddingR = rcEntirePaddingR;
- m_rcEntirePaddingC = rcEntirePaddingC;
- }
- void CExtPaintManager::SCROLLBARSKINDATA::Load2007_Zoom(
- UINT nResourceID_ButtonPlus,
- UINT nResourceID_ButtonMinus,
- UINT nResourceID_ButtonThumb,
- COLORREF clrZsLineLightEnabled,
- COLORREF clrZsLineDarkEnabled,
- COLORREF clrZsLineLightDisabled,
- COLORREF clrZsLineDarkDisabled,
- UINT nDockID,
- bool bResourceColorChannelsPreMultiplied // = true
- )
- {
- Empty();
- ASSERT(
- nDockID == AFX_IDW_DOCKBAR_TOP
- || nDockID == AFX_IDW_DOCKBAR_BOTTOM
- || nDockID == AFX_IDW_DOCKBAR_LEFT
- || nDockID == AFX_IDW_DOCKBAR_RIGHT
- );
- INT nAngleCw90 = 0;
- if( nDockID == AFX_IDW_DOCKBAR_BOTTOM )
- nAngleCw90 = 180;
- else if( nDockID == AFX_IDW_DOCKBAR_LEFT )
- nAngleCw90 = 270;
- else if( nDockID == AFX_IDW_DOCKBAR_RIGHT )
- nAngleCw90 = 90;
- INT i, j;
- for( i = 0; i < INT(__ESBSPT_PART_COUNT); i++ )
- {
- for( j = 0; j < INT(__ESBMHT_PART_COUNT); j++ )
- {
- CRect & rcPadding = m_arrPartPadding[i][j];
- rcPadding.SetRect( 0, 0, 0, 0 );
- CExtBitmap & _bmp = m_arrPartBmp[i][j];
- _bmp.Empty();
- m_arrClrSolidBackground[i][j] = COLORREF(-1L);
- }
- }
- m_clrZsLineLightEnabled = clrZsLineLightEnabled;
- m_clrZsLineDarkEnabled = clrZsLineDarkEnabled;
- m_clrZsLineLightDisabled = clrZsLineLightDisabled;
- m_clrZsLineDarkDisabled = clrZsLineDarkDisabled;
- CRect rcGlyph;
- CExtBitmap _bmpGlyphStack;
- VERIFY( _bmpGlyphStack.LoadBMP_Resource( MAKEINTRESOURCE(nResourceID_ButtonPlus) ) );
- _bmpGlyphStack.PreMultipliedRGBChannelsSet( bResourceColorChannelsPreMultiplied );
- rcGlyph.SetRect( 0, 0, _bmpGlyphStack.GetSize().cx, _bmpGlyphStack.GetSize().cy / 3 );
- VERIFY( m_arrPartBmp[INT(__ESBSPT_NORMAL)][INT(__ESBMHT_BUTTON_DOWN)].FromBitmap( _bmpGlyphStack, rcGlyph ) );
- m_arrPartBmp[INT(__ESBSPT_COLD)][INT(__ESBMHT_BUTTON_DOWN)] = m_arrPartBmp[INT(__ESBSPT_NORMAL)][INT(__ESBMHT_BUTTON_DOWN)];
- m_arrPartBmp[INT(__ESBSPT_DISABLED)][INT(__ESBMHT_BUTTON_DOWN)] = m_arrPartBmp[INT(__ESBSPT_NORMAL)][INT(__ESBMHT_BUTTON_DOWN)];
- m_arrPartBmp[INT(__ESBSPT_DISABLED)][INT(__ESBMHT_BUTTON_DOWN)].MakeMono();
- m_arrPartBmp[INT(__ESBSPT_DISABLED)][INT(__ESBMHT_BUTTON_DOWN)].AdjustAlpha( -0.25 );
- rcGlyph.OffsetRect( 0, rcGlyph.Height() );
- VERIFY( m_arrPartBmp[INT(__ESBSPT_HOT)][INT(__ESBMHT_BUTTON_DOWN)].FromBitmap( _bmpGlyphStack, rcGlyph ) );
- rcGlyph.OffsetRect( 0, rcGlyph.Height() );
- VERIFY( m_arrPartBmp[INT(__ESBSPT_PRESSED)][INT(__ESBMHT_BUTTON_DOWN)].FromBitmap( _bmpGlyphStack, rcGlyph ) );
- VERIFY( _bmpGlyphStack.LoadBMP_Resource( MAKEINTRESOURCE(nResourceID_ButtonMinus) ) );
- _bmpGlyphStack.PreMultipliedRGBChannelsSet( bResourceColorChannelsPreMultiplied );
- rcGlyph.SetRect( 0, 0, _bmpGlyphStack.GetSize().cx, _bmpGlyphStack.GetSize().cy / 3 );
- VERIFY( m_arrPartBmp[INT(__ESBSPT_NORMAL)][INT(__ESBMHT_BUTTON_UP)].FromBitmap( _bmpGlyphStack, rcGlyph ) );
- m_arrPartBmp[INT(__ESBSPT_COLD)][INT(__ESBMHT_BUTTON_UP)] = m_arrPartBmp[INT(__ESBSPT_NORMAL)][INT(__ESBMHT_BUTTON_UP)];
- m_arrPartBmp[INT(__ESBSPT_DISABLED)][INT(__ESBMHT_BUTTON_UP)] = m_arrPartBmp[INT(__ESBSPT_NORMAL)][INT(__ESBMHT_BUTTON_UP)];
- m_arrPartBmp[INT(__ESBSPT_DISABLED)][INT(__ESBMHT_BUTTON_UP)].MakeMono();
- m_arrPartBmp[INT(__ESBSPT_DISABLED)][INT(__ESBMHT_BUTTON_UP)].AdjustAlpha( -0.25 );
- rcGlyph.OffsetRect( 0, rcGlyph.Height() );
- VERIFY( m_arrPartBmp[INT(__ESBSPT_HOT)][INT(__ESBMHT_BUTTON_UP)].FromBitmap( _bmpGlyphStack, rcGlyph ) );
- rcGlyph.OffsetRect( 0, rcGlyph.Height() );
- VERIFY( m_arrPartBmp[INT(__ESBSPT_PRESSED)][INT(__ESBMHT_BUTTON_UP)].FromBitmap( _bmpGlyphStack, rcGlyph ) );
- VERIFY( _bmpGlyphStack.LoadBMP_Resource( MAKEINTRESOURCE(nResourceID_ButtonThumb) ) );
- _bmpGlyphStack.PreMultipliedRGBChannelsSet( bResourceColorChannelsPreMultiplied );
- rcGlyph.SetRect( 0, 0, _bmpGlyphStack.GetSize().cx, _bmpGlyphStack.GetSize().cy / 3 );
- VERIFY( m_arrPartBmp[INT(__ESBSPT_NORMAL)][INT(__ESBMHT_THUMB)].FromBitmap( _bmpGlyphStack, rcGlyph ) );
- m_arrPartBmp[INT(__ESBSPT_COLD)][INT(__ESBMHT_THUMB)] = m_arrPartBmp[INT(__ESBSPT_NORMAL)][INT(__ESBMHT_THUMB)];
- m_arrPartBmp[INT(__ESBSPT_DISABLED)][INT(__ESBMHT_THUMB)] = m_arrPartBmp[INT(__ESBSPT_NORMAL)][INT(__ESBMHT_THUMB)];
- m_arrPartBmp[INT(__ESBSPT_DISABLED)][INT(__ESBMHT_THUMB)].MakeMono();
- m_arrPartBmp[INT(__ESBSPT_DISABLED)][INT(__ESBMHT_THUMB)].AdjustAlpha( -0.25 );
- rcGlyph.OffsetRect( 0, rcGlyph.Height() );
- VERIFY( m_arrPartBmp[INT(__ESBSPT_HOT)][INT(__ESBMHT_THUMB)].FromBitmap( _bmpGlyphStack, rcGlyph ) );
- rcGlyph.OffsetRect( 0, rcGlyph.Height() );
- VERIFY( m_arrPartBmp[INT(__ESBSPT_PRESSED)][INT(__ESBMHT_THUMB)].FromBitmap( _bmpGlyphStack, rcGlyph ) );
- if( nAngleCw90 != 0 )
- {
- for( i = 0; i < INT(__ESBSPT_PART_COUNT); i++ )
- {
- CExtBitmap & _bmp1 = m_arrPartBmp[i][__ESBMHT_THUMB];
- if( _bmp1.IsEmpty() )
- continue;
- CExtBitmap _bmp2;
- VERIFY( _bmp2.CreateRotated9xStack( _bmp1, nAngleCw90, 1, _bmp1.GetSize().cx, _bmp1.GetSize().cy, false, false ) );
- _bmp1 = _bmp2;
- }
- }
- }
- void CExtPaintManager::SCROLLBARSKINDATA::Load2010_Zoom_R1(
- UINT nResourceID_ButtonPlus,
- UINT nResourceID_ButtonMinus,
- UINT nResourceID_ButtonThumb,
- COLORREF clrZsLineLightEnabled,
- COLORREF clrZsLineDarkEnabled,
- COLORREF clrZsLineLightDisabled,
- COLORREF clrZsLineDarkDisabled,
- UINT nDockID,
- bool bResourceColorChannelsPreMultiplied // = true
- )
- {
- Empty();
- ASSERT(
- nDockID == AFX_IDW_DOCKBAR_TOP
- || nDockID == AFX_IDW_DOCKBAR_BOTTOM
- || nDockID == AFX_IDW_DOCKBAR_LEFT
- || nDockID == AFX_IDW_DOCKBAR_RIGHT
- );
- INT nAngleCw90 = 0;
- if( nDockID == AFX_IDW_DOCKBAR_BOTTOM )
- nAngleCw90 = 180;
- else if( nDockID == AFX_IDW_DOCKBAR_LEFT )
- nAngleCw90 = 270;
- else if( nDockID == AFX_IDW_DOCKBAR_RIGHT )
- nAngleCw90 = 90;
- INT i, j;
- for( i = 0; i < INT(__ESBSPT_PART_COUNT); i++ )
- {
- for( j = 0; j < INT(__ESBMHT_PART_COUNT); j++ )
- {
- CRect & rcPadding = m_arrPartPadding[i][j];
- rcPadding.SetRect( 0, 0, 0, 0 );
- CExtBitmap & _bmp = m_arrPartBmp[i][j];
- _bmp.Empty();
- m_arrClrSolidBackground[i][j] = COLORREF(-1L);
- }
- }
- m_clrZsLineLightEnabled = clrZsLineLightEnabled;
- m_clrZsLineDarkEnabled = clrZsLineDarkEnabled;
- m_clrZsLineLightDisabled = clrZsLineLightDisabled;
- m_clrZsLineDarkDisabled = clrZsLineDarkDisabled;
- CRect rcGlyph;
- CExtBitmap _bmpGlyphStack;
- VERIFY( _bmpGlyphStack.LoadBMP_Resource( MAKEINTRESOURCE(nResourceID_ButtonPlus) ) );
- _bmpGlyphStack.PreMultipliedRGBChannelsSet( bResourceColorChannelsPreMultiplied );
- rcGlyph.SetRect( 0, 0, _bmpGlyphStack.GetSize().cx, _bmpGlyphStack.GetSize().cy / 3 );
- VERIFY( m_arrPartBmp[INT(__ESBSPT_NORMAL)][INT(__ESBMHT_BUTTON_DOWN)].FromBitmap( _bmpGlyphStack, rcGlyph ) );
- m_arrPartBmp[INT(__ESBSPT_NORMAL)][INT(__ESBMHT_BUTTON_DOWN)].MakeMono();
- m_arrPartBmp[INT(__ESBSPT_COLD)][INT(__ESBMHT_BUTTON_DOWN)] = m_arrPartBmp[INT(__ESBSPT_NORMAL)][INT(__ESBMHT_BUTTON_DOWN)];
- m_arrPartBmp[INT(__ESBSPT_DISABLED)][INT(__ESBMHT_BUTTON_DOWN)] = m_arrPartBmp[INT(__ESBSPT_NORMAL)][INT(__ESBMHT_BUTTON_DOWN)];
- m_arrPartBmp[INT(__ESBSPT_DISABLED)][INT(__ESBMHT_BUTTON_DOWN)].MakeMono();
- m_arrPartBmp[INT(__ESBSPT_DISABLED)][INT(__ESBMHT_BUTTON_DOWN)].AdjustAlpha( -0.25 );
- //rcGlyph.OffsetRect( 0, rcGlyph.Height() );
- VERIFY( m_arrPartBmp[INT(__ESBSPT_HOT)][INT(__ESBMHT_BUTTON_DOWN)].FromBitmap( _bmpGlyphStack, rcGlyph ) );
- rcGlyph.OffsetRect( 0, rcGlyph.Height() );
- VERIFY( m_arrPartBmp[INT(__ESBSPT_PRESSED)][INT(__ESBMHT_BUTTON_DOWN)].FromBitmap( _bmpGlyphStack, rcGlyph ) );
- VERIFY( _bmpGlyphStack.LoadBMP_Resource( MAKEINTRESOURCE(nResourceID_ButtonMinus) ) );
- _bmpGlyphStack.PreMultipliedRGBChannelsSet( bResourceColorChannelsPreMultiplied );
- rcGlyph.SetRect( 0, 0, _bmpGlyphStack.GetSize().cx, _bmpGlyphStack.GetSize().cy / 3 );
- VERIFY( m_arrPartBmp[INT(__ESBSPT_NORMAL)][INT(__ESBMHT_BUTTON_UP)].FromBitmap( _bmpGlyphStack, rcGlyph ) );
- m_arrPartBmp[INT(__ESBSPT_NORMAL)][INT(__ESBMHT_BUTTON_UP)].MakeMono();
- m_arrPartBmp[INT(__ESBSPT_COLD)][INT(__ESBMHT_BUTTON_UP)] = m_arrPartBmp[INT(__ESBSPT_NORMAL)][INT(__ESBMHT_BUTTON_UP)];
- m_arrPartBmp[INT(__ESBSPT_DISABLED)][INT(__ESBMHT_BUTTON_UP)] = m_arrPartBmp[INT(__ESBSPT_NORMAL)][INT(__ESBMHT_BUTTON_UP)];
- m_arrPartBmp[INT(__ESBSPT_DISABLED)][INT(__ESBMHT_BUTTON_UP)].MakeMono();
- m_arrPartBmp[INT(__ESBSPT_DISABLED)][INT(__ESBMHT_BUTTON_UP)].AdjustAlpha( -0.25 );
- //rcGlyph.OffsetRect( 0, rcGlyph.Height() );
- VERIFY( m_arrPartBmp[INT(__ESBSPT_HOT)][INT(__ESBMHT_BUTTON_UP)].FromBitmap( _bmpGlyphStack, rcGlyph ) );
- rcGlyph.OffsetRect( 0, rcGlyph.Height() );
- VERIFY( m_arrPartBmp[INT(__ESBSPT_PRESSED)][INT(__ESBMHT_BUTTON_UP)].FromBitmap( _bmpGlyphStack, rcGlyph ) );
- VERIFY( _bmpGlyphStack.LoadBMP_Resource( MAKEINTRESOURCE(nResourceID_ButtonThumb) ) );
- _bmpGlyphStack.PreMultipliedRGBChannelsSet( bResourceColorChannelsPreMultiplied );
- rcGlyph.SetRect( 0, 0, _bmpGlyphStack.GetSize().cx, _bmpGlyphStack.GetSize().cy / 2 /*3*/ );
- VERIFY( m_arrPartBmp[INT(__ESBSPT_NORMAL)][INT(__ESBMHT_THUMB)].FromBitmap( _bmpGlyphStack, rcGlyph ) );
- m_arrPartBmp[INT(__ESBSPT_NORMAL)][INT(__ESBMHT_THUMB)].MakeMono();
- m_arrPartBmp[INT(__ESBSPT_COLD)][INT(__ESBMHT_THUMB)] = m_arrPartBmp[INT(__ESBSPT_NORMAL)][INT(__ESBMHT_THUMB)];
- m_arrPartBmp[INT(__ESBSPT_DISABLED)][INT(__ESBMHT_THUMB)] = m_arrPartBmp[INT(__ESBSPT_NORMAL)][INT(__ESBMHT_THUMB)];
- m_arrPartBmp[INT(__ESBSPT_DISABLED)][INT(__ESBMHT_THUMB)].MakeMono();
- m_arrPartBmp[INT(__ESBSPT_DISABLED)][INT(__ESBMHT_THUMB)].AdjustAlpha( -0.25 );
- //rcGlyph.OffsetRect( 0, rcGlyph.Height() );
- VERIFY( m_arrPartBmp[INT(__ESBSPT_HOT)][INT(__ESBMHT_THUMB)].FromBitmap( _bmpGlyphStack, rcGlyph ) );
- rcGlyph.OffsetRect( 0, rcGlyph.Height() );
- VERIFY( m_arrPartBmp[INT(__ESBSPT_PRESSED)][INT(__ESBMHT_THUMB)].FromBitmap( _bmpGlyphStack, rcGlyph ) );
- if( nAngleCw90 != 0 )
- {
- for( i = 0; i < INT(__ESBSPT_PART_COUNT); i++ )
- {
- CExtBitmap & _bmp1 = m_arrPartBmp[i][__ESBMHT_THUMB];
- if( _bmp1.IsEmpty() )
- continue;
- CExtBitmap _bmp2;
- VERIFY( _bmp2.CreateRotated9xStack( _bmp1, nAngleCw90, 1, _bmp1.GetSize().cx, _bmp1.GetSize().cy, false, false ) );
- _bmp1 = _bmp2;
- }
- }
- }
- void CExtPaintManager::SCROLLBARSKINDATA::Load2010_Zoom_R2(
- UINT nResourceID_ButtonPlus,
- UINT nResourceID_ButtonMinus,
- UINT nResourceID_ButtonThumb,
- COLORREF clrZsLineLightEnabled,
- COLORREF clrZsLineDarkEnabled,
- COLORREF clrZsLineLightDisabled,
- COLORREF clrZsLineDarkDisabled,
- UINT nDockID,
- bool bResourceColorChannelsPreMultiplied // = true
- )
- {
- Empty();
- ASSERT(
- nDockID == AFX_IDW_DOCKBAR_TOP
- || nDockID == AFX_IDW_DOCKBAR_BOTTOM
- || nDockID == AFX_IDW_DOCKBAR_LEFT
- || nDockID == AFX_IDW_DOCKBAR_RIGHT
- );
- INT nAngleCw90 = 0;
- if( nDockID == AFX_IDW_DOCKBAR_BOTTOM )
- nAngleCw90 = 180;
- else if( nDockID == AFX_IDW_DOCKBAR_LEFT )
- nAngleCw90 = 270;
- else if( nDockID == AFX_IDW_DOCKBAR_RIGHT )
- nAngleCw90 = 90;
- INT i, j;
- for( i = 0; i < INT(__ESBSPT_PART_COUNT); i++ )
- {
- for( j = 0; j < INT(__ESBMHT_PART_COUNT); j++ )
- {
- CRect & rcPadding = m_arrPartPadding[i][j];
- rcPadding.SetRect( 0, 0, 0, 0 );
- CExtBitmap & _bmp = m_arrPartBmp[i][j];
- _bmp.Empty();
- m_arrClrSolidBackground[i][j] = COLORREF(-1L);
- }
- }
- m_clrZsLineLightEnabled = clrZsLineLightEnabled;
- m_clrZsLineDarkEnabled = clrZsLineDarkEnabled;
- m_clrZsLineLightDisabled = clrZsLineLightDisabled;
- m_clrZsLineDarkDisabled = clrZsLineDarkDisabled;
- CExtBitmap _bmpGlyphStack;
- VERIFY( _bmpGlyphStack.LoadBMP_Resource( MAKEINTRESOURCE(nResourceID_ButtonPlus) ) );
- _bmpGlyphStack.PreMultipliedRGBChannelsSet( bResourceColorChannelsPreMultiplied );
- CSize sizeStack = _bmpGlyphStack.GetSize();
- CSize sizeGryph( sizeStack.cx, sizeStack.cy / 3 );
- CRect rc1( 0, 0, sizeGryph.cx, sizeGryph.cy );
- CRect rc2 = rc1; rc2.OffsetRect( 0, sizeGryph.cy );
- CRect rc3 = rc2; rc3.OffsetRect( 0, sizeGryph.cy );
- VERIFY( m_arrPartBmp[INT(__ESBSPT_NORMAL)][INT(__ESBMHT_BUTTON_DOWN)].FromBitmap( _bmpGlyphStack, rc3 ) );
- //m_arrPartBmp[INT(__ESBSPT_NORMAL)][INT(__ESBMHT_BUTTON_DOWN)].MakeMono();
- m_arrPartBmp[INT(__ESBSPT_COLD)][INT(__ESBMHT_BUTTON_DOWN)] = m_arrPartBmp[INT(__ESBSPT_NORMAL)][INT(__ESBMHT_BUTTON_DOWN)];
- m_arrPartBmp[INT(__ESBSPT_DISABLED)][INT(__ESBMHT_BUTTON_DOWN)] = m_arrPartBmp[INT(__ESBSPT_NORMAL)][INT(__ESBMHT_BUTTON_DOWN)];
- m_arrPartBmp[INT(__ESBSPT_DISABLED)][INT(__ESBMHT_BUTTON_DOWN)].MakeMono();
- m_arrPartBmp[INT(__ESBSPT_DISABLED)][INT(__ESBMHT_BUTTON_DOWN)].AdjustAlpha( -0.25 );
- VERIFY( m_arrPartBmp[INT(__ESBSPT_HOT)][INT(__ESBMHT_BUTTON_DOWN)].FromBitmap( _bmpGlyphStack, rc1 ) );
- VERIFY( m_arrPartBmp[INT(__ESBSPT_PRESSED)][INT(__ESBMHT_BUTTON_DOWN)].FromBitmap( _bmpGlyphStack, rc2 ) );
- VERIFY( _bmpGlyphStack.LoadBMP_Resource( MAKEINTRESOURCE(nResourceID_ButtonMinus) ) );
- _bmpGlyphStack.PreMultipliedRGBChannelsSet( bResourceColorChannelsPreMultiplied );
- sizeStack = _bmpGlyphStack.GetSize();
- sizeGryph.cx = sizeStack.cx; sizeGryph.cy = sizeStack.cy / 3;
- rc1.SetRect( 0, 0, sizeGryph.cx, sizeGryph.cy );
- rc2 = rc1; rc2.OffsetRect( 0, sizeGryph.cy );
- rc3 = rc2; rc3.OffsetRect( 0, sizeGryph.cy );
- VERIFY( m_arrPartBmp[INT(__ESBSPT_NORMAL)][INT(__ESBMHT_BUTTON_UP)].FromBitmap( _bmpGlyphStack, rc3 ) );
- //m_arrPartBmp[INT(__ESBSPT_NORMAL)][INT(__ESBMHT_BUTTON_UP)].MakeMono();
- m_arrPartBmp[INT(__ESBSPT_COLD)][INT(__ESBMHT_BUTTON_UP)] = m_arrPartBmp[INT(__ESBSPT_NORMAL)][INT(__ESBMHT_BUTTON_UP)];
- m_arrPartBmp[INT(__ESBSPT_DISABLED)][INT(__ESBMHT_BUTTON_UP)] = m_arrPartBmp[INT(__ESBSPT_NORMAL)][INT(__ESBMHT_BUTTON_UP)];
- m_arrPartBmp[INT(__ESBSPT_DISABLED)][INT(__ESBMHT_BUTTON_UP)].MakeMono();
- m_arrPartBmp[INT(__ESBSPT_DISABLED)][INT(__ESBMHT_BUTTON_UP)].AdjustAlpha( -0.25 );
- VERIFY( m_arrPartBmp[INT(__ESBSPT_HOT)][INT(__ESBMHT_BUTTON_UP)].FromBitmap( _bmpGlyphStack, rc1 ) );
- VERIFY( m_arrPartBmp[INT(__ESBSPT_PRESSED)][INT(__ESBMHT_BUTTON_UP)].FromBitmap( _bmpGlyphStack, rc2 ) );
- VERIFY( _bmpGlyphStack.LoadBMP_Resource( MAKEINTRESOURCE(nResourceID_ButtonThumb) ) );
- _bmpGlyphStack.PreMultipliedRGBChannelsSet( bResourceColorChannelsPreMultiplied );
- sizeStack = _bmpGlyphStack.GetSize();
- sizeGryph.cx = sizeStack.cx; sizeGryph.cy = sizeStack.cy / 3;
- rc1.SetRect( 0, 0, sizeGryph.cx, sizeGryph.cy );
- rc2 = rc1; rc2.OffsetRect( 0, sizeGryph.cy );
- rc3 = rc2; rc3.OffsetRect( 0, sizeGryph.cy );
- VERIFY( m_arrPartBmp[INT(__ESBSPT_NORMAL)][INT(__ESBMHT_THUMB)].FromBitmap( _bmpGlyphStack, rc1 ) );
- //m_arrPartBmp[INT(__ESBSPT_NORMAL)][INT(__ESBMHT_THUMB)].MakeMono();
- m_arrPartBmp[INT(__ESBSPT_COLD)][INT(__ESBMHT_THUMB)] = m_arrPartBmp[INT(__ESBSPT_NORMAL)][INT(__ESBMHT_THUMB)];
- m_arrPartBmp[INT(__ESBSPT_DISABLED)][INT(__ESBMHT_THUMB)] = m_arrPartBmp[INT(__ESBSPT_NORMAL)][INT(__ESBMHT_THUMB)];
- m_arrPartBmp[INT(__ESBSPT_DISABLED)][INT(__ESBMHT_THUMB)].MakeMono();
- m_arrPartBmp[INT(__ESBSPT_DISABLED)][INT(__ESBMHT_THUMB)].AdjustAlpha( -0.25 );
- VERIFY( m_arrPartBmp[INT(__ESBSPT_HOT)][INT(__ESBMHT_THUMB)].FromBitmap( _bmpGlyphStack, rc2 ) );
- VERIFY( m_arrPartBmp[INT(__ESBSPT_PRESSED)][INT(__ESBMHT_THUMB)].FromBitmap( _bmpGlyphStack, rc3 ) );
- if( nAngleCw90 != 0 )
- {
- for( i = 0; i < INT(__ESBSPT_PART_COUNT); i++ )
- {
- CExtBitmap & _bmp1 = m_arrPartBmp[i][__ESBMHT_THUMB];
- if( _bmp1.IsEmpty() )
- continue;
- CExtBitmap _bmp2;
- VERIFY( _bmp2.CreateRotated9xStack( _bmp1, nAngleCw90, 1, _bmp1.GetSize().cx, _bmp1.GetSize().cy, false, false ) );
- _bmp1 = _bmp2;
- }
- }
- }
- void CExtPaintManager::SCROLLBARSKINDATA::Load2007_R1(
- UINT nResourceID_BumpyGlyphStack,
- INT nBumpyGlyphStackItemHeight,
- UINT nResourceID_GripperStack,
- const RECT & rcBumpyGlyphStackItemPadding,
- COLORREF clrSolidBackground,
- COLORREF clrPressedPageAreas,
- UINT nResourceID_ArrowUp_Normal,
- UINT nResourceID_ArrowUp_Disabled,
- UINT nResourceID_ArrowDown_Normal,
- UINT nResourceID_ArrowDown_Disabled,
- bool bRotateArrowsAndBk270,
- UINT nResourceID_BkEntire,
- UINT nResourceID_BkPage,
- const RECT & rcEntirePaddingR,
- const RECT & rcEntirePaddingC
- )
- {
- Empty();
- INT i, j;
- for( i = 0; i < INT(__ESBSPT_PART_COUNT); i++ )
- {
- for( j = 0; j < INT(__ESBMHT_PART_COUNT); j++ )
- {
- CRect & rcPadding = m_arrPartPadding[i][j];
- rcPadding.SetRect( 0, 0, 0, 0 );
- CExtBitmap & _bmp = m_arrPartBmp[i][j];
- _bmp.Empty();
- m_arrClrSolidBackground[i][j] = clrSolidBackground;
- if( ( j == INT(__ESBMHT_PAGE_UP) || j == INT(__ESBMHT_PAGE_DOWN) )
- && i == INT(__ESBSPT_PRESSED)
- )
- m_arrClrSolidBackground[i][j] = clrPressedPageAreas;
- }
- }
- CExtBitmap _bmpBumpyGlyphStack, _bmpGripperStack;
- VERIFY( _bmpBumpyGlyphStack.LoadBMP_Resource( MAKEINTRESOURCE(nResourceID_BumpyGlyphStack) ) );
- VERIFY( _bmpGripperStack.LoadBMP_Resource( MAKEINTRESOURCE(nResourceID_GripperStack) ) );
- _bmpBumpyGlyphStack.PreMultipliedRGBChannelsSet( true );
- _bmpGripperStack.PreMultipliedRGBChannelsSet( true );
- CSize _sizeBumpyGlyph = _bmpBumpyGlyphStack.GetSize();
- CSize _sizeGripper = _bmpGripperStack.GetSize();
- CRect rcBumpyGlyph( 0, 0, _sizeBumpyGlyph.cx, nBumpyGlyphStackItemHeight );
- CRect rcGripper( 0, 0, _sizeGripper.cx, _sizeGripper.cy );
- // cold parts
- rcBumpyGlyph.OffsetRect( 0, nBumpyGlyphStackItemHeight );
- VERIFY(
- m_arrPartBmp[INT(__ESBSPT_COLD)][INT(__ESBMHT_THUMB)].
- FromBitmap( _bmpBumpyGlyphStack, rcBumpyGlyph )
- );
- m_arrPartPadding[INT(__ESBSPT_COLD)][INT(__ESBMHT_THUMB)] = rcBumpyGlyphStackItemPadding;
- VERIFY(
- m_arrPartBmp[INT(__ESBSPT_COLD)][INT(__ESBMHT_GLYPH_THUMB_GRIPPER)].
- FromBitmap( _bmpGripperStack, rcGripper )
- );
- // normal parts
- VERIFY(
- m_arrPartBmp[INT(__ESBSPT_NORMAL)][INT(__ESBMHT_BUTTON_UP)].
- FromBitmap( _bmpBumpyGlyphStack, rcBumpyGlyph )
- );
- m_arrPartPadding[INT(__ESBSPT_NORMAL)][INT(__ESBMHT_BUTTON_UP)] = rcBumpyGlyphStackItemPadding;
- VERIFY(
- m_arrPartBmp[INT(__ESBSPT_NORMAL)][INT(__ESBMHT_BUTTON_DOWN)].
- FromBitmap( _bmpBumpyGlyphStack, rcBumpyGlyph )
- );
- m_arrPartPadding[INT(__ESBSPT_NORMAL)][INT(__ESBMHT_BUTTON_DOWN)] = rcBumpyGlyphStackItemPadding;
- // hot parts
- rcBumpyGlyph.OffsetRect( 0, nBumpyGlyphStackItemHeight );
- //rcGripper.OffsetRect( 0, nGripperStackItemHeight );
- VERIFY(
- m_arrPartBmp[INT(__ESBSPT_HOT)][INT(__ESBMHT_BUTTON_UP)].
- FromBitmap( _bmpBumpyGlyphStack, rcBumpyGlyph )
- );
- m_arrPartPadding[INT(__ESBSPT_HOT)][INT(__ESBMHT_BUTTON_UP)] = rcBumpyGlyphStackItemPadding;
- VERIFY(
- m_arrPartBmp[INT(__ESBSPT_HOT)][INT(__ESBMHT_BUTTON_DOWN)].
- FromBitmap( _bmpBumpyGlyphStack, rcBumpyGlyph )
- );
- m_arrPartPadding[INT(__ESBSPT_HOT)][INT(__ESBMHT_BUTTON_DOWN)] = rcBumpyGlyphStackItemPadding;
- VERIFY(
- m_arrPartBmp[INT(__ESBSPT_HOT)][INT(__ESBMHT_THUMB)].
- FromBitmap( _bmpBumpyGlyphStack, rcBumpyGlyph )
- );
- m_arrPartPadding[INT(__ESBSPT_HOT)][INT(__ESBMHT_THUMB)] = rcBumpyGlyphStackItemPadding;
- VERIFY(
- m_arrPartBmp[INT(__ESBSPT_HOT)][INT(__ESBMHT_GLYPH_THUMB_GRIPPER)].
- FromBitmap( _bmpGripperStack, rcGripper )
- );
- // pressed parts
- rcBumpyGlyph.OffsetRect( 0, nBumpyGlyphStackItemHeight );
- //rcGripper.OffsetRect( 0, nGripperStackItemHeight );
- VERIFY(
- m_arrPartBmp[INT(__ESBSPT_PRESSED)][INT(__ESBMHT_BUTTON_UP)].
- FromBitmap( _bmpBumpyGlyphStack, rcBumpyGlyph )
- );
- m_arrPartPadding[INT(__ESBSPT_PRESSED)][INT(__ESBMHT_BUTTON_UP)] = rcBumpyGlyphStackItemPadding;
- VERIFY(
- m_arrPartBmp[INT(__ESBSPT_PRESSED)][INT(__ESBMHT_BUTTON_DOWN)].
- FromBitmap( _bmpBumpyGlyphStack, rcBumpyGlyph )
- );
- m_arrPartPadding[INT(__ESBSPT_PRESSED)][INT(__ESBMHT_BUTTON_DOWN)] = rcBumpyGlyphStackItemPadding;
- VERIFY(
- m_arrPartBmp[INT(__ESBSPT_PRESSED)][INT(__ESBMHT_THUMB)].
- FromBitmap( _bmpBumpyGlyphStack, rcBumpyGlyph )
- );
- m_arrPartPadding[INT(__ESBSPT_PRESSED)][INT(__ESBMHT_THUMB)] = rcBumpyGlyphStackItemPadding;
- VERIFY(
- m_arrPartBmp[INT(__ESBSPT_PRESSED)][INT(__ESBMHT_GLYPH_THUMB_GRIPPER)].
- FromBitmap( _bmpGripperStack, rcGripper )
- );
- // arrows
- CExtBitmap _bmpArrowUpNormal, _bmpArrowUpDisabled, _bmpArrowDownNormal, _bmpArrowDownDisabled;
- VERIFY( _bmpArrowUpNormal.LoadBMP_Resource( MAKEINTRESOURCE(nResourceID_ArrowUp_Normal) ) );
- VERIFY( _bmpArrowUpDisabled.LoadBMP_Resource( MAKEINTRESOURCE(nResourceID_ArrowUp_Disabled) ) );
- VERIFY( _bmpArrowDownNormal.LoadBMP_Resource( MAKEINTRESOURCE(nResourceID_ArrowDown_Normal) ) );
- VERIFY( _bmpArrowDownDisabled.LoadBMP_Resource( MAKEINTRESOURCE(nResourceID_ArrowDown_Disabled) ) );
- // _bmpArrowUpNormal.PreMultipliedRGBChannelsSet( true );
- // _bmpArrowUpDisabled.PreMultipliedRGBChannelsSet( true );
- // _bmpArrowDownNormal.PreMultipliedRGBChannelsSet( true );
- // _bmpArrowDownDisabled.PreMultipliedRGBChannelsSet( true );
- CSize _sizeArrowUpNormal = _bmpArrowUpNormal.GetSize();
- CSize _sizeArrowUpDisabled = _bmpArrowUpDisabled.GetSize();
- CSize _sizeArrowDownNormal = _bmpArrowDownNormal.GetSize();
- CSize _sizeArrowDownDisabled = _bmpArrowDownDisabled.GetSize();
- VERIFY(
- m_arrPartBmp[INT(__ESBSPT_COLD)][INT(__ESBMHT_GLYPH_ARROW_UP)].
- CreateRotated9xStack(
- _bmpArrowUpNormal,
- bRotateArrowsAndBk270 ? 270 : 0,
- 1,
- _sizeArrowUpNormal.cx,
- _sizeArrowUpNormal.cy,
- false,
- false
- )
- );
- VERIFY(
- m_arrPartBmp[INT(__ESBSPT_DISABLED)][INT(__ESBMHT_GLYPH_ARROW_UP)].
- CreateRotated9xStack(
- _bmpArrowUpDisabled,
- bRotateArrowsAndBk270 ? 270 : 0,
- 1,
- _sizeArrowUpDisabled.cx,
- _sizeArrowUpDisabled.cy,
- false,
- false
- )
- );
- VERIFY(
- m_arrPartBmp[INT(__ESBSPT_COLD)][INT(__ESBMHT_GLYPH_ARROW_DOWN)].
- CreateRotated9xStack(
- _bmpArrowDownNormal,
- bRotateArrowsAndBk270 ? 270 : 0,
- 1,
- _sizeArrowDownNormal.cx,
- _sizeArrowDownNormal.cy,
- false,
- false
- )
- );
- VERIFY(
- m_arrPartBmp[INT(__ESBSPT_DISABLED)][INT(__ESBMHT_GLYPH_ARROW_DOWN)].
- CreateRotated9xStack(
- _bmpArrowDownDisabled,
- bRotateArrowsAndBk270 ? 270 : 0,
- 1,
- _sizeArrowDownDisabled.cx,
- _sizeArrowDownDisabled.cy,
- false,
- false
- )
- );
- // backgrounds
- CExtBitmap _bmpBkEntire, _bmpBkPage;
- VERIFY( _bmpBkEntire.LoadBMP_Resource( MAKEINTRESOURCE(nResourceID_BkEntire) ) );
- VERIFY( _bmpBkPage.LoadBMP_Resource( MAKEINTRESOURCE(nResourceID_BkPage) ) );
- _bmpBkEntire.PreMultipliedRGBChannelsSet( true );
- _bmpBkPage.PreMultipliedRGBChannelsSet( true );
- CSize _sizeBkEntire = _bmpBkEntire.GetSize();
- CSize _sizeBkPage = _bmpBkPage.GetSize();
- VERIFY(
- m_bmpEntireArea.
- CreateRotated9xStack(
- _bmpBkEntire,
- bRotateArrowsAndBk270 ? 270 : 0,
- 1,
- _sizeBkEntire.cx,
- _sizeBkEntire.cy,
- false,
- false
- )
- );
- VERIFY(
- m_arrPartBmp[INT(__ESBSPT_PRESSED)][INT(__ESBMHT_PAGE_DOWN)].
- CreateRotated9xStack(
- _bmpBkPage,
- bRotateArrowsAndBk270 ? 270 : 0,
- 1,
- _sizeBkPage.cx,
- _sizeBkPage.cy,
- false,
- false
- )
- );
- VERIFY(
- m_arrPartBmp[INT(__ESBSPT_PRESSED)][INT(__ESBMHT_PAGE_UP)].AssignFromOther(
- m_arrPartBmp[INT(__ESBSPT_PRESSED)][INT(__ESBMHT_PAGE_DOWN)]
- )
- );
- m_rcEntirePaddingR = rcEntirePaddingR;
- m_rcEntirePaddingC = rcEntirePaddingC;
- }
- CExtPaintManager::PAINTSCROLLBARDATA::PAINTSCROLLBARDATA()
- : m_bHorzBar( false )
- , m_bEnabled( false )
- , m_bHoveredAreaIsPressed( false )
- , m_bHelperLightAccent( true )
- , m_eSBMHT( CExtPaintManager::__ESBMHT_NOWHERE )
- , m_rcBar( 0, 0, 0, 0 )
- , m_rcButtonUp( 0, 0, 0, 0 )
- , m_rcButtonDown( 0, 0, 0, 0 )
- , m_rcThumb( 0, 0, 0, 0 )
- , m_rcPageUp( 0, 0, 0, 0 )
- , m_rcPageDown( 0, 0, 0, 0 )
- , m_pHelperSrc( NULL )
- , m_lParam( 0L )
- , m_rcScrollableArea( 0, 0, 0, 0 )
- {
- m_DSI.cbSize = sizeof(SCROLLINFO);
- ::memset( &m_DSI, 0, sizeof(SCROLLINFO) );
- }
- CExtPaintManager::PAINTSCROLLBARDATA::PAINTSCROLLBARDATA(
- bool bHorzBar,
- bool bEnabled,
- bool bHoveredAreaIsPressed,
- CExtPaintManager::e_scroll_bar_mouse_hover_type_t eSBMHT,
- const RECT & rcBar,
- const RECT & rcButtonUp,
- const RECT & rcButtonDown,
- const RECT & rcThumb,
- const RECT & rcPageUp,
- const RECT & rcPageDown,
- CObject * pHelperSrc, // = NULL
- LPARAM lParam // = 0L
- )
- : m_bHorzBar( bHorzBar )
- , m_bEnabled( bEnabled )
- , m_bHoveredAreaIsPressed( bHoveredAreaIsPressed )
- , m_bHelperLightAccent( true )
- , m_eSBMHT( eSBMHT )
- , m_rcBar( rcBar )
- , m_rcButtonUp( rcButtonUp )
- , m_rcButtonDown( rcButtonDown )
- , m_rcThumb( rcThumb )
- , m_rcPageUp( rcPageUp )
- , m_rcPageDown( rcPageDown )
- , m_pHelperSrc( pHelperSrc )
- , m_lParam( lParam )
- {
- if( m_bHorzBar )
- m_rcScrollableArea.SetRect(
- m_rcButtonUp.right,
- m_rcButtonUp.top,
- m_rcButtonDown.left,
- m_rcButtonDown.bottom
- );
- else
- m_rcScrollableArea.SetRect(
- m_rcButtonUp.left,
- m_rcButtonUp.bottom,
- m_rcButtonDown.right,
- m_rcButtonDown.top
- );
- m_DSI.cbSize = sizeof(SCROLLINFO);
- ::memset( &m_DSI, 0, sizeof(SCROLLINFO) );
- }
- CExtPaintManager::PAINTSCROLLBARDATA::PAINTSCROLLBARDATA(
- CExtScrollBar * pExtScrollBar,
- bool bHoveredAreaIsPressed, // false
- CExtPaintManager::e_scroll_bar_mouse_hover_type_t eSBMHT, // = CExtPaintManager::__ESBMHT_NOWHERE
- LPARAM lParam // = 0L
- )
- : m_bHorzBar( false )
- , m_bEnabled( false )
- , m_bHoveredAreaIsPressed( bHoveredAreaIsPressed )
- , m_bHelperLightAccent( true )
- , m_eSBMHT( eSBMHT )
- , m_rcBar( 0, 0, 0, 0 )
- , m_rcButtonUp( 0, 0, 0, 0 )
- , m_rcButtonDown( 0, 0, 0, 0 )
- , m_rcThumb( 0, 0, 0, 0 )
- , m_rcPageUp( 0, 0, 0, 0 )
- , m_rcPageDown( 0, 0, 0, 0 )
- , m_pHelperSrc( pExtScrollBar )
- , m_lParam( lParam )
- {
- m_DSI.cbSize = sizeof(SCROLLINFO);
- ::memset( &m_DSI, 0, sizeof(SCROLLINFO) );
- if( pExtScrollBar == NULL )
- return;
- ASSERT_VALID( pExtScrollBar );
- CExtScrollBar::eScrollerOrientation_t _eSO = pExtScrollBar->GetScrollerOrientation();
- if( _eSO != CExtScrollBar::__ESO_TOP
- && _eSO != CExtScrollBar::__ESO_BOTTOM
- && _eSO != CExtScrollBar::__ESO_LEFT
- && _eSO != CExtScrollBar::__ESO_RIGHT
- )
- return;
- m_bHorzBar =
- ( _eSO == CExtScrollBar::__ESO_TOP
- || _eSO == CExtScrollBar::__ESO_BOTTOM
- )
- ? true : false;
- pExtScrollBar->GetClientRect( &m_rcBar );
- SCROLLINFO _scroll_info;
- ::memset( &_scroll_info, 0, sizeof(SCROLLINFO) );
- if( pExtScrollBar->IsWindowEnabled() )
- {
- m_bEnabled = true;
- _scroll_info.cbSize = sizeof(SCROLLINFO);
- if( ! pExtScrollBar->GetScrollInfo(
- &_scroll_info,
- SIF_ALL
- )
- )
- {
- pExtScrollBar->GetScrollRange(
- &_scroll_info.nMin,
- &_scroll_info.nMax
- );
- _scroll_info.nPage = 0;
- _scroll_info.nTrackPos
- = _scroll_info.nPos
- = pExtScrollBar->GetScrollPos();
- }
- // if( pExtScrollBar->m_nHelperTrackPos != -1 )
- // _scroll_info.nTrackPos = pExtScrollBar->m_nHelperTrackPos;
- __EXT_MFC_MEMCPY(
- &m_DSI,
- sizeof(SCROLLINFO),
- &_scroll_info,
- sizeof(SCROLLINFO)
- );
- _scroll_info.nTrackPos -= _scroll_info.nMin;
- _scroll_info.nPos -= _scroll_info.nMin;
- _scroll_info.nMax -= _scroll_info.nMin;
- _scroll_info.nMin = 0;
- } // if( pExtScrollBar->IsWindowEnabled() )
- else
- __EXT_MFC_MEMCPY(
- &m_DSI,
- sizeof(SCROLLINFO),
- &_scroll_info,
- sizeof(SCROLLINFO)
- );
- if( _scroll_info.nMin < _scroll_info.nMax
- && _scroll_info.nMax < (INT_MAX-1)
- && _scroll_info.nPage > 0
- && _scroll_info.nPage == UINT( _scroll_info.nMax - _scroll_info.nMin )
- )
- {
- // layout issue
- _scroll_info.nMax ++;
- if( _scroll_info.nPos > 0 )
- _scroll_info.nPos ++;
- if( _scroll_info.nTrackPos > 0 )
- _scroll_info.nTrackPos ++;
- }
- INT nScrollLimit = 0, nExtentMD = 0, nExtentThumb = 0, nExtentBtn = 0, nExtentThumbMin = 4;
- nScrollLimit =
- _scroll_info.nMax
- - _scroll_info.nMin
- - _scroll_info.nPage
- + 1
- ;
- ASSERT( nScrollLimit >= 0 );
- INT nScrollTotalRange = _scroll_info.nMax;
- if( pExtScrollBar->IsKindOf( RUNTIME_CLASS(CExtZoomScrollBar) ) )
- {
- CExtPaintManager::SCROLLBARSKINDATA * _pSBSD =
- pExtScrollBar->PmBridge_GetPM()->
- ScrollBar_GetSkinData(
- m_bHorzBar, pExtScrollBar, lParam, false );
- if( _pSBSD != NULL )
- {
- CExtBitmap & _bmpSkinnedButtonUp =
- _pSBSD->m_arrPartBmp[INT(__ESBSPT_NORMAL)][INT(__ESBMHT_BUTTON_UP)];
- ASSERT( ! _bmpSkinnedButtonUp.IsEmpty() );
- CExtBitmap & _bmpSkinnedButtonThumb =
- _pSBSD->m_arrPartBmp[INT(__ESBSPT_NORMAL)][INT(__ESBMHT_THUMB)];
- ASSERT( ! _bmpSkinnedButtonUp.IsEmpty() );
- CExtPaintManager * pPM = pExtScrollBar->PmBridge_GetPM();
- ASSERT_VALID( pPM );
- if( m_bHorzBar )
- {
- nExtentBtn = _bmpSkinnedButtonUp.GetSize().cx;
- nExtentThumb = nExtentThumbMin = _bmpSkinnedButtonThumb.GetSize().cx;
- nExtentBtn = pPM->UiScalingDo( nExtentBtn, CExtPaintManager::__EUIST_X );
- nExtentThumb = pPM->UiScalingDo( nExtentThumb, CExtPaintManager::__EUIST_X );
- }
- else
- {
- nExtentBtn = _bmpSkinnedButtonUp.GetSize().cy;
- nExtentThumb = nExtentThumbMin = _bmpSkinnedButtonThumb.GetSize().cy;
- nExtentBtn = pPM->UiScalingDo( nExtentBtn, CExtPaintManager::__EUIST_Y );
- nExtentThumb = pPM->UiScalingDo( nExtentThumb, CExtPaintManager::__EUIST_Y );
- }
- } // if( _pSBSD != NULL )
- else
- {
- if( m_bHorzBar )
- {
- nExtentBtn = pExtScrollBar->m_nHorzButtonWidth;
- nExtentThumb = nExtentThumbMin = pExtScrollBar->m_nHorzThumbMinWidth;
- }
- else
- {
- nExtentBtn = pExtScrollBar->m_nVertButtonHeight;
- nExtentThumb = nExtentThumbMin = pExtScrollBar->m_nVertThumbMinHeight;
- }
- } // else from if( _pSBSD != NULL )
- } // if( pExtScrollBar->IsKindOf( RUNTIME_CLASS(CExtZoomScrollBar) ) )
- else
- {
- if( m_bHorzBar )
- {
- nExtentBtn = pExtScrollBar->m_nHorzButtonWidth;
- nExtentThumbMin = pExtScrollBar->m_nHorzThumbMinWidth;
- }
- else
- {
- nExtentBtn = pExtScrollBar->m_nVertButtonHeight;
- nExtentThumbMin = pExtScrollBar->m_nVertThumbMinHeight;
- }
- if( nScrollLimit > 0L )
- {
- if( _scroll_info.nPage == 0 )
- {
- nExtentThumb = nExtentBtn;
- if( nExtentThumb == 0 )
- nExtentThumb = 6;
- } // if( _scroll_info.nPage == 0 )
- else
- {
- if( nScrollTotalRange > INT(_scroll_info.nPage) )
- {
- nExtentMD = nScrollTotalRange/_scroll_info.nPage;
- } // if( nScrollTotalRange > _scroll_info.nPage )
- } // else from if( _scroll_info.nPage == 0 )
- } // if( nScrollLimit > 0L )
- } // else from if( pExtScrollBar->IsKindOf( RUNTIME_CLASS(CExtZoomScrollBar) ) )
- if( ! m_bEnabled )
- nExtentThumb = nExtentThumbMin = 0;
- CRect rcScrollable = m_rcBar;
- m_rcButtonUp = m_rcBar;
- m_rcButtonDown = m_rcBar;
- if( m_bHorzBar )
- {
- rcScrollable.DeflateRect( nExtentBtn, 0 );
- m_rcButtonUp.right = m_rcButtonUp.left + nExtentBtn;
- m_rcButtonDown.left = m_rcButtonDown.right - nExtentBtn;
- if( rcScrollable.Width() > 5 )
- {
- if( nExtentThumb == 0 && nExtentMD != 0L )
- nExtentThumb =
- ::MulDiv( rcScrollable.Width(), _scroll_info.nPage, nScrollTotalRange );
- if( m_bEnabled && /*nExtentThumb != 0 &&*/ nExtentThumb < nExtentThumbMin )
- nExtentThumb = nExtentThumbMin;
- if( nExtentThumb != 0 )
- {
- m_rcThumb = rcScrollable;
- m_rcThumb.right = m_rcThumb.left + nExtentThumb;
- if( nScrollLimit > 0 )
- {
- INT nRestSpace = rcScrollable.Width() - m_rcThumb.Width();
- if( nRestSpace < 0 )
- nRestSpace = 0;
- INT nOffset = ::MulDiv( nRestSpace, _scroll_info.nTrackPos, nScrollLimit );
- m_rcThumb.OffsetRect( nOffset, 0 );
- if( _scroll_info.nTrackPos > 0 )
- {
- m_rcPageUp = rcScrollable;
- m_rcPageUp.right = m_rcThumb.left;
- }
- if( _scroll_info.nTrackPos < nScrollLimit )
- {
- m_rcPageDown = rcScrollable;
- m_rcPageDown.left = m_rcThumb.right;
- }
- } // if( nScrollLimit > 0 )
- } // if( nExtentThumb != 0 )
- } // if( rcScrollable.Width() > 5 )
- if( (! m_rcButtonUp.IsRectEmpty() )
- && (! m_rcButtonDown.IsRectEmpty() )
- && m_rcButtonUp.right > m_rcButtonDown.left
- )
- {
- m_rcButtonUp.right
- = m_rcButtonDown.left
- = m_rcButtonUp.left
- + ( m_rcButtonDown.right - m_rcButtonUp.left ) / 2;
- m_rcPageUp.SetRect( 0, 0, 0, 0 );
- m_rcPageDown.SetRect( 0, 0, 0, 0 );
- m_rcThumb.SetRect( 0, 0, 0, 0 );
- }
- } // if( m_bHorzBar )
- else
- {
- rcScrollable.DeflateRect( 0, nExtentBtn );
- m_rcButtonUp.bottom = m_rcButtonUp.top + nExtentBtn;
- m_rcButtonDown.top = m_rcButtonDown.bottom - nExtentBtn;
- if( rcScrollable.Height() > 5 )
- {
- if( nExtentThumb == 0 && nExtentMD != 0L )
- nExtentThumb =
- ::MulDiv( rcScrollable.Height(), _scroll_info.nPage, nScrollTotalRange );
- if( m_bEnabled && /*nExtentThumb != 0 &&*/ nExtentThumb < nExtentThumbMin )
- nExtentThumb = nExtentThumbMin;
- if( nExtentThumb != 0 )
- {
- m_rcThumb = rcScrollable;
- m_rcThumb.bottom = m_rcThumb.top + nExtentThumb;
- if( nScrollLimit > 0 )
- {
- INT nRestSpace = rcScrollable.Height() - m_rcThumb.Height();
- if( nRestSpace < 0 )
- nRestSpace = 0;
- INT nOffset = ::MulDiv( nRestSpace, _scroll_info.nTrackPos, nScrollLimit );
- m_rcThumb.OffsetRect( 0, nOffset );
- if( _scroll_info.nTrackPos > 0 )
- {
- m_rcPageUp = rcScrollable;
- m_rcPageUp.bottom = m_rcThumb.top;
- }
- if( _scroll_info.nTrackPos < nScrollLimit )
- {
- m_rcPageDown = rcScrollable;
- m_rcPageDown.top = m_rcThumb.bottom;
- }
- } // if( nScrollLimit > 0 )
- } // if( nExtentThumb != 0 )
- } // if( rcScrollable.Height() > 5 )
- if( (! m_rcButtonUp.IsRectEmpty() )
- && (! m_rcButtonDown.IsRectEmpty() )
- && m_rcButtonUp.bottom > m_rcButtonDown.top
- )
- {
- m_rcButtonUp.bottom
- = m_rcButtonDown.top
- = m_rcButtonUp.top
- + ( m_rcButtonDown.bottom - m_rcButtonUp.top ) / 2;
- m_rcPageUp.SetRect( 0, 0, 0, 0 );
- m_rcPageDown.SetRect( 0, 0, 0, 0 );
- m_rcThumb.SetRect( 0, 0, 0, 0 );
- }
- } // else from if( m_bHorzBar )
- if( m_bHorzBar )
- m_rcScrollableArea.SetRect(
- m_rcButtonUp.right,
- m_rcButtonUp.top,
- m_rcButtonDown.left,
- m_rcButtonDown.bottom
- );
- else
- m_rcScrollableArea.SetRect(
- m_rcButtonUp.left,
- m_rcButtonUp.bottom,
- m_rcButtonDown.right,
- m_rcButtonDown.top
- );
- }
- CExtPaintManager::PAINTSCROLLBARDATA::~PAINTSCROLLBARDATA()
- {
- }
- COLORREF CExtPaintManager::stat_PaintShadedEllipse_ComputeColorValue(
- double lfA,
- COLORREF clrShadeAccentLight,
- COLORREF clrShadeAccentDark
- )
- {
- double lfD = - 2.356 - lfA;
- if( lfD < ( - 3.1415926535897932384626433832795 ) )
- lfD = 6.293 + lfD;
- else if( lfD > 3.1415926535897932384626433832795 )
- lfD = 6.293 - lfD;
- double lfW = ( ::cos( lfD ) + 1.0 ) * 0.5;
- return
- RGB(
- BYTE( lfW * GetRValue( clrShadeAccentLight ) + ( 1.0 - lfW ) * GetRValue( clrShadeAccentDark ) ),
- BYTE( lfW * GetGValue( clrShadeAccentLight ) + ( 1.0 - lfW ) * GetGValue( clrShadeAccentDark ) ),
- BYTE( lfW * GetBValue( clrShadeAccentLight ) + ( 1.0 - lfW ) * GetBValue( clrShadeAccentDark ) )
- );
- }
- void CExtPaintManager::stat_PaintShadedEllipse(
- HDC hDC,
- const POINT & ptEllipseCenter,
- LONG nRadiusH,
- LONG nRadiusV,
- COLORREF clrShadeAccentLight,
- COLORREF clrShadeAccentDark
- )
- {
- ASSERT(
- hDC != NULL
- && ( ptEllipseCenter.x + nRadiusH <= LONG_MAX )
- && ( ptEllipseCenter.y + nRadiusV <= LONG_MAX )
- && ( ptEllipseCenter.x - nRadiusH >= LONG_MIN )
- && ( ptEllipseCenter.y - nRadiusV >= LONG_MIN )
- );
- LONG nX = nRadiusH, nY = 0, nBoxSquare = nRadiusH * nRadiusH;
- LONG nTemp0 = 8 * nRadiusH * nRadiusV * nRadiusV;
- LONG nTemp1 = 0;
- LONG nTemp2 = 4 * nBoxSquare - nRadiusH * 4 * nRadiusV * nRadiusV + nRadiusV * nRadiusV;
- LONG nTemp3 = nBoxSquare - nTemp0 + 4 * nRadiusV * nRadiusV;
- for( ; nTemp3 < 0; )
- {
- double lfA = double( ::atan2( double(nY), double(nX) ) );
- COLORREF clr = stat_PaintShadedEllipse_ComputeColorValue( lfA, clrShadeAccentLight, clrShadeAccentDark );
- ::SetPixelV( hDC, ptEllipseCenter.x + nX, ptEllipseCenter.y + nY, clr );
- clr = stat_PaintShadedEllipse_ComputeColorValue( 3.1415926535897932384626433832795 - lfA, clrShadeAccentLight, clrShadeAccentDark );
- ::SetPixelV( hDC, ptEllipseCenter.x - nX, ptEllipseCenter.y + nY, clr );
- clr = stat_PaintShadedEllipse_ComputeColorValue( -3.1415926535897932384626433832795 + lfA, clrShadeAccentLight, clrShadeAccentDark );
- ::SetPixelV( hDC, ptEllipseCenter.x - nX, ptEllipseCenter.y - nY, clr );
- clr = stat_PaintShadedEllipse_ComputeColorValue( -lfA, clrShadeAccentLight, clrShadeAccentDark );
- ::SetPixelV( hDC, ptEllipseCenter.x + nX, ptEllipseCenter.y - nY, clr );
- nY ++;
- nTemp1 = nTemp1 + 8 * nBoxSquare;
- if( nTemp2 < 0 )
- {
- nTemp2 = nTemp2 + nTemp1 + 4 * nBoxSquare;
- nTemp3 = nTemp3 + nTemp1;
- }
- else
- {
- nX --;
- nTemp0 = nTemp0 - 8 * nRadiusV * nRadiusV;
- nTemp2 = nTemp2 - nTemp0 + nTemp1 + 4 * nBoxSquare;
- nTemp3 = nTemp3 - nTemp0 + nTemp1 + 4 * nRadiusV * nRadiusV;
- }
- } // for( ; nTemp3 < 0; )
- for( ; true; )
- {
- double lfA = double( ::atan2( double(nY), double(nX) ) );
- COLORREF clr = stat_PaintShadedEllipse_ComputeColorValue( lfA, clrShadeAccentLight, clrShadeAccentDark );
- ::SetPixelV( hDC, ptEllipseCenter.x + nX, ptEllipseCenter.y + nY, clr );
- clr = stat_PaintShadedEllipse_ComputeColorValue( 3.1415926535897932384626433832795 - lfA, clrShadeAccentLight, clrShadeAccentDark );
- ::SetPixelV( hDC, ptEllipseCenter.x - nX, ptEllipseCenter.y + nY, clr );
- clr = stat_PaintShadedEllipse_ComputeColorValue( -3.1415926535897932384626433832795 + lfA, clrShadeAccentLight, clrShadeAccentDark );
- ::SetPixelV( hDC, ptEllipseCenter.x - nX, ptEllipseCenter.y - nY, clr );
- clr = stat_PaintShadedEllipse_ComputeColorValue( -lfA, clrShadeAccentLight, clrShadeAccentDark );
- ::SetPixelV( hDC, ptEllipseCenter.x + nX, ptEllipseCenter.y - nY, clr );
- nX --;
- nTemp0 = nTemp0 - 8 * nRadiusV * nRadiusV;
- if( nTemp3 < 0 )
- {
- nY ++;
- nTemp1 = nTemp1 + 8 * nBoxSquare;
- nTemp3 = nTemp3 - nTemp0 + 4 * nRadiusV * nRadiusV + nTemp1;
- }
- else
- nTemp3 = nTemp3 - nTemp0 + 4 * nRadiusV * nRadiusV;
- if( nX < 0 )
- break;
- } // for( ; true; )
- }
- void CExtPaintManager::PAINTSCROLLBARDATA::PaintDefault(
- CDC & dc,
- CExtPaintManager * pPM
- )
- {
- ASSERT( dc.GetSafeHdc() != NULL );
- ASSERT_VALID( pPM );
- if( m_rcBar.IsRectEmpty()
- || (! dc.RectVisible( &m_rcBar ) )
- )
- return;
- CExtPaintManager::SCROLLBARSKINDATA * pSBSD =
- pPM->ScrollBar_GetSkinData(
- m_bHorzBar,
- m_pHelperSrc,
- m_lParam,
- m_bHelperLightAccent
- );
- if( pSBSD != NULL )
- {
- PaintSkinned(
- dc,
- pPM,
- *pSBSD
- );
- return;
- } // if( pSBSD != NULL )
- if( m_pHelperSrc != NULL )
- {
- ASSERT_VALID( m_pHelperSrc );
- if( m_pHelperSrc->IsKindOf( RUNTIME_CLASS(CExtZoomScrollBar) ) )
- {
- bool bTransparent = false;
- #if (!defined __EXT_MFC_NO_STATUSBAR)
- CExtStatusControlBar * pWndParent = DYNAMIC_DOWNCAST( CExtStatusControlBar, (((CExtZoomScrollBar*)m_pHelperSrc)->GetParent()) );
- if( pWndParent != NULL )
- {
- CExtPaintManager * pPM = ((CExtZoomScrollBar*)m_pHelperSrc)->PmBridge_GetPM();
- ASSERT_VALID( pPM );
- CRect rcPaint, _rcClient;
- pWndParent->GetWindowRect( &rcPaint );
- ((CExtZoomScrollBar*)m_pHelperSrc)->ScreenToClient( &rcPaint );
- ((CExtZoomScrollBar*)m_pHelperSrc)->GetClientRect( &_rcClient );
- ((CExtZoomScrollBar*)m_pHelperSrc)->ClientToScreen( &_rcClient );
- pWndParent->ScreenToClient( &_rcClient );
- if( pWndParent->m_bCompleteRepaint )
- {
- dc.OffsetViewportOrg( _rcClient.left, 0 );
- bool bRet = pPM->StatusBar_EraseBackground( dc, rcPaint, pWndParent );
- dc.OffsetViewportOrg( - _rcClient.left, 0 );
- if( ! bRet )
- {
- bool bTransparent = false;
- if( pPM->GetCb2DbTransparentMode(pWndParent) )
- {
- if( pPM->PaintDockerBkgnd( true, dc, ((CExtZoomScrollBar*)m_pHelperSrc) ) )
- bTransparent = true;
- }
- if( ! bTransparent )
- dc.FillSolidRect(
- &rcPaint,
- pPM->GetColor( CExtPaintManager::CLR_3DFACE_OUT, pWndParent )
- );
- }
- INT nIndex = pWndParent->CommandToIndex( ((CExtZoomScrollBar*)m_pHelperSrc)->GetDlgCtrlID() );
- if( nIndex >= 0 )
- {
- dc.OffsetViewportOrg( _rcClient.left, 0 );
- pPM->StatusBar_ErasePaneBackground( dc, nIndex, rcPaint, pWndParent );
- dc.OffsetViewportOrg( -_rcClient.left, 0 );
- bTransparent = true;
- }
- } // if( pWndParent->m_bCompleteRepaint )
- } // if( pWndParent != NULL )
- #endif // (!defined __EXT_MFC_NO_STATUSBAR)
- if( ! bTransparent )
- {
- if( (! bTransparent )
- && pPM->GetCb2DbTransparentMode( m_pHelperSrc )
- )
- {
- CExtPaintManager::stat_ExcludeChildAreas(
- dc,
- ((CExtZoomScrollBar*)m_pHelperSrc)->GetSafeHwnd(),
- CExtPaintManager::stat_DefExcludeChildAreaCallback
- );
- if( pPM->PaintDockerBkgnd( true, dc, ((CExtZoomScrollBar*)m_pHelperSrc) ) )
- bTransparent = true;
- }
- if( ! bTransparent )
- dc.FillSolidRect(
- &m_rcBar,
- pPM->GetColor( CExtPaintManager::CLR_3DFACE_OUT, ((CExtZoomScrollBar*)m_pHelperSrc) )
- );
- } // if( ! bTransparent )
- CRect rcLineH( m_rcScrollableArea );
- CRect rcLineV( m_rcScrollableArea );
- if( m_bHorzBar )
- {
- rcLineH.bottom = rcLineH.top + 1;
- rcLineH.OffsetRect( 0, m_rcScrollableArea.Height() / 2 + 1 );
- rcLineV.right = rcLineV.left + 1;
- rcLineV.OffsetRect( m_rcScrollableArea.Width() / 2, 0 );
- rcLineV.bottom = rcLineV.top + 7;
- rcLineV.OffsetRect( 0, (m_rcScrollableArea.Height() - 7 ) / 2 + 2 );
- }
- else
- {
- rcLineH.right = rcLineH.left + 1;
- rcLineH.OffsetRect( m_rcScrollableArea.Width() / 2 + 1, 0 );
- rcLineV.right = rcLineV.left + 7;
- rcLineV.OffsetRect( (m_rcScrollableArea.Width() - 7 ) / 2 + 1 , 0 );
- rcLineV.bottom = rcLineV.top + 1;
- rcLineV.OffsetRect( 0, m_rcScrollableArea.Height() / 2 );
- }
- COLORREF clrZsLineLight = pPM->GetColor( COLOR_3DHIGHLIGHT );
- COLORREF clrZsLineDark = pPM->GetColor( COLOR_3DSHADOW );
- rcLineH.OffsetRect(
- m_bHorzBar ? 0 : -1,
- m_bHorzBar ? -1 : 0
- );
- rcLineV.OffsetRect(
- m_bHorzBar ? -2 : 0,
- m_bHorzBar ? -2 : -1
- );
- if( m_bHorzBar )
- rcLineV.OffsetRect( 2, 0 );
- else
- rcLineV.OffsetRect( 0, 2 );
- if( clrZsLineDark != COLORREF(-1L) )
- {
- dc.FillSolidRect( &rcLineH, clrZsLineDark );
- dc.FillSolidRect( &rcLineV, clrZsLineDark );
- } // if( clrZsLineDark != COLORREF(-1L) )
- if( clrZsLineLight != COLORREF(-1L) )
- {
- rcLineH.OffsetRect( 1, 1 );
- rcLineV.OffsetRect( 1, 1 );
- dc.FillSolidRect( &rcLineH, clrZsLineLight );
- dc.FillSolidRect( &rcLineV, clrZsLineLight );
- } // if( clrZsLineLight != COLORREF(-1L) )
- COLORREF clrButtonBk = pPM->GetColor( COLOR_3DFACE, m_pHelperSrc, m_lParam );
- CBrush _brushBkDefault( clrButtonBk );
- HGDIOBJ hOldPen = ::SelectObject( dc.m_hDC, ::GetStockObject( NULL_PEN ) );
- CRect arrRcButtons[] = { m_rcButtonDown, m_rcButtonUp, m_rcThumb };
- INT nButtonIndex, nButtonCount = INT( sizeof(arrRcButtons)/sizeof(arrRcButtons[0]) );
- for( nButtonIndex = 0; nButtonIndex < nButtonCount; nButtonIndex ++ )
- {
- CRect rcButton = arrRcButtons[ nButtonIndex ];
- INT nMetric = min( rcButton.Width(), rcButton.Height() );
- nMetric &= ~1;
- rcButton.left += ( rcButton.Width() - nMetric ) / 2;
- rcButton.right = rcButton.left + nMetric;
- rcButton.top += ( rcButton.Height() - nMetric ) / 2;
- rcButton.bottom = rcButton.top + nMetric;
- bool bHover = false;
- bool bPressed = false;
- if( m_bEnabled )
- {
- switch( nButtonIndex )
- {
- case 0:
- if( m_eSBMHT == __ESBMHT_BUTTON_DOWN )
- bHover = true;
- break;
- case 1:
- if( m_eSBMHT == __ESBMHT_BUTTON_UP )
- bHover = true;
- break;
- case 2:
- if( m_eSBMHT == __ESBMHT_THUMB )
- bHover = true;
- break;
- } // switch( nButtonIndex )
- if( bHover )
- bPressed = m_bHoveredAreaIsPressed;
- } // if( m_bEnabled )
- COLORREF clrButtonText = pPM->GetColor( m_bEnabled ? COLOR_BTNTEXT : CLR_TEXT_DISABLED, m_pHelperSrc, m_lParam );
- COLORREF clrButtonShadeOuterTL = pPM->GetColor( COLOR_3DHIGHLIGHT, m_pHelperSrc, m_lParam );
- COLORREF clrButtonShadeOuterRB = pPM->GetColor( COLOR_3DDKSHADOW, m_pHelperSrc, m_lParam );
- COLORREF clrButtonShadeInnerTL = clrButtonShadeOuterTL;
- COLORREF clrButtonShadeInnerRB = pPM->GetColor( COLOR_3DSHADOW, m_pHelperSrc, m_lParam );
- if( bPressed )
- {
- COLORREF clrTmp;
- //clrTmp = clrButtonShadeOuterTL;
- //clrButtonShadeOuterTL = clrButtonShadeOuterRB;
- //clrButtonShadeOuterRB = clrTmp;
- clrTmp = clrButtonShadeInnerTL;
- clrButtonShadeInnerTL = clrButtonShadeInnerRB;
- clrButtonShadeInnerRB = clrTmp;
- } // if( bPressed )
- CBrush * pOldBrush =
- dc.SelectObject(
- ( m_bEnabled && ( bPressed || bHover ) )
- ? ( bPressed ? (&(pPM->m_brushDarkerDefault)) : (&(pPM->m_brushLighterDefault)) )
- : (&_brushBkDefault)
- );
- if( nButtonIndex == 2 )
- rcButton.InflateRect( 0, 0, 1, 1 );
- dc.Ellipse( &rcButton );
- dc.SelectObject( pOldBrush );
- if( nButtonIndex == 2 )
- rcButton.DeflateRect( 0, 0, 1, 1 );
- CPoint ptCenter = rcButton.CenterPoint();
- INT nHalfMetricToDraw = nMetric/2;
- stat_PaintShadedEllipse(
- dc.m_hDC,
- ptCenter,
- nHalfMetricToDraw,
- nHalfMetricToDraw,
- clrButtonShadeOuterTL,
- clrButtonShadeOuterRB
- );
- nHalfMetricToDraw --;
- stat_PaintShadedEllipse(
- dc.m_hDC,
- ptCenter,
- nHalfMetricToDraw,
- nHalfMetricToDraw,
- clrButtonShadeInnerTL,
- clrButtonShadeInnerRB
- );
- nHalfMetricToDraw /= 2;
- if( nHalfMetricToDraw > 0 )
- {
- switch( nButtonIndex )
- {
- case 0:
- dc.FillSolidRect(
- ptCenter.x,
- ptCenter.y - nHalfMetricToDraw,
- 1,
- nHalfMetricToDraw * 2 + 1,
- clrButtonText
- );
- case 1: // continuing case 0
- dc.FillSolidRect(
- ptCenter.x - nHalfMetricToDraw,
- ptCenter.y,
- nHalfMetricToDraw * 2 + 1,
- 1,
- clrButtonText
- );
- break;
- } // switch( nButtonIndex )
- } // if( nHalfMetricToDraw > 0 )
- } // for( nButtonIndex = 0; nButtonIndex < nButtonCount; nButtonIndex ++ )
- ::SelectObject( dc.m_hDC, hOldPen );
- return;
- } // if( m_pHelperSrc->IsKindOf( RUNTIME_CLASS(CExtZoomScrollBar) ) )
- } // if( m_pHelperSrc != NULL )
- dc.FillRect(
- &m_rcBar,
- &pPM->m_brushLightSystem
- );
- //m_bEnabled = false;
- //m_eSBMHT = __ESBMHT_BUTTON_UP;
- //m_eSBMHT = __ESBMHT_PAGE_DOWN;
- //m_eSBMHT = __ESBMHT_THUMB;
- //m_bHoveredAreaIsPressed = true;
- if( g_PaintManager.m_UxTheme.IsControlsThemed() )
- {
- HWND hWnd = NULL;
- if( m_pHelperSrc != NULL )
- {
- CWnd * pWnd = DYNAMIC_DOWNCAST( CWnd, m_pHelperSrc );
- hWnd = pWnd->GetSafeHwnd();