24#ifndef _SCOL_EMBEDDED_WEB_NAVIGATOR_
25#define _SCOL_EMBEDDED_WEB_NAVIGATOR_
28#if SO3_WEB_NAVIGATOR_BUILD == 1
29#include "include/cef_client.h"
33 namespace EmbeddedWebNavigator
35 static bool IsKeyDown(WPARAM
wparam)
37 return (GetKeyState((
int)
wparam) & 0x8000) != 0;
40 static int GetCefKeyboardModifiers(WPARAM
wparam, LPARAM
lparam)
43 if (IsKeyDown(VK_SHIFT))
44 modifiers |= EVENTFLAG_SHIFT_DOWN;
45 if (IsKeyDown(VK_CONTROL))
46 modifiers |= EVENTFLAG_CONTROL_DOWN;
47 if (IsKeyDown(VK_MENU))
48 modifiers |= EVENTFLAG_ALT_DOWN;
51 if (::GetKeyState(VK_NUMLOCK) & 1)
52 modifiers |= EVENTFLAG_NUM_LOCK_ON;
53 if (::GetKeyState(VK_CAPITAL) & 1)
54 modifiers |= EVENTFLAG_CAPS_LOCK_ON;
58 if ((
lparam >> 16) & KF_EXTENDED)
59 modifiers |= EVENTFLAG_IS_KEY_PAD;
71 if (!((
lparam >> 16) & KF_EXTENDED))
72 modifiers |= EVENTFLAG_IS_KEY_PAD;
91 modifiers |= EVENTFLAG_IS_KEY_PAD;
94 if (IsKeyDown(VK_LSHIFT))
95 modifiers |= EVENTFLAG_IS_LEFT;
96 else if (IsKeyDown(VK_RSHIFT))
97 modifiers |= EVENTFLAG_IS_RIGHT;
100 if (IsKeyDown(VK_LCONTROL))
101 modifiers |= EVENTFLAG_IS_LEFT;
102 else if (IsKeyDown(VK_RCONTROL))
103 modifiers |= EVENTFLAG_IS_RIGHT;
106 if (IsKeyDown(VK_LMENU))
107 modifiers |= EVENTFLAG_IS_LEFT;
108 else if (IsKeyDown(VK_RMENU))
109 modifiers |= EVENTFLAG_IS_RIGHT;
112 modifiers |= EVENTFLAG_IS_LEFT;
115 modifiers |= EVENTFLAG_IS_RIGHT;
126 const unsigned long uniqueId;
127 const ScolWindowHandle scolMainWindowHandle;
128 const ScolWindowHandle parentWindowHandle;
129 const bool mOffscreen;
131 CefRefPtr<WebNavigatorClient> webNavigatorClient;
132 std::pair<int, int> actualSize;
133 std::pair<int, int> actualPosition;
134 HANDLE synchroEventCanGoBack;
135 HANDLE synchroEventCanGoForward;
136 HANDLE synchroEventGetZoomLevel;
137 HANDLE synchroEventGetSource;
138 HANDLE synchroEventGetURL;
139 HANDLE synchroEventGetText;
146 WebNavigator(
const unsigned long navigatorUniqueId,
const ScolWindowHandle& scolMainWindow,
const ScolWindowHandle& parentWindowHandleInstance,
int xPosition,
int yPosition,
int width,
int height, std::string url);
151 WebNavigator(
const unsigned long navigatorUniqueId,
const ScolWindowHandle& scolMainWindow,
const ScolWindowHandle& parentWindowHandleInstance,
int width,
int height, std::string url,
bool transparency);
175 void LoadURL(
const std::string& url,
const std::string& frameName =
"");
183 void LoadFile(
const std::string& file,
const std::string& frameName =
"");
191 void LoadHTML(
const std::string& html,
const std::string& frameName =
"");
197 std::string
GetURL(
const std::string& frameName =
"");
203 void Undo(
const std::string& frameName =
"");
209 void Redo(
const std::string& frameName =
"");
215 void Cut(
const std::string& frameName =
"");
221 void Copy(
const std::string& frameName =
"");
227 void Paste(
const std::string& frameName =
"");
233 void Delete(
const std::string& frameName =
"");
239 void SelectAll(
const std::string& frameName =
"");
245 void Print(
const std::string& frameName =
"");
251 void ViewSource(
const std::string& frameName =
"");
257 std::string
GetSource(
const std::string& frameName =
"");
263 std::string
GetText(
const std::string& frameName =
"");
272 void ExecuteJavaScript(
const std::string& jsCode,
const std::string& scriptUrl,
int startLine,
const std::string& frameName =
"");
317 void Find(
int identifier,
const CefString& searchText,
bool forward,
bool matchCase,
bool findNext);
355 void SetSize(std::pair<int, int> newSize);
377 void InjectKey(
int scanCode,
int keydata,
bool down);
387 void InjectMouseClick(
int x,
int y,
int buttonType,
bool mouseUp,
int clickCount);
429 void CommonConstructorSequence(std::pair<int, int> newWebNavigatorPosition, std::pair<int, int> newWebNavigatorSize, std::string url);
433 void ApplyPositionAndSize();
438 CefBrowserHost::MouseButtonType ConvertMouseButton(
int scolButton);
SCOL_EXPORT void SCOL_PTR_TYPE WPARAM LPARAM lparam
SCOL_EXPORT void SCOL_PTR_TYPE WPARAM wparam
void Cut(const std::string &frameName="")
void InjectMouseClick(int x, int y, int buttonType, bool mouseUp, int clickCount)
void StopFinding(bool clearSelection)
unsigned long GetUniqueId()
void SetZoomLevel(double zoomLevel)
void LoadFile(const std::string &file, const std::string &frameName="")
WebNavigatorListener * GetListener()
std::string GetText(const std::string &frameName="")
void InjectMouseWheel(int x, int y, int delta)
void Delete(const std::string &frameName="")
void Redo(const std::string &frameName="")
void Undo(const std::string &frameName="")
std::string GetSource(const std::string &frameName="")
void InjectFocus(bool setFocus)
void SetSize(std::pair< int, int > newSize)
ScolWindowHandle GetParentWindowHandle()
void ViewSource(const std::string &frameName="")
std::string GetURL(const std::string &frameName="")
std::pair< int, int > GetPosition()
void SelectAll(const std::string &frameName="")
std::pair< int, int > GetSize()
void LoadURL(const std::string &url, const std::string &frameName="")
void InjectChar(int scanCode, int keydata)
void SetPosition(std::pair< int, int > newPosition)
CefRefPtr< CefBrowser > browser
void InjectKeyMsg(int msg, LPARAM lparam, WPARAM wparam)
void InjectMouseMove(int x, int y, bool mouseLeave)
void Find(int identifier, const CefString &searchText, bool forward, bool matchCase, bool findNext)
void Print(const std::string &frameName="")
CefRefPtr< WebNavigatorClient > & GetWebNavigatorClient()
void Paste(const std::string &frameName="")
void SetListener(WebNavigatorListener *newListener)
void LoadHTML(const std::string &html, const std::string &frameName="")
void ExecuteJavaScript(const std::string &jsCode, const std::string &scriptUrl, int startLine, const std::string &frameName="")
void Copy(const std::string &frameName="")
void InjectKey(int scanCode, int keydata, bool down)