Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

fix build wce, wm for new mainwindow

  • Loading branch information...
commit cf5388cc7d97ca2e0f5587d862065d7c35e66472 1 parent f0cdb6a
@antonv antonv authored
View
641 platform/wm/rhodes/RhoNativeViewManager.cpp
@@ -23,343 +23,308 @@
*
* http://rhomobile.com
*------------------------------------------------------------------------*/
-
-#include "stdafx.h"
-
-//#include <common/RhodesApp.h>
-//#include <logging/RhoLogConf.h>
-
-
-#include <stdlib.h>
-//#include <strings.h>
-
-#include "MainWindow.h"
-#include "common/RhodesApp.h"
-
-#include "logging/RhoLog.h"
-#include "Utils.h"
-
-
-#include "RhoNativeViewManagerWM.h"
-
-extern "C" HWND getWebViewWnd();
-extern "C" HWND getMainWnd();
-IMainWindow* Rhodes_getMainWindow();
-
-
-class RhoNativeViewHolder{
- public :
- RhoNativeViewHolder() {
- factory = NULL;
- next = NULL;
- viewtype = NULL;
- }
- virtual ~RhoNativeViewHolder() {
- if (viewtype != NULL) {
- delete viewtype;
- }
- }
- void setViewType(const char* viewtypename) {
- viewtype = new char[strlen(viewtypename)+2];
- strcpy(viewtype, viewtypename);
- }
- bool isApplicable(const char* viewtypename) {
- return (strcmp(viewtype, viewtypename) == 0);
- }
- char* viewtype;
- NativeViewFactory* factory;
- RhoNativeViewHolder* next;
-};
-
-static int ourGlobalID = 1;
-
-class RhoOpenedNativeView {
-public:
- RhoOpenedNativeView() {
- next = NULL;
- id = ourGlobalID++;
- tab_index = 0;
- factory_holder = NULL;
- n_view = NULL;
- }
- RhoOpenedNativeView* next;
- int id;
- int tab_index;
- RhoNativeViewHolder* factory_holder;
- NativeView* n_view;
-};
-
-
-class RhoNativeViewRunnable_OpenViewCommand : public RhoNativeViewRunnable {
-public:
- RhoNativeViewRunnable_OpenViewCommand(RhoOpenedNativeView* view) {
- mView = view;
- }
- virtual void run()
- {
- IMainWindow* mw = Rhodes_getMainWindow();
- String sn(mView->factory_holder->viewtype);
-#if !defined(OS_WINDOWS_DESKTOP)
- mw->openNativeView(mView->factory_holder->factory, mView->n_view, sn);
+
+#include "stdafx.h"
+
+//#include <common/RhodesApp.h>
+//#include <logging/RhoLogConf.h>
+
+
+#include <stdlib.h>
+//#include <strings.h>
+
+#include "MainWindow.h"
+#include "common/RhodesApp.h"
+
+#include "logging/RhoLog.h"
+#include "Utils.h"
+
+
+#include "RhoNativeViewManagerWM.h"
+
+extern "C" HWND getWebViewWnd();
+extern "C" HWND getMainWnd();
+IMainWindow* Rhodes_getMainWindow();
+
+
+class RhoNativeViewHolder{
+ public :
+ RhoNativeViewHolder() {
+ factory = NULL;
+ next = NULL;
+ viewtype = NULL;
+ }
+ virtual ~RhoNativeViewHolder() {
+ if (viewtype != NULL) {
+ delete viewtype;
+ }
+ }
+ void setViewType(const char* viewtypename) {
+ viewtype = new char[strlen(viewtypename)+2];
+ strcpy(viewtype, viewtypename);
+ }
+ bool isApplicable(const char* viewtypename) {
+ return (strcmp(viewtype, viewtypename) == 0);
+ }
+ char* viewtype;
+ NativeViewFactory* factory;
+ RhoNativeViewHolder* next;
+};
+
+static int ourGlobalID = 1;
+
+class RhoOpenedNativeView {
+public:
+ RhoOpenedNativeView() {
+ next = NULL;
+ id = ourGlobalID++;
+ tab_index = 0;
+ factory_holder = NULL;
+ n_view = NULL;
+ }
+ RhoOpenedNativeView* next;
+ int id;
+ int tab_index;
+ RhoNativeViewHolder* factory_holder;
+ NativeView* n_view;
+};
+
+
+class RhoNativeViewRunnable_OpenViewCommand : public RhoNativeViewRunnable {
+public:
+ RhoNativeViewRunnable_OpenViewCommand(RhoOpenedNativeView* view) {
+ mView = view;
+ }
+ virtual void run()
+ {
+ IMainWindow* mw = Rhodes_getMainWindow();
+ String sn(mView->factory_holder->viewtype);
+#if !defined(OS_WINDOWS_DESKTOP)
+ CMainWindow *nw = static_cast<CMainWindow*>(mw);
+ nw->openNativeView(mView->factory_holder->factory, mView->n_view, sn);
#endif
- //delete this;
- }
-
-private:
- RhoOpenedNativeView* mView;
-};
-
-class RhoNativeViewRunnable_CloseViewCommand : public RhoNativeViewRunnable {
-public:
- RhoNativeViewRunnable_CloseViewCommand() {
- }
- virtual void run() {
- IMainWindow* mw = Rhodes_getMainWindow();
-#if !defined(OS_WINDOWS_DESKTOP)
- mw->closeNativeView();
+ //delete this;
+ }
+
+private:
+ RhoOpenedNativeView* mView;
+};
+
+class RhoNativeViewRunnable_CloseViewCommand : public RhoNativeViewRunnable {
+public:
+ RhoNativeViewRunnable_CloseViewCommand() {
+ }
+ virtual void run() {
+ IMainWindow* mw = Rhodes_getMainWindow();
+#if !defined(OS_WINDOWS_DESKTOP)
+ mw->closeNativeView();
#endif
- //delete this;
- }
-};
-
-
-
-
-
-static RhoNativeViewHolder* first = NULL;
-static RhoOpenedNativeView* first_opened = NULL;
-
-
-
-
-
-
-
-
-
-static void addRhoNativeViewHolder(RhoNativeViewHolder* holder) {
- if (first == NULL) {
- first = holder;
- holder->next = NULL;
- }
- else {
- holder->next = first;
- first = holder;
- }
-}
-
-static void removeRhoNativeViewHolder(RhoNativeViewHolder* holder) {
- RhoNativeViewHolder* p = first;
- RhoNativeViewHolder* prev = NULL;
- while (p != NULL) {
- if (p == holder) {
- RhoNativeViewHolder* next = p->next;
- if (prev != NULL) {
- prev->next = next;
- }
- if (first == p) {
- first = NULL;
- }
- delete p;
- }
- prev = p;
- p = p->next;
- }
-}
-
-
-
-static RhoNativeViewHolder* getHolderByViewTypeName(const char* name) {
- RhoNativeViewHolder* p = first;
- while (p != NULL) {
- if (p->isApplicable(name)) {
- return p;
- }
- p = p->next;
- }
- return NULL;
-}
-
-
-
-
-
-
-
-static void addRhoNativeOpenedView(RhoOpenedNativeView* view) {
- if (first_opened == NULL) {
- first_opened = view;
- view->next = NULL;
- }
- else {
- view->next = first_opened;
- first_opened = view;
- }
-}
-
-static void removeRhoNativeOpenedView(RhoOpenedNativeView* view) {
- RhoOpenedNativeView* p = first_opened;
- RhoOpenedNativeView* prev = NULL;
- while (p != NULL) {
- if (p == view) {
- RhoOpenedNativeView* next = p->next;
- if (prev != NULL) {
- prev->next = next;
- }
- if (first_opened == p) {
- first_opened = NULL;
- }
- delete p;
- }
- prev = p;
- p = p->next;
- }
-}
-
-
-
-static RhoOpenedNativeView* getOpenedViewByID(int v_id) {
- RhoOpenedNativeView* p = first_opened;
- while (p != NULL) {
- if (p->id == v_id) {
- return p;
- }
- p = p->next;
- }
- return NULL;
-}
-
-
-static RhoOpenedNativeView* getOpenedViewByNativeView(NativeView* nv) {
- RhoOpenedNativeView* p = first_opened;
- while (p != NULL) {
- if (p->n_view == nv) {
- return p;
- }
- p = p->next;
- }
- return NULL;
-}
-
-
-
-
-
-
-
-
-
-
-
-void RhoNativeViewManager::registerViewType(const char* viewType, NativeViewFactory* factory) {
- RhoNativeViewHolder* holder = new RhoNativeViewHolder();
- holder->factory = factory;
- holder->setViewType(viewType);
- addRhoNativeViewHolder(holder);
-}
-
-void RhoNativeViewManager::unregisterViewType(const char* viewType) {
- RhoNativeViewHolder* holder = getHolderByViewTypeName(viewType);
- if (holder != NULL) {
- removeRhoNativeViewHolder(holder);
- }
-}
-
-// that function return native object used for display Web content :
-// UIWebView* for iPhone
-// jobject for Android - jobect is android.webkit.WebView class type
-// HWND for Windows Mobile
-void* RhoNativeViewManager::getWebViewObject(int tab_index) {
- HWND main_wnd = getMainWnd();//getWebViewWnd();
- return main_wnd;
-}
-
-NativeViewFactory* RhoNativeViewManagerWM::getFactoryByViewType(const char* viewtype) {
- RhoNativeViewHolder* h = getHolderByViewTypeName(viewtype);
- if (h != NULL) {
- return h->factory;
- }
- return NULL;
-}
-
-void RhoNativeViewUtil::executeInUIThread_WM(RhoNativeViewRunnable* command) {
- HWND main_wnd = getMainWnd();
- ::PostMessage(main_wnd, WM_EXECUTE_COMMAND, (WPARAM)command, 0);
-
-}
-
-
-extern "C" int rho_native_view_manager_create_native_view(const char* viewtype, int tab_index, VALUE params) {
- RhoNativeViewHolder* h = getHolderByViewTypeName(viewtype);
- if (h == NULL) {
- return -1;
- }
- NativeViewFactory* factory = h->factory;
- NativeView* nv = factory->getNativeView(viewtype);
- if (nv == NULL) {
- return -1;
- }
- //String vtype = new String(viewtype);
-
- RhoOpenedNativeView* opened_view = new RhoOpenedNativeView();
- opened_view->factory_holder = h;
- opened_view->n_view = nv;
- opened_view->tab_index = tab_index;
-
- addRhoNativeOpenedView(opened_view);
-
- RhoNativeViewRunnable_OpenViewCommand* open_command = new RhoNativeViewRunnable_OpenViewCommand(opened_view);
-
- RhoNativeViewUtil::executeInUIThread_WM(open_command);
-
- return opened_view->id;
-}
-
-extern "C" void rho_native_view_manager_navigate_native_view(int native_view_id, const char* url) {
- RhoOpenedNativeView* opened_view = getOpenedViewByID(native_view_id);
- if (opened_view != NULL) {
- opened_view->n_view->navigate(url);
- }
-}
-
-extern "C" void rho_native_view_manager_destroy_native_view(int native_view_id) {
- RhoOpenedNativeView* opened_view = getOpenedViewByID(native_view_id);
- if (opened_view != NULL) {
- removeRhoNativeOpenedView(opened_view);
- RhoNativeViewRunnable_CloseViewCommand* close_command = new RhoNativeViewRunnable_CloseViewCommand();
- RhoNativeViewUtil::executeInUIThread_WM(close_command);
- }
-}
-
-
-
-
-// destroy native view (opened with URL prefix or in separated full-screen window)
-// this function can executed from your native code (from NativeView code, for example)
-// instead of this function you can execute destroy() for Ruby NativeView object
-void RhoNativeViewManager::destroyNativeView(NativeView* nativeView) {
- RhoOpenedNativeView* opened_view = getOpenedViewByNativeView(nativeView);
- if (opened_view != NULL) {
- RhoNativeViewRunnable_CloseViewCommand* close_command = new RhoNativeViewRunnable_CloseViewCommand();
- RhoNativeViewUtil::executeInUIThread_WM(close_command);
- }
-}
-
-int RhoNativeViewManager::openNativeView(const char* viewType, int tab_index, VALUE params) {
- return rho_native_view_manager_create_native_view(viewType, tab_index, params);
-}
-
-
-void RhoNativeViewManager::closeNativeView(int v_id) {
- rho_native_view_manager_destroy_native_view(v_id);
-}
-
-
-
-
-
-
-
-
-
-
+ //delete this;
+ }
+};
+
+static RhoNativeViewHolder* first = NULL;
+static RhoOpenedNativeView* first_opened = NULL;
+
+static void addRhoNativeViewHolder(RhoNativeViewHolder* holder) {
+ if (first == NULL) {
+ first = holder;
+ holder->next = NULL;
+ }
+ else {
+ holder->next = first;
+ first = holder;
+ }
+}
+
+static void removeRhoNativeViewHolder(RhoNativeViewHolder* holder) {
+ RhoNativeViewHolder* p = first;
+ RhoNativeViewHolder* prev = NULL;
+ while (p != NULL) {
+ if (p == holder) {
+ RhoNativeViewHolder* next = p->next;
+ if (prev != NULL) {
+ prev->next = next;
+ }
+ if (first == p) {
+ first = NULL;
+ }
+ delete p;
+ }
+ prev = p;
+ p = p->next;
+ }
+}
+
+static RhoNativeViewHolder* getHolderByViewTypeName(const char* name) {
+ RhoNativeViewHolder* p = first;
+ while (p != NULL) {
+ if (p->isApplicable(name)) {
+ return p;
+ }
+ p = p->next;
+ }
+ return NULL;
+}
+
+static void addRhoNativeOpenedView(RhoOpenedNativeView* view) {
+ if (first_opened == NULL) {
+ first_opened = view;
+ view->next = NULL;
+ }
+ else {
+ view->next = first_opened;
+ first_opened = view;
+ }
+}
+
+static void removeRhoNativeOpenedView(RhoOpenedNativeView* view) {
+ RhoOpenedNativeView* p = first_opened;
+ RhoOpenedNativeView* prev = NULL;
+ while (p != NULL) {
+ if (p == view) {
+ RhoOpenedNativeView* next = p->next;
+ if (prev != NULL) {
+ prev->next = next;
+ }
+ if (first_opened == p) {
+ first_opened = NULL;
+ }
+ delete p;
+ }
+ prev = p;
+ p = p->next;
+ }
+}
+
+static RhoOpenedNativeView* getOpenedViewByID(int v_id) {
+ RhoOpenedNativeView* p = first_opened;
+ while (p != NULL) {
+ if (p->id == v_id) {
+ return p;
+ }
+ p = p->next;
+ }
+ return NULL;
+}
+
+static RhoOpenedNativeView* getOpenedViewByNativeView(NativeView* nv) {
+ RhoOpenedNativeView* p = first_opened;
+ while (p != NULL) {
+ if (p->n_view == nv) {
+ return p;
+ }
+ p = p->next;
+ }
+ return NULL;
+}
+
+void RhoNativeViewManager::registerViewType(const char* viewType, NativeViewFactory* factory) {
+ RhoNativeViewHolder* holder = new RhoNativeViewHolder();
+ holder->factory = factory;
+ holder->setViewType(viewType);
+ addRhoNativeViewHolder(holder);
+}
+
+void RhoNativeViewManager::unregisterViewType(const char* viewType) {
+ RhoNativeViewHolder* holder = getHolderByViewTypeName(viewType);
+ if (holder != NULL) {
+ removeRhoNativeViewHolder(holder);
+ }
+}
+
+// that function return native object used for display Web content :
+// UIWebView* for iPhone
+// jobject for Android - jobect is android.webkit.WebView class type
+// HWND for Windows Mobile
+void* RhoNativeViewManager::getWebViewObject(int tab_index) {
+ HWND main_wnd = getMainWnd();//getWebViewWnd();
+ return main_wnd;
+}
+
+NativeViewFactory* RhoNativeViewManagerWM::getFactoryByViewType(const char* viewtype) {
+ RhoNativeViewHolder* h = getHolderByViewTypeName(viewtype);
+ if (h != NULL) {
+ return h->factory;
+ }
+ return NULL;
+}
+
+void RhoNativeViewUtil::executeInUIThread_WM(RhoNativeViewRunnable* command) {
+ HWND main_wnd = getMainWnd();
+ ::PostMessage(main_wnd, WM_EXECUTE_COMMAND, (WPARAM)command, 0);
+
+}
+
+extern "C" int rho_native_view_manager_create_native_view(const char* viewtype, int tab_index, VALUE params)
+{
+ RhoNativeViewHolder* h = getHolderByViewTypeName(viewtype);
+ if (h == NULL) {
+ return -1;
+ }
+ NativeViewFactory* factory = h->factory;
+ NativeView* nv = factory->getNativeView(viewtype);
+ if (nv == NULL) {
+ return -1;
+ }
+ //String vtype = new String(viewtype);
+
+ RhoOpenedNativeView* opened_view = new RhoOpenedNativeView();
+ opened_view->factory_holder = h;
+ opened_view->n_view = nv;
+ opened_view->tab_index = tab_index;
+
+ addRhoNativeOpenedView(opened_view);
+
+ RhoNativeViewRunnable_OpenViewCommand* open_command = new RhoNativeViewRunnable_OpenViewCommand(opened_view);
+
+ RhoNativeViewUtil::executeInUIThread_WM(open_command);
+
+ return opened_view->id;
+}
+
+extern "C" void rho_native_view_manager_navigate_native_view(int native_view_id, const char* url) {
+ RhoOpenedNativeView* opened_view = getOpenedViewByID(native_view_id);
+ if (opened_view != NULL) {
+ opened_view->n_view->navigate(url);
+ }
+}
+
+extern "C" void rho_native_view_manager_destroy_native_view(int native_view_id) {
+ RhoOpenedNativeView* opened_view = getOpenedViewByID(native_view_id);
+ if (opened_view != NULL) {
+ removeRhoNativeOpenedView(opened_view);
+ RhoNativeViewRunnable_CloseViewCommand* close_command = new RhoNativeViewRunnable_CloseViewCommand();
+ RhoNativeViewUtil::executeInUIThread_WM(close_command);
+ }
+}
+
+// destroy native view (opened with URL prefix or in separated full-screen window)
+// this function can executed from your native code (from NativeView code, for example)
+// instead of this function you can execute destroy() for Ruby NativeView object
+void RhoNativeViewManager::destroyNativeView(NativeView* nativeView) {
+ RhoOpenedNativeView* opened_view = getOpenedViewByNativeView(nativeView);
+ if (opened_view != NULL) {
+ RhoNativeViewRunnable_CloseViewCommand* close_command = new RhoNativeViewRunnable_CloseViewCommand();
+ RhoNativeViewUtil::executeInUIThread_WM(close_command);
+ }
+}
+
+int RhoNativeViewManager::openNativeView(const char* viewType, int tab_index, VALUE params) {
+ return rho_native_view_manager_create_native_view(viewType, tab_index, params);
+}
+
+void RhoNativeViewManager::closeNativeView(int v_id)
+{
+ rho_native_view_manager_destroy_native_view(v_id);
+}
+
+
+
+
+
+
+
+
+
+
View
31 platform/wm/rhodes/Rhodes.cpp
@@ -217,18 +217,21 @@ rho::IBrowserEngine* rho_wmimpl_createBrowserEngine(HWND hwndParent)
rho::IMainWindow* rho_wmimpl_createMainWindow(HWND hwndParent, const StringW& wndTitle, DWORD dwStyle, rho::EMainWindowType type)
{
- if (type == rho::eQtWindow)
- {
- rho::IMainWindow *mainWindow = new CMainWindowQt();
- mainWindow->Initialize(wndTitle.c_str(), dwStyle);
- return mainWindow;
- }
- else if (type == rho::eNativeWindow)
+
+ if (type == rho::eNativeWindow)
{
CMainWindow* mainWindow = new CMainWindow();
mainWindow->Create(NULL, CWindow::rcDefault, wndTitle.c_str(), dwStyle);
return mainWindow;
+ }
+#if defined(OS_WINDOWS_DESKTOP)
+ else if (type == rho::eQtWindow)
+ {
+ rho::IMainWindow *mainWindow = new CMainWindowQt();
+ mainWindow->Initialize(wndTitle.c_str(), dwStyle);
+ return mainWindow;
}
+#endif
return 0;
}
@@ -604,11 +607,7 @@ HRESULT CRhodesModule::PreMessageLoop(int nShowCmd) throw()
RHODESAPP().startApp();
//#ifdef APP_BUILD_CAPABILITY_WEBKIT_BROWSER
// Navigate to the "loading..." page
- m_appWindow->Navigate2(_T("about:blank")
-#if defined(OS_WINDOWS_DESKTOP)
- , -1
-#endif
- );
+ m_appWindow->Navigate2(_T("about:blank") , -1);
//#endif //APP_BUILD_CAPABILITY_WEBKIT_BROWSER
}
// Show the main application window
@@ -636,7 +635,7 @@ HRESULT CRhodesModule::PreMessageLoop(int nShowCmd) throw()
hr = RegistryNotifyWindow(SN_CONNECTIONSNETWORKCOUNT_ROOT,
SN_CONNECTIONSNETWORKCOUNT_PATH,
SN_CONNECTIONSNETWORKCOUNT_VALUE,
- m_appWindow.m_hWnd,
+ m_appWindow->GetMainWindowHWND(),
WM_CONNECTIONSNETWORKCOUNT,
0,
NULL,
@@ -645,7 +644,7 @@ HRESULT CRhodesModule::PreMessageLoop(int nShowCmd) throw()
hr = RegistryNotifyWindow(SN_CONNECTIONSNETWORKCOUNT_ROOT,
SN_CELLSYSTEMCONNECTED_PATH,
SN_CELLSYSTEMCONNECTED_VALUE,
- m_appWindow.m_hWnd,
+ m_appWindow->GetMainWindowHWND(),
WM_CONNECTIONSNETWORKCELL,
0,
NULL,
@@ -657,11 +656,7 @@ HRESULT CRhodesModule::PreMessageLoop(int nShowCmd) throw()
void CRhodesModule::RunMessageLoop( ) throw( )
{
-#if defined(OS_WINDOWS_DESKTOP)
m_appWindow->MessageLoop();
-#else
- m_appWindow.getWebKitEngine()->RunMessageLoop(m_appWindow);
-#endif
#if defined(OS_WINCE)&& !defined( OS_PLATFORM_MOTCE )
if (g_hNotify)
View
27 platform/wm/rhodes/rho/common/ExtManager.cpp
@@ -33,7 +33,9 @@
#include "MainWindow.h"
#include "common/app_build_capabilities.h"
-extern CMainWindow& getAppWindow();
+extern IMainWindow& getAppWindow();
+extern IMainWindow* getMainWindowObject();
+
//#define IDM_NAVIGATE 40022
//#define IDM_EXECUTEJS 40033
//#define IDM_STOPNAVIGATE 40034
@@ -65,7 +67,7 @@ CRhoExtData CExtManager::makeExtData()
oData.m_hWnd = getMainWnd();
oData.m_hInstance = rho_wmimpl_get_appinstance();
#if !defined(OS_WINDOWS_DESKTOP)
- oData.m_hBrowserWnd = getAppWindow().getWebKitEngine()->GetHTMLWND();
+ oData.m_hBrowserWnd = getMainWindowObject()->getWebViewHWND(-1);
#endif
oData.m_iTabIndex = rho_webview_active_tab();
@@ -149,7 +151,8 @@ void CExtManager::navigate(const wchar_t* szUrl)
bool CExtManager::existsJavascript(const wchar_t* szJSFunction)
{
#if !defined(OS_WINDOWS_DESKTOP)
- return getAppWindow().getWebKitEngine()->isExistJavascript(szJSFunction, rho_webview_active_tab());
+ CMainWindow* mw = static_cast<CMainWindow*>(getMainWindowObject());
+ return mw->getWebKitEngine()->isExistJavascript(szJSFunction, rho_webview_active_tab());
#else
return true;
#endif
@@ -158,7 +161,8 @@ bool CExtManager::existsJavascript(const wchar_t* szJSFunction)
void CExtManager::setBrowserGesturing(bool bEnableGesturing)
{
#if !defined(OS_WINDOWS_DESKTOP)
- getAppWindow().getWebKitEngine()->setBrowserGesturing(bEnableGesturing);
+ CMainWindow* mw = static_cast<CMainWindow*>(getMainWindowObject());
+ mw->getWebKitEngine()->setBrowserGesturing(bEnableGesturing);
#endif
}
@@ -166,14 +170,16 @@ void CExtManager::setBrowserGesturing(bool bEnableGesturing)
void CExtManager::passSipPositionToEngine()
{
#if !defined(OS_WINDOWS_DESKTOP)
- getAppWindow().getWebKitEngine()->NotifyEngineOfSipPosition();
+ CMainWindow* mw = static_cast<CMainWindow*>(getMainWindowObject());
+ mw->getWebKitEngine()->NotifyEngineOfSipPosition();
#endif
}
bool CExtManager::RegisterForMessageCallback(unsigned int iMsgId)
{
#if !defined(OS_WINDOWS_DESKTOP)
- return getAppWindow().getWebKitEngine()->RegisterForMessage(iMsgId);
+ CMainWindow* mw = static_cast<CMainWindow*>(getMainWindowObject());
+ return mw->getWebKitEngine()->RegisterForMessage(iMsgId);
#else
return true;
#endif
@@ -182,7 +188,8 @@ bool CExtManager::RegisterForMessageCallback(unsigned int iMsgId)
bool CExtManager::DeRegisterForMessageCallback(unsigned int iMsgId)
{
#if !defined(OS_WINDOWS_DESKTOP)
- return getAppWindow().getWebKitEngine()->DeRegisterForMessage(iMsgId);
+ CMainWindow* mw = static_cast<CMainWindow*>(getMainWindowObject());
+ return mw->getWebKitEngine()->DeRegisterForMessage(iMsgId);
#else
return true;
#endif
@@ -260,7 +267,8 @@ void CExtManager::zoomText(int nZoom)
int CExtManager::getTextZoom() //Enum (0 to 4)
{
#if !defined(OS_WINDOWS_DESKTOP)
- return getAppWindow().getWebKitEngine()->GetTextZoomOnTab(rho_webview_active_tab());
+ CMainWindow* mw = static_cast<CMainWindow*>(getMainWindowObject());
+ return mw->getWebKitEngine()->GetTextZoomOnTab(rho_webview_active_tab());
#else
return 2;
#endif
@@ -280,7 +288,8 @@ StringW CExtManager::getPageTitle(UINT iTab)
#if !defined(OS_WINDOWS_DESKTOP)
wchar_t szBuf[1025];
szBuf[0]=0;
- getAppWindow().getWebKitEngine()->GetTitleOnTab( szBuf, 1024, iTab );
+ CMainWindow* mw = static_cast<CMainWindow*>(getMainWindowObject());
+ mw->getWebKitEngine()->GetTitleOnTab( szBuf, 1024, iTab );
return szBuf ? szBuf : L"";
#else
return L"";
View
27 platform/wm/rhodes/rho/rubyext/NativeToolbarExt.cpp
@@ -44,7 +44,7 @@ void create_native_toolbar(int bar_type, rho_param *p)
remove_native_toolbar();
else if ( bar_type == TOOLBAR_TYPE )
{
- getMainWindowObject()->performOnUiThread(getMainWindowObject()->makeCreateToolbarTask(p));
+ getMainWindowObject()->makeCreateToolbarTask(p);
}
else
{
@@ -60,7 +60,7 @@ void create_nativebar(int bar_type, rho_param *p)
void remove_native_toolbar()
{
- getMainWindowObject()->performOnUiThread(getMainWindowObject()->makeRemoveToolbarTask());
+ getMainWindowObject()->makeRemoveToolbarTask();
}
void remove_nativebar()
@@ -84,9 +84,9 @@ VALUE nativebar_started()
//Tabbar
void remove_native_tabbar()
{
-//#if defined(OS_WINDOWS_DESKTOP)
-// getAppWindow().performOnUiThread(new CNativeTabbarQt::CRemoveTask() );
-//#endif
+#if defined(OS_WINDOWS_DESKTOP)
+ getMainWindowObject()->makeRemoveTabbarTask();
+#endif
}
void create_native_tabbar(int bar_type, rho_param *p)
@@ -101,8 +101,9 @@ void create_native_tabbar(int bar_type, rho_param *p)
remove_native_tabbar();
else if ( bar_type == TABBAR_TYPE )
{
- getMainWindowObject()->performOnUiThread(new CNativeTabbarQt::CCreateTask(bar_type, p) );
- } else
+ getMainWindowObject()->makeCreateTabbarTask(bar_type, p);
+ }
+ else
{
RAWLOGC_ERROR("NativeTabbar", "Only Tabbar control is supported.");
}
@@ -111,16 +112,16 @@ void create_native_tabbar(int bar_type, rho_param *p)
void native_tabbar_switch_tab(int index)
{
-//#if defined(OS_WINDOWS_DESKTOP)
-// getAppWindow().performOnUiThread(new CNativeTabbarQt::CSwitchTask(index) );
-//#endif
+#if defined(OS_WINDOWS_DESKTOP)
+ getMainWindowObject()->makeSwitchTabbarTask(index);
+#endif
}
void native_tabbar_set_tab_badge(int index,char *val)
{
-//#if defined(OS_WINDOWS_DESKTOP)
-// getAppWindow().performOnUiThread(new CNativeTabbarQt::CBadgeTask(index, val) );
-//#endif
+#if defined(OS_WINDOWS_DESKTOP)
+ getMainWindowObject()->makeBadgeTabbarTask(index, val);
+#endif
}
void nativebar_set_tab_badge(int index,char* val)
Please sign in to comment.
Something went wrong with that request. Please try again.