| Flutter Linux Embedder |

fl_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_LINUX_PUBLIC_FLUTTER_LINUX_FL_VIEW_H_
6 #define FLUTTER_SHELL_PLATFORM_LINUX_PUBLIC_FLUTTER_LINUX_FL_VIEW_H_
7
8 #if !defined(__FLUTTER_LINUX_INSIDE__) && !defined(FLUTTER_LINUX_COMPILATION)
9 #error "Only <flutter_linux/flutter_linux.h> can be included directly."
10 #endif
11
12 #include <gmodule.h>
13 #include <gtk/gtk.h>
14
15 #include "fl_dart_project.h"
16 #include "fl_engine.h"
17
18 G_BEGIN_DECLS
19
20 G_MODULE_EXPORT
21 G_DECLARE_FINAL_TYPE(FlView, fl_view, FL, VIEW, GtkBox)
22
23 /**
24 * FlView:
25 *
26 * #FlView is a GTK widget that is capable of displaying a Flutter application.
27 *
28 * The following example shows how to set up a view in a GTK application:
29 * |[<!-- language="C" -->
30 * FlDartProject *project = fl_dart_project_new ();
31 * FlView *view = fl_view_new (project);
32 * gtk_widget_show (GTK_WIDGET (view));
33 * gtk_container_add (GTK_CONTAINER (parent), view);
34 *
35 * FlBinaryMessenger *messenger =
36 * fl_engine_get_binary_messenger (fl_view_get_engine (view));
37 * setup_channels_or_plugins (messenger);
38 * ]|
39 */
40
41 /**
42 * fl_view_new:
43 * @project: The project to show.
44 *
45 * Creates a widget to show a Flutter application.
46 *
47 * Returns: a new #FlView.
48 */
49 FlView* fl_view_new(FlDartProject* project);
50
51 /**
52 * fl_view_new_for_engine:
53 * @engine: an #FlEngine.
54 *
55 * Creates a widget to show a window in a Flutter application.
56 * The engine must be not be headless.
57 *
58 * Returns: a new #FlView.
59 */
60 FlView* fl_view_new_for_engine(FlEngine* engine);
61
62 /**
63 * fl_view_get_engine:
64 * @view: an #FlView.
65 *
66 * Gets the engine being rendered in the view.
67 *
68 * Returns: an #FlEngine.
69 */
70 FlEngine* fl_view_get_engine(FlView* view);
71
72 /**
73 * fl_view_get_id:
74 * @view: an #FlView.
75 *
76 * Gets the Flutter view ID used by this view.
77 *
78 * Returns: a view ID or -1 if now ID assigned.
79 */
80 int64_t fl_view_get_id(FlView* view);
81
82 /**
83 * fl_view_set_background_color:
84 * @view: an #FlView.
85 * @color: a background color.
86 *
87 * Set the background color for Flutter (defaults to black).
88 */
89 void fl_view_set_background_color(FlView* view, const GdkRGBA* color);
90
91 G_END_DECLS
92
93 #endif // FLUTTER_SHELL_PLATFORM_LINUX_PUBLIC_FLUTTER_LINUX_FL_VIEW_H_
G_DECLARE_FINAL_TYPE
G_BEGIN_DECLS G_DECLARE_FINAL_TYPE(FlAccessibleTextField, fl_accessible_text_field, FL, ACCESSIBLE_TEXT_FIELD, FlAccessibleNode)
view
FlView * view
Definition: fl_application.cc:36
FL
FL
Definition: fl_binary_messenger.cc:27
fl_dart_project.h
fl_engine.h
fl_view_new_for_engine
FlView * fl_view_new_for_engine(FlEngine *engine)
Definition: fl_view.cc:775
fl_view_set_background_color
void fl_view_set_background_color(FlView *view, const GdkRGBA *color)
Definition: fl_view.cc:799
fl_view_new
G_BEGIN_DECLS G_MODULE_EXPORT FlView * fl_view_new(FlDartProject *project)
Definition: fl_view.cc:761
fl_view_get_engine
FlEngine * fl_view_get_engine(FlView *view)
Definition: fl_view.cc:788
fl_view_get_id
int64_t fl_view_get_id(FlView *view)
Definition: fl_view.cc:794