Ejemplo n.º 1
0
HICON CShellIcons::ExtractIcon(int nIndex, int nSize)
{
	CQuickLock oLock( m_pSection );

	HICON hIcon;
	switch ( nSize )
	{
	case 16:
		hIcon = m_i16.ExtractIcon( nIndex );
		break;
//	case 24:
//		hIcon = m_i24.ExtractIcon( nIndex );
//		break;
	case 32:
		hIcon = m_i32.ExtractIcon( nIndex );
		break;
	case 48:
		hIcon = m_i48.ExtractIcon( nIndex );
		break;
	default:
		ASSERT( FALSE );
		return NULL;
	}

	if ( Settings.General.LanguageRTL )
		hIcon = CreateMirroredIcon( hIcon );

	return hIcon;
}
BOOL CFavouritesProfilePage::OnInitDialog()
{
	CSettingsPage::OnInitDialog();

	m_gdiImageList.Create( 16, 16, ILC_COLOR16|ILC_MASK, 1, 1 );
	HICON hIcon = AfxGetApp()->LoadIcon( IDI_WEB_URL );
	if ( theApp.m_bRTL ) hIcon = CreateMirroredIcon( hIcon );
	m_gdiImageList.Add( hIcon );

	CRect rc;
	m_wndList.GetClientRect( &rc );
	rc.right -= GetSystemMetrics( SM_CXVSCROLL ) + 1;

	m_wndList.SetImageList( &m_gdiImageList, LVSIL_SMALL );
	m_wndList.InsertColumn( 0, _T("Name"), LVCFMT_LEFT, rc.right / 2, -1 );
	m_wndList.InsertColumn( 1, _T("URL"), LVCFMT_LEFT, rc.right / 2, 0 );

	m_wndList.SendMessage( LVM_SETEXTENDEDLISTVIEWSTYLE,
		LVS_EX_FULLROWSELECT, LVS_EX_FULLROWSELECT );

	if ( CXMLElement* pBookmarks = MyProfile.GetXML( _T("bookmarks") ) )
	{
		for ( POSITION pos = pBookmarks->GetElementIterator() ; pos ; )
		{
			CXMLElement* pBookmark = pBookmarks->GetNextElement( pos );

			if ( pBookmark->IsNamed( _T("bookmark") ) )
			{
				CString strTitle	= pBookmark->GetAttributeValue( _T("title") );
				CString strURL		= pBookmark->GetAttributeValue( _T("url") );
				if ( theApp.m_bRTL ) strURL = _T("\x202A") + strURL;

				int nItem = m_wndList.InsertItem( LVIF_TEXT|LVIF_IMAGE,
					m_wndList.GetItemCount(), strTitle, 0, 0, 0, 0 );
				m_wndList.SetItemText( nItem, 1, strURL );
			}
		}
	}

	Skin.Translate( _T("CFavouritesProfileList"), m_wndList.GetHeaderCtrl() );
	UpdateData( FALSE );
	m_wndAdd.EnableWindow( FALSE );
	m_wndRemove.EnableWindow( FALSE );

	return TRUE;
}
Ejemplo n.º 3
0
void CIconButtonCtrl::SetIcon(HICON hIcon, BOOL bMirrored)
{
	if ( hIcon )
	{
		if ( bMirrored )
		{
			hIcon = CreateMirroredIcon( hIcon );
			ASSERT( hIcon != NULL );
		}
		if ( hIcon )
		{
			if ( m_pImageList.GetImageCount() )
			{
				ASSERT( m_pImageList.GetImageCount() == 1 );
				VERIFY( m_pImageList.Remove( 0 ) );
			}
			VERIFY( m_pImageList.Add( hIcon ) != -1 );
			VERIFY( DestroyIcon( hIcon ) );

			RemoveStyle();
		}
	}
}
Ejemplo n.º 4
0
void CPluginWnd::OnSkinChange()
{
	m_pSkin = Skin.GetWindowSkin( m_sName );
	if ( m_pSkin == NULL ) m_pSkin = Skin.GetWindowSkin( this );

	if ( m_nResID )
	{
		HICON hIcon = CoolInterface.ExtractIcon( m_nResID );

		if ( ! hIcon )
		{
			hIcon = (HICON)LoadImage( AfxGetResourceHandle(),
				MAKEINTRESOURCE( m_nResID ), IMAGE_ICON, 16, 16, 0 );
		}

		SetIcon( theApp.m_bRTL ? CreateMirroredIcon( hIcon ) : hIcon, FALSE );

		CString strCaption;
		Skin.LoadString( strCaption, m_nResID );

		SetWindowText( _T("") );
		SetWindowText( strCaption );
	}

	if ( m_bAlert != 1982 )
	{
		SetWindowRgn( NULL, FALSE );
		SetWindowPos( NULL, 0, 0, 0, 0,
			SWP_NOMOVE|SWP_NOSIZE|SWP_NOACTIVATE|SWP_NOZORDER|SWP_FRAMECHANGED );

		if ( m_pSkin ) m_pSkin->OnSize( this );

		LRESULT lResult = 0;
		m_pOwner->OnMessage( WM_SKINCHANGED, 0, 0, &lResult );
	}
}
Ejemplo n.º 5
0
BOOL CShellIcons::Lookup(LPCTSTR pszType, CString* psName, CString* psMIME, HICON* phSmallIcon, HICON* phLargeIcon /*NULL*/, HICON* phHugeIcon /*NULL*/)
{
	DWORD nType, nResult;
	TCHAR szResult[ MAX_PATH + 1 ];
	HKEY hKey, hSub;

	if ( phSmallIcon ) *phSmallIcon = NULL;
	if ( phLargeIcon ) *phLargeIcon = NULL;
	if ( phHugeIcon )  *phHugeIcon = NULL;
	if ( psName ) psName->Empty();
	if ( psMIME ) psMIME->Empty();

	if ( pszType == NULL || *pszType == 0 )
		return FALSE;

	if ( RegOpenKeyEx( HKEY_CLASSES_ROOT, pszType, 0, KEY_READ, &hKey ) != ERROR_SUCCESS )
		return FALSE;

	if ( psMIME )
	{
		nResult = sizeof( TCHAR ) * MAX_PATH;
		if ( RegQueryValueEx( hKey, L"Content Type", NULL, &nType, (LPBYTE)szResult, &nResult ) == ERROR_SUCCESS )
		{
			szResult[ nResult / sizeof( TCHAR ) ] = 0;
			*psMIME = szResult;
		}
	}

	nResult = sizeof( TCHAR ) * MAX_PATH;
	if ( RegQueryValueEx( hKey, L"", NULL, &nType, (LPBYTE)szResult, &nResult ) != ERROR_SUCCESS )
	{
		RegCloseKey( hKey );
		return FALSE;
	}

	RegCloseKey( hKey );
	szResult[ nResult / sizeof( TCHAR ) ] = 0;

	if ( RegOpenKeyEx( HKEY_CLASSES_ROOT, szResult, 0, KEY_READ, &hKey ) != ERROR_SUCCESS )
		return FALSE;

	if ( psName )
	{
		nResult = sizeof( TCHAR ) * MAX_PATH;
		if ( RegQueryValueEx( hKey, L"", NULL, &nType, (LPBYTE)szResult, &nResult ) == ERROR_SUCCESS )
		{
			szResult[ nResult / sizeof( TCHAR ) ] = 0;
			*psName = szResult;
		}
	}

	if ( RegOpenKeyEx( hKey, L"DefaultIcon", 0, KEY_READ, &hSub ) != ERROR_SUCCESS )
	{
		if ( RegOpenKeyEx( hKey, L"CurVer", 0, KEY_READ, &hSub ) != ERROR_SUCCESS )
		{
			RegCloseKey( hKey );
			return FALSE;
		}
		nResult = sizeof( TCHAR ) * MAX_PATH;
		if ( RegQueryValueEx( hSub, L"", NULL, &nType, (LPBYTE)szResult, &nResult ) != ERROR_SUCCESS )
		{
			RegCloseKey( hSub );
			RegCloseKey( hKey );
			return FALSE;
		}
		RegCloseKey( hSub );
		RegCloseKey( hKey );
		szResult[ nResult / sizeof( TCHAR ) ] = 0;

		if ( RegOpenKeyEx( HKEY_CLASSES_ROOT, szResult, 0, KEY_READ, &hKey ) != ERROR_SUCCESS )
			return FALSE;

		if ( psName )
		{
			nResult = sizeof( TCHAR ) * MAX_PATH; nType = REG_SZ;
			if ( RegQueryValueEx( hKey, L"", NULL, &nType, (LPBYTE)szResult, &nResult ) == ERROR_SUCCESS )
			{
				szResult[ nResult / sizeof( TCHAR ) ] = 0;
				*psName = szResult;
			}
		}

		if ( RegOpenKeyEx( hKey, L"DefaultIcon", 0, KEY_READ, &hSub ) != ERROR_SUCCESS )
		{
			RegCloseKey( hSub );
			RegCloseKey( hKey );
			return FALSE;
		}
	}

	nResult = sizeof( TCHAR ) * MAX_PATH;
	if ( RegQueryValueEx( hSub, L"", NULL, &nType, (LPBYTE)szResult, &nResult ) != ERROR_SUCCESS )
	{
		RegCloseKey( hSub );
		RegCloseKey( hKey );
		return FALSE;
	}

	RegCloseKey( hSub );
	RegCloseKey( hKey );
	szResult[ nResult / sizeof( TCHAR ) ] = 0;

	if ( ! LoadIcon( szResult, phSmallIcon, phLargeIcon, phHugeIcon ) )
		return FALSE;

	if ( Settings.General.LanguageRTL )
	{
		if ( phSmallIcon && *phSmallIcon )
			*phSmallIcon = CreateMirroredIcon( *phSmallIcon );
		if ( phLargeIcon && *phLargeIcon )
			*phLargeIcon = CreateMirroredIcon( *phLargeIcon );
		if ( phHugeIcon && *phHugeIcon )
			*phHugeIcon  = CreateMirroredIcon( *phHugeIcon );
	}

	return TRUE;
}