Flutter Engine
The Flutter Engine
Public Member Functions | Static Public Member Functions | List of all members
sk_app::Window_ios Class Reference

#include <Window_ios.h>

Inheritance diagram for sk_app::Window_ios:
sk_app::Window

Public Member Functions

 Window_ios ()
 
 ~Window_ios () override
 
bool initWindow ()
 
void setTitle (const char *) override
 
void show () override
 
bool attach (BackendType) override
 
void onInval () override
 
UIWindow * uiWindow ()
 
- Public Member Functions inherited from sk_app::Window
virtual ~Window ()
 
virtual void setTitle (const char *)=0
 
virtual void show ()=0
 
virtual void setUIState (const char *)
 
virtual const char * getClipboardText ()
 
virtual void setClipboardText (const char *)
 
void inval ()
 
virtual bool scaleContentToFit () const
 
virtual bool attach (BackendType)=0
 
void detach ()
 
void pushLayer (Layer *layer)
 
void onBackendCreated ()
 
bool onChar (SkUnichar c, skui::ModifierKey modifiers)
 
bool onKey (skui::Key key, skui::InputState state, skui::ModifierKey modifiers)
 
bool onMouse (int x, int y, skui::InputState state, skui::ModifierKey modifiers)
 
bool onMouseWheel (float delta, int x, int y, skui::ModifierKey modifiers)
 
bool onTouch (intptr_t owner, skui::InputState state, float x, float y)
 
bool onFling (skui::InputState state)
 
bool onPinch (skui::InputState state, float scale, float x, float y)
 
void onUIStateChanged (const SkString &stateName, const SkString &stateValue)
 
void onPaint ()
 
void onResize (int width, int height)
 
void onActivate (bool isActive)
 
int width () const
 
int height () const
 
virtual float scaleFactor () const
 
virtual const DisplayParamsgetRequestedDisplayParams ()
 
virtual void setRequestedDisplayParams (const DisplayParams &, bool allowReattach=true)
 
int sampleCount () const
 
int stencilBits () const
 
GrDirectContextdirectContext () const
 
skgpu::graphite::ContextgraphiteContext () const
 
skgpu::graphite::RecordergraphiteRecorder () const
 

Static Public Member Functions

static void PaintWindow ()
 
static Window_iosMainWindow ()
 
- Static Public Member Functions inherited from sk_app::Window
static WindowCreateNativeWindow (void *platformData)
 

Additional Inherited Members

- Public Types inherited from sk_app::Window
enum  BackendType { kRaster_BackendType , kLast_BackendType = kRaster_BackendType }
 
enum  { kBackendTypeCount = kLast_BackendType + 1 }
 
- Protected Member Functions inherited from sk_app::Window
 Window ()
 
virtual void onInval ()=0
 
void markInvalProcessed ()
 
void visitLayers (const std::function< void(Layer *)> &visitor)
 
bool signalLayers (const std::function< bool(Layer *)> &visitor)
 
- Protected Attributes inherited from sk_app::Window
SkTDArray< Layer * > fLayers
 
DisplayParams fRequestedDisplayParams
 
bool fIsActive = true
 
std::unique_ptr< skwindow::WindowContextfWindowContext
 
bool fIsContentInvalidated = false
 

Detailed Description

Definition at line 19 of file Window_ios.h.

Constructor & Destructor Documentation

◆ Window_ios()

sk_app::Window_ios::Window_ios ( )
inline

Definition at line 21 of file Window_ios.h.

22 : Window()
23 , fWindow(nil) {}

◆ ~Window_ios()

sk_app::Window_ios::~Window_ios ( )
inlineoverride

Definition at line 24 of file Window_ios.h.

24{ this->closeWindow(); }

Member Function Documentation

◆ attach()

bool sk_app::Window_ios::attach ( BackendType  attachType)
overridevirtual

Implements sk_app::Window.

Definition at line 80 of file Window_ios.mm.

80 {
81 this->initWindow();
82
84 info.fWindow = this;
85 info.fViewController = fWindow.rootViewController;
86 switch (attachType) {
87#ifdef SK_METAL
88 case kMetal_BackendType:
90 break;
91#if defined(SK_GRAPHITE)
92 case kGraphiteMetal_BackendType:
94 break;
95#endif
96#endif
97#ifdef SK_GL
98 case kNativeGL_BackendType:
100 break;
103 break;
104#endif
105 default:
106 SkASSERT_RELEASE(false);
107 }
108 this->onBackendCreated();
109
110 return (SkToBool(fWindowContext));
111}
static void info(const char *fmt,...) SK_PRINTF_LIKE(1
Definition: DM.cpp:213
#define SkASSERT_RELEASE(cond)
Definition: SkAssert.h:100
static constexpr bool SkToBool(const T &x)
Definition: SkTo.h:35
@ kRaster_BackendType
Definition: Window.h:90
DisplayParams fRequestedDisplayParams
Definition: Window.h:176
std::unique_ptr< skwindow::WindowContext > fWindowContext
Definition: Window.h:179
void onBackendCreated()
Definition: Window.cpp:44
std::unique_ptr< WindowContext > MakeMetalForIOS(const IOSWindowInfo &info, const DisplayParams &params)
std::unique_ptr< WindowContext > MakeRasterForIOS(const IOSWindowInfo &info, const DisplayParams &params)
std::unique_ptr< WindowContext > MakeGLForIOS(const IOSWindowInfo &info, const DisplayParams &params)
std::unique_ptr< WindowContext > MakeGraphiteMetalForIOS(const IOSWindowInfo &info, const DisplayParams &params)

◆ initWindow()

bool sk_app::Window_ios::initWindow ( )

Definition at line 44 of file Window_ios.mm.

44 {
45 // we already have a window
46 if (fWindow) {
47 return true;
48 }
49
50 // Create a view controller to track certain events
51 WindowViewController* viewController = [[WindowViewController alloc] initWithWindow:this];
52 if (nil == viewController) {
53 return false;
54 }
55
56 fWindow = [[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]];
57 if (nil == fWindow) {
58 [viewController release];
59 return false;
60 }
61 fWindow.backgroundColor = [UIColor whiteColor];
62
63 viewController.view = nil;
64 [fWindow setRootViewController:viewController];
65 [fWindow makeKeyAndVisible];
66
67 gWindow = this;
68
69 return true;
70}
FlutterViewController * viewController
instancetype initWithFrame
Optional< SkRect > bounds
Definition: SkRecords.h:189

◆ MainWindow()

static Window_ios * sk_app::Window_ios::MainWindow ( )
inlinestatic

Definition at line 39 of file Window_ios.h.

39{ return gWindow; }

◆ onInval()

void sk_app::Window_ios::onInval ( )
overridevirtual

Implements sk_app::Window.

Definition at line 117 of file Window_ios.mm.

117 {
118 // TODO: send expose event
119}

◆ PaintWindow()

void sk_app::Window_ios::PaintWindow ( )
static

Definition at line 113 of file Window_ios.mm.

113 {
114 gWindow->onPaint();
115}
void onPaint()
Definition: Window.cpp:81

◆ setTitle()

void sk_app::Window_ios::setTitle ( const char *  )
inlineoverridevirtual

Implements sk_app::Window.

Definition at line 28 of file Window_ios.h.

28{}

◆ show()

void sk_app::Window_ios::show ( )
inlineoverridevirtual

Implements sk_app::Window.

Definition at line 29 of file Window_ios.h.

29{}

◆ uiWindow()

UIWindow * sk_app::Window_ios::uiWindow ( )
inline

Definition at line 37 of file Window_ios.h.

37{ return fWindow; }

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