Example #1
0
void CALLBACK CUICommandHistory::UIAdd(TiXmlNode* pNode)
{
	TiXmlElement* pElement = pNode->ToElement();
	CStringA strParentName = pElement->Attribute("parentname");
	pElement->RemoveAttribute("parentname");
	if(strParentName.IsEmpty())
		return;

	CUIDesignerView* pUIView = g_pMainFrame->GetActiveUIView();
	CPaintManagerUI* pManager = pUIView->GetPaintManager();
	CControlUI* pParentControl = pManager->FindControl(StringConvertor::Utf8ToWide(strParentName));
	if(pParentControl == NULL)
		return;

	TiXmlDocument xmlDoc;
	TiXmlDeclaration Declaration("1.0","utf-8","yes");
	xmlDoc.InsertEndChild(Declaration);
	TiXmlElement* pRootElem = new TiXmlElement("UIAdd");
	pRootElem->InsertEndChild(*pElement);
	xmlDoc.InsertEndChild(*pRootElem);
	TiXmlPrinter printer;
	xmlDoc.Accept(&printer);
	delete pRootElem;

	CDialogBuilder builder;
	CControlUI* pRoot=builder.Create(StringConvertor::Utf8ToWide(printer.CStr()), (UINT)0, NULL, pManager);
 	if(pRoot)
		pUIView->RedoUI(pRoot, pParentControl);
}
Example #2
0
LRESULT CDuilib3dFrame::OnCreate(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled)
{
	LONG styleValue = ::GetWindowLong(*this, GWL_STYLE);
	styleValue &= ~WS_CAPTION;
	styleValue &= ~WS_THICKFRAME;
	::SetWindowLong(*this, GWL_STYLE, styleValue | WS_CLIPSIBLINGS | WS_CLIPCHILDREN);

	HMENU hMenu = GetSystemMenu(m_hWnd,FALSE);
	if (hMenu != NULL)
	{
		DeleteMenu(hMenu,SC_MAXIMIZE,MF_BYCOMMAND);
	}

	//根据skin.xml创建程序界面
	m_PaintManager.Init(m_hWnd);

	CDialogBuilder builder;
	CDialogBuilderCallbackEx cb;
	CControlUI* pRoot = builder.Create(_T("skin.xml"), (UINT)0,  &cb, &m_PaintManager);
	ASSERT(pRoot && "Failed to parse XML");

	m_PaintManager.AttachDialog(pRoot);
	m_PaintManager.AddNotifier(this);

	HICON hIcon = LoadIcon((HINSTANCE)GetWindowLong(m_hWnd,GWL_HINSTANCE),MAKEINTRESOURCE(IDI_ICON));
	m_tray.Create(m_hWnd,WM_USER+1021,_T("360安全卫士"),hIcon,NULL);

	return 0;
}
Example #3
0
void CHelloDuilibWnd::InitWindow()
{
	CLabelUI* helloTxUI = static_cast<CLabelUI*>(m_PaintManager.FindControl(_T("apptitle")));
	helloTxUI->SetText(_T("hehe"));
	CButtonUI* btnClose = static_cast<CButtonUI*>(m_PaintManager.FindControl(_T("closebtn")));
	CVerticalLayoutUI* layoutBody = static_cast<CVerticalLayoutUI*>(m_PaintManager.FindControl(_T("body")));

	CLabelUI* txtUI = new CLabelUI();
	layoutBody->Add(txtUI);
	txtUI->SetFloat(true);
	txtUI->SetPos({ 10, 300, 0, 0 });
	txtUI->SetFixedWidth(200);
	txtUI->SetFixedHeight(20);
	txtUI->SetText(_T("Hello Dynamic Text"));

	btnClose->OnEvent += MakeDelegate(this, &CHelloDuilibWnd::OnCloseClicked);

	CDialogBuilder builder;
	CVerticalLayoutUI* userControl = static_cast<CVerticalLayoutUI*>(builder.Create(_T("HelloControl.xml"),(LPCTSTR)0));
	CControlUI* testLabel = userControl->FindSubControl(_T("myLabel"));
	layoutBody->Add(userControl);

	layoutBody->NeedUpdate();
	
	CControlUI* myLabel = static_cast<CLabelUI*>(m_PaintManager.FindControl(_T("myLabel")));
	
	if (myLabel)
	{
	}

}
	LRESULT HandleMessage(UINT uMsg, WPARAM wParam, LPARAM lParam) {
		if( uMsg == WM_CREATE ) {     
			paint_manager_.Init(m_hWnd);
			CDialogBuilder builder;
			CControlUI* pRoot = builder.Create(GetDialogResource(), (UINT)0, NULL, &paint_manager_);
			paint_manager_.AttachDialog(pRoot);
			paint_manager_.AddNotifier(this);

			CControlUI *pText = paint_manager_.FindControl(_T("content"));
			if( pText ) pText->SetText(m_sContent);
			CenterWindow();
			return 0;
		}
		else if( uMsg == WM_KEYDOWN ) {
			if( wParam == VK_RETURN ) {
				m_iRetCode = IDOK;
				Close();
				return 0;
			}
			else if( wParam == VK_ESCAPE ) {
				m_iRetCode = IDCANCEL;
				Close();
				return 0;
			}
		}
		LRESULT lRes = 0;
		if( paint_manager_.MessageHandler(uMsg, wParam, lParam, lRes) ) return lRes;
		return CWindowWnd::HandleMessage(uMsg, wParam, lParam);
	}
