Example #1
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 #2
0
void CFileUtil::OpenDir(HWND hwndOwner,CDuiString path,CDuiString fileName)
{
	CDuiString str;
	str.Format(L"/select,%s",path);
	str.Append(L"\\");
	str.Append(fileName);
	ShellExecute(hwndOwner,_T("open"),_T("Explorer.exe"),str,NULL,SW_SHOWNORMAL);
}
Example #3
0
	CDuiString CDuiString::operator+(LPCTSTR lpStr) const
	{
		ASSERT(!::IsBadStringPtr(lpStr,-1));
		CDuiString sTemp = *this;
		sTemp.Append(lpStr);
		return sTemp;
	}
void RedisConfigUI::DoApplyData()
{
	CEditUI exampleEditUI;
	CComboUI exampleComboUI;

	RedisClient::TDicConfig::const_iterator it = m_dicConfig.begin();
	RedisClient::TDicConfig::const_iterator itend = m_dicConfig.end();
	RedisClient::TDicConfig config;
	for ( ; it!=itend; ++it)
	{
		CDuiString name = _T("redisconfig_");
		CDuiString key = CharacterSet::ANSIToUnicode(it->first).c_str();	
		name.Append(key);
		CControlUI* pCtl = GetPaintMgr()->FindControl(name);

		string val ;
		if (pCtl->GetClass() == exampleEditUI.GetClass())
		{
			CEditUI* pEdit = static_cast<CEditUI*> (pCtl);
			val = CharacterSet::UnicodeToANSI(pEdit->GetText().GetData());
		}
		else if (pCtl->GetClass() == exampleComboUI.GetClass())
		{
			CComboUI* pCombo = static_cast<CComboUI*> (pCtl);
			int idx = pCombo->GetCurSel();
			if (it->first == "loglevel")
			{
				if (idx == 0) val = "debug";
				else if (idx == 1) val = "verbose";
				else if (idx == 2) val = "notice";
				else if (idx == 3) val = "warning";
			}
			else 
			{
				if (idx == 0) val = "yes";
				else if (idx == 1) val = "no";
			}
		}
		if (val != it->second)
		{
			config.insert(std::make_pair(it->first, val));
		}
	}
	if (SetConfig(config) && GetConfig())
	{
		DoFillData();
	}
}
Example #5
0
LPCTSTR ConnInfoUI::GetItemText( CControlUI* pControl, int iIndex, int iSubItem )
{
    const std::string& str = m_dicServerInfo[iSubItem][iIndex];
    
    if (iSubItem == 3 && !str.empty()) {
        CDuiString authStr;
        for (std::size_t idx=0; idx<str.size(); ++idx) 
        {
            authStr.Append(_T("*"));
        }
        pControl->SetUserData(authStr.GetData());
    } else {
        pControl->SetUserData(Base::CharacterSet::ANSIToUnicode(str).c_str());
    }
    
    return pControl->GetUserData();
}
Example #6
0
void RedisConfigUI::DoFillData()
{
    CEditUI exampleEditUI;
    CComboUI exampleComboUI;

    RedisClient::TDicConfig::const_iterator it = m_dicConfig.begin();
    RedisClient::TDicConfig::const_iterator itend = m_dicConfig.end();

    for ( ; it!=itend; ++it)
    {
        CDuiString name = _T("redisconfig_");
        CDuiString key = Base::CharacterSet::ANSIToUnicode(it->first).c_str();
        CDuiString val = Base::CharacterSet::ANSIToUnicode(it->second).c_str();
        name.Append(key);
        CControlUI* pCtl = GetPaintMgr()->FindControl(name);

        /// xml中未配置该项
        if (pCtl == NULL) continue;

        if (pCtl->GetClass() == exampleEditUI.GetClass())
        {
            CEditUI* pEdit = static_cast<CEditUI*> (pCtl);
            pEdit->SetText(val);
        }
        else if (pCtl->GetClass() == exampleComboUI.GetClass())
        {
            CComboUI* pCombo = static_cast<CComboUI*> (pCtl);
            int idx = 0;
            if (val == _T("yes")) idx = 0;
            else if (val == _T("no")) idx = 1;
            else if (it->first == "loglevel")
            {
                string loglevel = it->second;
                if (loglevel == "debug") idx = 0;
                else if (loglevel == "verbose") idx = 1;
                else if (loglevel == "notice") idx = 2;
                else if (loglevel == "warning") idx = 3;
            }
            pCombo->SetInternVisible(true);
            pCombo->SelectItem(idx);
            pCombo->SetFocus();
        }
    }
}
Example #7
0
	CDuiString CDuiString::operator+(const CDuiString& src) const
	{
		CDuiString sTemp = *this;
		sTemp.Append(src);
		return sTemp;
	}