forked from MicrosoftEdge/WebView2Samples
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathControlComponent.h
More file actions
49 lines (35 loc) · 1.47 KB
/
ControlComponent.h
File metadata and controls
49 lines (35 loc) · 1.47 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
// Copyright (C) Microsoft Corporation. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#pragma once
#include "stdafx.h"
#include <vector>
#include "AppWindow.h"
#include "ComponentBase.h"
// This component handles commands from the buttons and address bar, as well as keyboard
// input, tabbing, focus changing, and related events.
class ControlComponent : public ComponentBase
{
public:
ControlComponent(AppWindow* appWindow, Toolbar* toolbar);
bool HandleWindowMessage(
HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam, LRESULT* result) override;
void NavigateToAddressBar();
void TabForwards(int currentIndex);
void TabBackwards(int currentIndex);
static LRESULT CALLBACK
ChildWndProcStatic(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam);
bool HandleChildWindowMessage(
HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam, LRESULT* result);
~ControlComponent() override;
private:
AppWindow* m_appWindow;
wil::com_ptr<IWebView2WebView5> m_webView;
Toolbar* m_toolbar;
std::vector<std::pair<HWND, WNDPROC>> m_tabbableWindows;
EventRegistrationToken m_navigationStartingToken = {};
EventRegistrationToken m_documentStateChangedToken = {};
EventRegistrationToken m_navigationCompletedToken = {};
EventRegistrationToken m_moveFocusRequestedToken = {};
EventRegistrationToken m_acceleratorKeyPressedToken = {};
};