Example #5
0
void SessionLayout::_AddGroupMemberToList(IN const std::string& sID, IN const BOOL bCreator)
{
	module::UserInfoEntity userInfo;
	if (!module::getUserListModule()->getUserInfoBySId(sID, userInfo))
	{
		LOG__(ERR, _T("can't find the userInfo:%s,GroupId:%s"),util::stringToCString(sID),util::stringToCString(m_sId));
		return;
	}
	CDialogBuilder dlgBuilder;
	CListContainerElementUI* pListElement = (CListContainerElementUI*)dlgBuilder.Create(_T("SessionDialog\\groupMembersListItem.xml"), (UINT)0, NULL, &m_paint_manager);
	if (!pListElement)
	{
		LOG__(ERR, _T("群item创建失败"));
		return;
	}
	CButtonUI* pLogo = static_cast<CButtonUI*>(pListElement->FindSubControl(_T("AvatarInfo")));
	PTR_VOID(pLogo);
	pLogo->SetBkImage(util::stringToCString(userInfo.getAvatarPath()));

	if (bCreator)
	{
		CButtonUI* pCreator = static_cast<CButtonUI*>(pListElement->FindSubControl(_T("Creator")));
		PTR_VOID(pCreator);
		pCreator->SetVisible(true);
		pCreator->SetUserData(_T("Creator"));
	}

	CLabelUI* pNameLable = static_cast<CLabelUI*>(pListElement->FindSubControl(_T("nickname")));
	PTR_VOID(pNameLable);
	pNameLable->SetText(userInfo.getRealName());
	pListElement->SetUserData(util::stringToCString(userInfo.sId));

	m_pGroupMemberList->Add(pListElement);
}
Example #6
0
    LRESULT CShadowWindow::OnCreate(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled)
    {
        // 使用xml字符串形式加载皮肤,内容很简单,一个Container控件就够了!Window要有bktrans属性
        CDuiString xml;
        xml.Append(_T("<?xml version=\"1.0\" encoding=\"utf-8\" standalone=\"yes\" ?>"));
        xml.Append(_T("<Window size=\"%d,%d\" bktrans=\"true\">"));
        xml.Append(_T(" <Container />"));
        xml.Append(_T("</Window>"));
        xml.Format(xml.GetData(), m_pShadowUI->GetFixedWidth(), m_pShadowUI->GetFixedHeight());

        m_pManager->Init(m_hWnd);

        CDialogBuilder builder;
        CControlUI* pRoot = builder.Create((LPCTSTR)xml, (UINT)0, NULL, m_pManager);
        if (pRoot == NULL)
        {
            MessageBox(m_hWnd, _T("加载资源文件失败"), _T("错误"), MB_OK | MB_ICONERROR);
            ExitProcess(1);
            return 0;
        }

        m_pManager->AttachDialog(pRoot);

        // 为主窗口设置一个属性,内容为阴影窗口的指针,然后子类化主窗口
        ::SetProp(m_hWndOwner, SHADOW_WINDOW_PROP, (HANDLE) this);
        m_pOldOwnerProc = (WNDPROC) ::SetWindowLongPtr(m_hWndOwner, GWL_WNDPROC, (LONG) OwnerProc);
        return 0;
    }
