25 TestArcControl(
IRECT rect,
int paramIdx = kNoParameter,
float angle1 = -135.f,
float angle2 = 135.f)
37 float angle = mAngle1 + (float)
GetValue() * (mAngle2 - mAngle1);
38 g.
FillArc(COLOR_BLUE, mRECT.
MW(), mRECT.
MH(), mRECT.
W() * 0.44f, mAngle1, angle);
39 g.
DrawArc(COLOR_BLACK, mRECT.
MW(), mRECT.
MH(), mRECT.
W() * 0.44f, mAngle1, angle);
44 angle = DegToRad(angle-90.f);
46 float x1 = mRECT.
MW() + cosf(angle - 0.3f) * mRECT.
W() * 0.3f;
47 float y1 = mRECT.
MH() + sinf(angle - 0.3f) * mRECT.
W() * 0.3f;
48 float x2 = mRECT.
MW() + cosf(angle + 0.3f) * mRECT.
W() * 0.3f;
49 float y2 = mRECT.
MH() + sinf(angle + 0.3f) * mRECT.
W() * 0.3f;
50 float x3 = mRECT.
MW() + cosf(angle) * mRECT.
W() * 0.44f;
51 float y3 = mRECT.
MH() + sinf(angle) * mRECT.
W() * 0.44f;
This file contains the base IControl implementation, along with some base classes for specific types ...
IControl * SetTooltip(const char *str)
Set a tooltip for the control.
double GetValue(int valIdx=0) const
Get the control's value.
The lowest level base class of an IGraphics context.
virtual void DrawRect(const IColor &color, const IRECT &bounds, const IBlend *pBlend=0, float thickness=1.f)
Draw a rectangle to the graphics context.
void DrawRadialLine(const IColor &color, float cx, float cy, float angle, float rMin, float rMax, const IBlend *pBlend=0, float thickness=1.f)
Draw a radial line to the graphics context, useful for pointers on dials.
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 DrawArc(const IColor &color, float cx, float cy, float r, float a1, float a2, const IBlend *pBlend=0, float thickness=1.f)
Draw an arc to the graphics context.
virtual void DrawCircle(const IColor &color, float cx, float cy, float r, const IBlend *pBlend=0, float thickness=1.f)
Draw a circle to the graphics context.
virtual void FillTriangle(const IColor &color, float x1, float y1, float x2, float y2, float x3, float y3, const IBlend *pBlend=0)
Fill a triangle with a color.
virtual void HideMouseCursor(bool hide=true, bool lock=true)=0
Call to hide/show the mouse cursor.
virtual void FillArc(const IColor &color, float cx, float cy, float r, float a1, float a2, const IBlend *pBlend=0)
Fill an arc segment with a color.
virtual void DrawTriangle(const IColor &color, float x1, float y1, float x2, float y2, float x3, float y3, const IBlend *pBlend=0, float thickness=1.f)
Draw a triangle to the graphics context.
virtual void FillCircle(const IColor &color, float cx, float cy, float r, const IBlend *pBlend=0)
Fill a circle with a color.
A base class for knob/dial controls, to handle mouse action and Sender.
void OnMouseDown(float x, float y, const IMouseMod &mod) override
Implement this method to respond to a mouse down event on this control.
void OnMouseUp(float x, float y, const IMouseMod &mod) override
Implement this method to respond to a mouse up event on this control.
Control to test drawing arcs.
void OnMouseUp(float x, float y, const IMouseMod &mod) override
Implement this method to respond to a mouse up event on this control.
void Draw(IGraphics &g) override
Draw the control to the graphics context.
void OnMouseDown(float x, float y, const IMouseMod &mod) override
Implement this method to respond to a mouse down event on this control.
Used to manage mouse modifiers i.e.
Used to manage a rectangular area, independent of draw class/platform.
IRECT GetPadded(float padding) const
Get a copy of this IRECT with each value padded by padding N.B.