30 SetTooltip(
"TestSVGControl - Click or Drag 'n drop here to load a new SVG.");
54 WDL_String fileName, path;
57 [
this](
const WDL_String& fileName,
const WDL_String& path) {
58 if (fileName.GetLength())
59 SetSVG(
GetUI()->LoadSVG(fileName.Get()));
64 void OnDrop(
const char* str)
override
66 SetSVG(
GetUI()->LoadSVG(str));
70 void SetSVG(
const ISVG& svg)
This file contains the base IControl implementation, along with some base classes for specific types ...
The lowest level base class of an IGraphics control.
bool mMouseIsOver
if mGraphics::mHandleMouseOver = true, this will be true when the mouse is over control.
IControl * SetTooltip(const char *str)
Set a tooltip for the control.
virtual void SetDirty(bool triggerAction=true, int valIdx=kNoValIdx)
Mark the control as dirty, i.e.
The lowest level base class of an IGraphics context.
virtual void DrawDottedRect(const IColor &color, const IRECT &bounds, const IBlend *pBlend=0, float thickness=1.f, float dashLen=2.f)
Draw a dotted rectangle to the graphics context.
bool CheckLayer(const ILayerPtr &layer)
Test to see if a layer needs drawing, for instance if the control's bounds were changed.
void DrawLayer(const ILayerPtr &layer, const IBlend *pBlend=nullptr)
Draw a layer to the main IGraphics context.
virtual void FillRect(const IColor &color, const IRECT &bounds, const IBlend *pBlend=0)
Fill a rectangular region of the graphics context with a color.
virtual void PromptForFile(WDL_String &fileName, WDL_String &path, EFileAction action=EFileAction::Open, const char *ext="", IFileDialogCompletionHandlerFunc completionHandler=nullptr)=0
Create a platform file prompt dialog to choose a path for opening/saving a single file.
void StartLayer(IControl *pOwner, const IRECT &r, bool cacheable=false)
Create an IGraphics layer.
virtual void DrawSVG(const ISVG &svg, const IRECT &bounds, const IBlend *pBlend=0, const IColor *pStrokeColor=nullptr, const IColor *pFillColor=nullptr)
Draw an SVG image to the graphics context.
ILayerPtr EndLayer()
End an IGraphics layer.
Control to test drawing SVGs.
void Draw(IGraphics &g) override
Draw the control to the graphics context.
void OnDrop(const char *str) override
Implement to do something when something was drag 'n dropped onto this control.
void OnMouseDown(float x, float y, const IMouseMod &mod) override
Implement this method to respond to a mouse down event on this control.
std::unique_ptr< ILayer > ILayerPtr
ILayerPtr is a managed pointer for transferring the ownership of layers.
Used to manage mouse modifiers i.e.
Used to manage a rectangular area, independent of draw class/platform.
User-facing SVG abstraction that you use to manage SVG data ISVG doesn't actually own the image data.