Example #7
0
void SessionLayout::_AddGroupMemberToList(IN const std::string& sID)
{
	module::UserInfoEntity userInfo;
	if (!module::getUserListModule()->getUserInfoBySId(sID, userInfo))
	{
		APP_LOG(LOG_ERROR, _T("SessionLayout::_updateGroupMembersList(),can't find the userInfo"));
		return;
	}
	CDialogBuilder dlgBuilder;
	CListContainerElementUI* pListElement = (CListContainerElementUI*)dlgBuilder.Create(_T("SessionDialog\\groupMembersListItem.xml"), (UINT)0, NULL, &m_paint_manager);
	if (!pListElement)
	{
		APP_LOG(LOG_ERROR, _T("群item创建失败"));
		return;
	}
	CButtonUI* pLogo = static_cast<CButtonUI*>(pListElement->FindSubControl(_T("AvatarInfo")));
	if (!pLogo)
	{
		return;
	}
	pLogo->SetBkImage(util::stringToCString(userInfo.getAvatarPath()));

	CLabelUI* pNameLable = static_cast<CLabelUI*>(pListElement->FindSubControl(_T("nickname")));
	if (!pNameLable)
	{
		return;
	}
	pNameLable->SetText(userInfo.getRealName());
	pListElement->SetUserData(util::stringToCString(userInfo.sId));

	m_pGroupMemberList->Add(pListElement);

}
Example #8
0
LRESULT CToolbarBottom::HandleMessage(UINT uMsg, WPARAM wParam, LPARAM lParam)
{
	LRESULT lRes = 0;
	BOOL bHandled = TRUE;

	if( uMsg == WM_CREATE ) 
	{
		m_PaintManager.Init(m_hWnd);

		CDialogBuilder builder;
		STRINGorID xml(GetSkinRes());
		CControlUI* pRoot = builder.Create(xml, _T("xml"), 0, &m_PaintManager);
		ASSERT(pRoot && "Failed to parse XML");

		m_PaintManager.AttachDialog(pRoot);
		m_PaintManager.AddNotifier(this);
		InitWindow(); 
		return lRes;
	}

	if( m_PaintManager.MessageHandler(uMsg, wParam, lParam, lRes) ) 
	{
		return lRes;
	}

	return __super::HandleMessage(uMsg, wParam, lParam);
}
Example #9
0
File: App.cpp Project: wyrover/GDES
    LRESULT HandleMessage(UINT uMsg, WPARAM wParam, LPARAM lParam)
    {
		LRESULT lRes = 0;
		BOOL bHandled = FALSE;

        if( uMsg == WM_CREATE ) {
            m_pm.Init(m_hWnd);
            CDialogBuilder builder;
            CControlUI* pRoot = builder.Create(_T("test1.xml"), (UINT)0, NULL, &m_pm);
            ASSERT(pRoot && "Failed to parse XML");
            m_pm.AttachDialog(pRoot);
            m_pm.AddNotifier(this);
            Init();
            return 0;
        }
        else if( uMsg == WM_DESTROY ) {
            ::PostQuitMessage(0L);
        }
        else if( uMsg == WM_ERASEBKGND ) {
            return 1;
        }
		else if( uMsg == WM_CLOSE) {
			lRes = OnClose(uMsg, wParam, lParam, bHandled);
		}
		else if(uMsg == WM_SYSCOMMAND) {
			lRes = OnSysCommand(uMsg, wParam, lParam, bHandled); 
		}

		if( bHandled ) return lRes;
        if( m_pm.MessageHandler(uMsg, wParam, lParam, lRes) ) return lRes;
        return CWindowWnd::HandleMessage(uMsg, wParam, lParam);
    }
