mirror of
https://bitbucket.org/chromiumembedded/cef
synced 2025-06-05 21:39:12 +02:00
views: Add support for accelerators (issue #2102)
This commit is contained in:
@@ -81,6 +81,18 @@ CefRefPtr<CefBrowser> CefBrowserViewCToCpp::GetBrowser() {
|
||||
return CefBrowserCToCpp::Wrap(_retval);
|
||||
}
|
||||
|
||||
void CefBrowserViewCToCpp::SetPreferAccelerators(bool prefer_accelerators) {
|
||||
cef_browser_view_t* _struct = GetStruct();
|
||||
if (CEF_MEMBER_MISSING(_struct, set_prefer_accelerators))
|
||||
return;
|
||||
|
||||
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
|
||||
|
||||
// Execute
|
||||
_struct->set_prefer_accelerators(_struct,
|
||||
prefer_accelerators);
|
||||
}
|
||||
|
||||
CefRefPtr<CefBrowserView> CefBrowserViewCToCpp::AsBrowserView() {
|
||||
cef_view_t* _struct = reinterpret_cast<cef_view_t*>(GetStruct());
|
||||
if (CEF_MEMBER_MISSING(_struct, as_browser_view))
|
||||
|
@@ -32,6 +32,7 @@ class CefBrowserViewCToCpp
|
||||
|
||||
// CefBrowserView methods.
|
||||
CefRefPtr<CefBrowser> GetBrowser() OVERRIDE;
|
||||
void SetPreferAccelerators(bool prefer_accelerators) OVERRIDE;
|
||||
|
||||
// CefView methods.
|
||||
CefRefPtr<CefBrowserView> AsBrowserView() OVERRIDE;
|
||||
|
@@ -505,6 +505,46 @@ void CefWindowCToCpp::SendMouseEvents(cef_mouse_button_type_t button,
|
||||
mouse_up);
|
||||
}
|
||||
|
||||
void CefWindowCToCpp::SetAccelerator(int command_id, int key_code,
|
||||
bool shift_pressed, bool ctrl_pressed, bool alt_pressed) {
|
||||
cef_window_t* _struct = GetStruct();
|
||||
if (CEF_MEMBER_MISSING(_struct, set_accelerator))
|
||||
return;
|
||||
|
||||
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
|
||||
|
||||
// Execute
|
||||
_struct->set_accelerator(_struct,
|
||||
command_id,
|
||||
key_code,
|
||||
shift_pressed,
|
||||
ctrl_pressed,
|
||||
alt_pressed);
|
||||
}
|
||||
|
||||
void CefWindowCToCpp::RemoveAccelerator(int command_id) {
|
||||
cef_window_t* _struct = GetStruct();
|
||||
if (CEF_MEMBER_MISSING(_struct, remove_accelerator))
|
||||
return;
|
||||
|
||||
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
|
||||
|
||||
// Execute
|
||||
_struct->remove_accelerator(_struct,
|
||||
command_id);
|
||||
}
|
||||
|
||||
void CefWindowCToCpp::RemoveAllAccelerators() {
|
||||
cef_window_t* _struct = GetStruct();
|
||||
if (CEF_MEMBER_MISSING(_struct, remove_all_accelerators))
|
||||
return;
|
||||
|
||||
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
|
||||
|
||||
// Execute
|
||||
_struct->remove_all_accelerators(_struct);
|
||||
}
|
||||
|
||||
CefRefPtr<CefWindow> CefWindowCToCpp::AsWindow() {
|
||||
cef_panel_t* _struct = reinterpret_cast<cef_panel_t*>(GetStruct());
|
||||
if (CEF_MEMBER_MISSING(_struct, as_window))
|
||||
|
@@ -68,6 +68,10 @@ class CefWindowCToCpp
|
||||
void SendMouseMove(int screen_x, int screen_y) OVERRIDE;
|
||||
void SendMouseEvents(cef_mouse_button_type_t button, bool mouse_down,
|
||||
bool mouse_up) OVERRIDE;
|
||||
void SetAccelerator(int command_id, int key_code, bool shift_pressed,
|
||||
bool ctrl_pressed, bool alt_pressed) OVERRIDE;
|
||||
void RemoveAccelerator(int command_id) OVERRIDE;
|
||||
void RemoveAllAccelerators() OVERRIDE;
|
||||
|
||||
// CefPanel methods.
|
||||
CefRefPtr<CefWindow> AsWindow() OVERRIDE;
|
||||
|
@@ -151,6 +151,50 @@ bool CefWindowDelegateCToCpp::CanClose(CefRefPtr<CefWindow> window) {
|
||||
return _retval?true:false;
|
||||
}
|
||||
|
||||
bool CefWindowDelegateCToCpp::OnAccelerator(CefRefPtr<CefWindow> window,
|
||||
int command_id) {
|
||||
cef_window_delegate_t* _struct = GetStruct();
|
||||
if (CEF_MEMBER_MISSING(_struct, on_accelerator))
|
||||
return false;
|
||||
|
||||
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
|
||||
|
||||
// Verify param: window; type: refptr_diff
|
||||
DCHECK(window.get());
|
||||
if (!window.get())
|
||||
return false;
|
||||
|
||||
// Execute
|
||||
int _retval = _struct->on_accelerator(_struct,
|
||||
CefWindowCppToC::Wrap(window),
|
||||
command_id);
|
||||
|
||||
// Return type: bool
|
||||
return _retval?true:false;
|
||||
}
|
||||
|
||||
bool CefWindowDelegateCToCpp::OnKeyEvent(CefRefPtr<CefWindow> window,
|
||||
const CefKeyEvent& event) {
|
||||
cef_window_delegate_t* _struct = GetStruct();
|
||||
if (CEF_MEMBER_MISSING(_struct, on_key_event))
|
||||
return false;
|
||||
|
||||
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
|
||||
|
||||
// Verify param: window; type: refptr_diff
|
||||
DCHECK(window.get());
|
||||
if (!window.get())
|
||||
return false;
|
||||
|
||||
// Execute
|
||||
int _retval = _struct->on_key_event(_struct,
|
||||
CefWindowCppToC::Wrap(window),
|
||||
&event);
|
||||
|
||||
// Return type: bool
|
||||
return _retval?true:false;
|
||||
}
|
||||
|
||||
CefSize CefWindowDelegateCToCpp::GetPreferredSize(CefRefPtr<CefView> view) {
|
||||
cef_view_delegate_t* _struct = reinterpret_cast<cef_view_delegate_t*>(
|
||||
GetStruct());
|
||||
|
@@ -40,6 +40,9 @@ class CefWindowDelegateCToCpp
|
||||
bool CanMaximize(CefRefPtr<CefWindow> window) override;
|
||||
bool CanMinimize(CefRefPtr<CefWindow> window) override;
|
||||
bool CanClose(CefRefPtr<CefWindow> window) override;
|
||||
bool OnAccelerator(CefRefPtr<CefWindow> window, int command_id) override;
|
||||
bool OnKeyEvent(CefRefPtr<CefWindow> window,
|
||||
const CefKeyEvent& event) override;
|
||||
|
||||
// CefPanelDelegate methods.
|
||||
|
||||
|
Reference in New Issue
Block a user