ASPiK SDK
mandelbrotview.h
1 // This file is part of VSTGUI. It is subject to the license terms
2 // in the LICENSE file found in the top-level directory of this
3 // distribution and at http://github.com/steinbergmedia/vstgui/LICENSE
4 
5 #pragma once
6 
7 #include "vstgui/lib/cview.h"
8 #include "vstgui/lib/ifocusdrawing.h"
9 #include <functional>
10 
11 //------------------------------------------------------------------------
12 namespace Mandelbrot {
13 
14 //------------------------------------------------------------------------
15 struct View : public VSTGUI::CView, public VSTGUI::IFocusDrawing
16 {
17  using CRect = VSTGUI::CRect;
18  using CPoint = VSTGUI::CPoint;
19  using CMouseEventResult = VSTGUI::CMouseEventResult;
23  using ChangedFunc = std::function<void (CRect box)>;
24 
25  View (ChangedFunc&& func);
26 
27  int32_t onKeyDown (VstKeyCode& keyCode) override;
28  CMouseEventResult onMouseDown (CPoint& where, const CButtonState& buttons) override;
29  CMouseEventResult onMouseUp (CPoint& where, const CButtonState& buttons) override;
30  CMouseEventResult onMouseMoved (CPoint& where, const CButtonState& buttons) override;
31  CMouseEventResult onMouseCancel () override;
32  void draw (CDrawContext* context) override;
33 
34  bool drawFocusOnTop () override { return false; }
35  bool getFocusPath (CGraphicsPath& outPath) override { return false; }
36 
37 private:
38  CRect box;
39  ChangedFunc changed;
40 };
41 
42 //------------------------------------------------------------------------
43 } // Mandelbrot
Rect structure.
Definition: crect.h:17
bool getFocusPath(CGraphicsPath &outPath) override
Definition: mandelbrotview.h:35
Definition: vstkeycode.h:12
CMouseEventResult onMouseMoved(CPoint &where, const CButtonState &buttons) override
called when a mouse move event occurs
Definition: mandelbrotview.cpp:51
A drawing context encapsulates the drawing context of the underlying OS.
Definition: cdrawcontext.h:29
bool drawFocusOnTop() override
Definition: mandelbrotview.h:34
int32_t onKeyDown(VstKeyCode &keyCode) override
called if a key down event occurs and this view has focus
Definition: mandelbrotview.cpp:73
void draw(CDrawContext *context) override
called if the view should draw itself
Definition: mandelbrotview.cpp:84
Definition: mandelbrotview.h:15
Custom focus drawing interface.
Definition: ifocusdrawing.h:21
Graphics Path Object.
Definition: cgraphicspath.h:19
Button and Modifier state.
Definition: cbuttonstate.h:34
Base Class of all view objects.
Definition: cview.h:44
CMouseEventResult onMouseDown(CPoint &where, const CButtonState &buttons) override
called when a mouse down event occurs
Definition: mandelbrotview.cpp:21
Point structure.
Definition: cpoint.h:17
CMouseEventResult onMouseCancel() override
called when mouse tracking should be canceled
Definition: mandelbrotview.cpp:63
CMouseEventResult onMouseUp(CPoint &where, const CButtonState &buttons) override
called when a mouse up event occurs
Definition: mandelbrotview.cpp:35
Definition: mandelbrot.h:12