本文整理汇总了C++中COptionUI类的典型用法代码示例。如果您正苦于以下问题:C++ COptionUI类的具体用法?C++ COptionUI怎么用?C++ COptionUI使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了COptionUI类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: Selected
void COptionUI::Selected(bool bSelected, bool bTriggerEvent)
{
if( m_bSelected == bSelected ) return;
m_bSelected = bSelected;
if( m_bSelected ) m_uButtonState |= UISTATE_SELECTED;
else m_uButtonState &= ~UISTATE_SELECTED;
if( m_pManager != NULL ) {
if( !m_sGroupName.IsEmpty() ) {
if( m_bSelected ) {
CStdPtrArray* aOptionGroup = m_pManager->GetOptionGroup(m_sGroupName);
for( int i = 0; i < aOptionGroup->GetSize(); i++ ) {
COptionUI* pControl = static_cast<COptionUI*>(aOptionGroup->GetAt(i));
if( pControl != this ) {
pControl->Selected(false, bTriggerEvent);
}
}
if (bTriggerEvent) m_pManager->SendNotify(this, DUI_MSGTYPE_SELECTCHANGED);
}
}
else {
if (bTriggerEvent) m_pManager->SendNotify(this, DUI_MSGTYPE_SELECTCHANGED);
}
}
Invalidate();
}
示例2: if
void CLoginWnd::Notify(TNotifyUI& msg)
{
if (msg.sType ==DUI_MSGTYPE_CLICK)
{
CDuiString str = msg.pSender->GetName();
if ( str == _T("configbtn"))
{
CConfigWnd* pConfig = new CConfigWnd;
pConfig->Create(NULL,_T("服务器配置"),UI_WNDSTYLE_FRAME,WS_EX_WINDOWEDGE);
pConfig->CenterWindow();
pConfig->ShowModal();
delete pConfig;
}
else if ( str == _T("login"))
{
Login();
}
}
if (msg.sType == DUI_MSGTYPE_SELECTCHANGED)
{
if (msg.pSender->GetName()==_T("autolog"))
{
COptionUI* pLeft = static_cast<COptionUI*>(m_PaintManager.FindControl(_T("remember")));
COptionUI* pRight = static_cast<COptionUI*>(m_PaintManager.FindControl(_T("autolog")));
if (!pLeft->IsSelected())
{
pLeft->Selected(true);
}
}
}
return WindowImplBase::Notify(msg);
}
示例3: SelectAll
void CVisitor::SelectAll(bool flag)
{
int num = m_pList->GetCount();
for (int i=0;i<num;++i)
{
CListContainerElementUI* pContainer = static_cast<CListContainerElementUI*>(m_pList->GetItemAt(i));
COptionUI* pOpt = static_cast<COptionUI*>(m_pManager->FindSubControlByName(pContainer,_T("selectall")));
pOpt->Selected(flag);
}
}
示例4: GetData
void CLoginWnd::GetData()
{
CEditUI* pAccount = static_cast<CEditUI*>(m_PaintManager.FindControl(_T("account")));
m_strAccount = pAccount->GetText();
CEditUI* pWord = static_cast<CEditUI*>(m_PaintManager.FindControl(_T("password")));
m_strPassWord = pWord->GetText();
COptionUI* pLeft = static_cast<COptionUI*>(m_PaintManager.FindControl(_T("remember")));
m_IsLeftSelected = pLeft->IsSelected();
COptionUI* pRight = static_cast<COptionUI*>(m_PaintManager.FindControl(_T("autolog")));
m_IsRightSeleced = pRight->IsSelected();
}
示例5: if
void CMainWnd::Notify( TNotifyUI &msg )
{
if(msg.sType.CompareNoCase(DUI_MSGTYPE_SCROLL) == 0)
{
CVerticalLayoutUI* pTabPanel = (CVerticalLayoutUI*)msg.pSender;
CString sName = msg.pSender->GetName();
int nPage = (int)msg.wParam;
CString sTabPanel = sName;
int nIdx = sTabPanel.Find(_T("@"));
if(nIdx == -1) return;
CString sType = sTabPanel.Mid(nIdx + 1);
if(nPage < 1) nPage = 1;
if(nPage > 200) nPage = 200;
int nScrollPos = (nPage - 1) * pTabPanel->GetVerticalScrollBar()->GetLineSize();
SIZE szSize = {0, nScrollPos};
pTabPanel->SetScrollPos(szSize, false);
m_Data.LoadBizhi(sType, nPage, 10);
}
else if(msg.sType.CompareNoCase(DUI_MSGTYPE_SELECTCHANGED) == 0)
{
COptionUI* pTabBtn = (COptionUI*)msg.pSender;
CTabLayoutUI* pTabLayout = (CTabLayoutUI*)m_PaintManager.FindControl(_T("wp_tablayout"));
CString sName = pTabBtn->GetName();
if(sName == _T("wp_tabbtn") && pTabLayout)
{
CString sType = pTabBtn->GetUserData();
CString sTabPanel;
sTabPanel.Format(_T("[email protected]%s"), sType);
CVerticalLayoutUI* pTabPanel = (CVerticalLayoutUI*)m_PaintManager.FindControl(sTabPanel);
if(pTabPanel == NULL)
{
m_Data.LoadBizhi(sType, 1, 10);
}
else
{
pTabLayout->SelectItem(pTabPanel);
}
}
}
else if(msg.sType.CompareNoCase(DUI_MSGTYPE_CLICK_WPFAV) == 0)
{
MessageBox(NULL, _T("收藏成功"), _T("百度壁纸 - 提示"), MB_OK);
}
else if(msg.sType.CompareNoCase(DUI_MSGTYPE_CLICK_WPSET) == 0)
{
CWPButton* pWPBtn = (CWPButton*)msg.pSender;
pWPBtn->SetWP();
}
return WindowImplBase::Notify(msg);
}
示例6: InitWindow
void CLoginWnd::InitWindow()
{
COptionUI* pLeft = static_cast<COptionUI*>(m_PaintManager.FindControl(_T("remember")));
COptionUI* pRight = static_cast<COptionUI*>(m_PaintManager.FindControl(_T("autolog")));
CEditUI* pName = static_cast<CEditUI*>(m_PaintManager.FindControl(_T("account")));
CEditUI* pPassWord = static_cast<CEditUI*>(m_PaintManager.FindControl(_T("password")));
HANDLE hFile = CreateFile(L"..\\logstate.dat",GENERIC_WRITE|GENERIC_READ,FILE_SHARE_READ|FILE_SHARE_WRITE,NULL,OPEN_EXISTING,0,NULL);
if (hFile == INVALID_HANDLE_VALUE)
{
return;
}
char account[128];
memset(account,0,sizeof(account));
char password[128];
memset(password,0,sizeof(password));
char left[32];
memset(left,0,sizeof(left));
char right[32];
memset(right,0,sizeof(right));
DWORD num = 0;
ReadFile(hFile,account,sizeof(account),&num,NULL);
SetFilePointer(hFile,150,NULL,FILE_BEGIN);
ReadFile(hFile,password,sizeof(password),&num,NULL);
SetFilePointer(hFile,300,NULL,FILE_BEGIN);
ReadFile(hFile,left,sizeof(left),&num,NULL);
SetFilePointer(hFile,350,NULL,FILE_BEGIN);
ReadFile(hFile,right,sizeof(right),&num,NULL);
CloseHandle(hFile);
if (strcmp(left,"yes")==0)
{
pLeft->Selected(true);
WCHAR wAccount[256];
memset(wAccount,0,sizeof(wAccount));
WCHAR wPassword[256];
memset(wPassword,0,sizeof(wPassword));
CCommonConvert::Char2WChar(account,sizeof(account),wAccount);
CCommonConvert::Char2WChar(password,sizeof(password),wPassword);
pName->SetText(wAccount);
pPassWord->SetText(wPassword);
}
if (strcmp(right,"yes")==0)
{
pRight->Selected(true);
Login();
HMODULE hd = ::GetModuleHandle(NULL);
LPTSTR lpFileName = NULL;
::GetModuleFileName(hd,lpFileName,MAX_PATH);
::WritePrivateProfileString(_T("Windows"),_T("load"),lpFileName,_T("c:windows\\win.ini"));
}
}
示例7: DeleteFileItem
void CDuiFrameWnd::DeleteFileItem()
{
COptionUI* pOption = NULL;
CVerticalLayoutUI* pLayout = (CVerticalLayoutUI*)m_PaintManager.FindControl(_T("playlist"));
int nIndex = pLayout->GetCount();
for (int i = 0; i < nIndex;i++)
{
pOption = (COptionUI*)pLayout->GetItemAt(i);
if (pOption->IsSelected())
{
CDuiString strPath = pOption->GetUserData();
m_cPlayList.deleteFile(strPath.GetData());
pLayout->RemoveAt(i);
break;
}
}
}
示例8: EnumPrinters
void MainFrame::EnumInstalledDriver()
{
// 清空界面中list中显示的打印机列表
CContainerUI* pDriverList = static_cast<CContainerUI*>(paint_manager_.FindControl(_T("driver_list")));
if (pDriverList != NULL)
pDriverList->RemoveAll();
// 枚举本地计算机上所有安装的打印机驱动(实际使用时可以只枚举自家的打印机驱动)
LPBYTE lpBuffer = NULL;
DWORD dwNeeded = 0,dwReturned = 0;
EnumPrinters(PRINTER_ENUM_LOCAL, NULL, 1, NULL, 0, &dwNeeded, &dwReturned);
if (dwNeeded == 0)
return;
lpBuffer = (LPBYTE)malloc(dwNeeded);
if (lpBuffer == NULL)
return;
EnumPrinters(PRINTER_ENUM_LOCAL, NULL, 1, lpBuffer, dwNeeded, &dwNeeded, &dwReturned);
for (DWORD dwIndex = 0; (dwIndex < dwReturned) && (pDriverList != NULL); dwIndex++)
{
COptionUI* pDriver = new COptionUI();
if (pDriver != NULL)
{
pDriver->ApplyAttributeList(_T("padding=\"15,0,0,0\" height=\"35\" textpadding=\"20,0,0,0\" align=\"left\" normalimage=\"res='124' restype='png' dest='0,10,15,25'\" hotimage=\"res='125' restype='png' dest='0,10,15,25'\" selectedimage=\"res='126' restype='png' dest='0,10,15,25'\""));
pDriver->SetText(((PRINTER_INFO_1*)lpBuffer + dwIndex)->pName);
pDriverList->Add(pDriver);
}
}
LPTSTR lpDefaultPrinter;
GetDefaultPrinter(NULL, &dwNeeded);
lpDefaultPrinter = (LPTSTR)malloc(dwNeeded * sizeof(TCHAR));
GetDefaultPrinter((LPTSTR)lpDefaultPrinter, &dwNeeded);
free(lpDefaultPrinter);
free(lpBuffer);
}
示例9: HandleWindowInitEvent
//.........这里部分代码省略.........
CFrameBusinessData::Instance()->setProjectItem(pData);
}
}
else if (msg.pSender->GetName() == "btn_bussiness_chat")
{
sProjectItem* pData = (sProjectItem*)msg.pSender->GetParent()->GetParent()->GetParent()->GetTag();
if (NULL != pData)
{
//没有创建房间,就需要重新选人。
if (pData->strRoomID.empty())
{
CAddNewGroupMember* pAddGroupMemWnd = new CAddNewGroupMember(m_PaintManager);
if (NULL != pAddGroupMemWnd)
{
pAddGroupMemWnd->SetShowMode(true);
pAddGroupMemWnd->CreateWnd();
pAddGroupMemWnd->Initialize();//初始化一次。
}
//bool bWithProperty = m_pComboResProperty->GetCurSel() == 1;
pAddGroupMemWnd->SetResProperty(false, pData->strProjID, pData->strProjName);
pAddGroupMemWnd->ShowWindow(true);
}
else
{
//我有可能不是这个群里面的成员,就需要判断下。如果我不是这个群里面的人,就不能进去。
tstring strMyPhone = CController::Instance()->GetXmppClient()->jid().username();
tstring strMyAccount = strMyPhone+MMPC_ACCOUNT;
if(CController::Instance()->GetRoomManager()->IsInThisRoom(pData->strRoomID, strMyAccount ))
{
CController::Instance()->GetRoomManager()->EnterRoom(pData->strRoomID, strMyPhone);
if (pData->strDestOrgID.empty() && pData->strDestOrgName.empty())
{
if (pData->vecDestParticipants.size()>0)
{
mainDlg::getInstance()->OnShowGroupChatWnd_Personal(pData->vecDestParticipants[0], pData->strRoomID);
}
}
else
{
mainDlg::getInstance()->OnShowGroupChatWnd(pData->strDestOrgID, pData->strDestOrgName, pData->strRoomID);
}
}
else
{
CMsgBox* pMsgBox = new CMsgBox("错误","您不是该群组成员!");
pMsgBox->ShowModal();
}
}
}
}
//增加搜索功能 by HQ 20160519
else if (msg.pSender->GetName() == "btn_Search")
{
COptionUI* OptionToday = static_cast<COptionUI*>(m_PaintManager->FindControl("OptionToday"));
COptionUI* OptionWeek = static_cast<COptionUI*>(m_PaintManager->FindControl("OptionWeek"));
COptionUI* OptionMonth = static_cast<COptionUI*>(m_PaintManager->FindControl("OptionMonth"));
COptionUI* OptionAll = static_cast<COptionUI*>(m_PaintManager->FindControl("OptionAll"));
tstring sSelectedTime=(_T(""));
if (OptionToday->IsSelected())
{
time_t tToday = time(0);
sSelectedTime = GetYMDTimeString(tToday);
}
else if (OptionWeek->IsSelected())
{
time_t tToday = time(0);
time_t tOneWeekAgo = tToday - const_one_week_seconds;
sSelectedTime = GetYMDTimeString(tOneWeekAgo);
}
else if (OptionMonth->IsSelected())
{
time_t tToday = time(0);
time_t tOneMonthAgo = tToday - const_one_month_seconds;
sSelectedTime = GetYMDTimeString(tOneMonthAgo);
}
else if (OptionAll->IsSelected())
{
//do nothing...
}
CEditUI* edtSearchString = static_cast<CEditUI*>(m_PaintManager->FindControl("edt_SearchString"));
tstring sSearchString = edtSearchString->GetText();
//允许空字符串查询 by HQ 20160519
//if(sSearchString == "")
//{
// CMsgBox* pMsgBox = new CMsgBox("错误","请输入查找条件!");
// pMsgBox->ShowModal();
// edtSearchString->SetFocus();
//}
//else
//{
FetchProjects(sSelectedTime,sSearchString);
//}
}
}
示例10: _T
void CMainWnd::InitWindow()
{
// 初始化数据管理器
m_Data.Init(m_hWnd);
// 创建分类按钮
CHorizontalLayoutUI* pTabBar = (CHorizontalLayoutUI*)m_PaintManager.FindControl(_T("tabbar"));
if(pTabBar)
{
TABBTN aTypes[] = {
{_T("8009|1003|1004|1007|1002|1005|1006|1001|1008"), _T("精选")},
{_T("1003"), _T("风景")},
{_T("1004"), _T("美女")},
{_T("1007"), _T("小清新")},
{_T("1002"), _T("动漫")},
{_T("1005"), _T("萌宠")},
{_T("1006"), _T("明星")},
{_T("1001"), _T("创意")},
{_T("1008"), _T("汽车")},
{_T("8009"), _T("颜色")},
};
COptionUI* pFirst = NULL;
for(int i = 0; i < sizeof(aTypes) / sizeof(TABBTN); ++i)
{
TABBTN Tab = aTypes[i];
COptionUI* pOption = new COptionUI();
pOption->SetName(_T("wp_tabbtn"));
pOption->SetText(Tab.sText);
pOption->SetUserData(Tab.sType);
pOption->SetGroup(_T("tabbar"));
pOption->SetFixedHeight(25);
pOption->SetFixedWidth(65);
pOption->SetHotImage(_T("file='main/224.bmp' corner='4,4,4,4'"));
pOption->SetSelectedImage(_T("file='main/224.bmp' corner='4,4,4,4'"));
pOption->OnNotify += MakeDelegate(this, &CMainWnd::OnNotify1);
pOption->OnNotify += MakeDelegate(this, &CMainWnd::OnNotify2);
pTabBar->Add(pOption);
if(pFirst == NULL) pFirst = pOption;
}
if(pFirst != NULL) pFirst->Selected(true);
}
m_Data.LoadBizhi(_T("8009|1003|1004|1007|1002|1005|1006|1001|1008"), 1, 10);
}
示例11: TBCIASendMessage
NSDUILIB_API void TBCIASendMessage(HWND hwndParent, int string_size, char *variables, stack_t **stacktop, extra_parameters *extra)
{
HWND hwnd = (HWND)popint();
TCHAR msgID[MAX_PATH];
TCHAR wParam[MAX_PATH];
TCHAR lParam[MAX_PATH];
EXDLL_INIT();
ZeroMemory(msgID, MAX_PATH*sizeof(TCHAR));
ZeroMemory(wParam, MAX_PATH*sizeof(TCHAR));
ZeroMemory(lParam, MAX_PATH*sizeof(TCHAR));
DEBUG_INFO("to send message stringsize %d MAX_PATH %d\n",g_stringsize,MAX_PATH);
popstring( msgID,sizeof(msgID) );
popstring( wParam,sizeof(wParam) );
popstring( lParam ,sizeof(lParam));
if( _tcsicmp( msgID, _T("WM_TBCIAMIN")) == 0 )
::SendMessage( hwnd, WM_TBCIAMIN, (WPARAM)wParam, (LPARAM)lParam );
else if( _tcsicmp( msgID, _T("WM_TBCIACLOSE")) == 0 )
::SendMessage( hwnd, WM_TBCIACLOSE, (WPARAM)wParam, (LPARAM)lParam );
else if( _tcsicmp( msgID, _T("WM_TBCIABACK")) == 0 )
::SendMessage( hwnd, WM_TBCIABACK, (WPARAM)g_installPageTabName.GetData(), (LPARAM)lParam );
else if( _tcsicmp( msgID, _T("WM_TBCIANEXT")) == 0 )
::SendMessage( hwnd, WM_TBCIANEXT, (WPARAM)g_installPageTabName.GetData(), (LPARAM)lParam );
else if( _tcsicmp( msgID, _T("WM_TBCIACANCEL")) == 0 )
{
LPCTSTR lpTitle = (LPCTSTR)wParam;
LPCTSTR lpText = (LPCTSTR)lParam;
DEBUG_BUFFER_FMT(lpTitle,_tcslen(lpTitle) + sizeof(TCHAR),"lpTitle :");
DEBUG_BUFFER_FMT(lpText,_tcslen(lpText) + sizeof(TCHAR),"lpText :");
if( IDYES == MessageBox( hwnd, lpText, lpTitle, MB_YESNO)/*TBCIAMessageBox( hwnd, lpTitle, lpText )*/)
{
pushint( 0 );
::SendMessage( hwnd, WM_TBCIACLOSE, (WPARAM)wParam, (LPARAM)lParam );
}
else
pushint( -1 );
}
else if (_tcsicmp( msgID, _T("WM_QAUERYCANCEL")) == 0)
{
LPCTSTR lpTitle = (LPCTSTR)wParam;
LPCTSTR lpText = (LPCTSTR)lParam;
if( IDYES == MessageBox( hwnd, lpText, lpTitle, MB_YESNO)/*TBCIAMessageBox( hwnd, lpTitle, lpText )*/)
{
pushint( 0 );
}
else
pushint( -1 );
}
else if( _tcsicmp( msgID, _T("WM_TBCIASTARTINSTALL")) == 0 )
{
::SendMessage( hwnd, WM_TBCIASTARTINSTALL, (WPARAM)g_installPageTabName.GetData(), (LPARAM)lParam );
}
else if( _tcsicmp( msgID, _T("WM_TBCIASTARTUNINSTALL")) == 0 )
::SendMessage( hwnd, WM_TBCIASTARTUNINSTALL, (WPARAM)g_installPageTabName.GetData(), (LPARAM)lParam );
else if( _tcsicmp( msgID, _T("WM_TBCIAFINISHEDINSTALL")) == 0 )
::SendMessage( hwnd, WM_TBCIAFINISHEDINSTALL, (WPARAM)wParam, (LPARAM)lParam );
else if( _tcsicmp( msgID, _T("WM_TBCIAOPTIONSTATE")) == 0 ) // 返回option的状态
{
COptionUI* pOption = static_cast<COptionUI*>(g_pFrame->GetPaintManager().FindControl( wParam ));
if( pOption == NULL )
return;
DEBUG_INFO("selected %s\n",pOption->IsSelected() ? "yes" : "no");
pushint( pOption->IsSelected() );
}
else if (_tcsicmp( msgID, _T("WM_TBCIASETSTATE")) == 0)
{
COptionUI* pOption = static_cast<COptionUI*>(g_pFrame->GetPaintManager().FindControl( wParam ));
if( pOption == NULL )
return;
if (_tcsicmp(lParam,_T("1"))== 0)
{
pOption->Selected(true);
}
else
{
pOption->Selected(false);
}
DEBUG_INFO("selected %s\n",pOption->IsSelected() ? "yes" : "no");
pOption->PaintStatusImage(g_pFrame->GetPaintManager().GetPaintDC());
pushint( pOption->IsSelected() );
}
else if (_tcsicmp(msgID,_T("WM_TBCIAEXIT"))==0)
{
::SendMessage(hwnd,WM_CLOSE,0,0);
}
else if( _tcsicmp( msgID, _T("WM_TBCIAOPENURL")) == 0 )
{
CDuiString url = (CDuiString)wParam;
if( url.Find( _T("https://") ) == -1 &&
url.Find(_T("http://")) == -1)
{
pushstring( _T("url error") );
return;
}
CDuiString lpCmdLine = _T("explorer \"");
lpCmdLine += url;
lpCmdLine += _T("\"");
//.........这里部分代码省略.........
示例12: OnPrepare
void MainFrame::Notify(TNotifyUI& msg)
{
if (_tcsicmp(msg.sType, kWindowInit) == 0)
{
OnPrepare(msg);
}
else if (_tcsicmp(msg.sType, kClick) == 0)
{
if (_tcsicmp(msg.pSender->GetName(), kCloseButtonControlName) == 0 || _tcsicmp(msg.pSender->GetName(), kCancelButtonControlName) == 0)
{
OnExit(msg);
}
else if (_tcsicmp(msg.pSender->GetName(), kMinButtonControlName) == 0)
{
#if defined(UNDER_CE)
::ShowWindow(m_hWnd, SW_MINIMIZE);
#else
SendMessage(WM_SYSCOMMAND, SC_MINIMIZE, 0);
#endif
}
else if (_tcsicmp(msg.pSender->GetName(), kMaxButtonControlName) == 0)
{
#if defined(UNDER_CE)
::ShowWindow(m_hWnd, SW_MAXIMIZE);
CControlUI* pControl = static_cast<CControlUI*>(paint_manager_.FindControl(kMaxButtonControlName));
if( pControl ) pControl->SetVisible(false);
pControl = static_cast<CControlUI*>(paint_manager_.FindControl(kRestoreButtonControlName));
if( pControl ) pControl->SetVisible(true);
#else
SendMessage(WM_SYSCOMMAND, SC_MAXIMIZE, 0);
#endif
}
else if (_tcsicmp(msg.pSender->GetName(), kRestoreButtonControlName) == 0)
{
#if defined(UNDER_CE)
::ShowWindow(m_hWnd, SW_RESTORE);
CControlUI* pControl = static_cast<CControlUI*>(paint_manager_.FindControl(kMaxButtonControlName));
if( pControl ) pControl->SetVisible(true);
pControl = static_cast<CControlUI*>(paint_manager_.FindControl(kRestoreButtonControlName));
if( pControl ) pControl->SetVisible(false);
#else
SendMessage(WM_SYSCOMMAND, SC_RESTORE, 0);
#endif
}
else if (_tcsicmp(msg.pSender->GetName(), _T("select_all_btn")) == 0)
{
CContainerUI* pDriverList = static_cast<CContainerUI*>(paint_manager_.FindControl(_T("driver_list")));
for (int i = 0; (pDriverList != NULL) && (i < pDriverList->GetCount()); ++i)
{
COptionUI* pDriver = static_cast<COptionUI*>(pDriverList->GetItemAt(i)->GetInterface(_T("Option")));
if (pDriver != NULL)
pDriver->Selected(true);
}
}
else if (_tcsicmp(msg.pSender->GetName(), _T("uninstall_btn")) == 0)
{
vector<tString> deleted_printer_driver;
DWORD dwError = 0;
TCHAR szBuf[MAX_PATH] = {0};
CContainerUI* pDriverList = static_cast<CContainerUI*>(paint_manager_.FindControl(_T("driver_list")));
for (int i = 0; (pDriverList != NULL) && (i < pDriverList->GetCount()); ++i)
{
COptionUI* pDriver = static_cast<COptionUI*>(pDriverList->GetItemAt(i)->GetInterface(_T("Option")));
if ((pDriver != NULL) && pDriver->IsSelected())
{
// 涉及到的API: DeletePrinter DeletePrinterDriver
HANDLE hPrinter = NULL;
_stprintf_s(szBuf, MAX_PATH - 1, pDriver->GetText().GetData());
PRINTER_DEFAULTS PrtDefault = {NULL, NULL, PRINTER_ALL_ACCESS};
OpenPrinter(szBuf, &hPrinter, &PrtDefault);
if (hPrinter != NULL)
{
DWORD dwNeeded = 0;
GetPrinter(hPrinter, 2, NULL, 0, &dwNeeded);
LPBYTE lpBuffer = (LPBYTE)malloc(dwNeeded);
if (lpBuffer != NULL)
{
GetPrinter(hPrinter, 2, lpBuffer, dwNeeded, &dwNeeded);
DeletePrinter(hPrinter);
dwError = GetLastError();
vector<tString>::const_iterator citer = find(deleted_printer_driver.begin(), deleted_printer_driver.end(), ((PRINTER_INFO_2*)lpBuffer)->pDriverName);
if (citer == deleted_printer_driver.end())
{
deleted_printer_driver.push_back(((PRINTER_INFO_2*)lpBuffer)->pDriverName);
}
ClosePrinter(hPrinter);
free(lpBuffer);
}
}
}
}
for (vector<tString>::const_iterator citer = deleted_printer_driver.begin(); citer != deleted_printer_driver.end(); ++citer)
{
_stprintf_s(szBuf, MAX_PATH - 1, citer->c_str());
DeletePrinterDriver(NULL, NULL, szBuf);
//.........这里部分代码省略.........
示例13: Close
void CMainDlg::Notify(TNotifyUI& msg)
{
//throw std::exception("The method or operation is not implemented.");
//单击事件
if(msg.sType == DUI_MSGTYPE_CLICK)
{
//点击关闭按钮
if(msg.pSender->GetName() == _T("sys_close_btn")) //退出
Close(0);
//点击添加按钮
else if(msg.pSender->GetName() == _T("add_option"))
{
//新建一个option按钮
CDialogBuilder builder;
COptionUI * p = static_cast<COptionUI *>(builder.Create(_T("option.xml"),0,NULL,&m_pm));
if(NULL == p)
return;
CContainerUI * pContainer = static_cast<CContainerUI *>(m_pm.FindControl(_T("main_option_layout")));
int nCount = pContainer->GetCount();
static int i = 1;
CDuiString str1;
str1.Format(_T("新增按钮%d"), i);
p->SetText(str1);
pContainer->AddAt(p, nCount - 1);
CTabLayoutUI * pTab = static_cast<CTabLayoutUI *>(m_pm.FindControl(_T("main_tab")));
if(NULL != pTab)
{
CDuiString str2;
str2.Format(_T("新增界面%d"), i);
//增加一个界面,这里可以像上边option一样使用xml创建
CButtonUI * pButton = new CButtonUI;
pButton->SetTextColor(0xffffffff);
pButton->SetText(str2);
pTab->Add(pButton);
p->SetTag(pTab->GetCount() - 1);
}
i++;
}
}
//切换选项卡按钮时根据不同的按钮,选中不同的界面
else if(msg.sType == DUI_MSGTYPE_SELECTCHANGED)
{
if(msg.pSender->GetName() == _T("option_1"))
{
CTabLayoutUI * pTab = static_cast<CTabLayoutUI *>(m_pm.FindControl(_T("main_tab")));
if(NULL != pTab)
{
CControlUI * pControl = pTab->FindSubControl(_T("tab_01"));
if(NULL != pControl)
pTab->SelectItem(pControl);
}
}
else if(msg.pSender->GetName() == _T("option_2"))
{
CTabLayoutUI * pTab = static_cast<CTabLayoutUI *>(m_pm.FindControl(_T("main_tab")));
if(NULL != pTab)
{
CControlUI * pControl = pTab->FindSubControl(_T("tab_02"));
if(NULL != pControl)
pTab->SelectItem(pControl);
}
}
else if(msg.pSender->GetName() == _T("option"))
{
CTabLayoutUI * pTab = static_cast<CTabLayoutUI *>(m_pm.FindControl(_T("main_tab")));
pTab->SelectItem(msg.pSender->GetTag());
}
}
}
示例14: _tsplitpath_s
void CDuiFrameWnd::AddFiles( const std::vector<PlayFileInfo> &vctString, bool bInit )
{
COptionUI *pOptionTmp;
CVerticalLayoutUI* pLayout = NULL;
CDuiString strTmp;
TCHAR szName[_MAX_FNAME];
TCHAR szExt[_MAX_EXT];
unsigned i, uWantedCount;
pLayout = static_cast<CVerticalLayoutUI*>(m_PaintManager.FindControl(_T("playlist")));
if (! pLayout)
{
return;
}
for(i = 0, uWantedCount = 0; i < vctString.size(); i++)
{
if (IsWantedFile(vctString[i].szFileName))
{
_tsplitpath_s(vctString[i].szFileName, NULL, 0, NULL, 0, szName, _MAX_FNAME, szExt, _MAX_EXT);
strTmp.Format(_T("%s%s"), szName, szExt); // 文件名
pOptionTmp = new COptionUI;
pOptionTmp->SetTextColor(0xFFC8C6CB);
pOptionTmp->SetHotTextColor(0xFFC8C6CB);
pOptionTmp->SetSelectedTextColor(0xFFC8C6CB);
pOptionTmp->SetTag(U_TAG_PLAYLIST);
pOptionTmp->SetText(strTmp);
pOptionTmp->SetAttribute(_T("height"), _T("22"));
pOptionTmp->SetAttribute(_T("inset"), _T("7,0,0,0"));
pOptionTmp->SetAttribute(_T("align"), _T("center"));
pOptionTmp->SetAttribute(_T("font"),_T("4"));
pOptionTmp->SetUserData(vctString[i].szFileName);
pOptionTmp->SetName(vctString[i].szFileName);
pOptionTmp->SetSelectedImage(_T("file='btn_bk.png'"));
pLayout->Add(pOptionTmp);
uWantedCount++;
if (! bInit)
{
m_cPlayList.Add(vctString[i]); // 完整路径
}
}
}
Rand(m_queRand, uWantedCount);
ShowPlaylist(true);
}
示例15: while
//加载常规控件皮肤
void CUseBoardCastWnd::LoadNormalCtrlSkin()
{
int idx = 0;
CStdPtrArray* pCtrls = NULL;
//加载所有文本编辑框的皮肤
pCtrls = m_pm.FindSubControlsByClass(m_pm.GetRoot(),_TEXT("EditUI"));
CEditUI* pEditUI = NULL;
do
{
pEditUI = static_cast<CEditUI*>(pCtrls->GetAt(idx++));
if (pEditUI)
{
if (pEditUI->GetName() == _T("Edt_ID"))
{
continue;
}
pEditUI->SetNormalImage("file='dialog\\edit.png' dest='0,0,500,30' source='0,0,500,22' corner='3,4,2,2'");
pEditUI->SetHotImage("file='dialog\\edit.png' dest='0,0,500,30' source='0,22,500,44' corner='3,4,2,2'");
pEditUI->SetFocusedImage("file='dialog\\edit.png' dest='0,0,500,30' source='0,44,500,66' corner='3,4,2,2'");
pEditUI->SetDisabledImage("file='dialog\\edit.png' dest='0,0,500,30' source='0,66,500,88' corner='3,4,2,2'");
}
} while (pEditUI);
//加载所有下拉列表框的皮肤
idx = 0;
pCtrls = m_pm.FindSubControlsByClass(m_pm.GetRoot(),_TEXT("ComboUI"));
CComboUI* pComboUI = NULL;
do
{
pComboUI = static_cast<CComboUI*>(pCtrls->GetAt(idx++));
if (pComboUI)
{
pComboUI->SetNormalImage("file='dialog\\combo.png' dest='0,0,500,30' source='0,0,500,22' corner='5,2,22,0'");
pComboUI->SetHotImage("file='dialog\\combo.png' dest='0,0,500,30' source='0,22,500,44' corner='5,2,22,0'");
pComboUI->SetPushedImage("file='dialog\\combo.png' dest='0,0,500,30' source='0,44,500,66' corner='5,2,22,0'");
pComboUI->SetDisabledImage("file='dialog\\combo.png' dest='0,0,500,30' source='0,66,500,88' corner='5,2,22,0'");
RECT rc = {6,0,0,0};
pComboUI->SetItemTextPadding(rc);
// CScrollBarUI* pVScroll = pComboUI->GetVerticalScrollBar();
// if (pVScroll)
// {
// pVScroll->SetBkNormalImage("file='dialog\\vscrollbar_back.png' dest='0,0,14,100' source='0,0,14,100' corner='0,0,0,0'");
// pVScroll->SetButton1NormalImage("file='dialog\\vscrollbar_up.png' dest='0,0,16,16' source='0,0,16,16' corner='0,0,0,0'");
// }
}
} while (pComboUI);
//加载所有多选框的皮肤
idx = 0;
pCtrls = m_pm.FindSubControlsByClass(m_pm.GetRoot(),_TEXT("OptionUI"));
COptionUI* pOptionUI = NULL;
do
{
pOptionUI = static_cast<COptionUI*>(pCtrls->GetAt(idx++));
if (pOptionUI)
{
if (lstrlen(pOptionUI->GetGroup()) == 0) //多选框
{
pOptionUI->SetNormalImage("file='dialog\\check.png' dest='0,0,15,15' source='0,0,15,15' corner='0,0,0,0'");
pOptionUI->SetHotImage("file='dialog\\check.png' dest='0,0,15,15' source='15,0,30,15' corner='0,0,0,0'");
pOptionUI->SetSelectedImage("file='dialog\\check.png' dest='0,0,15,15' source='30,0,45,15' corner='0,0,0,0'");
RECT rc = {9,0,0,0};
pOptionUI->SetTextPadding(rc);
}
else //单选框
{
pOptionUI->SetNormalImage("file='dialog\\radio.png' dest='0,0,15,15' source='0,0,15,15' corner='0,0,0,0'");
pOptionUI->SetHotImage("file='dialog\\radio.png' dest='0,0,15,15' source='15,0,30,15' corner='0,0,0,0'");
pOptionUI->SetSelectedImage("file='dialog\\radio.png' dest='0,0,15,15' source='30,0,45,15' corner='0,0,0,0'");
RECT rc = {18,0,0,0};
pOptionUI->SetTextPadding(rc);
}
}
} while (pOptionUI);
}