本文整理汇总了C++中CDialogBuilder::Create方法的典型用法代码示例。如果您正苦于以下问题:C++ CDialogBuilder::Create方法的具体用法?C++ CDialogBuilder::Create怎么用?C++ CDialogBuilder::Create使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CDialogBuilder
的用法示例。
在下文中一共展示了CDialogBuilder::Create方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: OnCreate
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;
}
示例2: cb
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);
}
示例3: OnCreate
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;
}
示例4: CreateControl
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;
}
示例5: InitWindow
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)
{
}
}
示例6: OnCreate
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;
}
示例7: HandleMessage
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);
}
示例8: OnCreate
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;
}
示例9: _AddGroupMemberToList
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);
}
示例10: _AddGroupMemberToList
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);
}
示例11: HandleMessage
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);
}
示例12: AddMenuItem
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;
}
示例13: HandleMessage
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);
}
示例14: GetSystemMenu
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;
}
示例15: OnCreate
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;
}