Flutter Engine
flutter_view.h
Go to the documentation of this file.
1 // Copyright 2013 The Flutter Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4 
5 #ifndef FLUTTER_SHELL_PLATFORM_WINDOWS_CLIENT_WRAPPER_INCLUDE_FLUTTER_FLUTTER_VIEW_H_
6 #define FLUTTER_SHELL_PLATFORM_WINDOWS_CLIENT_WRAPPER_INCLUDE_FLUTTER_FLUTTER_VIEW_H_
7 
8 #include <flutter_windows.h>
9 
10 namespace flutter {
11 
12 // A view displaying Flutter content.
13 class FlutterView {
14  public:
15  explicit FlutterView(FlutterDesktopViewRef view) : view_(view) {}
16 
17  virtual ~FlutterView() = default;
18 
19  // Prevent copying.
20  FlutterView(FlutterView const&) = delete;
21  FlutterView& operator=(FlutterView const&) = delete;
22 
23 #ifdef WINUWP
24  // Returns the backing CoreApplicationView for the view.
25  ABI::Windows::ApplicationModel::Core::CoreApplicationView* GetNativeWindow() {
26  return FlutterDesktopViewGetCoreApplicationView(view_);
27  }
28 #else
29  // Returns the backing HWND for the view.
30  HWND GetNativeWindow() { return FlutterDesktopViewGetHWND(view_); }
31 #endif
32 
33  private:
34  // Handle for interacting with the C API's view.
35  FlutterDesktopViewRef view_ = nullptr;
36 };
37 
38 } // namespace flutter
39 
40 #endif // FLUTTER_SHELL_PLATFORM_WINDOWS_CLIENT_WRAPPER_INCLUDE_FLUTTER_FLUTTER_VIEW_H_
HWND FlutterDesktopViewGetHWND(FlutterDesktopViewRef controller)
FlutterView(FlutterDesktopViewRef view)
Definition: flutter_view.h:15
FlutterView & operator=(FlutterView const &)=delete
struct FlutterDesktopView * FlutterDesktopViewRef
FlView * view
virtual ~FlutterView()=default