diff --git a/cefclient/cefclient_win.cpp b/cefclient/cefclient_win.cpp index 82ea721..f7ae784 100755 --- a/cefclient/cefclient_win.cpp +++ b/cefclient/cefclient_win.cpp @@ -287,52 +287,8 @@ LRESULT CALLBACK WndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam) // Create the child windows used for navigation RECT rect; - int x = 0; GetClientRect(hWnd, &rect); - - backWnd = CreateWindow(L"BUTTON", L"Back", - WS_CHILD | WS_VISIBLE | BS_PUSHBUTTON - | WS_DISABLED, x, 0, BUTTON_WIDTH, URLBAR_HEIGHT, - hWnd, (HMENU) IDC_NAV_BACK, hInst, 0); - x += BUTTON_WIDTH; - - forwardWnd = CreateWindow(L"BUTTON", L"Forward", - WS_CHILD | WS_VISIBLE | BS_PUSHBUTTON - | WS_DISABLED, x, 0, BUTTON_WIDTH, - URLBAR_HEIGHT, hWnd, (HMENU) IDC_NAV_FORWARD, - hInst, 0); - x += BUTTON_WIDTH; - - reloadWnd = CreateWindow(L"BUTTON", L"Reload", - WS_CHILD | WS_VISIBLE | BS_PUSHBUTTON - | WS_DISABLED, x, 0, BUTTON_WIDTH, - URLBAR_HEIGHT, hWnd, (HMENU) IDC_NAV_RELOAD, - hInst, 0); - x += BUTTON_WIDTH; - - stopWnd = CreateWindow(L"BUTTON", L"Stop", - WS_CHILD | WS_VISIBLE | BS_PUSHBUTTON - | WS_DISABLED, x, 0, BUTTON_WIDTH, URLBAR_HEIGHT, - hWnd, (HMENU) IDC_NAV_STOP, hInst, 0); - x += BUTTON_WIDTH; - - editWnd = CreateWindow(L"EDIT", 0, - WS_CHILD | WS_VISIBLE | WS_BORDER | ES_LEFT | - ES_AUTOVSCROLL | ES_AUTOHSCROLL| WS_DISABLED, - x, 0, rect.right - BUTTON_WIDTH * 4, - URLBAR_HEIGHT, hWnd, 0, hInst, 0); - - // Assign the edit window's WNDPROC to this function so that we can - // capture the enter key - editWndOldProc = - reinterpret_cast(GetWindowLongPtr(editWnd, GWLP_WNDPROC)); - SetWindowLongPtr(editWnd, GWLP_WNDPROC, - reinterpret_cast(WndProc)); - g_handler->SetEditHwnd(editWnd); - g_handler->SetButtonHwnds(backWnd, forwardWnd, reloadWnd, stopWnd); - - rect.top += URLBAR_HEIGHT; CefWindowInfo info; CefBrowserSettings settings; diff --git a/cefclient/client_handler.cpp b/cefclient/client_handler.cpp index e6192b4..53293ea 100755 --- a/cefclient/client_handler.cpp +++ b/cefclient/client_handler.cpp @@ -15,11 +15,6 @@ ClientHandler::ClientHandler() : m_MainHwnd(NULL), m_BrowserHwnd(NULL), - m_EditHwnd(NULL), - m_BackHwnd(NULL), - m_ForwardHwnd(NULL), - m_StopHwnd(NULL), - m_ReloadHwnd(NULL), m_bFormElementHasFocus(false) { } @@ -76,11 +71,6 @@ void ClientHandler::OnLoadStart(CefRefPtr browser, CefRefPtr frame) { REQUIRE_UI_THREAD(); - - if(m_BrowserHwnd == browser->GetWindowHandle() && frame->IsMain()) { - // We've just started loading a page - SetLoading(true); - } } void ClientHandler::OnLoadEnd(CefRefPtr browser, @@ -91,8 +81,7 @@ void ClientHandler::OnLoadEnd(CefRefPtr browser, if(m_BrowserHwnd == browser->GetWindowHandle() && frame->IsMain()) { // We've just finished loading a page - SetLoading(false); - + CefRefPtr visitor = GetDOMVisitor(frame->GetURL()); if(visitor.get()) frame->VisitDOM(visitor); @@ -153,8 +142,6 @@ void ClientHandler::OnNavStateChange(CefRefPtr browser, bool canGoForward) { REQUIRE_UI_THREAD(); - - SetNavState(canGoBack, canGoForward); } bool ClientHandler::OnConsoleMessage(CefRefPtr browser, @@ -316,24 +303,6 @@ void ClientHandler::SetMainHwnd(CefWindowHandle hwnd) m_MainHwnd = hwnd; } -void ClientHandler::SetEditHwnd(CefWindowHandle hwnd) -{ - AutoLock lock_scope(this); - m_EditHwnd = hwnd; -} - -void ClientHandler::SetButtonHwnds(CefWindowHandle backHwnd, - CefWindowHandle forwardHwnd, - CefWindowHandle reloadHwnd, - CefWindowHandle stopHwnd) -{ - AutoLock lock_scope(this); - m_BackHwnd = backHwnd; - m_ForwardHwnd = forwardHwnd; - m_ReloadHwnd = reloadHwnd; - m_StopHwnd = stopHwnd; -} - std::string ClientHandler::GetLogFile() { AutoLock lock_scope(this); diff --git a/cefclient/client_handler.h b/cefclient/client_handler.h index 42983c9..42ab90b 100755 --- a/cefclient/client_handler.h +++ b/cefclient/client_handler.h @@ -180,9 +180,6 @@ class ClientHandler : public CefClient, void CloseMainWindow(); protected: - void SetLoading(bool isLoading); - void SetNavState(bool canGoBack, bool canGoForward); - // The child browser window CefRefPtr m_Browser; @@ -192,15 +189,6 @@ class ClientHandler : public CefClient, // The child browser window handle CefWindowHandle m_BrowserHwnd; - // The edit window handle - CefWindowHandle m_EditHwnd; - - // The button window handles - CefWindowHandle m_BackHwnd; - CefWindowHandle m_ForwardHwnd; - CefWindowHandle m_StopHwnd; - CefWindowHandle m_ReloadHwnd; - // Support for logging. std::string m_LogFile; diff --git a/cefclient/client_handler_win.cpp b/cefclient/client_handler_win.cpp index f60b1d3..b7b26bc 100755 --- a/cefclient/client_handler_win.cpp +++ b/cefclient/client_handler_win.cpp @@ -51,12 +51,6 @@ void ClientHandler::OnAddressChange(CefRefPtr browser, const CefString& url) { REQUIRE_UI_THREAD(); - - if(m_BrowserHwnd == browser->GetWindowHandle() && frame->IsMain()) - { - // Set the edit window text - SetWindowText(m_EditHwnd, std::wstring(url).c_str()); - } } void ClientHandler::OnTitleChange(CefRefPtr browser, @@ -94,21 +88,6 @@ void ClientHandler::SendNotification(NotificationType type) PostMessage(m_MainHwnd, WM_COMMAND, id, 0); } -void ClientHandler::SetLoading(bool isLoading) -{ - ASSERT(m_EditHwnd != NULL && m_ReloadHwnd != NULL && m_StopHwnd != NULL); - EnableWindow(m_EditHwnd, TRUE); - EnableWindow(m_ReloadHwnd, !isLoading); - EnableWindow(m_StopHwnd, isLoading); -} - -void ClientHandler::SetNavState(bool canGoBack, bool canGoForward) -{ - ASSERT(m_BackHwnd != NULL && m_ForwardHwnd != NULL); - EnableWindow(m_BackHwnd, canGoBack); - EnableWindow(m_ForwardHwnd, canGoForward); -} - void ClientHandler::CloseMainWindow() { ::PostMessage(m_MainHwnd, WM_CLOSE, 0, 0);