#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);
|
}
|
}
|