Esempio n. 1
0
static void activate_gecko(NSContainer *This)
{
    TRACE("(%p) %p\n", This, This->window);

    SetParent(This->hwnd, This->doc->hwnd);
    ShowWindow(This->hwnd, SW_SHOW);

    nsIBaseWindow_SetVisibility(This->window, TRUE);
    nsIBaseWindow_SetEnabled(This->window, TRUE);
    nsIWebBrowserFocus_Activate(This->focus);
}
Esempio n. 2
0
static LRESULT WINAPI serverwnd_proc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
{
    HTMLDocumentObj *This;

    static const WCHAR wszTHIS[] = {'T','H','I','S',0};

    if(msg == WM_CREATE) {
        This = *(HTMLDocumentObj**)lParam;
        SetPropW(hwnd, wszTHIS, This);
    }else {
        This = GetPropW(hwnd, wszTHIS);
    }

    switch(msg) {
    case WM_CREATE:
        This->hwnd = hwnd;
        break;
    case WM_PAINT:
        paint_document(This);
        break;
    case WM_SIZE:
        TRACE("(%p)->(WM_SIZE)\n", This);
        if(This->nscontainer) {
            INT ew=0, eh=0;

            if(!(This->hostinfo.dwFlags & (DOCHOSTUIFLAG_NO3DOUTERBORDER|DOCHOSTUIFLAG_NO3DBORDER))) {
                ew = GetSystemMetrics(SM_CXEDGE);
                eh = GetSystemMetrics(SM_CYEDGE);
            }

            SetWindowPos(This->nscontainer->hwnd, NULL, ew, eh,
                         LOWORD(lParam) - 2*ew, HIWORD(lParam) - 2*eh,
                         SWP_NOZORDER | SWP_NOACTIVATE);
        }
        break;
    case WM_TIMER:
        return on_timer(This);
    case WM_SETFOCUS:
        TRACE("(%p) WM_SETFOCUS\n", This);
        nsIWebBrowserFocus_Activate(This->nscontainer->focus);
        break;
    case WM_MOUSEACTIVATE:
        return MA_ACTIVATE;
    }
        
    return DefWindowProcW(hwnd, msg, wParam, lParam);
}
Esempio n. 3
0
static HRESULT WINAPI OleDocumentView_UIActivate(IOleDocumentView *iface, BOOL fUIActivate)
{
    HTMLDocument *This = DOCVIEW_THIS(iface);
    HRESULT hres;

    TRACE("(%p)->(%x)\n", This, fUIActivate);

    if(!This->doc_obj->ipsite) {
        IOleClientSite *cs = This->doc_obj->client;
        IOleInPlaceSite *ips;

        if(!cs) {
            WARN("this->ipsite = NULL\n");
            return E_UNEXPECTED;
        }

        hres = IOleClientSite_QueryInterface(cs, &IID_IOleInPlaceSiteWindowless, (void**)&ips);
        if(SUCCEEDED(hres))
            This->doc_obj->ipsite = ips;
        else {
            hres = IOleClientSite_QueryInterface(cs, &IID_IOleInPlaceSiteEx, (void**)&ips);
            if(SUCCEEDED(hres))
                This->doc_obj->ipsite = ips;
            else {
                hres = IOleClientSite_QueryInterface(cs, &IID_IOleInPlaceSite, (void**)&ips);
                if(SUCCEEDED(hres))
                    This->doc_obj->ipsite = ips;
                else {
                    WARN("this->ipsite = NULL\n");
                    return E_NOINTERFACE;
                }
            }
        }

        IOleClientSite_AddRef(This->doc_obj->ipsite);
        This->doc_obj->request_uiactivate = FALSE;
        HTMLDocument_LockContainer(This->doc_obj, TRUE);
    }

    if(fUIActivate) {
        RECT rcBorderWidths;

        if(This->doc_obj->ui_active)
            return S_OK;

        if(!This->doc_obj->window_active) {
            hres = activate_window(This->doc_obj);
            if(FAILED(hres))
                return hres;
        }

        This->doc_obj->focus = TRUE;
        if(This->doc_obj->nscontainer)
            nsIWebBrowserFocus_Activate(This->doc_obj->nscontainer->focus);
        notif_focus(This->doc_obj);

        update_doc(This, UPDATE_UI);

        hres = IOleInPlaceSite_OnUIActivate(This->doc_obj->ipsite);
        if(SUCCEEDED(hres)) {
            call_set_active_object((IOleInPlaceUIWindow*)This->doc_obj->frame, ACTOBJ(This));
        }else {
            FIXME("OnUIActivate failed: %08x\n", hres);
            IOleInPlaceFrame_Release(This->doc_obj->frame);
            This->doc_obj->frame = NULL;
            This->doc_obj->ui_active = FALSE;
            return hres;
        }

        if(This->doc_obj->hostui) {
            hres = IDocHostUIHandler_ShowUI(This->doc_obj->hostui,
                    This->doc_obj->usermode == EDITMODE ? DOCHOSTUITYPE_AUTHOR : DOCHOSTUITYPE_BROWSE,
                    ACTOBJ(This), CMDTARGET(This), This->doc_obj->frame, This->doc_obj->ip_window);
            if(FAILED(hres))
                IDocHostUIHandler_HideUI(This->doc_obj->hostui);
        }

        if(This->doc_obj->ip_window)
            call_set_active_object(This->doc_obj->ip_window, ACTOBJ(This));

        memset(&rcBorderWidths, 0, sizeof(rcBorderWidths));
        IOleInPlaceFrame_SetBorderSpace(This->doc_obj->frame, &rcBorderWidths);

        This->doc_obj->ui_active = TRUE;
    }else {
        This->doc_obj->focus = FALSE;
        nsIWebBrowserFocus_Deactivate(This->doc_obj->nscontainer->focus);
        if(This->doc_obj->ui_active) {
            This->doc_obj->ui_active = FALSE;
            if(This->doc_obj->ip_window)
                call_set_active_object(This->doc_obj->ip_window, NULL);
            if(This->doc_obj->frame)
                call_set_active_object((IOleInPlaceUIWindow*)This->doc_obj->frame, NULL);
            if(This->doc_obj->hostui)
                IDocHostUIHandler_HideUI(This->doc_obj->hostui);
            if(This->doc_obj->ipsite)
                IOleInPlaceSite_OnUIDeactivate(This->doc_obj->ipsite, FALSE);
        }
    }
    return S_OK;
}
Esempio n. 4
0
static HRESULT WINAPI OleDocumentView_UIActivate(IOleDocumentView *iface, BOOL fUIActivate)
{
    HTMLDocument *This = DOCVIEW_THIS(iface);
    HRESULT hres;

    TRACE("(%p)->(%x)\n", This, fUIActivate);

    if(!This->ipsite) {
        FIXME("This->ipsite = NULL\n");
        return E_FAIL;
    }

    if(fUIActivate) {
        RECT rcBorderWidths;

        if(This->ui_active)
            return S_OK;

        if(!This->window_active) {
            hres = activate_window(This);
            if(FAILED(hres))
                return hres;
        }

        This->focus = TRUE;
        if(This->nscontainer)
            nsIWebBrowserFocus_Activate(This->nscontainer->focus);
        notif_focus(This);

        update_doc(This, UPDATE_UI);

        hres = IOleInPlaceSite_OnUIActivate(This->ipsite);
        if(SUCCEEDED(hres)) {
            call_set_active_object((IOleInPlaceUIWindow*)This->frame, ACTOBJ(This));
        }else {
            FIXME("OnUIActivate failed: %08x\n", hres);
            IOleInPlaceFrame_Release(This->frame);
            This->frame = NULL;
            This->ui_active = FALSE;
            return hres;
        }

        hres = IDocHostUIHandler_ShowUI(This->hostui,
                This->usermode == EDITMODE ? DOCHOSTUITYPE_AUTHOR : DOCHOSTUITYPE_BROWSE,
                ACTOBJ(This), CMDTARGET(This), This->frame, This->ip_window);
        if(FAILED(hres))
            IDocHostUIHandler_HideUI(This->hostui);

        if(This->ip_window)
            call_set_active_object(This->ip_window, ACTOBJ(This));

        memset(&rcBorderWidths, 0, sizeof(rcBorderWidths));
        IOleInPlaceFrame_SetBorderSpace(This->frame, &rcBorderWidths);

        This->ui_active = TRUE;
    }else {
        if(This->ui_active) {
            This->ui_active = FALSE;
            if(This->ip_window)
                call_set_active_object(This->ip_window, NULL);
            if(This->frame)
                call_set_active_object((IOleInPlaceUIWindow*)This->frame, NULL);
            if(This->hostui)
                IDocHostUIHandler_HideUI(This->hostui);
            if(This->ipsite)
                IOleInPlaceSite_OnUIDeactivate(This->ipsite, FALSE);
        }
    }
    return S_OK;
}