diff options
author | Noel Grandin <noel.grandin@collabora.co.uk> | 2018-04-20 17:08:47 +0200 |
---|---|---|
committer | Noel Grandin <noel.grandin@collabora.co.uk> | 2018-04-23 08:15:55 +0200 |
commit | e098e2d5bf0f0f9452774c133cca23ba7fbd16df (patch) | |
tree | dffee85041e308bf0714f0b1bd31b06fb2d667c1 | |
parent | 00dd50d1a82d04df2baebcc3ae2f5ddab5c43997 (diff) |
loplugin:useuniqueptr in MoreButton
and remove unused mpItemList field in ImplMoreButtonData
Change-Id: I1eee6958d0f064cec22028399de5fb28e8647617
Reviewed-on: https://gerrit.libreoffice.org/53236
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
-rw-r--r-- | include/vcl/morebtn.hxx | 3 | ||||
-rw-r--r-- | vcl/source/control/morebtn.cxx | 22 |
2 files changed, 4 insertions, 21 deletions
diff --git a/include/vcl/morebtn.hxx b/include/vcl/morebtn.hxx index 1ee17a348380..4243a1438045 100644 --- a/include/vcl/morebtn.hxx +++ b/include/vcl/morebtn.hxx @@ -24,13 +24,14 @@ #include <vcl/dllapi.h> #include <vcl/mapmod.hxx> #include <vcl/button.hxx> +#include <memory> struct ImplMoreButtonData; class VCL_DLLPUBLIC MoreButton : public PushButton { - ImplMoreButtonData* mpMBData; + std::unique_ptr<ImplMoreButtonData> mpMBData; bool mbState; MoreButton( const MoreButton & ) = delete; diff --git a/vcl/source/control/morebtn.cxx b/vcl/source/control/morebtn.cxx index 1bcbee39d9db..6756853fe5ec 100644 --- a/vcl/source/control/morebtn.cxx +++ b/vcl/source/control/morebtn.cxx @@ -23,18 +23,15 @@ struct ImplMoreButtonData { - std::vector< VclPtr<vcl::Window> >* mpItemList; OUString maMoreText; OUString maLessText; }; void MoreButton::ImplInit( vcl::Window* pParent, WinBits nStyle ) { - mpMBData = new ImplMoreButtonData; + mpMBData.reset(new ImplMoreButtonData); mbState = false; - mpMBData->mpItemList = nullptr; - PushButton::ImplInit( pParent, nStyle ); mpMBData->maMoreText = Button::GetStandardText( StandardButtonType::More ); @@ -80,8 +77,7 @@ MoreButton::~MoreButton() void MoreButton::dispose() { - delete mpMBData->mpItemList; - delete mpMBData; + mpMBData.reset(); PushButton::dispose(); } @@ -98,13 +94,6 @@ void MoreButton::Click() // Update the windows according to the status if ( mbState ) { - // Show window - if ( mpMBData->mpItemList ) { - for (VclPtr<Window> & i : *mpMBData->mpItemList) { - i->Show(); - } - } - // Adapt dialogbox Point aPos( pParent->GetPosPixel() ); tools::Rectangle aDeskRect( pParent->ImplGetFrameWindow()->GetDesktopRectPixel() ); @@ -127,13 +116,6 @@ void MoreButton::Click() // Adapt Dialogbox aSize.AdjustHeight( -nDeltaPixel ); pParent->SetSizePixel( aSize ); - - // Hide window(s) again - if ( mpMBData->mpItemList ) { - for (VclPtr<Window> & i : *mpMBData->mpItemList) { - i->Hide(); - } - } } // Call Click handler here, so that we can initialize the Controls PushButton::Click(); |