Flutter Engine
flutter_view_controller.cc
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 
6 
7 #include <algorithm>
8 #include <iostream>
9 
10 namespace flutter {
11 
12 #ifdef WINUWP
14  ABI::Windows::ApplicationModel::Core::CoreApplicationView* applicationview,
15  ABI::Windows::ApplicationModel::Activation::IActivatedEventArgs* args,
16  const DartProject& project) {
17  engine_ = std::make_unique<FlutterEngine>(project);
19  applicationview, args, engine_->RelinquishEngine());
20  if (!controller_) {
21  std::cerr << "Failed to create view controller." << std::endl;
22  return;
23  }
24  view_ = std::make_unique<FlutterView>(
26 }
27 #else
29  int height,
30  const DartProject& project) {
31  engine_ = std::make_unique<FlutterEngine>(project);
32  controller_ = FlutterDesktopViewControllerCreate(width, height,
33  engine_->RelinquishEngine());
34  if (!controller_) {
35  std::cerr << "Failed to create view controller." << std::endl;
36  return;
37  }
38  view_ = std::make_unique<FlutterView>(
40 }
41 #endif
42 
44  if (controller_) {
46  }
47 }
48 
49 #ifndef WINUWP
51  HWND hwnd,
52  UINT message,
53  WPARAM wparam,
54  LPARAM lparam) {
57  controller_, hwnd, message, wparam, lparam, &result);
58  return handled ? result : std::optional<LRESULT>(std::nullopt);
59 }
60 #endif
61 
62 } // namespace flutter
G_BEGIN_DECLS FlValue * args
FlutterDesktopViewControllerRef FlutterDesktopViewControllerCreate(int width, int height, FlutterDesktopEngineRef engine)
WINUWP.
void FlutterDesktopViewControllerDestroy(FlutterDesktopViewControllerRef controller)
GAsyncResult * result
LONG_PTR LRESULT
Definition: windows_types.h:61
FlutterDesktopViewControllerRef FlutterDesktopViewControllerCreateFromCoreApplicationView(ABI::Windows::ApplicationModel::Core::CoreApplicationView *application_view, ABI::Windows::ApplicationModel::Activation::IActivatedEventArgs *args, FlutterDesktopEngineRef engine)
UINT_PTR WPARAM
Definition: windows_types.h:59
FlutterViewController(int width, int height, const DartProject &project)
std::optional< LRESULT > HandleTopLevelWindowProc(HWND hwnd, UINT message, WPARAM wparam, LPARAM lparam)
int32_t width
int32_t height
FlutterDesktopViewRef FlutterDesktopViewControllerGetView(FlutterDesktopViewControllerRef controller)
LONG_PTR LPARAM
Definition: windows_types.h:60
bool FlutterDesktopViewControllerHandleTopLevelWindowProc(FlutterDesktopViewControllerRef controller, HWND hwnd, UINT message, WPARAM wparam, LPARAM lparam, LRESULT *result)
unsigned int UINT
Definition: windows_types.h:32