本文整理汇总了C++中BitmapImage::SetSize方法的典型用法代码示例。如果您正苦于以下问题:C++ BitmapImage::SetSize方法的具体用法?C++ BitmapImage::SetSize怎么用?C++ BitmapImage::SetSize使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类BitmapImage
的用法示例。
在下文中一共展示了BitmapImage::SetSize方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: GetNodeImage
/** \brief Get a suitable icon for the file.
* This should retrieve a suitable icon for the file to display and return
* an Image pointer to it.
*
* \param pcNode The item from the remote view that needs an icon.
* \param bSmall If true, the icon should be 24x24. Otherwise it should be 48x48.
*
* \todo Ask the registrar for a suitable icon, based on the file extension.
* \todo Add basic file/dir icons as resources, and fall back to them if the icon file is missing.
*/
Image* RemoteIconView::GetNodeImage( RemoteNode* pcNode, bool bSmall )
{
File* pcFile;
/* Todo: ask the Registrar for suitable icon */
/* Looks like with current RegistrarManager class, either have to parse the list of registered types, or create a 'fake' temp file and query registrar about that instead */
if( pcNode->m_bIsDir ) {
/* TODO: fall back to resource if file isn't present */
pcFile = new File( "/system/icons/folder.png" );
} else {
pcFile = new File( "/system/icons/file.png" );
}
BitmapImage* pcImage = new BitmapImage( pcFile );
if( bSmall ) {
if( pcImage && pcImage->GetSize() != Point( 24,24 ) )
pcImage->SetSize( Point( 24,24 ) );
} else {
if( pcImage && pcImage->GetSize() != Point( 48,48 ) )
pcImage->SetSize( Point( 48,48 ) );
}
return( pcImage );
}
示例2: DragSelection
/** \brief DragSelection callback.
* Handles the results of a drag selection.
*/
void RemoteIconView::DragSelection( Point cStartPoint )
{
/* Most of this is adapted from IconDirectoryView::DragSelection */
if( m_pcServer == NULL )
{
DEBUG( "DragSelection with m_pcServer== NULL\n" );
return;
}
String zBase = m_pcServer->GetServerAddress();
Message cMsg( 1234 ); /* Message code isn't important */
/* Add all selected icons to the message, and find the icon under the mouse. */
int nCount = 0;
int nLastSelected = -1;
Point cIconPos = Point( 0,0 );
for( uint i = 0; i < GetIconCount(); i++ ) {
if( GetIconSelected( i ) ) {
RemoteIconData* pcData = (RemoteIconData*)GetIconData( i );
// DEBUG( " %s\n", pcData->m_cNode.m_zPath.c_str() );
cMsg.AddString( "remote-file/path", pcData->m_cNode.m_zPath );
cMsg.AddString( "server", zBase );
cMsg.AddBool( "is_dir", pcData->m_cNode.m_bIsDir );
if( Rect( GetIconPosition( i ), GetIconPosition( i ) + GetIconSize() ).DoIntersect( cStartPoint ) ) {
cIconPos = GetIconPosition( i );
}
nLastSelected = i;
nCount++;
}
}
if( nCount == 0 ) return;
/* Create a drag&drop icon */
Bitmap cBitmap( (int)GetIconSize().x + 1, (int)GetIconSize().y + 1, CS_RGB32, Bitmap::ACCEPT_VIEWS | Bitmap::SHARE_FRAMEBUFFER );
View* pcView = new View( Rect( Point(0,0), GetIconSize() ), "temp" );
cBitmap.AddChild( pcView );
Image* pcIcon = NULL;
String zLabel;
if( nCount == 1 ) {
/* Only one file selected; use its icon */
zLabel = GetIconString( nLastSelected, 0 );
pcIcon = GetIconImage( nLastSelected );
} else {
/* Multiple files selected; use dir icon */
zLabel.Format( "%i items", nCount ); /* TODO: localise the string */
/* TODO: Fall back to resource if file isn't present */
File* pcFile = new File( "/system/icons/folder.png" );
BitmapImage* pcBitmapImage = new BitmapImage( pcFile );
Point cSize = (GetView() == VIEW_LIST || GetView() == VIEW_DETAILS ? Point( 24,24 ) : Point( 48,48 ));
if( pcBitmapImage->GetSize() != cSize ) pcBitmapImage->SetSize( cSize );
pcIcon = pcBitmapImage;
}
if( pcIcon ) {
RenderIcon( zLabel, pcIcon, pcView, Point(0,0) );
}
cBitmap.Sync();
if( nCount != 1 ) delete( pcIcon );
BeginDrag( &cMsg, cStartPoint - cIconPos, &cBitmap );
}