Example #10
0
bool PopupMenu::AddMenuItem(std::wstring menu_item_title, int menu_item_tag, bool enable, bool checked, bool add_seperate, const std::wstring& icon)
{
	CListUI* menu_list = static_cast<CListUI*>(paint_manager_.FindControl(kMenuList));
	if (menu_list != NULL)
	{
		CDialogBuilder builder;
		CListContainerElementUI* menu_item = static_cast<CListContainerElementUI*>(builder.Create(kMenuItemSkin, (UINT)0, NULL, &paint_manager_));
		if (menu_item != NULL)
		{
			menu_item_tags_.push_back(menu_item_tag);

			CLabelUI* item_title = static_cast<CLabelUI*>(paint_manager_.FindSubControlByName(menu_item, kMenuItemTitleName));
			CControlUI* item_image = paint_manager_.FindSubControlByName(menu_item, kMenuItemImageName);
			CControlUI* underline = paint_manager_.FindSubControlByName(menu_item, kMenuItemUnderlineName);
			if ((item_title != NULL) && (item_image != NULL) && (underline != NULL))
			{
				if (checked)
					item_image->SetBkImage(kMenuCheckPngName);
				else if (!icon.empty())
					item_image->SetBkImage(icon.c_str());

				underline->SetVisible(add_seperate);

				item_title->SetText(menu_item_title.c_str());
				item_title->SetEnabled(enable);
			}

			menu_item->SetVisible(true);
			menu_list->Add(menu_item);

			return true;
		}
	}
	return false;
}
Example #11
0
CProjectInfoPage::CProjectInfoPage(DuiLib::CPaintManagerUI* ppm)
:m_pListProjs(NULL)
,m_pProjProcessor(NULL)
//,m_pAddGroupMemWnd(NULL)
,m_pBtnPrevPage(NULL)
,m_pBtnNextPage(NULL)
,m_pBtnEndPage(NULL)
,m_nCurrentPageIndex(-1)
,m_nEndPageIndex(-1)
{
	m_PaintManager = ppm;

	CDialogBuilder DlgBuilder;
	CVerticalLayoutUI *pProjectPage = NULL;
	CDialogBuilderCallbackEx cb(m_PaintManager);
	if (!DlgBuilder.GetMarkup()->IsValid())
	{
		pProjectPage = static_cast<CVerticalLayoutUI*>(DlgBuilder.Create(_T("tab_project_page.xml"),
			(UINT)0, &cb, m_PaintManager));
	}
	else
	{
		pProjectPage = static_cast<CVerticalLayoutUI*>(DlgBuilder.Create((UINT)0, m_PaintManager));
	}
	static_cast<CTabLayoutUI*>(ppm->FindControl("SidebarTabContainer"))->Add(pProjectPage);	

	m_PaintManager->AddNotifier(this);
}
Example #12
0
	LRESULT HandleMessage(UINT uMsg, WPARAM wParam, LPARAM lParam)
	{
		switch(uMsg)
		{
		case WM_KEYDOWN:
			{
				int nVirtKey = (int) wParam;
				if(VK_ESCAPE == nVirtKey)
				{
					::PostQuitMessage(0);
				}
			} 
			break;
		case WM_CREATE:
			{
				m_PaintMgr.Init(m_hWnd); 
				//从xml中加载界面
				CDialogBuilder builder;
				m_pRoot = builder.Create(L"tutorial3.xml",(UINT)0,NULL,&m_PaintMgr);

				m_PaintMgr.AttachDialog(m_pRoot); 
				m_PaintMgr.AddNotifier(this);
			}
			break;  
		case WM_DESTROY:
			::PostQuitMessage(0);
			break;
		} 
		LRESULT lRes=0;
		if(m_PaintMgr.MessageHandler(uMsg,wParam,lParam,lRes)) return lRes;
		return CWindowWnd::HandleMessage(uMsg,wParam,lParam);
	}
Example #13
0
LRESULT WindowImplBase::OnCreate(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled)
{
	LONG styleValue = ::GetWindowLong(*this, GWL_STYLE);
	styleValue &= ~WS_CAPTION;
	::SetWindowLong(*this, GWL_STYLE, styleValue | WS_CLIPSIBLINGS | WS_CLIPCHILDREN);

	RECT rcClient;
	::GetClientRect(*this, &rcClient);
	::SetWindowPos(*this, NULL, rcClient.left, rcClient.top, rcClient.right - rcClient.left, \
		rcClient.bottom - rcClient.top, SWP_FRAMECHANGED);

	m_PaintManager.Init(m_hWnd);
	m_PaintManager.AddPreMessageFilter(this);

	CDialogBuilder builder;

	CControlUI* pRoot=NULL;
	pRoot = builder.Create(GetSkinFile().GetData(), (UINT)0, this, &m_PaintManager);
	ASSERT(pRoot);
	if (pRoot==NULL)
	{
		MessageBox(NULL,_T("加载资源文件失败"),_T("Duilib"),MB_OK|MB_ICONERROR);
		ExitProcess(1);
		return 0;
	}
	m_PaintManager.AttachDialog(pRoot);
	m_PaintManager.AddNotifier(this);

	InitWindow();
	return 0;
}
Example #14
0
	LRESULT OnCreate(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled)
	{
		LONG styleValue = ::GetWindowLong(*this, GWL_STYLE);
		styleValue &= ~WS_CAPTION;
		::SetWindowLong(*this, GWL_STYLE, styleValue | WS_CLIPSIBLINGS | WS_CLIPCHILDREN);
		RECT rcClient;
		::GetClientRect(*this, &rcClient);
		::SetWindowPos(*this, NULL, rcClient.left, rcClient.top, rcClient.right - rcClient.left, \
			rcClient.bottom - rcClient.top, SWP_FRAMECHANGED);

		m_pm.Init(m_hWnd);
		CDialogBuilder builder;

		tString tstrSkin = CPaintManagerUI::GetInstancePath() + _T("skins\\TestSkin\\");
		m_pm.SetResourcePath(tstrSkin.c_str());

		tstrSkin = m_pm.GetResourcePath() + _T("test1.xml");
		CControlUI* pRoot = builder.Create(tstrSkin.c_str(), (UINT)0, this, &m_pm);		
		ASSERT(pRoot && _T("Failed to parse XML"));
		m_pm.AttachDialog(pRoot);
		m_pm.AddNotifier(this);

		Init();
		return 0;
	}
