Expand a bit of ownership...

This commit is contained in:
2025-04-18 18:31:23 -04:00
parent dfa19f03cd
commit b1ac6cde6d
4 changed files with 7 additions and 5 deletions

View File

@ -777,9 +777,9 @@ void FltkComplexButtonResource::widgetCallback (Fl_Widget *widget,
} }
} }
dw::core::Platform *FltkComplexButtonResource::createPlatform () std::unique_ptr< dw::core::Platform > FltkComplexButtonResource::createPlatform ()
{ {
return new FltkPlatform (); return std::make_unique< FltkPlatform >();
} }
void FltkComplexButtonResource::attachView (FltkView *view) void FltkComplexButtonResource::attachView (FltkView *view)

View File

@ -275,7 +275,7 @@ protected:
void sizeAllocate (core::Allocation *allocation); void sizeAllocate (core::Allocation *allocation);
dw::core::Platform *createPlatform (); std::unique_ptr< dw::core::Platform > createPlatform ();
void setLayout (dw::core::Layout *layout); void setLayout (dw::core::Layout *layout);
int reliefXThickness (); int reliefXThickness ();

View File

@ -345,7 +345,7 @@ void ComplexButtonResource::init (std::unique_ptr< Widget > widget)
childWidget = widget.get(); childWidget = widget.get();
/* FIXME: Buttons should not need a full Layout */ /* FIXME: Buttons should not need a full Layout */
layout = new Layout (createPlatform (), false); layout = new Layout (createPlatform ().release(), false);
setLayout (layout); setLayout (layout);
DBG_OBJ_ASSOC_CHILD (layout); DBG_OBJ_ASSOC_CHILD (layout);
layout->setWidget (std::move( widget )); layout->setWidget (std::move( widget ));

View File

@ -5,6 +5,8 @@
# error Do not include this file directly, use "core.hh" instead. # error Do not include this file directly, use "core.hh" instead.
#endif #endif
#include <memory>
namespace dw { namespace dw {
namespace core { namespace core {
@ -427,7 +429,7 @@ protected:
void setEmbed (Embed *embed); void setEmbed (Embed *embed);
virtual Platform *createPlatform () = 0; virtual std::unique_ptr< Platform > createPlatform () = 0;
virtual void setLayout (Layout *layout) = 0; virtual void setLayout (Layout *layout) = 0;
virtual int reliefXThickness () = 0; virtual int reliefXThickness () = 0;