From 92bad2a3d97586dc1127580e1d5a002679105149 Mon Sep 17 00:00:00 2001 From: Noel Grandin Date: Sun, 29 May 2016 13:00:07 +0200 Subject: Convert ImageSet to scoped enum Change-Id: I9957435f769957d76e95248914a422e82019e22d Reviewed-on: https://gerrit.libreoffice.org/25604 Tested-by: Jenkins Reviewed-by: Noel Grandin --- include/vcl/throbber.hxx | 12 ++++++------ toolkit/source/controls/spinningprogress.cxx | 2 +- vcl/source/control/throbber.cxx | 26 +++++++++++++------------- 3 files changed, 20 insertions(+), 20 deletions(-) diff --git a/include/vcl/throbber.hxx b/include/vcl/throbber.hxx index 898fee4e3ba8..1ab8ce62906c 100644 --- a/include/vcl/throbber.hxx +++ b/include/vcl/throbber.hxx @@ -31,18 +31,18 @@ class VCL_DLLPUBLIC Throbber : public ImageControl { public: - enum ImageSet + enum class ImageSet { /// no (default) images at all - IMAGES_NONE, + NONE, /// automatically decide between different image sets, depending on what fits best the actual size - IMAGES_AUTO, + Auto, /// default images, 16x16 pixels - IMAGES_16_PX, + N16px, /// default images, 32x32 pixels - IMAGES_32_PX, + N32px, /// default images, 64x64 pixels - IMAGES_64_PX, + N64px, }; public: diff --git a/toolkit/source/controls/spinningprogress.cxx b/toolkit/source/controls/spinningprogress.cxx index 76b36f0e379b..73fd74fe920d 100644 --- a/toolkit/source/controls/spinningprogress.cxx +++ b/toolkit/source/controls/spinningprogress.cxx @@ -61,7 +61,7 @@ protected: { Throbber::ImageSet aImageSets[] = { - Throbber::IMAGES_16_PX, Throbber::IMAGES_32_PX, Throbber::IMAGES_64_PX + Throbber::ImageSet::N16px, Throbber::ImageSet::N32px, Throbber::ImageSet::N64px }; for ( size_t i=0; i < SAL_N_ELEMENTS(aImageSets); ++i ) { diff --git a/vcl/source/control/throbber.cxx b/vcl/source/control/throbber.cxx index 0830774f654f..a2630932e01a 100644 --- a/vcl/source/control/throbber.cxx +++ b/vcl/source/control/throbber.cxx @@ -45,7 +45,7 @@ Throbber::Throbber( vcl::Window* i_parentWindow, WinBits i_style ) ,mbRepeat( true ) ,mnStepTime( 100 ) ,mnCurStep( 0 ) - ,meImageSet( IMAGES_AUTO ) + ,meImageSet( ImageSet::Auto ) { maWaitTimer.SetTimeout( mnStepTime ); maWaitTimer.SetTimeoutHdl( LINK( this, Throbber, TimeOutHdl ) ); @@ -70,7 +70,7 @@ namespace ::std::vector< Image > lcl_loadImageSet( const Throbber::ImageSet i_imageSet ) { ::std::vector< Image > aImages; - ENSURE_OR_RETURN( i_imageSet != Throbber::IMAGES_NONE, "lcl_loadImageSet: illegal image set", aImages ); + ENSURE_OR_RETURN( i_imageSet != Throbber::ImageSet::NONE, "lcl_loadImageSet: illegal image set", aImages ); const Reference< css::uno::XComponentContext > aContext( ::comphelper::getProcessComponentContext() ); const Reference< XGraphicProvider > xGraphicProvider( css::graphic::GraphicProvider::create(aContext) ); @@ -98,23 +98,23 @@ void Throbber::Resize() { ImageControl::Resize(); - if ( meImageSet == IMAGES_AUTO ) + if ( meImageSet == ImageSet::Auto ) initImages(); } void Throbber::initImages() { - if ( meImageSet == IMAGES_NONE ) + if ( meImageSet == ImageSet::NONE ) return; try { ::std::vector< ::std::vector< Image > > aImageSets; - if ( meImageSet == IMAGES_AUTO ) + if ( meImageSet == ImageSet::Auto ) { - aImageSets.push_back( lcl_loadImageSet( IMAGES_16_PX ) ); - aImageSets.push_back( lcl_loadImageSet( IMAGES_32_PX ) ); - aImageSets.push_back( lcl_loadImageSet( IMAGES_64_PX ) ); + aImageSets.push_back( lcl_loadImageSet( ImageSet::N16px ) ); + aImageSets.push_back( lcl_loadImageSet( ImageSet::N32px ) ); + aImageSets.push_back( lcl_loadImageSet( ImageSet::N64px ) ); } else { @@ -200,11 +200,11 @@ void Throbber::setImageList( ::std::vector< Image > const& i_images ) size_t index = 0; switch ( i_imageSet ) { - case IMAGES_16_PX: index = 0; break; - case IMAGES_32_PX: index = 1; break; - case IMAGES_64_PX: index = 2; break; - case IMAGES_NONE: - case IMAGES_AUTO: + case ImageSet::N16px: index = 0; break; + case ImageSet::N32px: index = 1; break; + case ImageSet::N64px: index = 2; break; + case ImageSet::NONE: + case ImageSet::Auto: OSL_ENSURE( false, "Throbber::getDefaultImageURLs: illegal image set!" ); return aImageURLs; } -- cgit