Example #15
0
LRESULT CMainFrame::OnCreate(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled){
	m_pm.Init(m_hWnd);//主窗口类与窗口句柄关联
	CDialogBuilder builder;
#ifdef _DEBUG
	CControlUI* pRoot = builder.Create(_T("UISkin.xml"), (UINT)0, NULL, &m_pm);//加载XML并动态创建界面无素,与布局界面元素,核心函数单独分析
#else
	CControlUI* pRoot = builder.Create((STRINGorID)MAKEINTRESOURCE(IDR_SKIN_XML), _T("DATA"), NULL, &m_pm);//加载XML并动态创建界面无素,与布局界面元素,核心函数单独分析
#endif
	//注意:CDialogBuilder 并不是一个对话框类
	ASSERT(pRoot && "Failed to parse XML");
	if (NULL==pRoot)//如果找不到皮肤文件则退出
	{
		MessageBox(NULL,TEXT("Cant not find the skin!"),NULL,MB_ICONHAND);
		return 0;
	}
	m_pm.AttachDialog(pRoot);//附加控件数据到HASH表中……为pRoot作为对话框结点,为其创建控件树	
	m_pm.AddNotifier(this);//增加通知处理

 	LONG styleValue = ::GetWindowLong(*this, GWL_STYLE);
 	styleValue &= ~WS_CAPTION;
 	styleValue &= ~WS_THICKFRAME; 
 	::SetWindowLong(*this, GWL_STYLE, styleValue | WS_CLIPSIBLINGS | WS_CLIPCHILDREN);
	
	if(m_pBackWnd){
		m_pBackWnd->AttachWindow(m_hWnd);//必须要让背景与当前要作为背景的窗口绑定起来
		DWORD oldLong = ::GetWindowLong(m_pBackWnd->GetHandle(), GWL_STYLE);
		::SetWindowLong(m_pBackWnd->GetHandle(), GWL_STYLE, oldLong | WS_MINIMIZEBOX);
	}

	m_gaThread.Resume();	//开始统计线程
	return 0;
}
Example #16
0
LRESULT CEICFrameWindow::OnCreate(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled)
{
	SetIcon(IDR_MAINFRAME);
	LONG styleValue = ::GetWindowLong(*this, GWL_STYLE);
	styleValue &= ~WS_CAPTION;
	::SetWindowLong(*this, GWL_STYLE, styleValue | WS_CLIPSIBLINGS | WS_CLIPCHILDREN);
	RECT rcClient;
	::GetClientRect(*this, &rcClient);
	::SetWindowPos(*this, NULL, rcClient.left, rcClient.top, rcClient.right - rcClient.left,rcClient.bottom - rcClient.top, SWP_FRAMECHANGED);

	m_pm.Init(m_hWnd);

	//////////////////////////////////////////////////////////////////////////
	CDialogBuilder builder;
	CDialogBuilderCallbackEx cb;

	tString tstrSkin = CPaintManagerUI::GetInstancePath() + _T("skins\\EIC_Skin\\");
	m_pm.SetResourcePath(tstrSkin.c_str());

	CControlUI* pRoot = builder.Create(_T("mainui.xml"),(UINT)0,  &cb, &m_pm);
	ASSERT(pRoot && "Failed to parse XML");
	m_pm.AttachDialog(pRoot);
	m_pm.AddNotifier(this);

	SIZE szInitWindowSize = m_pm.GetInitSize();
	if( szInitWindowSize.cx != 0 ) 
	{
		::SetWindowPos(*this, NULL, 0, 0, szInitWindowSize.cx, szInitWindowSize.cy, SWP_NOZORDER | SWP_NOMOVE);
	}
	//////////////////////////////////////////////////////////////////////////

	Init();
	return 0;
}
Example #17
0
CControlUI* CDuiFrameWnd::CreateControl( LPCTSTR pstrClassName )
{
    CDuiString     strXML;
    CDialogBuilder builder;

    if (_tcsicmp(pstrClassName, _T("Caption")) == 0)
    {
        strXML = _T("Caption.xml");
    }
    else if (_tcsicmp(pstrClassName, _T("PlayPanel")) == 0)
    {
        strXML = _T("PlayPanel.xml");
    }
    else if (_tcsicmp(pstrClassName, _T("Playlist")) == 0)
    {
        strXML = _T("Playlist.xml");
    }
    else if (_tcsicmp(pstrClassName, _T("WndMediaDisplay")) == 0)
    {
        CWndUI *pUI = new CWndUI;   
        HWND   hWnd = CreateWindow(_T("#32770"), _T("WndMediaDisplay"), WS_VISIBLE | WS_CHILD, 0, 0, 0, 0, m_PaintManager.GetPaintWindow(), (HMENU)0, NULL, NULL);
        pUI->Attach(hWnd);  
        return pUI;
    }

    if (! strXML.IsEmpty())
    {
        CControlUI* pUI = builder.Create(strXML.GetData(), NULL, NULL, &m_PaintManager, NULL); // 这里必须传入m_PaintManager,不然子XML不能使用默认滚动条等信息。
        return pUI;
    }

    return NULL;
}
Example #18
0
YPlayListItemUI::YPlayListItemUI()
{
	this->SetFixedHeight(ListItemHeight);
	CDialogBuilder builder;
	builder.Create(_T("play-list-item.xml"),0,NULL,NULL,this);

	InitVar();
}
CSysSkinLayoutUI::CSysSkinLayoutUI()
{
	this->SetFixedHeight(100);
	CDialogBuilder builder;
	builder.Create(_T("SysSkinLayout.xml"),0,NULL,NULL,this);
	_ImageCount = 0;
	Init();
}
Example #20
0
YSongListItemUI::YSongListItemUI(CPaintManagerUI* pManager)
{
	this->SetManager(pManager, this);
	this->SetFixedHeight(SongItemHeight);
	CDialogBuilder builder;
	builder.Create(_T("song-list-item.xml"), 0, NULL, pManager, this);

	InitVar();
}
Example #21
0
	LRESULT CMenuWnd::OnCreate(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled)
	{
		if( m_pOwner != NULL) {
			LONG styleValue = ::GetWindowLong(*this, GWL_STYLE);
			styleValue &= ~WS_CAPTION;
			::SetWindowLong(*this, GWL_STYLE, styleValue | WS_CLIPSIBLINGS | WS_CLIPCHILDREN);
			RECT rcClient;
			::GetClientRect(*this, &rcClient);
			::SetWindowPos(*this, NULL, rcClient.left, rcClient.top, rcClient.right - rcClient.left, \
				rcClient.bottom - rcClient.top, SWP_FRAMECHANGED);

			m_pm.Init(m_hWnd);
			// The trick is to add the items to the new container. Their owner gets
			// reassigned by this operation - which is why it is important to reassign
			// the items back to the righfull owner/manager when the window closes.
			m_pLayout = new CMenuUI();
			m_pm.SetForceUseSharedRes(true);
			m_pLayout->SetManager(&m_pm, NULL, true);
			LPCTSTR pDefaultAttributes = m_pOwner->GetManager()->GetDefaultAttributeList(_T("Menu"));
			if( pDefaultAttributes ) {
				m_pLayout->ApplyAttributeList(pDefaultAttributes);
			}
			m_pLayout->SetAutoDestroy(false);

			for( int i = 0; i < m_pOwner->GetCount(); i++ ) {
				if(m_pOwner->GetItemAt(i)->GetInterface(_T("MenuElement")) != NULL ){
					(static_cast<CMenuElementUI*>(m_pOwner->GetItemAt(i)))->SetOwner(m_pLayout);
					m_pLayout->Add(static_cast<CControlUI*>(m_pOwner->GetItemAt(i)));
				}
			}

			CShadowUI *pShadow = m_pOwner->GetManager()->GetShadow();
			pShadow->CopyShadow(m_pm.GetShadow());
			pShadow->ShowShadow(false);

			m_pm.AttachDialog(m_pLayout);
			m_pm.AddNotifier(this);

			ResizeSubMenu();
		}
		else {
			m_pm.Init(m_hWnd);

			CDialogBuilder builder;

			CControlUI* pRoot = builder.Create(m_xml,UINT(0), this, &m_pm);
			m_pm.GetShadow()->ShowShadow(false);
			m_pm.AttachDialog(pRoot);
			m_pm.AddNotifier(this);

			ResizeMenu();
		}

		m_pm.GetShadow()->ShowShadow(true);
		m_pm.GetShadow()->Create(&m_pm);
		return 0;
	}
