| Flutter macOS Embedder |

FlutterPlatformNodeDelegateMac.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_DARWIN_MACOS_FRAMEWORK_SOURCE_FLUTTERPLATFORMNODEDELEGATEMAC_H_
6 #define FLUTTER_SHELL_PLATFORM_DARWIN_MACOS_FRAMEWORK_SOURCE_FLUTTERPLATFORMNODEDELEGATEMAC_H_
7
8 #import <Cocoa/Cocoa.h>
9
10 #import "flutter/shell/platform/darwin/macos/framework/Headers/FlutterViewController.h"
11
12 #include "flutter/fml/macros.h"
13 #include "flutter/shell/platform/common/accessibility_bridge.h"
14 #include "flutter/shell/platform/common/flutter_platform_node_delegate.h"
15 #include "flutter/shell/platform/embedder/embedder.h"
16
17 namespace flutter {
18
19 //------------------------------------------------------------------------------
20 /// The macOS implementation of FlutterPlatformNodeDelegate. This class uses
21 /// AXPlatformNodeMac to manage the macOS-specific accessibility objects.
22 class FlutterPlatformNodeDelegateMac : public FlutterPlatformNodeDelegate {
23 public:
24 FlutterPlatformNodeDelegateMac(std::weak_ptr<AccessibilityBridge> bridge,
25 __weak FlutterViewController* view_controller);
26 virtual ~FlutterPlatformNodeDelegateMac();
27
28 void Init(std::weak_ptr<OwnerBridge> bridge, ui::AXNode* node) override;
29
30 void NodeDataChanged(const ui::AXNodeData& old_node_data,
31 const ui::AXNodeData& new_node_data) override;
32
33 //---------------------------------------------------------------------------
34 /// @brief Gets the live region text of this node in UTF-8 format. This
35 /// is useful to determine the changes in between semantics
36 /// updates when generating accessibility events.
37 std::string GetLiveRegionText() const;
38
39 // |ui::AXPlatformNodeDelegate|
40 gfx::NativeViewAccessible GetNativeViewAccessible() override;
41
42 // |ui::AXPlatformNodeDelegate|
43 gfx::NativeViewAccessible GetNSWindow() override;
44
45 // |FlutterPlatformNodeDelegate|
46 gfx::NativeViewAccessible GetParent() override;
47
48 // |FlutterPlatformNodeDelegate|
49 gfx::Rect GetBoundsRect(
50 const ui::AXCoordinateSystem coordinate_system,
51 const ui::AXClippingBehavior clipping_behavior,
52 ui::AXOffscreenResult* offscreen_result) const override;
53
54 private:
55 ui::AXPlatformNode* ax_platform_node_;
56 std::weak_ptr<AccessibilityBridge> bridge_;
57 __weak FlutterViewController* view_controller_;
58
59 gfx::RectF ConvertBoundsFromLocalToScreen(
60 const gfx::RectF& local_bounds) const;
61 gfx::RectF ConvertBoundsFromScreenToGlobal(
62 const gfx::RectF& window_bounds) const;
63
64 FML_DISALLOW_COPY_AND_ASSIGN(FlutterPlatformNodeDelegateMac);
65 };
66
67 } // namespace flutter
68
69 #endif // FLUTTER_SHELL_PLATFORM_DARWIN_MACOS_FRAMEWORK_SOURCE_FLUTTERPLATFORMNODEDELEGATEMAC_H_
flutter::FlutterPlatformNodeDelegateMac::Init
void Init(std::weak_ptr< OwnerBridge > bridge, ui::AXNode *node) override
Called only once, immediately after construction. The constructor doesn't take any arguments because ...
Definition: FlutterPlatformNodeDelegateMac.mm:28
flutter::FlutterPlatformNodeDelegateMac::GetLiveRegionText
std::string GetLiveRegionText() const
Gets the live region text of this node in UTF-8 format. This is useful to determine the changes in be...
Definition: FlutterPlatformNodeDelegateMac.mm:84
FlutterViewController
Definition: FlutterViewController.h:73
flutter::FlutterPlatformNodeDelegateMac::FlutterPlatformNodeDelegateMac
FlutterPlatformNodeDelegateMac(std::weak_ptr< AccessibilityBridge > bridge, __weak FlutterViewController *view_controller)
Definition: FlutterPlatformNodeDelegateMac.mm:23
flutter::FlutterPlatformNodeDelegateMac::GetNSWindow
gfx::NativeViewAccessible GetNSWindow() override
Definition: FlutterPlatformNodeDelegateMac.mm:79
flutter::FlutterPlatformNodeDelegateMac::GetParent
gfx::NativeViewAccessible GetParent() override
Definition: FlutterPlatformNodeDelegateMac.mm:59
flutter
Definition: AccessibilityBridgeMac.h:16
flutter_platform_node_delegate.h
flutter::FlutterPlatformNodeDelegateMac::NodeDataChanged
void NodeDataChanged(const ui::AXNodeData &old_node_data, const ui::AXNodeData &new_node_data) override
Definition: FlutterPlatformNodeDelegateMac.mm:38
flutter::FlutterPlatformNodeDelegateMac::~FlutterPlatformNodeDelegateMac
virtual ~FlutterPlatformNodeDelegateMac()
Definition: FlutterPlatformNodeDelegateMac.mm:49
flutter::FlutterPlatformNodeDelegateMac::GetBoundsRect
gfx::Rect GetBoundsRect(const ui::AXCoordinateSystem coordinate_system, const ui::AXClippingBehavior clipping_behavior, ui::AXOffscreenResult *offscreen_result) const override
Definition: FlutterPlatformNodeDelegateMac.mm:68
flutter::FlutterPlatformNodeDelegateMac::GetNativeViewAccessible
gfx::NativeViewAccessible GetNativeViewAccessible() override
Definition: FlutterPlatformNodeDelegateMac.mm:54
flutter::FlutterPlatformNodeDelegate
Definition: flutter_platform_node_delegate.h:33
accessibility_bridge.h
flutter::FlutterPlatformNodeDelegateMac
Definition: FlutterPlatformNodeDelegateMac.h:22
FlutterViewController.h