使用soui开发的mbc,只支持windows版本
w1146869587
2022-01-24 0408576e9da10015ffa9da0079b8c985113ce4b3
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
#include "StdAfx.h"
#include "MBViewWebWnd.h"
 
CMBViewWebWnd::CMBViewWebWnd() : SHostWnd(_T("LAYOUT:DLG_VIEW_WEB"))
{
    m_bLayoutInited = FALSE;    
    m_pWebRealWnd      = NULL;
}
 
CMBViewWebWnd::~CMBViewWebWnd()
{
    
}
 
int CMBViewWebWnd::OnCreate(LPCREATESTRUCT lpCreateStruct)
{
    SetMsgHandled(FALSE);
     
    //::SetWindowPos(m_hWnd,HWND_TOPMOST,0,0,0,0,SWP_NOMOVE|SWP_NOSIZE); 
    return 0;
}
 
BOOL CMBViewWebWnd::OnInitDialog(HWND hWnd, LPARAM lParam)
{
    m_bLayoutInited = TRUE;
 
    /*m_pWebView  = FindChildByName2<SWebView>(_T("wb_oosurl"));
    if( NULL == m_pWebView )
        return FALSE;
*/
    m_pWebRealWnd =  FindChildByName2<SRealWnd>(_T("wb_popupurl"));
    if( NULL == m_pWebRealWnd )
        return FALSE;
 
    SetWindowTitle(m_strTitle); 
    return 0;
}
//TODO:ÏûÏ¢Ó³Éä
void CMBViewWebWnd::OnClose()
{    
    CSimpleWnd::DestroyWindow();
}
 
void CMBViewWebWnd::OnMaximize()
{
    SendMessage(WM_SYSCOMMAND, SC_MAXIMIZE);
}
void CMBViewWebWnd::OnRestore()
{
    SendMessage(WM_SYSCOMMAND, SC_RESTORE);
}
void CMBViewWebWnd::OnMinimize()
{
    SendMessage(WM_SYSCOMMAND, SC_MINIMIZE);
}
 
void CMBViewWebWnd::OnSize(UINT nType, SOUI::CSize size)
{
    SetMsgHandled(FALSE);
    if (!m_bLayoutInited) return;
    
    SWindow *pBtnMax = FindChildByName(L"btn_max");
    SWindow *pBtnRestore = FindChildByName(L"btn_restore");
    if(!pBtnMax || !pBtnRestore) return;
    
    if (nType == SIZE_MAXIMIZED)
    {
        pBtnRestore->SetVisible(TRUE);
        pBtnMax->SetVisible(FALSE);
    }
    else if (nType == SIZE_RESTORED)
    {
        pBtnRestore->SetVisible(FALSE);
        pBtnMax->SetVisible(TRUE);
    }
}
 
 
void CMBViewWebWnd::LoadUrl( SStringT &strUrl )
{
    CUrlParseMap mapUrlParam;
    CString strDecodeUrl = UrlParse::UrlDecode(strUrl);
 
    UrlParse::GetUrlParam( mapUrlParam,strDecodeUrl );
 
    m_strTitle = mapUrlParam[_T("name")]; 
    SetWindowTitle(m_strTitle); 
 
    if(m_pWebRealWnd->GetRealWndParam().m_strClassName.CompareNoCase(_T("cef_cls"))==0)
    {
        SWebViewWnd *pWnd=(SWebViewWnd *)m_pWebRealWnd->GetUserData();
        if(pWnd)
        {  
            if( pWnd->GetURL().IsEmpty() )
            { 
                pWnd->LoadURL(strUrl);
                pWnd->ReDraw();
            } 
        }
    } 
 
    /*m_pWebRealWnd
    if( m_pWebView )
    {  
        m_pWebView->SetAttribute(_T("url"),strUrl);     
    }*/
}
 
 
void CMBViewWebWnd::SetTitle( CString &strTitle )
{
    // <text name="txt_title" pos="29,9"></text>
    m_strTitle = strTitle;
}
 
void CMBViewWebWnd::SetWindowTitle(SStringT strTitle)
{
    if( strTitle.IsEmpty() )
     return ;
 
    SStatic *pTitle = FindChildByName2<SStatic>(L"txt_title");
    if( pTitle )
    {
        pTitle->SetWindowText(strTitle);
    } 
}