00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024 #ifndef _SCOL_EMBEDDED_WEB_NAVIGATOR_
00025 #define _SCOL_EMBEDDED_WEB_NAVIGATOR_
00026
00027 #include "embeddedWebNavigatorClient.h"
00028 #include "embeddedWebNavigatorCriticalSection.h"
00029
00030 namespace Scol
00031 {
00032 namespace EmbeddedWebNavigator
00033 {
00034
00035 class WebNavigator
00036 {
00037 public:
00038 protected:
00039 private:
00040 const unsigned long uniqueId;
00041 const ScolWindowHandle scolMainWindowHandle;
00042 const ScolWindowHandle parentWindowHandle;
00043 const bool offscreen;
00044 CefRefPtr<WebNavigatorClient> webNavigatorClient;
00045 std::pair<int, int> actualSize;
00046 std::pair<int, int> actualPosition;
00047 HANDLE synchroEventCanGoBack;
00048 HANDLE synchroEventCanGoForward;
00049 HANDLE synchroEventGetZoomLevel;
00050 HANDLE synchroEventGetSource;
00051 HANDLE synchroEventGetURL;
00052 HANDLE synchroEventGetText;
00053 CefRefPtr<WebNavigatorCriticalSection> offscreenBufferCriticalSection;
00054
00055 public:
00059 WebNavigator(const unsigned long navigatorUniqueId, const ScolWindowHandle& scolMainWindow, const ScolWindowHandle& parentWindowHandleInstance, int xPosition, int yPosition, int width, int height);
00060
00064 WebNavigator(const unsigned long navigatorUniqueId, const ScolWindowHandle& scolMainWindow,const ScolWindowHandle& parentWindowHandleInstance, int width, int height, bool transparency = false);
00065
00069 ~WebNavigator();
00070
00073 unsigned long GetUniqueId();
00074
00077 ScolWindowHandle GetParentWindowHandle();
00078
00081 CefRefPtr<WebNavigatorClient>& GetWebNavigatorClient();
00082
00088 void LoadURL(const std::string& url, const std::string& frameName="");
00089
00096 void LoadFile(const std::string& file, const std::string& frameName="");
00097
00098
00099
00100
00101
00102
00103
00104 void LoadHTML(const std::string& html, const std::string& frameName="");
00105
00110 std::string GetURL(const std::string& frameName="");
00111
00116 void Undo(const std::string& frameName="");
00117
00122 void Redo(const std::string& frameName="");
00123
00128 void Cut(const std::string& frameName="");
00129
00134 void Copy(const std::string& frameName="");
00135
00140 void Paste(const std::string& frameName="");
00141
00146 void Delete(const std::string& frameName="");
00147
00152 void SelectAll(const std::string& frameName="");
00153
00158 void Print(const std::string& frameName="");
00159
00164 void ViewSource(const std::string& frameName="");
00165
00170 std::string GetSource(const std::string& frameName="");
00171
00176 std::string GetText(const std::string& frameName="");
00177
00185 void ExecuteJavaScript(const std::string& jsCode, const std::string& scriptUrl, int startLine, const std::string& frameName="");
00186
00190 bool CanGoBack();
00191
00195 void GoBack();
00196
00200 bool CanGoForward();
00201
00205 void GoForward();
00206
00210 void Reload();
00211
00215 void ReloadIgnoreCache();
00216
00220 void StopLoad();
00221
00230 void Find(int identifier, const CefString& searchText, bool forward, bool matchCase, bool findNext);
00231
00235 void StopFinding(bool clearSelection);
00236
00240 double GetZoomLevel();
00241
00245 void SetZoomLevel(double zoomLevel);
00246
00250 void ClearHistory();
00251
00255 void ShowDevTools();
00256
00260 void CloseDevTools();
00261
00264 std::pair<int, int> GetSize();
00265
00268 void SetSize(std::pair<int, int> newSize);
00269
00272 std::pair<int, int> GetPosition();
00273
00276 void SetPosition(std::pair<int, int> newPosition);
00277
00280 bool IsOffscreen() const;
00281
00285 void InjectKeyMsg(int msg, int lparam, int wparam);
00286
00290 void InjectKey(int scanCode, int keydata, bool down);
00291
00295 void InjectChar(int scanCode, int keydata);
00296
00300 void InjectMouseClick(int x, int y, int buttonType, bool mouseUp, int clickCount);
00301
00305 void InjectMouseMove(int x, int y, bool mouseLeave);
00306
00310 void InjectMouseWheel(int x, int y, int delta);
00311
00315 void InjectFocus(bool setFocus);
00316
00320
00321 protected:
00322 private:
00326 WebNavigator();
00327
00331 void CommonConstructorSequence(std::pair<int, int> newWebNavigatorPosition, std::pair<int, int> newWebNavigatorSize, bool transparency = false);
00332
00335 void ApplyPositionAndSize();
00336 };
00337
00338 }
00339 }
00340
00341 #endif