11 #include "vstkeycode.h" 12 #include "cbuttonstate.h" 13 #include "cgraphicstransform.h" 20 extern UTF8StringPtr kDegreeSymbol;
21 extern UTF8StringPtr kInfiniteSymbol;
22 extern UTF8StringPtr kCopyrightSymbol;
23 extern UTF8StringPtr kTrademarkSymbol;
24 extern UTF8StringPtr kRegisteredSymbol;
25 extern UTF8StringPtr kMicroSymbol;
26 extern UTF8StringPtr kPerthousandSymbol;
29 extern IdStringPtr kMsgViewSizeChanged;
35 extern const CViewAttributeID kCViewAttributeReferencePointer;
36 extern const CViewAttributeID kCViewTooltipAttribute;
37 extern const CViewAttributeID kCViewControllerAttribute;
56 virtual bool checkUpdate (
const CRect& updateRect)
const {
return updateRect.rectOverlap (
getViewSize ()); }
58 virtual bool isDirty ()
const {
return hasViewFlag (kDirty); }
59 virtual void setDirty (
bool val =
true);
85 virtual bool onWheel (
const CPoint& where,
const CMouseWheelAxis& axis,
const float& distance,
const CButtonState& buttons);
95 #if VSTGUI_TOUCH_EVENT_HANDLING 100 virtual void onTouchEvent (ITouchEvent& event) {}
101 virtual bool wantsMultiTouchEvents ()
const {
return false; }
109 virtual DragResult
doDrag (IDataPackage* source,
const CPoint& offset = CPoint (0, 0), CBitmap* dragBitmap =
nullptr);
147 virtual bool wantsFocus ()
const {
return hasViewFlag (kWantsFocus); }
156 bool getAttribute (
const CViewAttributeID
id,
const uint32_t inSize,
void* outData, uint32_t& outSize)
const;
157 bool setAttribute (
const CViewAttributeID
id,
const uint32_t inSize,
const void* inData);
171 CBitmap* getDrawBackground ()
const;
191 bool isAttached ()
const {
return hasViewFlag (kIsAttached); }
194 void setSubviewState (
bool state);
195 bool isSubview ()
const {
return hasViewFlag (kIsSubview); }
203 virtual VSTGUIEditorInterface*
getEditor ()
const;
210 void addAnimation (IdStringPtr name, Animation::IAnimationTarget* target, Animation::ITimingFunction* timingFunction, CBaseObject* notificationObject =
nullptr);
211 void addAnimation (IdStringPtr name, Animation::IAnimationTarget* target, Animation::ITimingFunction* timingFunction,
const Animation::DoneFunction& doneFunc);
212 void removeAnimation (IdStringPtr name);
213 void removeAllAnimations ();
224 bool wantsIdle ()
const {
return hasViewFlag (kWantsIdle); }
242 template<
typename T> T&
translateToGlobal (T& t)
const { getGlobalTransform ().transform (t);
return t; }
243 template<
typename T> T
translateToGlobal (
const T& t)
const { T tmp (t); getGlobalTransform ().transform (tmp);
return tmp; }
244 template<
typename T> T&
translateToLocal (T& t)
const { getGlobalTransform ().inverse ().transform (t);
return t; }
245 template<
typename T> T
translateToLocal (
const T& t)
const { T tmp (t); getGlobalTransform ().inverse ().transform (tmp);
return tmp; }
248 virtual void dumpInfo ();
252 virtual const CViewContainer* asViewContainer ()
const {
return nullptr; }
255 CMessageResult
notify (CBaseObject* sender, IdStringPtr message)
override;
256 void beforeDelete ()
override;
259 CLASS_METHODS(CView, CBaseObject)
262 kMouseEnabled = 1 << 0,
263 kTransparencyEnabled = 1 << 1,
264 kWantsFocus = 1 << 2,
265 kIsAttached = 1 << 3,
273 ~CView () noexcept override;
275 CGraphicsPath* getHitTestPath () const;
277 bool hasViewFlag (int32_t bit) const;
278 void setViewFlag (int32_t bit,
bool state);
280 void setAlphaValueNoInvalidate (
float value);
281 void setParentFrame (CFrame* frame);
282 void setParentView (CView* parent);
286 std::unique_ptr<Impl> pImpl;
299 void* first (int32_t& size, int32_t& type);
300 void* next (int32_t& size, int32_t& type);
302 int32_t getType (int32_t idx)
const;
303 int32_t getCount ()
const;
Helper class to port old code which used CDragContainer.
Definition: cview.h:293
virtual bool attached(CView *parent)
view is attached to a parent view
Definition: cview.cpp:359
void setWantsIdle(bool state)
enable/disable onIdle() callback
Definition: cview.cpp:323
virtual void setMouseableArea(const CRect &rect)
set the area in which the view reacts to the mouse
Definition: cview.cpp:256
virtual bool removed(CView *parent)
view is removed from parent view
Definition: cview.cpp:382
Container Class of CView objects.
Definition: cviewcontainer.h:52
bool getAttribute(const CViewAttributeID id, const uint32_t inSize, void *outData, uint32_t &outSize) const
get an attribute
Definition: cview.cpp:831
Rect structure.
Definition: crect.h:17
ASCII Text.
Definition: cview.h:307
virtual CPoint & localToFrame(CPoint &point) const
conversion from local view coordinates to frame coordinates
Definition: cview.cpp:481
virtual VSTGUIEditorInterface * getEditor() const
get editor
Definition: cview.cpp:756
virtual void onWindowActivate(bool state)
Definition: cview.h:231
UTF8 Text.
Definition: cview.h:308
T & translateToGlobal(T &t) const
translates a local coordinate to a global one using parent transforms
Definition: cview.h:242
virtual void drawRect(CDrawContext *pContext, const CRect &updateRect)
called if the view should draw itself
Definition: cview.h:55
virtual CMouseEventResult onMouseExited(CPoint &where, const CButtonState &buttons)
called when the mouse leaves this view
Definition: cview.h:79
virtual CMouseEventResult onMouseDown(CPoint &where, const CButtonState &buttons)
called when a mouse down event occurs
Definition: cview.cpp:405
void setHitTestPath(CGraphicsPath *path)
Definition: cview.cpp:442
Definition: vstkeycode.h:12
virtual void looseFocus()
called if view should loose focus
Definition: cview.cpp:622
T translateToLocal(const T &t) const
translates a local coordinate to a global one using parent transforms
Definition: cview.h:245
float getAlphaValue() const
get alpha value
Definition: cview.cpp:714
virtual CMouseEventResult onMouseEntered(CPoint &where, const CButtonState &buttons)
called when the mouse enters this view
Definition: cview.h:78
virtual DragResult doDrag(IDataPackage *source, const CPoint &offset=CPoint(0, 0), CBitmap *dragBitmap=nullptr)
start a drag operation. See CDropSource to create the source data package
Definition: cview.cpp:600
A drawing context encapsulates the drawing context of the underlying OS.
Definition: cdrawcontext.h:29
virtual CPoint & frameToLocal(CPoint &point) const
conversion from frame coordinates to local view coordinates
Definition: cview.cpp:469
static uint32_t idleRate
global idle rate in Hz, defaults to 30 Hz
Definition: cview.h:225
Base Object with reference counter.
Definition: vstguibase.h:276
virtual void parentSizeChanged()
notification that one of the views parent has changed its size
Definition: cview.h:133
bool isVisible() const
get visibility state
Definition: cview.h:66
CBitmap * getBackground() const
get the background image of this view
Definition: cview.cpp:773
virtual CMouseEventResult onMouseMoved(CPoint &where, const CButtonState &buttons)
called when a mouse move event occurs
Definition: cview.cpp:427
virtual void setWantsFocus(bool state)
set focus support on/off
Definition: cview.cpp:317
bool removeAttribute(const CViewAttributeID id)
remove an attribute
Definition: cview.cpp:868
virtual bool onDrop(IDataPackage *drag, const CPoint &where)
called if a drag is dropped onto this view
Definition: cview.h:110
CCoord getWidth() const
get the width of the view
Definition: cview.h:129
CDragType
Definition: cview.h:305
Graphics Path Object.
Definition: cgraphicspath.h:19
CView * getParentView() const
get parent view
Definition: cview.cpp:744
virtual bool hitTest(const CPoint &where, const CButtonState &buttons=-1)
check if where hits this view
Definition: cview.cpp:453
bool setAttribute(const CViewAttributeID id, const uint32_t inSize, const void *inData)
set an attribute
Definition: cview.cpp:855
virtual bool onWheel(const CPoint &where, const float &distance, const CButtonState &buttons)
called if a mouse wheel event is happening over this view
Definition: cview.cpp:547
virtual void setAutosizeFlags(int32_t flags)
set autosize flags
Definition: cview.cpp:720
virtual void setTransparency(bool val)
set views transparent state
Definition: cview.cpp:307
virtual CMouseEventResult onMouseCancel()
called when mouse tracking should be canceled
Definition: cview.cpp:433
virtual CMouseEventResult onMouseUp(CPoint &where, const CButtonState &buttons)
called when a mouse up event occurs
Definition: cview.cpp:416
virtual void setViewSize(const CRect &rect, bool invalid=true)
set views size
Definition: cview.cpp:642
Encapsulates various platform depended kinds of bitmaps.
Definition: cbitmap.h:21
bool getAttributeSize(const CViewAttributeID id, uint32_t &outSize) const
get the size of an attribute
Definition: cview.cpp:812
CBitmap * getDisabledBackground() const
get background image used when the mouse is not enabled
Definition: cview.cpp:779
Definition: customcontrols.cpp:8
virtual void onDragMove(IDataPackage *drag, const CPoint &where)
called if a drag is moved inside this view
Definition: cview.h:113
bool getTransparency() const
get views transparent state
Definition: cview.h:179
bool isAttached() const
is view attached to a parentView
Definition: cview.h:191
virtual void invalidRect(const CRect &rect)
mark rect as invalid
Definition: cview.cpp:518
virtual void setMouseEnabled(bool bEnable=true)
turn on/off mouse usage for this view
Definition: cview.cpp:293
int32_t getAutosizeFlags() const
get autosize flags
Definition: cview.cpp:726
virtual void onIdle()
called on idle when view wants idle
Definition: cview.h:222
const CRect & getViewSize() const
read only access to view size
Definition: cview.cpp:661
virtual void setDirty(bool val=true)
set the view to dirty so that it is redrawn in the next idle. Thread Safe !
Definition: cview.cpp:333
virtual void onDragLeave(IDataPackage *drag, const CPoint &where)
called if a drag is leaving this view
Definition: cview.h:112
static bool kDirtyCallAlwaysOnMainThread
if this is true, setting a view dirty will call invalid() instead of checking it in idle...
Definition: cview.h:60
T & translateToLocal(T &t) const
translates a global coordinate to a local one using parent transforms
Definition: cview.h:244
const CRect & getMouseableArea() const
read only access to the mouseable area
Definition: cview.cpp:269
Base Class of all view objects.
Definition: cview.h:44
View Listener Interface.
Definition: iviewlistener.h:15
virtual bool sizeToFit()
resize view to optimal size
Definition: cview.h:138
interface for drag&drop and clipboard data
Definition: idatapackage.h:15
virtual void setBackground(CBitmap *background)
set the background image of this view
Definition: cview.cpp:765
virtual CRect getVisibleViewSize() const
returns the visible size of the view
Definition: cview.cpp:670
bool getMouseEnabled() const
get the state of wheather this view uses the mouse or not
Definition: cview.h:88
CFrame * getFrame() const
get frame
Definition: cview.cpp:750
virtual void draw(CDrawContext *pContext)
called if the view should draw itself
Definition: cview.cpp:531
virtual void invalid()
mark whole view as invalid
Definition: cview.h:63
virtual int32_t onKeyUp(VstKeyCode &keyCode)
called if a key up event occurs and this view has focus
Definition: cview.cpp:587
CCoord getHeight() const
get the height of the view
Definition: cview.h:128
virtual void takeFocus()
called if view should take focus
Definition: cview.cpp:630
virtual int32_t onKeyDown(VstKeyCode &keyCode)
called if a key down event occurs and this view has focus
Definition: cview.cpp:577
virtual bool isDirty() const
check if view is dirty
Definition: cview.h:58
virtual void setDisabledBackground(CBitmap *background)
set background image used when the mouse is not enabled
Definition: cview.cpp:794
Point structure.
Definition: cpoint.h:17
T translateToGlobal(const T &t) const
translates a local coordinate to a global one using parent transforms
Definition: cview.h:243
virtual void onDragEnter(IDataPackage *drag, const CPoint &where)
called if a drag is entering this view
Definition: cview.h:111
virtual bool wantsFocus() const
check if view supports focus
Definition: cview.h:147
virtual void setVisible(bool state)
set visibility state
Definition: cview.cpp:678
virtual void setAlphaValue(float alpha)
set alpha value which will be applied when drawing this view
Definition: cview.cpp:702
bool wantsIdle() const
returns if the view wants idle callback or not
Definition: cview.h:224
virtual bool wantsWindowActiveStateChangeNotification() const
Definition: cview.h:229
CMessageResult notify(CBaseObject *sender, IdStringPtr message) override
Definition: cview.cpp:616