Flutter Engine
The Flutter Engine
Classes | Public Member Functions | Protected Member Functions | List of all members
ClickHandlerSlide Class Referenceabstract

#include <ClickHandlerSlide.h>

Inheritance diagram for ClickHandlerSlide:
Slide SkRefCnt SkRefCntBase ArcToSlide AudioSlide BackdropSlide CameraSlide CubicCurve2Slide CubicCurveSlide CubicResamplerSlide DegenerateQuadSlide DrawLineSlide EdgeClipSlide FatStrokeSlide GraphitePrimitivesSlide HalfPlaneSlide HalfPlaneSlide2 MixerSlide PathClipSlide PathSlide QuadStrokerSlide SGSlide SampleFitCubicToCircle SimpleStrokerSlide SlidesSlide StringArtSlide ThreeDSlide VariableWidthStrokerSlide XferSlide

Classes

class  Click
 

Public Member Functions

bool onMouse (SkScalar x, SkScalar y, skui::InputState clickState, skui::ModifierKey modifierKeys) final
 
- Public Member Functions inherited from Slide
virtual SkISize getDimensions () const
 
virtual void gpuTeardown ()
 
virtual void draw (SkCanvas *canvas)=0
 
virtual bool animate (double nanos)
 
virtual void load (SkScalar winWidth, SkScalar winHeight)
 
virtual void resize (SkScalar winWidth, SkScalar winHeight)
 
virtual void unload ()
 
virtual bool onChar (SkUnichar c)
 
virtual bool onMouse (SkScalar x, SkScalar y, skui::InputState state, skui::ModifierKey modifiers)
 
virtual bool onGetControls (SkMetaData *)
 
virtual void onSetControls (const SkMetaData &)
 
const SkStringgetName ()
 
- Public Member Functions inherited from SkRefCntBase
 SkRefCntBase ()
 
virtual ~SkRefCntBase ()
 
bool unique () const
 
void ref () const
 
void unref () const
 

Protected Member Functions

virtual ClickonFindClickHandler (SkScalar x, SkScalar y, skui::ModifierKey modi)=0
 
virtual bool onClick (Click *)=0
 

Additional Inherited Members

- Protected Attributes inherited from Slide
SkString fName
 

Detailed Description

Provides a higher level abstraction for click handling than the Slide base class. A Click object is is used to track the state of the mouse over time.

Definition at line 22 of file ClickHandlerSlide.h.

Member Function Documentation

◆ onClick()

virtual bool ClickHandlerSlide::onClick ( Click )
protectedpure virtual

◆ onFindClickHandler()

virtual Click * ClickHandlerSlide::onFindClickHandler ( SkScalar  x,
SkScalar  y,
skui::ModifierKey  modi 
)
protectedpure virtual

◆ onMouse()

bool ClickHandlerSlide::onMouse ( SkScalar  x,
SkScalar  y,
skui::InputState  clickState,
skui::ModifierKey  modifierKeys 
)
finalvirtual

Reimplemented from Slide.

Definition at line 10 of file ClickHandlerSlide.cpp.

12 {
13 auto dispatch = [this](Click* c) {
14 return c->fHasFunc ? c->fFunc(c) : this->onClick(c);
15 };
16
17 switch (clickState) {
19 fClick = nullptr;
20 fClick.reset(this->onFindClickHandler(x, y, modifierKeys));
21 if (!fClick) {
22 return false;
23 }
24 fClick->fPrev = fClick->fCurr = fClick->fOrig = {x, y};
25 fClick->fState = skui::InputState::kDown;
26 fClick->fModifierKeys = modifierKeys;
27 dispatch(fClick.get());
28 return true;
30 if (fClick) {
31 fClick->fPrev = fClick->fCurr;
32 fClick->fCurr = {x, y};
33 fClick->fState = skui::InputState::kMove;
34 fClick->fModifierKeys = modifierKeys;
35 return dispatch(fClick.get());
36 }
37 return false;
39 if (fClick) {
40 fClick->fPrev = fClick->fCurr;
41 fClick->fCurr = {x, y};
42 fClick->fState = skui::InputState::kUp;
43 fClick->fModifierKeys = modifierKeys;
44 bool result = dispatch(fClick.get());
45 fClick = nullptr;
46 return result;
47 }
48 return false;
49 default:
50 // Ignore other cases
51 SK_ABORT("Unexepected InputState");
52 }
53
55}
#define SkUNREACHABLE
Definition: SkAssert.h:135
#define SK_ABORT(message,...)
Definition: SkAssert.h:70
virtual bool onClick(Click *)=0
virtual Click * onFindClickHandler(SkScalar x, SkScalar y, skui::ModifierKey modi)=0
GAsyncResult * result
double y
double x

The documentation for this class was generated from the following files: