void CVideoFrame::Notify(TNotifyUI& msg) { if (_tcsicmp(msg.sType, _T("windowinit")) == 0) { OnPrepare(msg); } else if (_tcsicmp(msg.sType, _T("killfocus")) == 0) { } else if (_tcsicmp(msg.sType, _T("click")) == 0) { if (_tcsicmp(msg.pSender->GetName(), _T("closebtn")) == 0) { Close(); } else if (_tcsicmp(msg.pSender->GetName(), _T("minbtn")) == 0) { SendMessage(WM_SYSCOMMAND, SC_MINIMIZE, 0); } } else if (_tcsicmp(msg.sType, _T("selectchanged")) == 0) { } else if (_tcsicmp(msg.sType, _T("itemselect")) == 0) { } }
void CSelectOnlineUserWnd::Notify(TNotifyUI& msg) { if (_tcsicmp(msg.sType, DUI_MSGTYPE_WINDOWINIT) == 0) { OnPrepare(msg); } if (msg.sType == DUI_MSGTYPE_CLICK) { if (msg.pSender->GetName() == L"closeBtn_chat" || msg.pSender->GetName() == L"cancelChatInsideBtn") { PostQuitMessage(0); } else if (msg.pSender->GetName() == L"conformChatInsideBtn") { Close(); } } if (msg.sType == DUI_MSGTYPE_ITEMSELECT) { } if (msg.sType == DUI_MSGTYPE_ITEMCLICK) { OnItemClick(msg); } }
void Notify(TNotifyUI& msg) { if( msg.sType == _T("windowinit") ) OnPrepare(); else if( msg.sType == _T("click") ) { if( msg.pSender == m_pCloseBtn ) { PostQuitMessage(0); return; } #if defined(UI_BUILD_FOR_WIN32) && !defined(UI_BUILD_FOR_WINCE) else if( msg.pSender == m_pMinBtn ) { SendMessage(WM_SYSCOMMAND, SC_MINIMIZE, 0); return; } else if( msg.pSender == m_pMaxBtn ) { SendMessage(WM_SYSCOMMAND, SC_MAXIMIZE, 0); return; } else if( msg.pSender == m_pRestoreBtn ) { SendMessage(WM_SYSCOMMAND, SC_RESTORE, 0); return; } #else else if( msg.pSender == m_pMinBtn ) { ::ShowWindow(*this, SW_MINIMIZE); return; } else if( msg.pSender == m_pMaxBtn ) { ::ShowWindow(*this, SW_MAXIMIZE); CControlUI* pControl = static_cast<CControlUI*>(m_pm.FindControl(_T("maxbtn"))); if( pControl ) pControl->SetVisible(false); pControl = static_cast<CControlUI*>(m_pm.FindControl(_T("restorebtn"))); if( pControl ) pControl->SetVisible(true); return; } else if( msg.pSender == m_pRestoreBtn ) { ::ShowWindow(*this, SW_RESTORE); CControlUI* pControl = static_cast<CControlUI*>(m_pm.FindControl(_T("maxbtn"))); if( pControl ) pControl->SetVisible(true); pControl = static_cast<CControlUI*>(m_pm.FindControl(_T("restorebtn"))); if( pControl ) pControl->SetVisible(false); return; } #endif } else if(msg.sType==_T("setfocus")) { CStdString name = msg.pSender->GetName(); CTabLayoutUI* pControl = static_cast<CTabLayoutUI*>(m_pm.FindControl(_T("switch"))); if(name==_T("examine")) pControl->SelectItem(0); else if(name==_T("trojan")) pControl->SelectItem(1); else if(name==_T("plugins")) pControl->SelectItem(2); else if(name==_T("vulnerability")) pControl->SelectItem(3); else if(name==_T("rubbish")) pControl->SelectItem(4); else if(name==_T("cleanup")) pControl->SelectItem(5); else if(name==_T("fix")) pControl->SelectItem(6); else if(name==_T("tool")) pControl->SelectItem(7); } }
void EmotionDialog::Notify(TNotifyUI& msg) { if (0 == _tcsicmp(msg.sType, DUI_MSGTYPE_WINDOWINIT)) { OnPrepare(); } else if (msg.sType == DUI_MSGTYPE_KILLFOCUS) { int n = 1; n++; } else if (0 == _tcsicmp(msg.sType, DUI_MSGTYPE_CLICK)) { if (_tcsicmp(msg.pSender->GetName(), _T("prev_page")) == 0) //上一页 { CEmotionButton *pEmotionButton = static_cast<CEmotionButton*>(m_PaintManager.FindControl(_T("emotion_button"))); if (pEmotionButton != NULL && pEmotionButton->GetCurrentPage() > 0) { pEmotionButton->SetPage(pEmotionButton->GetCurrentPage() - 1); } } else if (_tcsicmp(msg.pSender->GetName(), _T("next_page")) == 0) //下一页 { CEmotionButton *pEmotionButton = static_cast<CEmotionButton*>(m_PaintManager.FindControl(_T("emotion_button"))); if (pEmotionButton != NULL && pEmotionButton->GetCurrentPage() < (pEmotionButton->GetPageCount() - 1)) { pEmotionButton->SetPage(pEmotionButton->GetCurrentPage() + 1); } } } else __super::Notify(msg); }
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) { 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("btn_menu")) == 0) { CMenuWnd* pMenu = new CMenuWnd(m_hWnd); CPoint point = msg.ptMouse; ClientToScreen(m_hWnd, &point); STRINGorID xml(IDR_XML_MENU); pMenu->Init(NULL, xml, _T("xml"), point); } } else if (_tcsicmp(msg.sType, kTimer) == 0) { return OnTimer(msg); } }
void DesktopUI::Notify(TNotifyUI& msg) { if(msg.sType==_T("windowinit")) OnPrepare(); else if(msg.sType==_T("click")) { } }
void CLoginPreWnd::Notify(TNotifyUI& msg) { if( msg.sType == _T("windowinit") ) { OnPrepare(msg); } else if( msg.sType == _T("click") ) { if( msg.pSender->GetName() == L"closebtn" ) { Close(); return; } else if( msg.pSender->GetName() == L"EverAccountLoginBtn" ) { Close(); // 强制弹出更新窗口进行升级 mainframe::MainFrame_GetWndService stGetWndService; login::g_LoginModule->GetModuleManager()->CallService(mainframe::SERVICE_VALUE_MAINFRAME_GET_MAINWND, (param)&stGetWndService); CWindowWnd* pMainFrameWnd = reinterpret_cast<CWindowWnd*>(stGetWndService.pBaseWnd); ASSERT(pMainFrameWnd != NULL); CLoginFrameWnd* pLoginFrame = new CLoginFrameWnd(); pLoginFrame->Create(pMainFrameWnd->GetHWND(), _T(""), UI_WNDSTYLE_DIALOG, UI_WNDSTYLE_EX_DIALOG, 0, 0, 0, 0, NULL); pLoginFrame->CenterWindow(); /* pMainFrameWnd->ShowModal(*pLoginFrame); */ return; } else if( msg.pSender->GetName() == L"EverAacountRegisterBtn" ) { } else if( msg.pSender->GetName() == L"QQLogin" ) { Close(); // 强制弹出更新窗口进行升级 mainframe::MainFrame_GetWndService stGetWndService; login::g_LoginModule->GetModuleManager()->CallService(mainframe::SERVICE_VALUE_MAINFRAME_GET_MAINWND, (param)&stGetWndService); CWindowWnd* pMainFrameWnd = reinterpret_cast<CWindowWnd*>(stGetWndService.pBaseWnd); ASSERT(pMainFrameWnd != NULL); COAuthLoginWnd* pLoginFrame = new COAuthLoginWnd(); pLoginFrame->Create(pMainFrameWnd->GetHWND(), _T(""), UI_WNDSTYLE_DIALOG, UI_WNDSTYLE_EX_DIALOG, 0, 0, 0, 0, NULL); pLoginFrame->CenterWindow(); } } }
void GameObject::Prepare() { OnPrepare(); // prepare this object if (HasChild()) // prepare children ((GameObject*)GetChild())->Prepare(); if (HasParent() && !IsLastChild()) // prepare siblings ((GameObject*)GetFollowing())->Prepare(); }
BOOL CFColorQuantizerBase::ProcessQuantizer(UINT nWantClrCount, UINT *pResultClrCount) { FUNCTION_BLOCK_TRACE(500); BOOL bRet = FALSE; API_VERIFY(OnPrepare()); if (bRet) { API_VERIFY(OnProcessQuantizer(nWantClrCount, pResultClrCount)); OnFinish(); } return bRet; }
void CFrameWnd::Notify( TNotifyUI& msg ) { CDuiString strControlName = msg.pSender->GetName(); if( msg.sType == _T("windowinit") ) { OnPrepare(msg); } else if( msg.sType == _T("click") ) { } __super::Notify(msg); }
void InputDialog::Notify(TNotifyUI& msg) { if (_tcsicmp(msg.sType, _T("windowinit")) == 0) { OnPrepare(msg); } else if (_tcsicmp(msg.sType, _T("click")) == 0) { if (_tcsicmp(msg.pSender->GetName(), _T("closebtn")) == 0) { CRichEditUI* rich_edit = static_cast<CRichEditUI*>(paint_manager_.FindControl(_T("input"))); if (rich_edit != NULL) input_string_ = rich_edit->GetText(); Close(); } } }
void Notify(TNotifyUI& msg) { if( msg.sType == _T("windowinit") ) OnPrepare(); else if( msg.sType == _T("click") ) { if( msg.pSender->GetName() == _T("insertimagebtn") ) { CRichEditUI* pRich = static_cast<CRichEditUI*>(m_pm.FindControl(_T("testrichedit"))); if( pRich ) { pRich->RemoveAll(); } } else if( msg.pSender->GetName() == _T("changeskinbtn") ) { if( CPaintManagerUI::GetResourcePath() == CPaintManagerUI::GetInstancePath() ) CPaintManagerUI::SetResourcePath(CPaintManagerUI::GetInstancePath() + _T("skin\\FlashRes")); else CPaintManagerUI::SetResourcePath(CPaintManagerUI::GetInstancePath()); CPaintManagerUI::ReloadSkin(); } } }
void CAbout::Notify(TNotifyUI& msg) { if (_tcsicmp(msg.sType, _T("windowinit")) == 0) { OnPrepare(msg); } else if (_tcsicmp(msg.sType, _T("killfocus")) == 0) { } else if( msg.sType == _T("click") ) { if (_tcsicmp(msg.pSender->GetName(), kCloseButtonControlName) == 0) { Close(); return; } } }
void PopupMenu::Notify(TNotifyUI& msg) { if (_tcsicmp(msg.sType, _T("windowinit")) == 0) { OnPrepare(msg); } else if (_tcsicmp(msg.sType, _T("click")) == 0) {} else if (_tcsicmp(msg.sType, _T("itemselect")) == 0) { //Close(); } else if ((_tcsicmp(msg.sType, _T("itemactivate")) == 0) || (_tcsicmp(msg.sType, _T("itemclick")) == 0)) { if ((msg.pSender->GetInterface(_T("ListContainerElement")) != NULL) && !menu_item_tags_.empty()) { bool fire = false; DWORD fire_id = 0; CListUI* menu_list = static_cast<CListUI*>(paint_manager_.FindControl(kMenuList)); if (menu_list != NULL) { CListContainerElementUI* menu_item = static_cast<CListContainerElementUI*>(msg.pSender); int selected_item = menu_list->GetItemIndex(msg.pSender); CLabelUI* item_title = static_cast<CLabelUI*>(paint_manager_.FindSubControlByName(menu_item, kMenuItemTitleName)); if ((item_title != NULL) && (selected_item >= 0) && (selected_item < static_cast<int>(menu_item_tags_.size()))) { fire = item_title->IsEnabled(); fire_id = menu_item_tags_[selected_item]; } } if (fire) { ::PostMessage(hosted_window_, WM_MENU, (WPARAM)fire_id, (LPARAM)0); Close(); } } } }
void Notify(TNotifyUI& msg) { if( msg.sType == _T("windowinit") ) OnPrepare(); else if( msg.sType == _T("click") ) { if( msg.pSender == m_pCloseBtn ) { PostQuitMessage(0); return; } #if defined(UI_BUILD_FOR_WIN32) && !defined(UI_BUILD_FOR_WINCE) else if( msg.pSender == m_pMinBtn ) { SendMessage(WM_SYSCOMMAND, SC_MINIMIZE, 0); return; } else if( msg.pSender == m_pMaxBtn ) { SendMessage(WM_SYSCOMMAND, SC_MAXIMIZE, 0); return; } else if( msg.pSender == m_pRestoreBtn ) { SendMessage(WM_SYSCOMMAND, SC_RESTORE, 0); return; } #else else if( msg.pSender == m_pMinBtn ) { ::ShowWindow(*this, SW_MINIMIZE); return; } else if( msg.pSender == m_pMaxBtn ) { ::ShowWindow(*this, SW_MAXIMIZE); CControlUI* pControl = static_cast<CControlUI*>(m_pm.FindControl(_T("maxbtn"))); if( pControl ) pControl->SetVisible(false); pControl = static_cast<CControlUI*>(m_pm.FindControl(_T("restorebtn"))); if( pControl ) pControl->SetVisible(true); return; } else if( msg.pSender == m_pRestoreBtn ) { ::ShowWindow(*this, SW_RESTORE); CControlUI* pControl = static_cast<CControlUI*>(m_pm.FindControl(_T("maxbtn"))); if( pControl ) pControl->SetVisible(true); pControl = static_cast<CControlUI*>(m_pm.FindControl(_T("restorebtn"))); if( pControl ) pControl->SetVisible(false); return; } #endif } }
void Emotionlist::Notify(TNotifyUI& msg) { if( msg.sType == _T("windowinit") ) OnPrepare(msg); else if (_tcsicmp(msg.sType, _T("click")) == 0) { if(msg.pSender->GetName() == _T("ButtonOK")) { } } //else if (_tcsicmp(msg.sType, _T("timer")) == 0) //return OnTimer(msg); }
void Notify(TNotifyUI& msg) { if( msg.sType == _T("windowinit") ) OnPrepare(); else if( msg.sType == _T("click") ) { if( msg.pSender == m_pCloseBtn ) { PostQuitMessage(0); return; } else if( msg.pSender == m_pMinBtn ) { SendMessage(WM_SYSCOMMAND, SC_MINIMIZE, 0); return; } else if( msg.pSender == m_pMaxBtn ) { SendMessage(WM_SYSCOMMAND, SC_MAXIMIZE, 0); return; } else if( msg.pSender == m_pRestoreBtn ) { SendMessage(WM_SYSCOMMAND, SC_RESTORE, 0); return; } } else if(msg.sType==_T("selectchanged")) { CDuiString name = msg.pSender->GetName(); CTabLayoutUI* pControl = static_cast<CTabLayoutUI*>(m_pm.FindControl(_T("switch"))); if(name==_T("examine")) pControl->SelectItem(0); else if(name==_T("trojan")) pControl->SelectItem(1); else if(name==_T("plugins")) pControl->SelectItem(2); else if(name==_T("vulnerability")) pControl->SelectItem(3); else if(name==_T("rubbish")) pControl->SelectItem(4); else if(name==_T("cleanup")) pControl->SelectItem(5); else if(name==_T("fix")) pControl->SelectItem(6); else if(name==_T("tool")) pControl->SelectItem(7); } }
void MainDialog::Notify(TNotifyUI& msg) { if( msg.sType == _T("windowinit") ) OnPrepare(msg); else if( msg.sType == _T("click") ) { if( msg.pSender == m_pCloseBtn ) { PostQuitMessage(0); return; } else if( msg.pSender == m_pMinBtn ) { SendMessage(WM_SYSCOMMAND, SC_MINIMIZE, 0); return; } else if( msg.pSender == m_pMaxBtn ) { SendMessage(WM_SYSCOMMAND, SC_MAXIMIZE, 0); return; } else if( msg.pSender == m_pRestoreBtn ) { SendMessage(WM_SYSCOMMAND, SC_RESTORE, 0); return; } else if (msg.pSender->GetName() == _T("upload")) { } else if (msg.pSender == m_pClose) { } } else if(msg.sType==_T("setfocus")) { } else if( msg.sType == _T("itemexpand") ) { CTreeNodeUI* pNowNode = static_cast<CTreeNodeUI*>(msg.pSender); pNowNode->Select(true); CTreeViewUI* pTree = static_cast<CTreeViewUI*>(m_pm.FindControl(_T("tree"))); CListUI* pList = static_cast<CListUI*>(m_pm.FindControl(_T("file_list"))); g_bUpdateDir = false; if (!pNowNode->IsHasChild()) { g_bUpdateDir = true; } pList->RemoveAll(); WIN32_FIND_DATA FindFileData; HANDLE hListFile; TCHAR szFilePath[MAX_PATH]; lstrcpy(szFilePath,pNowNode->GetUserData()); lstrcat(szFilePath, _T("\\*")); hListFile = FindFirstFile(szFilePath,&FindFileData); if(hListFile==INVALID_HANDLE_VALUE) { return; } else { do { if(lstrcmp(FindFileData.cFileName,TEXT("."))==0|| lstrcmp(FindFileData.cFileName,TEXT(".."))==0) { continue; } SYSTEMTIME st; FileTimeToSystemTime(&FindFileData.ftLastWriteTime,&st); DWORDLONG dwlSize = (DWORDLONG)(FindFileData.nFileSizeHigh * (MAXDWORD+1)) + FindFileData.nFileSizeLow; DWORD dwSize = (DWORD)(dwlSize / 1024); if(FindFileData.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY) { if (g_bUpdateDir) { CTreeNodeUI* pNode = new CTreeNodeUI; pNode->SetAttribute(_T("folderattr"),_T("padding=\"0,1,0,0\" width=\"36\" height=\"16\" normalimage=\"file='treeview_b.png' source='0,0,36,16'\" hotimage=\"file='treeview_b.png' source='36,0,72,16'\" selectedimage=\"file='treeview_a.png' source='0,0,36,16' selectedhotimage=\"file='treeview_a.png' source='36,0,72,16'\"")); pNowNode->AddChildNode(pNode); pNode->SetItemText(FindFileData.cFileName); CDuiString szUserData = pNowNode->GetUserData() + _T("\\") + pNode->GetItemText(); pNode->SetUserData(szUserData); } } else { CListTextElementUI* pLine = new CListTextElementUI; pList->Add(pLine); CDuiString szNewName(FindFileData.cFileName); int pos = szNewName.ReverseFind('.'); CDuiString szExt = szNewName.Right(szNewName.GetLength() - pos); SHFILEINFO shfi; memset(&shfi,0,sizeof(shfi)); SHGetFileInfo(szExt, FILE_ATTRIBUTE_NORMAL, &shfi, sizeof(shfi), SHGFI_ICON|SHGFI_USEFILEATTRIBUTES); pLine->SetIcon(0,shfi.hIcon); pLine->SetText(0,szNewName); SYSTEMTIME st; FileTimeToSystemTime(&FindFileData.ftLastWriteTime,&st); CDuiString szTime; szTime.Format(_T("%04d/%02d/%02d %02d:%02d:%02d"), st.wYear, st.wMonth, st.wDay, st.wHour, st.wMinute, st.wSecond); pLine->SetText(1,szTime); DWORDLONG dwlSize = (DWORDLONG)(FindFileData.nFileSizeHigh * (MAXDWORD+1)) + FindFileData.nFileSizeLow; CDuiString szSize; if (dwlSize <1024) { szSize.Format(_T("%ldB"),dwlSize); } else { szSize.Format(_T("%ldK"),dwlSize/1024); } pLine->SetText(2,szSize); CDuiString szArrtib; szArrtib.Format(_T("%d"),FindFileData.dwFileAttributes); pLine->SetText(3,szArrtib); } } while(FindNextFile(hListFile, &FindFileData)); } } }
void main_frame::Notify( TNotifyUI& msg ) { if( msg.sType == _T("windowinit") ) OnPrepare(msg); else if (_tcsicmp(msg.sType,_T("click")) == 0) { if (_tcsicmp(msg.pSender->GetName(),_T("closebtn")) == 0 ) { Close(); } else if (_tcsicmp(msg.pSender->GetName(),_T("minbtn")) == 0) { SendMessage(WM_SYSCOMMAND, SC_MINIMIZE, 0); } else if (_tcsicmp(msg.pSender->GetName(),_T("maxbtn")) == 0) { SendMessage(WM_SYSCOMMAND, SC_MAXIMIZE, 0); } else if (_tcsicmp(msg.pSender->GetName(),_T("tagBtn")) == 0) { CRichEditUI *pRichEdit = static_cast<CRichEditUI*>(m_PaintManager.FindControl(_T("weiboContent"))); if (pRichEdit) { CDuiString strText = _T("#²åÈëÄãµÄ»°Ìâ#"); pRichEdit->SetText(strText); pRichEdit->SetSel(1,7); pRichEdit->SetFocus(); CLabelUI *plabel = static_cast<CLabelUI*>(m_PaintManager.FindControl(_T("defaultShowText"))); if (plabel) { plabel->SetVisible(false); } } } else if (_tcsicmp(msg.pSender->GetName(),_T("sendWeiboBtn")) == 0) { CRichEditUI *pRichEdit = static_cast<CRichEditUI*>(m_PaintManager.FindControl(_T("weiboContent"))); if (pRichEdit) { CDuiString strWeibo = pRichEdit->GetText(); if (strWeibo.GetLength() > 0) { DWORD dwNum = WideCharToMultiByte(CP_UTF8,NULL,strWeibo,-1,NULL,0,NULL,FALSE); char *psText; psText = new char[dwNum]; if(!psText) { delete []psText; } WideCharToMultiByte (CP_UTF8,NULL,strWeibo,-1,psText,dwNum,NULL,FALSE); m_weiboManage.PostNewWeibo(psText); delete []psText; pRichEdit->SetText(_T("")); } } } else if (_tcsicmp(msg.pSender->GetName(),_T("refreshBtn")) == 0) { m_weiboManage.RefreshTimeline(); } } }
void ChatDialog::Notify(TNotifyUI& msg) { if (_tcsicmp(msg.sType, _T("windowinit")) == 0) { OnPrepare(msg); } else if (_tcsicmp(msg.sType, _T("killfocus")) == 0) { } else if (_tcsicmp(msg.sType, _T("click")) == 0) { if (_tcsicmp(msg.pSender->GetName(), kCloseButtonControlName) == 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(), kFontButtonControlName) == 0) { CContainerUI* pFontbar = static_cast<CContainerUI*>(paint_manager_.FindControl(kFontbarControlName)); if (pFontbar != NULL) pFontbar->SetVisible(!pFontbar->IsVisible()); } else if (_tcsicmp(msg.pSender->GetName(), kEmotionButtonControlName) == 0) { POINT pt = {0}; CRect rcEmotionBtn = msg.pSender->GetPos(); CRect rcWindow; GetWindowRect(m_hWnd, &rcWindow); pt.y = rcWindow.top + rcEmotionBtn.top; pt.x = rcWindow.left + rcEmotionBtn.left; //emotion_list_window_.SelectEmotion(pt); } else if (_tcsicmp(msg.pSender->GetName(), kSendButtonControlName) == 0) { } } else if (_tcsicmp(msg.sType, _T("timer")) == 0) { return OnTimer(msg); } else if (_tcsicmp(msg.sType, _T("selectchanged")) == 0) { if (_tcsicmp(msg.pSender->GetName(), kColorButtonControlName) == 0) { CContainerUI* pFontbar = static_cast<CContainerUI*>(paint_manager_.FindControl(kFontbarControlName)); if (pFontbar != NULL) { POINT pt = {0}; CRect rcFontbar = pFontbar->GetPos(); CRect rcColorBtn = msg.pSender->GetPos(); CRect rcWindow; GetWindowRect(m_hWnd, &rcWindow); pt.y = rcWindow.top + rcFontbar.top; pt.x = rcWindow.left + rcColorBtn.left + static_cast<LONG>(rcColorBtn.right - rcColorBtn.left / 2); new CColorPicker(this, pt); } } else if (_tcsicmp(msg.pSender->GetName(), kBoldButtonControlName) == 0) { COptionUI* bold_button = static_cast<COptionUI*>(msg.pSender); if (bold_button != NULL) { bold_ = bold_button->IsSelected(); FontStyleChanged(); } } else if (_tcsicmp(msg.pSender->GetName(), kItalicButtonControlName) == 0) { COptionUI* italic_button = static_cast<COptionUI*>(msg.pSender); if (italic_button != NULL) { italic_ = italic_button->IsSelected(); FontStyleChanged(); } } else if (_tcsicmp(msg.pSender->GetName(), KUnderlineButtonControlName) == 0) { COptionUI* underline_button = static_cast<COptionUI*>(msg.pSender); if (underline_button != NULL) { underline_ = underline_button->IsSelected(); FontStyleChanged(); } } } else if (_tcsicmp(msg.sType, _T("itemselect")) == 0) { if (_tcsicmp(msg.pSender->GetName(), kFontTypeControlName) == 0) { CComboUI* font_type = static_cast<CComboUI*>(msg.pSender); if (font_type != NULL) { font_face_name_ = font_type->GetText(); FontStyleChanged(); } } else if (_tcsicmp(msg.pSender->GetName(), kFontSizeControlName) == 0) { CComboUI* font_size = static_cast<CComboUI*>(msg.pSender); if (font_size != NULL) { font_size_ = _ttoi(font_size->GetText()); FontStyleChanged(); } } } }
void CSettingFrame::Notify(TNotifyUI& msg) { CDuiString SenderName = msg.pSender->GetName(); if(msg.sType == _T("click")) //按钮点击事件 { if(SenderName == L"account_set") { pButton_account->SetTextColor(0x3dce3d); pButton_generic->SetTextColor(0); pButton_shortcut->SetTextColor(0); pButton_backup->SetTextColor(0); pButton_about->SetTextColor(0); if(pTabLayout) { pTabLayout->SelectItem(0); } } else if(SenderName == L"generic_set") { pButton_account->SetTextColor(0); pButton_generic->SetTextColor(0x3dce3d); pButton_shortcut->SetTextColor(0); pButton_backup->SetTextColor(0); pButton_about->SetTextColor(0); if(pTabLayout) { pTabLayout->SelectItem(1); } } else if(SenderName == L"shortcut_set") { pButton_account->SetTextColor(0); pButton_generic->SetTextColor(0); pButton_shortcut->SetTextColor(0x3dce3d); pButton_backup->SetTextColor(0); pButton_about->SetTextColor(0); if(pTabLayout) { pTabLayout->SelectItem(2); } } else if(SenderName == L"backup_set") { pButton_account->SetTextColor(0); pButton_generic->SetTextColor(0); pButton_shortcut->SetTextColor(0); pButton_backup->SetTextColor(0x3dce3d); pButton_about->SetTextColor(0); if(pTabLayout) { pTabLayout->SelectItem(3); } } else if(SenderName == L"about_set") { pButton_account->SetTextColor(0); pButton_generic->SetTextColor(0); pButton_shortcut->SetTextColor(0); pButton_backup->SetTextColor(0); pButton_about->SetTextColor(0x3dce3d); if(pTabLayout) { pTabLayout->SelectItem(4); } } } else if(msg.sType == _T("windowinit")) { OnPrepare(); } __super::Notify(msg); }
void MainFrame::Notify(TNotifyUI& msg) { if (_tcsicmp(msg.sType, _T("windowinit")) == 0) { OnPrepare(msg); } else if (_tcsicmp(msg.sType, _T("killfocus")) == 0) { if (_tcsicmp(msg.pSender->GetName(), kSignatureControlName) == 0) { msg.pSender->SetVisible(false); CControlUI* signature_tip = paint_manager_.FindControl(kSignatureTipsControlName); if (signature_tip != NULL) { CRichEditUI* signature = static_cast<CRichEditUI*>(msg.pSender); if (signature != NULL) signature_tip->SetText(signature->GetText()); signature_tip->SetVisible(true); } } else if (_tcsicmp(msg.pSender->GetName(), kSearchEditControlName) == 0) { msg.pSender->SetVisible(false); CControlUI* search_tip = static_cast<CRichEditUI*>(paint_manager_.FindControl(kSearchEditTipControlName)); if (search_tip != NULL) { CRichEditUI* search_edit = static_cast<CRichEditUI*>(msg.pSender); if (search_edit != NULL) search_tip->SetText(search_edit->GetText()); search_tip->SetVisible(true); } } } else if (_tcsicmp(msg.sType, _T("click")) == 0) { if (_tcsicmp(msg.pSender->GetName(), kCloseButtonControlName) == 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(), kHideLeftMainPannelControlName) == 0) { CControlUI* left_main_pannel = paint_manager_.FindControl(kLeftMainPannelControlName); CControlUI* hide_left_main_pannel = paint_manager_.FindControl(kHideLeftMainPannelControlName); CControlUI* show_left_main_pannel = paint_manager_.FindControl(kShowLeftMainPannelControlName); if ((left_main_pannel != NULL) && (show_left_main_pannel != NULL) && (hide_left_main_pannel != NULL)) { hide_left_main_pannel->SetVisible(false); left_main_pannel->SetVisible(false); show_left_main_pannel->SetVisible(true); } } else if (_tcsicmp(msg.pSender->GetName(), kShowLeftMainPannelControlName) == 0) { CControlUI* left_main_pannel = paint_manager_.FindControl(kLeftMainPannelControlName); CControlUI* hide_left_main_pannel = paint_manager_.FindControl(kHideLeftMainPannelControlName); CControlUI* show_left_main_pannel = paint_manager_.FindControl(kShowLeftMainPannelControlName); if ((left_main_pannel != NULL) && (show_left_main_pannel != NULL) && (hide_left_main_pannel != NULL)) { hide_left_main_pannel->SetVisible(true); left_main_pannel->SetVisible(true); show_left_main_pannel->SetVisible(false); } } else if (_tcsicmp(msg.pSender->GetName(), kSignatureTipsControlName) == 0) { msg.pSender->SetVisible(false); CRichEditUI* signature = static_cast<CRichEditUI*>(paint_manager_.FindControl(kSignatureControlName)); if (signature != NULL) { signature->SetText(msg.pSender->GetText()); signature->SetVisible(true); } } else if (_tcsicmp(msg.pSender->GetName(), kSearchEditTipControlName) == 0) { msg.pSender->SetVisible(false); CRichEditUI* search_edit = static_cast<CRichEditUI*>(paint_manager_.FindControl(kSearchEditControlName)); if (search_edit != NULL) { search_edit->SetText(msg.pSender->GetText()); search_edit->SetVisible(true); } } else if (_tcsicmp(msg.pSender->GetName(), kChangeBkSkinControlName) == 0) { CControlUI* background = paint_manager_.FindControl(kBackgroundControlName); if (background != NULL) { TCHAR szBuf[MAX_PATH] = {0}; ++bk_image_index_; if (kBackgroundSkinImageCount < bk_image_index_) bk_image_index_ = 0; #if defined(UNDER_WINCE) _stprintf(szBuf, _T("file='bg%d.png' corner='600,200,1,1'"), bk_image_index_); #else _stprintf_s(szBuf, MAX_PATH - 1, _T("file='bg%d.png' corner='600,200,1,1'"), bk_image_index_); #endif background->SetBkImage(szBuf); SkinChangedParam param; CControlUI* background = paint_manager_.FindControl(kBackgroundControlName); if (background != NULL) { param.bkcolor = background->GetBkColor(); if (_tcslen(background->GetBkImage()) > 0) { #if defined(UNDER_WINCE) _stprintf(szBuf, _T("bg%d.png"), bk_image_index_); #else _stprintf_s(szBuf, MAX_PATH - 1, _T("bg%d.png"), bk_image_index_); #endif } param.bgimage = szBuf; } skin_changed_observer_.Broadcast(param); } } else if (_tcsicmp(msg.pSender->GetName(), kChangeColorSkinControlName) == 0) { CDuiRect rcWindow; GetWindowRect(m_hWnd, &rcWindow); rcWindow.top = rcWindow.top + msg.pSender->GetPos().bottom; new ColorSkinWindow(this, rcWindow); } } else if (_tcsicmp(msg.sType, _T("timer")) == 0) { return OnTimer(msg); } else if (_tcsicmp(msg.sType, _T("selectchanged")) == 0) { CTabLayoutUI* pTabControl = static_cast<CTabLayoutUI*>(paint_manager_.FindControl(kTabControlName)); if (_tcsicmp(msg.pSender->GetName(), kFriendButtonControlName) == 0) { if (pTabControl && pTabControl->GetCurSel() != 0) { pTabControl->SelectItem(0); UpdateFriendsList(); } } else if (_tcsicmp(msg.pSender->GetName(), kGroupButtonControlName) == 0) { if (pTabControl && pTabControl->GetCurSel() != 1) { pTabControl->SelectItem(1); UpdateGroupsList(); } } else if (_tcsicmp(msg.pSender->GetName(), kMicroBlogButtonControlName) == 0) { if (pTabControl && pTabControl->GetCurSel() != 2) { pTabControl->SelectItem(2); UpdateMicroBlogList(); } } } else if (_tcsicmp(msg.sType, _T("itemactivate")) == 0) { CTabLayoutUI* pTabControl = static_cast<CTabLayoutUI*>(paint_manager_.FindControl(kTabControlName)); if (pTabControl != NULL) { if (pTabControl->GetCurSel() == 0) { CFriendsUI* pFriendsList = static_cast<CFriendsUI*>(paint_manager_.FindControl(kFriendsListControlName)); if ((pFriendsList != NULL) && pFriendsList->GetItemIndex(msg.pSender) != -1) { if (_tcsicmp(msg.pSender->GetClass(), _T("ListContainerElementUI")) == 0) { Node* node = (Node*)msg.pSender->GetTag(); CControlUI* background = paint_manager_.FindControl(kBackgroundControlName); if (!pFriendsList->CanExpand(node) && (background != NULL)) { FriendListItemInfo friend_info; for (std::vector<FriendListItemInfo>::const_iterator citer = friends_.begin(); citer != friends_.end(); ++citer) { if (_tcsicmp(citer->id.c_str(), node->data().value.c_str()) == 0) { friend_info = *citer; break; } } TCHAR szBuf[MAX_PATH] = {0}; if (_tcslen(background->GetBkImage()) > 0) { #if defined(UNDER_WINCE) _stprintf(szBuf, _T("bg%d.png"), bk_image_index_); #else _stprintf_s(szBuf, MAX_PATH - 1, _T("bg%d.png"), bk_image_index_); #endif } ChatDialog* pChatDialog = new ChatDialog(szBuf, background->GetBkColor(), myself_info_, friend_info); if( pChatDialog == NULL ) return; #if defined(WIN32) && !defined(UNDER_CE) pChatDialog->Create(NULL, _T("ChatDialog"), UI_WNDSTYLE_FRAME | WS_POPUP, NULL, 0, 0, 0, 0); #else pChatDialog->Create(NULL, _T("ChatDialog"), UI_WNDSTYLE_FRAME | WS_POPUP, NULL, 0, 0, 0, 0); #endif skin_changed_observer_.AddReceiver(pChatDialog); pChatDialog->CenterWindow(); ::ShowWindow(*pChatDialog, SW_SHOW); } } } } } } else if (_tcsicmp(msg.sType, _T("itemclick")) == 0) { CTabLayoutUI* pTabControl = static_cast<CTabLayoutUI*>(paint_manager_.FindControl(kTabControlName)); if (pTabControl != NULL) { if (pTabControl->GetCurSel() == 0) { CFriendsUI* pFriendsList = static_cast<CFriendsUI*>(paint_manager_.FindControl(kFriendsListControlName)); if ((pFriendsList != NULL) && pFriendsList->GetItemIndex(msg.pSender) != -1) { if (_tcsicmp(msg.pSender->GetClass(), _T("ListContainerElementUI")) == 0) { Node* node = (Node*)msg.pSender->GetTag(); if (pFriendsList->CanExpand(node)) { pFriendsList->SetChildVisible(node, !node->data().child_visible_); } } } } else if (pTabControl->GetCurSel() == 1) { CGroupsUI* pGroupsList = static_cast<CGroupsUI*>(paint_manager_.FindControl(kGroupsListControlName)); if ((pGroupsList != NULL) && pGroupsList->GetItemIndex(msg.pSender) != -1) { if (_tcsicmp(msg.pSender->GetClass(), _T("ListContainerElementUI")) == 0) { Node* node = (Node*)msg.pSender->GetTag(); if (pGroupsList->CanExpand(node)) { pGroupsList->SetChildVisible(node, !node->data().child_visible_); } } } } } } }
void CZiMainFrame::Notify(TNotifyUI & msg) { if(msg.sType == _T("windowinit")) { OnPrepare(msg); } else if(msg.sType == _T("killfocus")) { OnKillFocus(msg); } else if (msg.sType == _T("setfocus")) { /* int a= 1; if (msg.pSender->GetName() == _T("SearchCombo")) { CComboUI * pSearchCombo = DuiControl(CComboUI, _T("SearchCombo")); pSearchCombo->Activate(); } */ } else if(msg.sType == _T("return")) { DuiClickButtonMap(_T("SearchEdit"), OnReturnSearch); } else if(msg.sType == _T("click")) { DuiClickButtonMap(_T("MinBtn"), OnClickMin); DuiClickButtonMap(_T("CloseBtn"), OnClickClose); DuiClickButtonMap(_T("SearchTip"), OnClickMatchButton); DuiClickButtonMap(_T("SettingBtn"), OnClickSettingButton); DuiClickButtonMap(_T("SearchBtn"), OnClickSearchButton); } else if(msg.sType == _T("selectchanged")) { // tab 切换. ( friends 和 group ) OnSelectTab(msg); } else if(msg.sType == _T("itemselect")) { // search item click. OnSelectSearch(msg); } else if(msg.sType == _T("itemclick")) { // List . OnSelectItemList(msg); } else if(msg.sType == _T("itemactivate")) { // 增加 select 响应双击操作. OnItemChat(msg); OnSelectItemList(msg); } else if(msg.sType == _T("menu")) { // 右键支持 //char szLog[256] = {0}; //sprintf(szLog, "Class: %ws, Name = %ws\n", // msg.pSender->GetClass(), msg.pSender->GetName()); //::OutputDebugStringA(szLog); DuiClickButtonMap(_T("FriendsList"), OnClickRightButton); DuiClickButtonMap(_T("GroupsList"), OnClickRightButton); } else if(msg.sType == _T("menuclick")) { // 右键点击 //char szLog[256] = {0}; //sprintf(szLog, "Class: %ws, Name = %ws\n", // msg.pSender->GetClass(), msg.pSender->GetName() // ); //::OutputDebugStringA(szLog); DuiClickMenuMap(Event_OpenItem, OnClickRightMenu); DuiClickMenuMap(Event_ModifyItem, OnClickRightMenu); DuiClickMenuMap(Event_DeleteItem, OnClickRightMenu); DuiClickMenuMap(Event_CreateGroup, OnCreateGroup); } }
void ChatDialog::Notify(TNotifyUI& msg) { if (_tcsicmp(msg.sType, _T("windowinit")) == 0) { OnPrepare(msg); } else if (_tcsicmp(msg.sType, _T("killfocus")) == 0) { } else if (_tcsicmp(msg.sType, _T("click")) == 0) { if (_tcsicmp(msg.pSender->GetName(), kCloseButtonControlName) == 0) { OnExit(msg); } else if (_tcsicmp(msg.pSender->GetName(), kMinButtonControlName) == 0) { SendMessage(WM_SYSCOMMAND, SC_MINIMIZE, 0); } else if (_tcsicmp(msg.pSender->GetName(), kMaxButtonControlName) == 0) { SendMessage(WM_SYSCOMMAND, SC_MAXIMIZE, 0); } else if (_tcsicmp(msg.pSender->GetName(), kRestoreButtonControlName) == 0) { SendMessage(WM_SYSCOMMAND, SC_RESTORE, 0); } else if (_tcsicmp(msg.pSender->GetName(), kFontButtonControlName) == 0) { CContainerUI* pFontbar = static_cast<CContainerUI*>(paint_manager_.FindControl(kFontbarControlName)); if (pFontbar != NULL) pFontbar->SetVisible(!pFontbar->IsVisible()); } else if (_tcsicmp(msg.pSender->GetName(), kEmotionButtonControlName) == 0) { POINT pt = {0}; CDuiRect rcEmotionBtn = msg.pSender->GetPos(); CDuiRect rcWindow; GetWindowRect(m_hWnd, &rcWindow); pt.y = rcWindow.top + rcEmotionBtn.top; pt.x = rcWindow.left + rcEmotionBtn.left; //emotion_list_window_.SelectEmotion(pt); new CEmotion(this,pt); } else if (_tcsicmp(msg.pSender->GetName(), kSendButtonControlName) == 0) { CRichEditUI* pRichEdit = static_cast<CRichEditUI*>(paint_manager_.FindControl(kInputRichEditControlName)); CRichEditUI* pViewEdit = static_cast<CRichEditUI*>(paint_manager_.FindControl(kViewRichEditControlName)); if( pRichEdit == NULL ) return; pRichEdit->SetFocus(); CDuiString sText = pRichEdit->GetTextRange(0, pRichEdit->GetTextLength()); //CDuiString sText=pRichEdit->GetEditGifStr(); if( sText.IsEmpty() ) return; int textlen = sText.GetLength(); if (textlen > 512) { pViewEdit->SetTextColor(RGB(255,0,0)); pViewEdit->SetText(_T("错误!发送数据的长度不能超过512字节。")); } else { int imNum = friend_.id; TCHAR sendmesg[513] = {0}; _stprintf_s(sendmesg,512,_T("%s"),sText.GetData()); int len = strlen(sendmesg); if (len !=textlen) { pViewEdit->SetTextColor(RGB(255,0,0)); pViewEdit->SetText(_T("警告!发送数据的长度和计算的不同。")); } frame_wnd_->m_pTcpCommunication->SendMsg(MSG_TYPE_FRIEND,imNum,sendmesg,textlen); //显示在 SendMsg(g_myself_info.nick_name,sText); pRichEdit->SetText(_T("")); //test //CDuiString strbmp; //strbmp.Format("c:\\1.gif"); //pRichEdit->InsertGif(strbmp); } } } else if( _tcsicmp(msg.sType, _T("return")) == 0 ) { if (_tcsicmp(msg.pSender->GetName(), kInputRichEditControlName) == 0) { CRichEditUI* pRichEdit = static_cast<CRichEditUI*>(paint_manager_.FindControl(kInputRichEditControlName)); CRichEditUI* pViewEdit = static_cast<CRichEditUI*>(paint_manager_.FindControl(kViewRichEditControlName)); if( pRichEdit == NULL ) return; pRichEdit->SetFocus(); CDuiString sText = pRichEdit->GetTextRange(0, pRichEdit->GetTextLength()); if( sText.IsEmpty() ) return; int textlen = sText.GetLength(); if (textlen > 512) { pViewEdit->SetTextColor(RGB(255,0,0)); pViewEdit->SetText(_T("错误!发送数据的长度不能超过512字节。")); } else { int imNum = friend_.id; TCHAR sendmesg[513] = {0}; _stprintf_s(sendmesg,512,_T("%s"),sText.GetData()); int len = strlen(sendmesg); if (len !=textlen) { pViewEdit->SetTextColor(RGB(255,0,0)); pViewEdit->SetText(_T("警告!发送数据的长度和计算的不同。")); } frame_wnd_->m_pTcpCommunication->SendMsg(MSG_TYPE_FRIEND,imNum,sendmesg,textlen); //显示在 SendMsg(g_myself_info.nick_name,sText); pRichEdit->SetText(_T("")); } } } else if (_tcsicmp(msg.sType, _T("timer")) == 0) { return OnTimer(msg); } else if (_tcsicmp(msg.sType, _T("selectchanged")) == 0) { if (_tcsicmp(msg.pSender->GetName(), kColorButtonControlName) == 0) { CContainerUI* pFontbar = static_cast<CContainerUI*>(paint_manager_.FindControl(kFontbarControlName)); if (pFontbar != NULL) { POINT pt = {0}; CDuiRect rcFontbar = pFontbar->GetPos(); CDuiRect rcColorBtn = msg.pSender->GetPos(); CDuiRect rcWindow; GetWindowRect(m_hWnd, &rcWindow); pt.y = rcWindow.top + rcFontbar.top; pt.x = rcWindow.left + rcColorBtn.left + static_cast<LONG>(rcColorBtn.right - rcColorBtn.left / 2); new CColorPicker((ChatDialog*)this, pt); } } else if (_tcsicmp(msg.pSender->GetName(), kBoldButtonControlName) == 0) { COptionUI* bold_button = static_cast<COptionUI*>(msg.pSender); if (bold_button != NULL) { bold_ = bold_button->IsSelected(); FontStyleChanged(); } } else if (_tcsicmp(msg.pSender->GetName(), kItalicButtonControlName) == 0) { COptionUI* italic_button = static_cast<COptionUI*>(msg.pSender); if (italic_button != NULL) { italic_ = italic_button->IsSelected(); FontStyleChanged(); } } else if (_tcsicmp(msg.pSender->GetName(), KUnderlineButtonControlName) == 0) { COptionUI* underline_button = static_cast<COptionUI*>(msg.pSender); if (underline_button != NULL) { underline_ = underline_button->IsSelected(); FontStyleChanged(); } } } else if (_tcsicmp(msg.sType, _T("itemselect")) == 0) { if (_tcsicmp(msg.pSender->GetName(), kFontTypeControlName) == 0) { CComboUI* font_type = static_cast<CComboUI*>(msg.pSender); if (font_type != NULL) { font_face_name_ = font_type->GetText(); FontStyleChanged(); } } else if (_tcsicmp(msg.pSender->GetName(), kFontSizeControlName) == 0) { CComboUI* font_size = static_cast<CComboUI*>(msg.pSender); if (font_size != NULL) { font_size_ = _ttoi(font_size->GetText()); FontStyleChanged(); } } } }
void ChatDialog::Notify(TNotifyUI& msg) { if (_tcsicmp(msg.sType, _T("windowinit")) == 0) { OnPrepare(msg); InitWindow(); } else if (_tcsicmp(msg.sType, _T("killfocus")) == 0) { } else if (_tcsicmp(msg.sType, _T("click")) == 0) { if (_tcsicmp(msg.pSender->GetName(), _T("shockbtn"))==0) { theApp->ShakeToWho(friend_); } else if (_tcsicmp(msg.pSender->GetName(), _T("trans_file"))==0) { OnTransFile(msg); } else if (_tcsicmp(msg.pSender->GetName(), _T("empty_richedit")) == 0) { int lSelBegin,lSelEnd; lSelEnd = lSelBegin = m_pMsgView->GetTextLength(); m_pMsgView->SetSel(0, lSelEnd);//选择全部 m_pMsgView->ReplaceSel(_T(""), false); } else if (_tcsicmp(msg.pSender->GetName(), kCloseButtonControlName) == 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*>(GetPaintMgr()->FindControl(kMaxButtonControlName)); if( pControl ) pControl->SetVisible(false); pControl = static_cast<CControlUI*>(GetPaintMgr()->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*>(GetPaintMgr()->FindControl(kMaxButtonControlName)); if( pControl ) pControl->SetVisible(true); pControl = static_cast<CControlUI*>(GetPaintMgr()->FindControl(kRestoreButtonControlName)); if( pControl ) pControl->SetVisible(false); #else SendMessage(WM_SYSCOMMAND, SC_RESTORE, 0); #endif } else if (_tcsicmp(msg.pSender->GetName(), kFontButtonControlName) == 0) { CContainerUI* pFontbar = static_cast<CContainerUI*>(GetPaintMgr()->FindControl(kFontbarControlName)); if (pFontbar != NULL) pFontbar->SetVisible(!pFontbar->IsVisible()); } else if (_tcsicmp(msg.pSender->GetName(), kEmotionButtonControlName) == 0) { POINT pt = {0}; CDuiRect rcEmotionBtn = msg.pSender->GetPos(); RECT rcWindow; GetWindowRect( &rcWindow ); pt.y = rcWindow.top + rcEmotionBtn.top; pt.x = rcWindow.left + rcEmotionBtn.left; //emotion_list_window_.SelectEmotion(pt); } else if (_tcsicmp(msg.pSender->GetName(), kSendButtonControlName) == 0) { SendMsg(); } } else if( _tcsicmp(msg.sType, _T("return")) == 0 ) { if (_tcsicmp(msg.pSender->GetName(), kInputRichEditControlName) == 0) { SendMsg(); } } else if (_tcsicmp(msg.sType, _T("timer")) == 0) { return OnTimer(msg); } else if (_tcsicmp(msg.sType, _T("selectchanged")) == 0) { if (_tcsicmp(msg.pSender->GetName(), kColorButtonControlName) == 0) { // CContainerUI* pFontbar = static_cast<CContainerUI*>(GetPaintMgr()->FindControl(kFontbarControlName)); // if (pFontbar != NULL) // { // POINT pt = {0}; // CDuiRect rcFontbar = pFontbar->GetPos(); // CDuiRect rcColorBtn = msg.pSender->GetPos(); // RECT rcWindow; // GetWindowRect( &rcWindow); // // pt.y = rcWindow.top + rcFontbar.top; // pt.x = rcWindow.left + rcColorBtn.left + static_cast<LONG>(rcColorBtn.right - rcColorBtn.left / 2); // new CColorPicker(this, pt); // } static CHOOSECOLOR cc; static COLORREF crCustCoLors[16]; cc.lStructSize=sizeof(CHOOSECOLOR); cc.hwndOwner= this->m_hWnd; cc.hInstance=NULL; cc.rgbResult = RGB(0,0,0); cc.lpCustColors=crCustCoLors; cc.Flags=CC_RGBINIT|CC_FULLOPEN | CC_ANYCOLOR; cc.lCustData=0; cc.lpfnHook=NULL; cc.lpTemplateName=NULL; if(TRUE == ChooseColor(&cc)) { TCHAR szBuf[MAX_PATH] = {0}; #if defined(UNDER_CE) _stprintf(szBuf, _T("FF%02X%02X%02X"), GetRValue(cc.rgbResult), GetGValue(cc.rgbResult), GetBValue(cc.rgbResult)); #else _stprintf_s(szBuf, MAX_PATH - 1, _T("FF%02X%02X%02X"), GetRValue(cc.rgbResult), GetGValue(cc.rgbResult), GetBValue(cc.rgbResult)); #endif LPTSTR pstr = NULL; text_color_ = _tcstoul(szBuf, &pstr, 16); } } else if (_tcsicmp(msg.pSender->GetName(), kBoldButtonControlName) == 0) { COptionUI* bold_button = static_cast<COptionUI*>(msg.pSender); if (bold_button != NULL) { bold_ = bold_button->IsSelected(); FontStyleChanged(); } } else if (_tcsicmp(msg.pSender->GetName(), kItalicButtonControlName) == 0) { COptionUI* italic_button = static_cast<COptionUI*>(msg.pSender); if (italic_button != NULL) { italic_ = italic_button->IsSelected(); FontStyleChanged(); } } else if (_tcsicmp(msg.pSender->GetName(), KUnderlineButtonControlName) == 0) { COptionUI* underline_button = static_cast<COptionUI*>(msg.pSender); if (underline_button != NULL) { underline_ = underline_button->IsSelected(); FontStyleChanged(); } } } else if (_tcsicmp(msg.sType, _T("itemselect")) == 0) { if (_tcsicmp(msg.pSender->GetName(), kFontTypeControlName) == 0) { CComboUI* font_type = static_cast<CComboUI*>(msg.pSender); if (font_type != NULL) { font_face_name_ = font_type->GetText(); FontStyleChanged(); } } else if (_tcsicmp(msg.pSender->GetName(), kFontSizeControlName) == 0) { CComboUI* font_size = static_cast<CComboUI*>(msg.pSender); if (font_size != NULL) { font_size_ = _ttoi(font_size->GetText()); FontStyleChanged(); } } } }
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); dwError = GetLastError(); } RestartSpoolsv(); EnumInstalledDriver(); if (IDYES == DUIMessageBox(m_hWnd, _T("注意:您需要重新启动计算机使设置生效,现在需要重启计算机吗?点击“是”立即重启计算机,点击“否”稍后您自己手动重启计算机。"), _T("重新启动计算机"), MB_YESNO)) SystemReboot(); } } else if (_tcsicmp(msg.sType, kTimer) == 0) { return OnTimer(msg); } }