Jacek Caban : mshtml: Added border implementation.

Alexandre Julliard julliard at wine.codeweavers.com
Mon Nov 13 06:30:42 CST 2006


Module: wine
Branch: master
Commit: 396b0ad126eb239507e7b6cfbd8de621e70ce587
URL:    http://source.winehq.org/git/wine.git/?a=commit;h=396b0ad126eb239507e7b6cfbd8de621e70ce587

Author: Jacek Caban <jacek at codeweavers.com>
Date:   Sun Nov 12 17:09:38 2006 +0100

mshtml: Added border implementation.

---

 dlls/mshtml/mshtml_private.h |    2 +
 dlls/mshtml/oleobj.c         |    9 +++++-
 dlls/mshtml/view.c           |   60 ++++++++++++++++++++++++++---------------
 3 files changed, 47 insertions(+), 24 deletions(-)

diff --git a/dlls/mshtml/mshtml_private.h b/dlls/mshtml/mshtml_private.h
index f47a799..998ee49 100644
--- a/dlls/mshtml/mshtml_private.h
+++ b/dlls/mshtml/mshtml_private.h
@@ -91,6 +91,8 @@ struct HTMLDocument {
     HWND hwnd;
     HWND tooltips_hwnd;
 
+    DOCHOSTUIINFO hostinfo;
+
     USERMODE usermode;
     READYSTATE readystate;
     BOOL in_place_active;
diff --git a/dlls/mshtml/oleobj.c b/dlls/mshtml/oleobj.c
index 9ed62f7..343facc 100644
--- a/dlls/mshtml/oleobj.c
+++ b/dlls/mshtml/oleobj.c
@@ -84,6 +84,8 @@ static HRESULT WINAPI OleObject_SetClien
         This->hostui = NULL;
     }
 
+    memset(&This->hostinfo, 0, sizeof(DOCHOSTUIINFO));
+
     if(!pClientSite)
         return S_OK;
 
@@ -96,11 +98,12 @@ static HRESULT WINAPI OleObject_SetClien
         memset(&hostinfo, 0, sizeof(DOCHOSTUIINFO));
         hostinfo.cbSize = sizeof(DOCHOSTUIINFO);
         hres = IDocHostUIHandler_GetHostInfo(pDocHostUIHandler, &hostinfo);
-        if(SUCCEEDED(hres))
-            /* FIXME: use hostinfo */
+        if(SUCCEEDED(hres)) {
             TRACE("hostinfo = {%u %08x %08x %s %s}\n",
                     hostinfo.cbSize, hostinfo.dwFlags, hostinfo.dwDoubleClick,
                     debugstr_w(hostinfo.pchHostCss), debugstr_w(hostinfo.pchHostNS));
+            memcpy(&This->hostinfo, &hostinfo, sizeof(DOCHOSTUIINFO));
+        }
 
         if(!This->has_key_path) {
             hres = IDocHostUIHandler_GetOptionKeyPath(pDocHostUIHandler, &key_path, 0);
@@ -693,4 +696,6 @@ void HTMLDocument_OleObj_Init(HTMLDocume
 
     This->has_key_path = FALSE;
     This->container_locked = FALSE;
+
+    memset(&This->hostinfo, 0, sizeof(DOCHOSTUIINFO));
 }
diff --git a/dlls/mshtml/view.c b/dlls/mshtml/view.c
index 632d6bd..e0db0b8 100644
--- a/dlls/mshtml/view.c
+++ b/dlls/mshtml/view.c
@@ -49,29 +49,37 @@ typedef struct {
     WNDPROC proc;
 } tooltip_data;
 
-static void paint_disabled(HWND hwnd) {
-    HDC hdc;
+static void paint_document(HTMLDocument *This)
+{
     PAINTSTRUCT ps;
-    HBRUSH brush;
     RECT rect;
-    HFONT font;
-    WCHAR wszHTMLDisabled[100];
+    HDC hdc;
+
+    GetClientRect(This->hwnd, &rect);
+
+    hdc = BeginPaint(This->hwnd, &ps);
+
+    if(!(This->hostinfo.dwFlags & (DOCHOSTUIFLAG_NO3DOUTERBORDER|DOCHOSTUIFLAG_NO3DBORDER)))
+        DrawEdge(hdc, &rect, EDGE_SUNKEN, BF_RECT|BF_ADJUST);
+
+    if(!This->nscontainer) {
+        WCHAR wszHTMLDisabled[100];
+        HFONT font;
 
-    LoadStringW(hInst, IDS_HTMLDISABLED, wszHTMLDisabled, sizeof(wszHTMLDisabled)/sizeof(WCHAR));
+        LoadStringW(hInst, IDS_HTMLDISABLED, wszHTMLDisabled, sizeof(wszHTMLDisabled)/sizeof(WCHAR));
 
-    font = CreateFontA(25,0,0,0,400,0,0,0,ANSI_CHARSET,0,0,DEFAULT_QUALITY,DEFAULT_PITCH,NULL);
-    brush = CreateSolidBrush(RGB(255,255,255));
-    GetClientRect(hwnd, &rect);
+        font = CreateFontA(25,0,0,0,400,0,0,0,ANSI_CHARSET,0,0,DEFAULT_QUALITY,DEFAULT_PITCH,NULL);
 
-    hdc = BeginPaint(hwnd, &ps);
-    SelectObject(hdc, font);
-    SelectObject(hdc, brush);
-    Rectangle(hdc, rect.left, rect.top, rect.right, rect.bottom);
-    DrawTextW(hdc, wszHTMLDisabled,-1, &rect, DT_CENTER | DT_SINGLELINE | DT_VCENTER);
-    EndPaint(hwnd, &ps);
+        SelectObject(hdc, font);
+        SelectObject(hdc, GetSysColorBrush(COLOR_WINDOW));
 
-    DeleteObject(font);
-    DeleteObject(brush);
+        Rectangle(hdc, rect.left, rect.top, rect.right, rect.bottom);
+        DrawTextW(hdc, wszHTMLDisabled,-1, &rect, DT_CENTER | DT_SINGLELINE | DT_VCENTER);
+
+        DeleteObject(font);
+    }
+
+    EndPaint(This->hwnd, &ps);
 }
 
 static void activate_gecko(HTMLDocument *This)
@@ -106,14 +114,22 @@ static LRESULT WINAPI serverwnd_proc(HWN
             activate_gecko(This);
         break;
     case WM_PAINT:
-        if(!This->nscontainer)
-            paint_disabled(hwnd);
+        paint_document(This);
         break;
     case WM_SIZE:
         TRACE("(%p)->(WM_SIZE)\n", This);
-        if(This->nscontainer)
-            SetWindowPos(This->nscontainer->hwnd, NULL, 0, 0, LOWORD(lParam), HIWORD(lParam),
-                    SWP_NOZORDER | SWP_NOACTIVATE);
+        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);
+        }
     }
         
     return DefWindowProcW(hwnd, msg, wParam, lParam);




More information about the wine-cvs mailing list