forked from MicrosoftEdge/WebView2Samples
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathFileComponent.h
43 lines (32 loc) · 1.06 KB
/
FileComponent.h
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
// 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 "AppWindow.h"
#include "ComponentBase.h"
#include <commdlg.h>
// This component handles commands from the File menu, except for Exit.
// It also handles the DocumentTitleChanged event.
class FileComponent : public ComponentBase
{
public:
FileComponent(AppWindow* appWindow);
bool HandleWindowMessage(
HWND hWnd,
UINT message,
WPARAM wParam,
LPARAM lParam,
LRESULT* result) override;
void SaveScreenshot();
void PrintToPdf(bool enableLandscape);
bool IsPrintToPdfInProgress();
~FileComponent() override;
private:
OPENFILENAME CreateOpenFileName(LPWSTR defaultName, LPCWSTR filter);
AppWindow* m_appWindow = nullptr;
wil::com_ptr<ICoreWebView2> m_webView;
bool m_printToPdfInProgress = false;
bool m_enableLandscape = false;
EventRegistrationToken m_documentTitleChangedToken = {};
};