Example #22
0
	virtual CControlUI* CreateControl(LPCTSTR pstrClass)
	{
		if (_tcsicmp(pstrClass, _T("Window2")) == 0)
		{
			CDialogBuilder builderManualOpera;
			CControlUI* ptemp = builderManualOpera.Create(_T("Window2.xml"),NULL,NULL,NULL,NULL);
			return ptemp;
		}

		return NULL;
	};
Example #23
0
CButtonTab::CButtonTab(CPaintManagerUI* ppm)
{
	CDialogBuilder builder;
	CContainerUI* pbtnTab = static_cast<CContainerUI*>(builder.Create(_T("Button.xml"), 0, NULL, ppm));
	if( pbtnTab ) {
		this->Add(pbtnTab);
	}
	else {
		this->RemoveAll();
		return;
	}
}
Example #24
0
RedisInfoUI::RedisInfoUI( const CDuiString& strXML, CPaintManagerUI* pm ):AbstraceUI(pm),m_bIsRefresh(false)
{
    CDialogBuilder builder;
    CControlUI* pContainer = builder.Create(strXML.GetData(), NULL, NULL, GetPaintMgr(), NULL); // 这里必须传入m_PaintManager,不然子XML不能使用默认滚动条等信息。
    if( pContainer ) {
        this->Add(pContainer);
    }
    else {
        this->RemoveAll();
        return;
    }
}
Example #25
0
CTreeTab::CTreeTab(CPaintManagerUI* ppm)
{
	CDialogBuilder builder;
	CDialogBuilderCallbackEx cb (ppm);
	CContainerUI* pbtnTab = static_cast<CContainerUI*>(builder.Create(_T("tree.xml"), 0, &cb, ppm));
	if( pbtnTab ) {
		this->Add(pbtnTab);
	}
	else {
		this->RemoveAll();
		return;
	}

	CDuiTreeView* pTree1 = static_cast<CDuiTreeView*>(pbtnTab->FindSubControl(_T("Tree1")));
	pTree1->OnNotify += MakeDelegate(this,&CTreeTab::OnFolderChanged);
	if (pTree1) {
		pTree1->SetDepth(4);
		pTree1->SetExpandImage(_T("tree_expand.png"));
		CDuiTreeView::Node* pCategoryNode = NULL;
		CDuiTreeView::Node* pGameNode = NULL;
		CDuiTreeView::Node* pServerNode = NULL;
		CDuiTreeView::Node* pRoomNode = NULL;
		pCategoryNode = pTree1->AddNode(_T("{x 4}{i gameicons.png 18 3}{x 4}ÍƼöÓÎÏ·"));
		for (int i = 0; i < 4; ++i)
		{
			pGameNode = pTree1->AddNode(_T("{x 4}{i gameicons.png 18 10}{x 4}ËÄÈ˶·µØÖ÷"), pCategoryNode);
			for (int i = 0; i < 3; ++i)
			{
				pServerNode = pTree1->AddNode(_T("{x 4}{i gameicons.png 18 10}{x 4}²âÊÔ·þÎñÆ÷"), pGameNode);
				for (int i = 0; i < 3; ++i)
				{
					pRoomNode = pTree1->AddNode(_T("{x 4}{i gameicons.png 18 10}{x 4}²âÊÔ·¿¼ä"), pServerNode);
				}
			}
		}
		pCategoryNode = pTree1->AddNode(_T("{x 4}{i gameicons.png 18 3}{x 4}×î½üÍæ¹ýµÄÓÎÏ·"));
		for (int i = 0; i < 2; ++i)
		{
			pTree1->AddNode(_T("Èýȱһ"), pCategoryNode);
		}
		pCategoryNode = pTree1->AddNode(_T("{x 4}{i gameicons.png 18 3}{x 4}ÆåÅÆÓÎÏ·"));
		for (int i = 0; i < 8; ++i)
		{
			pTree1->AddNode(_T("Ë«¿Û"), pCategoryNode);
		}
		pCategoryNode = pTree1->AddNode(_T("{x 4}{i gameicons.png 18 3}{x 4}ÐÝÏÐÓÎÏ·"));
		for (int i = 0; i < 8; ++i)
		{
			pTree1->AddNode(_T("·ÉÐÐÆå"), pCategoryNode);
		}
	}
}
Example #26
0
void CChildLayoutUI::Init()
{
    if (!m_pstrXMLFile.IsEmpty()) {
        CDialogBuilder builder;
        CContainerUI* pChildWindow = static_cast<CContainerUI*>(builder.Create(m_pstrXMLFile.GetData(), (UINT)0, NULL, m_pManager));

        if (pChildWindow) {
            this->Add(pChildWindow);
        } else {
            this->RemoveAll();
        }
    }
}
LRESULT WindowImplBase::OnCreate(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled)
{
	::SetWindowLong(*this, GWL_STYLE, GetStyle() | WS_CLIPSIBLINGS | WS_CLIPCHILDREN);
	RECT rcClient;
	::GetClientRect(*this, &rcClient);
	::SetWindowPos(*this, NULL, rcClient.left, rcClient.top, rcClient.right - rcClient.left, \
		rcClient.bottom - rcClient.top, SWP_FRAMECHANGED);

	paint_manager_.Init(m_hWnd);
	paint_manager_.AddPreMessageFilter(this);

	CDialogBuilder builder;

	paint_manager_.SetResourcePath(GetSkinFolder().c_str());

	CControlUI* pRoot = NULL;
#if USE(EMBEDED_RESOURCE)
	STRINGorID xml(_ttoi(GetSkinFile().c_str()));
	pRoot = builder.Create(xml, _T("xml"), this, &paint_manager_);
#else
#if USE(ZIP_SKIN)

#if defined(UNDER_CE)
	static bool resource_unzipped = false;
	if (!resource_unzipped)
	{
		resource_unzipped = true;
		paint_manager_.SetResourceZip(kResourceSkinZipFileName);
		paint_manager_.UnzipResource();
		paint_manager_.SetResourceZip(_T(""));
	}
	tString tstrSkin = paint_manager_.GetResourcePath();
	tstrSkin += GetSkinFile();
#else
	paint_manager_.SetResourceZip(kResourceSkinZipFileName);
	tString tstrSkin = GetSkinFile();
#endif

#else
	// DuiLib中用的是相对路径,绝对路径会出错,最好能够内部判断一下。
	//tString tstrSkin = paint_manager_.GetResourcePath();
	tString tstrSkin = GetSkinFile();
#endif
	pRoot = builder.Create(tstrSkin.c_str(), (UINT)0, this, &paint_manager_);
#endif
	paint_manager_.AttachDialog(pRoot);
	paint_manager_.AddNotifier(this);

	Init();
	return 0;
}
Example #28
0
RedisHelpUI::RedisHelpUI(const CDuiString& strXML, CPaintManagerUI* pm, Environment* env) : AbstraceUI(pm, env)
{
    CDialogBuilder builder;
    /// 这里必须传入m_PaintManager,不然子XML不能使用默认滚动条等信息。
    CControlUI* pContainer = builder.Create(strXML.GetData(), NULL, NULL, GetPaintMgr(), NULL); 
    if (pContainer) 
    {
        this->Add(pContainer);
    }
    else {
        this->RemoveAll();
        return;
    }
}
Example #29
0
CFuturesPastOrderUI::CFuturesPastOrderUI(const CDuiString& strXML,CPaintManagerUI* pm):CAbstractUI(pm)
{
    CDialogBuilder builder;
    CControlUI* pContainer = builder.Create(strXML.GetData(), NULL, NULL, GetPaintMgr(), NULL); 
    if( pContainer ) 
	{
        this->Add(pContainer);
    }
    else 
	{
        this->RemoveAll();
        return;
    }
}
Example #30
0
CTabRecentChat::CTabRecentChat(CPaintManagerUI* ppm)
{
	CDialogBuilder builder;
	CContainerUI* pTabRecentChat = static_cast<CContainerUI*>(builder.Create(_T("tab_recent_new.xml"), 0, NULL, ppm));
	if (NULL != pTabRecentChat)
	{
		this->Add(pTabRecentChat);
	}
	else
	{
		this->RemoveAll();
		return;
	}
}