-
Notifications
You must be signed in to change notification settings - Fork 71
Expand file tree
/
Copy pathCefControlNative.h
More file actions
78 lines (62 loc) · 1.97 KB
/
CefControlNative.h
File metadata and controls
78 lines (62 loc) · 1.97 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
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
/**@brief 封装Cef浏览器对象为duilib控件
* @copyright (c) 2016, NetEase Inc. All rights reserved
* @author Redrain
* @date 2016/7/19
*/
#ifndef UI_CEF_CONTROL_CEF_NATIVE_CONTROL_H_
#define UI_CEF_CONTROL_CEF_NATIVE_CONTROL_H_
#include "CefControl.h"
namespace ui {
/** duilib的CEF控件,窗口模式
*/
class CefControlNative : public CefControl
{
typedef CefControl BaseClass;
public:
explicit CefControlNative(ui::Window* pWindow);
virtual ~CefControlNative(void) override;
virtual void Init() override;
virtual void SetPos(ui::UiRect rc) override;
virtual bool OnSetFocus(const EventArgs& msg) override;
virtual bool OnKillFocus(const EventArgs& msg) override;
virtual void SetWindow(ui::Window* pWindow) override;
protected:
/** 重新创建Browser对象
*/
virtual void ReCreateBrowser() override;
/** 更新CEF控件窗口的位置(子窗口模式)
*/
virtual void UpdateCefWindowPos() override;
/** 关闭所有的Browser对象
*/
virtual void CloseAllBrowsers() override;
/** 将网页保存为一张图片, 图片大小与控件大小相同
*/
virtual std::shared_ptr<IBitmap> MakeImageSnapshot() override;
/** 是否为CEF的子窗口模式控件
*/
virtual bool IsCefNative() const override;
/** 页面获得了焦点
*/
virtual void OnGotFocus() override;
/** 设置可见状态事件
* @param [in] bChanged true表示状态发生变化,false表示状态未发生变化
*/
virtual void OnSetVisible(bool bChanged) override;
private:
/** 关闭所有的Browser对象
*/
void DoCloseAllNativeBrowsers(bool bForceClose);
private:
/** 首次绘制的事件是否关联
*/
bool m_bWindowFirstShown;
/** CEF窗口的父子关系是否已经解除
*/
bool m_bSetCefWindowParentNull;
/** 当前是否处于OnGotFocus回调函数中
*/
bool m_bInGotFocusEvent;
};
}
#endif //UI_CEF_CONTROL_CEF_NATIVE_CONTROL_H_