9 #include "cviewcontainer.h" 10 #include "platform/iplatformframecallback.h" 24 extern IdStringPtr kMsgNewFocusView;
25 extern IdStringPtr kMsgOldFocusView;
41 bool open (
void* pSystemWindow, PlatformType systemWindowType = kDefaultNative, IPlatformFrameConfig* =
nullptr);
44 bool setZoom (
double zoomFactor);
47 double getScaleFactor ()
const;
59 bool setSize (CCoord width, CCoord height);
64 CView* getModalView ()
const;
66 void beginEdit (int32_t index);
67 void endEdit (int32_t index);
74 CView* getFocusView ()
const;
82 void invalidate (
const CRect& rect);
126 using Function = std::function<void ()>;
144 void onStartLocalEventLoop ();
150 bool removeAll (
bool withForget =
true)
override;
164 bool onWheel (
const CPoint& where,
const CMouseWheelAxis& axis,
const float& distance,
const CButtonState& buttons)
override;
171 IPlatformFrame* getPlatformFrame ()
const;
174 void dumpHierarchy ()
override;
181 struct CollectInvalidRects;
183 ~
CFrame () noexcept override = default;
184 void beforeDelete () override;
187 void clearMouseViews (const
CPoint& where, const
CButtonState& buttons,
bool callMouseExit = true);
188 void removeFromMouseViews (
CView* view);
189 void setCollectInvalidRects (CollectInvalidRects* collectInvalidRects);
192 int32_t keyboardHooksOnKeyDown (const
VstKeyCode& key);
193 int32_t keyboardHooksOnKeyUp (const
VstKeyCode& key);
196 void callMouseObserverMouseEntered (
CView* view);
197 void callMouseObserverMouseExited (
CView* view);
198 CMouseEventResult callMouseObserverMouseDown (const
CPoint& where, const
CButtonState& buttons);
199 CMouseEventResult callMouseObserverMouseMoved (const
CPoint& where, const
CButtonState& buttons);
201 void dispatchNewScaleFactor (
double newScaleFactor);
205 CMouseEventResult platformOnMouseDown (
CPoint& where, const
CButtonState& buttons) override;
206 CMouseEventResult platformOnMouseMoved (
CPoint& where, const
CButtonState& buttons) override;
207 CMouseEventResult platformOnMouseUp (
CPoint& where, const
CButtonState& buttons) override;
208 CMouseEventResult platformOnMouseExited (
CPoint& where, const
CButtonState& buttons) override;
209 bool platformOnMouseWheel (const
CPoint& where, const CMouseWheelAxis& axis, const
float& distance, const
CButtonState& buttons) override;
214 bool platformOnKeyDown (
VstKeyCode& keyCode) override;
215 bool platformOnKeyUp (
VstKeyCode& keyCode) override;
216 void platformOnActivate (
bool state) override;
217 void platformOnWindowActivate (
bool state) override;
218 void platformScaleFactorChanged (
double newScaleFactor) override;
219 #if VSTGUI_TOUCH_EVENT_HANDLING 220 void platformOnTouchEvent (ITouchEvent& event)
override;
225 Impl* pImpl {
nullptr};
232 virtual void doIdleStuff () {}
233 virtual int32_t getKnobMode ()
const {
return -1; }
235 virtual void beginEdit (int32_t index) {}
236 virtual void endEdit (int32_t index) {}
240 virtual CFrame* getFrame ()
const {
return frame; }
242 VSTGUIEditorInterface () =
default;
243 virtual ~VSTGUIEditorInterface () noexcept = default;
245 CFrame* frame {
nullptr};
256 virtual void onMouseEntered (
CView* view,
CFrame* frame) = 0;
257 virtual void onMouseExited (
CView* view,
CFrame* frame) = 0;
286 virtual void onViewAdded (
CFrame* frame,
CView* view) = 0;
287 virtual void onViewRemoved (
CFrame* frame,
CView* view) = 0;
300 virtual void onFocusViewChanged (
CFrame* frame,
CView* newFocusView,
CView* oldFocusView) = 0;
bool inEventProcessing() const
Definition: cframe.cpp:1704
Container Class of CView objects.
Definition: cviewcontainer.h:52
void setViewSize(const CRect &rect, bool invalid=true) override
set views size
Definition: cframe.cpp:772
void onViewAdded(CView *pView)
Definition: cframe.cpp:967
void setFocusWidth(CCoord width)
set focus draw width
Definition: cframe.cpp:1254
SharedPointer< IDataPackage > getClipboard()
get the clipboard data. data is owned by the caller
Definition: cframe.cpp:674
void close()
closes the frame and calls forget
Definition: cframe.cpp:165
void onActivate(bool state)
called when the platform view/window is activated/deactivated
Definition: cframe.cpp:1185
CViewContainer * getContainerAt(const CPoint &where, const GetViewOptions &options=GetViewOptions().deep()) const override
get the container at point where
Definition: cframe.cpp:1164
Rect structure.
Definition: crect.h:17
bool getSize(CRect *pSize) const
Definition: cframe.cpp:817
void setFocusColor(const CColor &color)
set focus draw color
Definition: cframe.cpp:1248
void setFocusView(CView *pView)
Definition: cframe.cpp:982
CMouseEventResult onMouseUp(CPoint &where, const CButtonState &buttons) override
called when a mouse up event occurs
Definition: cframe.cpp:522
Definition: cviewcontainer.h:22
view added removed observer interface for CFrame
Definition: cframe.h:281
virtual bool beforeSizeChange(const CRect &newSize, const CRect &oldSize)
frame will change size, if this returns false the upstream implementation does not allow it and thus ...
Definition: cframe.h:238
Definition: vstkeycode.h:12
Definition: vstguibase.h:299
VSTGUIEditorInterface * getEditor() const override
get editor
Definition: cframe.cpp:1454
bool setZoom(double zoomFactor)
set zoom factor
Definition: cframe.cpp:216
CButtonState getCurrentMouseButtons() const
get current mouse buttons and key modifiers
Definition: cframe.cpp:913
A drawing context encapsulates the drawing context of the underlying OS.
Definition: cdrawcontext.h:29
bool attached(CView *parent) override
view is attached to a parent view
Definition: cframe.cpp:198
void draw(CDrawContext *pContext) override
called if the view should draw itself
Definition: cframe.cpp:272
void setClipboard(const SharedPointer< IDataPackage > &data)
set the clipboard data.
Definition: cframe.cpp:682
void registerMouseObserver(IMouseObserver *observer)
register a mouse observer
Definition: cframe.cpp:1366
RGBA Color structure.
Definition: ccolor.h:15
bool onWheel(const CPoint &where, const float &distance, const CButtonState &buttons) override
called if a mouse wheel event is happening over this view
Definition: cframe.cpp:660
void setCursor(CCursorType type)
set mouse cursor
Definition: cframe.cpp:927
void enableTooltips(bool state)
enable or disable tooltips
Definition: cframe.cpp:258
virtual int32_t onKeyUp(const VstKeyCode &code, CFrame *frame)=0
should return 1 if no further key up processing should apply, otherwise -1
CMouseEventResult onMouseDown(CPoint &where, const CButtonState &buttons) override
called when a mouse down event occurs
Definition: cframe.cpp:485
bool advanceNextFocusView(CView *oldFocus, bool reverse=false) override
Definition: cframe.cpp:1047
void invalid() override
mark whole view as invalid
Definition: cframe.h:146
bool doAfterEventProcessing(Function &&func)
Definition: cframe.cpp:1688
void registerKeyboardHook(IKeyboardHook *hook)
register a keyboard hook
Definition: cframe.cpp:1316
uint32_t getTicks() const
get the current time (in ms)
Definition: cframe.cpp:708
DragResult doDrag(IDataPackage *source, const CPoint &offset, CBitmap *dragBitmap) override
start a drag operation. See CDropSource to create the source data package
Definition: cframe.cpp:666
bool hitTestSubViews(const CPoint &where, const CButtonState &buttons=-1) override
Definition: cframe.cpp:465
Encapsulates various platform depended kinds of bitmaps.
Definition: cbitmap.h:21
bool setPosition(CCoord x, CCoord y)
Definition: cframe.cpp:734
CMouseEventResult onMouseMoved(CPoint &where, const CButtonState &buttons) override
called when a mouse move event occurs
Definition: cframe.cpp:531
CView * getViewAt(const CPoint &where, const GetViewOptions &options=GetViewOptions()) const override
get the view at point where
Definition: cframe.cpp:1141
Definition: customcontrols.cpp:8
virtual int32_t onKeyDown(const VstKeyCode &code, CFrame *frame)=0
should return 1 if no further key down processing should apply, otherwise -1
focus view observer interface for CFrame
Definition: cframe.h:295
bool getPosition(CCoord &x, CCoord &y) const
Definition: cframe.cpp:756
virtual CMouseEventResult onMouseMoved(CFrame *frame, const CPoint &where, const CButtonState &buttons)
a mouse move event happend on the frame at position where. If the observer handles this...
Definition: cframe.h:258
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
bool focusDrawingEnabled() const
is focus drawing enabled
Definition: cframe.cpp:1212
int32_t onKeyDown(VstKeyCode &keyCode) override
called if a key down event occurs and this view has focus
Definition: cframe.cpp:586
bool getCurrentMouseLocation(CPoint &where) const
get current mouse location
Definition: cframe.cpp:896
Base Class of all view objects.
Definition: cview.h:44
Animation runner.
Definition: animator.h:20
virtual CMouseEventResult onMouseDown(CFrame *frame, const CPoint &where, const CButtonState &buttons)
a mouse down event happend on the frame at position where. If the observer handles this...
Definition: cframe.h:259
CCoord getFocusWidth() const
get focus draw width
Definition: cframe.cpp:1230
interface for drag&drop and clipboard data
Definition: idatapackage.h:15
bool setSize(CCoord width, CCoord height)
Definition: cframe.cpp:784
Definition: iscalefactorchangedlistener.h:13
double getZoom() const
get zoom factor
Definition: cframe.cpp:246
CMouseEventResult onMouseExited(CPoint &where, const CButtonState &buttons) override
called when the mouse leaves this view
Definition: cframe.cpp:572
static int32_t kDefaultKnobMode
default knob mode if host does not provide one
Definition: cframe.h:53
generic keyboard hook interface for CFrame
Definition: cframe.h:267
bool removeView(CView *pView, bool withForget=true) override
remove a child view
Definition: cframe.cpp:1119
int32_t getKnobMode() const
get hosts knob mode
Definition: cframe.cpp:719
void unregisterKeyboardHook(IKeyboardHook *hook)
unregister a keyboard hook
Definition: cframe.cpp:1322
bool setModalView(CView *pView)
Definition: cframe.cpp:835
Point structure.
Definition: cpoint.h:17
void invalidRect(const CRect &rect) override
mark rect as invalid
Definition: cframe.cpp:1289
CColor getFocusColor() const
get focus draw color
Definition: cframe.cpp:1221
void setFocusDrawingEnabled(bool state)
enable focus drawing
Definition: cframe.cpp:1239
bool removeAll(bool withForget=true) override
remove all child views
Definition: cframe.cpp:1127
int32_t onKeyUp(VstKeyCode &keyCode) override
called if a key up event occurs and this view has focus
Definition: cframe.cpp:620
void scrollRect(const CRect &src, const CPoint &distance)
scroll src rect by distance
Definition: cframe.cpp:1264
void drawRect(CDrawContext *pContext, const CRect &updateRect) override
called if the view should draw itself
Definition: cframe.cpp:278
The CFrame is the parent container of all views.
Definition: cframe.h:32
void unregisterMouseObserver(IMouseObserver *observer)
unregister a mouse observer
Definition: cframe.cpp:1384
Animation::Animator * getAnimator()
get animator for this frame
Definition: cframe.cpp:697
void onViewRemoved(CView *pView)
Definition: cframe.cpp:937
generic mouse observer interface for CFrame
Definition: cframe.h:252