virtual void getView(int position, SWindow * pItem, pugi::xml_node xmlTemplate) { int nViewType = getItemViewType(position); if(pItem->GetChildrenCount() == 0) { pugi::xml_node xmlItem; switch(nViewType) { case VT_GROUP: xmlItem = xmlTemplate.child(L"item_group");break; case VT_DATA: xmlItem = xmlTemplate.child(L"item_data");break; } pItem->InitFromXml(xmlItem); } if(nViewType == VT_GROUP) { SToggle * pSwitch=pItem->FindChildByID2<SToggle>(R.id.tgl_tv_expand); pSwitch->SetToggle(position==0?m_bCurrentExpand:m_bExpiredExpand); pSwitch->GetEventSet()->subscribeEvent(EVT_CMD,Subscriber(&CStudentAdapter::OnBtnGroupExpand,this)); pItem->FindChildByID(R.id.txt_group)->SetWindowText(TR(GETSTRING(position==0?R.string.current_student:R.string.expired_student),L"")); pItem->GetEventSet()->subscribeEvent(EVT_ITEMPANEL_DBCLICK,Subscriber(&CStudentAdapter::OnGroupDblClick,this)); SCheckBox *pGroupCheck = pItem->FindChildByID2<SCheckBox>(R.id.chk_select_group); pGroupCheck->GetEventSet()->subscribeEvent(EVT_STATECHANGED,Subscriber(&CStudentAdapter::OnGroupSelectCheckChanged,this)); pGroupCheck->GetEventSet()->setMutedState(true); pGroupCheck->SetCheck(position==0?m_bAllCurrentChecked:m_bAllExpiredChecked); pGroupCheck->GetEventSet()->setMutedState(false); }else { int nBaseCurrent = 1; int nBaseExpired = 1 + (m_bCurrentExpand?m_stuCurrent.GetCount():0) + 1; if(position< nBaseExpired) {//current student StudentInfo & stuInfo = m_stuCurrent[position-nBaseCurrent]; SCheckBox *pCheckBox = pItem->FindChildByID2<SCheckBox>(R.id.txt_nick); pCheckBox->GetEventSet()->subscribeEvent(EVT_STATECHANGED,Subscriber(&CStudentAdapter::OnStudentCheckChanged,this)); pCheckBox->GetEventSet()->setMutedState(true); pCheckBox->SetCheck(stuInfo.bChecked); pCheckBox->GetEventSet()->setMutedState(false); pCheckBox->SetWindowText(SStringT().Format(_T("%s(%u)"),stuInfo.strNick,stuInfo.imid)); pItem->FindChildByID(R.id.txt_loyal_degree)->SetWindowText(SStringT().Format(_T("%d"),stuInfo.nLoyalDegree)); pItem->FindChildByID(R.id.txt_time_span)->SetWindowText(stuInfo.tm1.Format(_T("%Y/%m/%d") + SStringT(_T(" - ")) + stuInfo.tm2.Format(_T("%Y/%m/%d")))); }else {//expired student StudentInfo & stuInfo = m_stuExpired[position-nBaseExpired]; SCheckBox *pCheckBox = pItem->FindChildByID2<SCheckBox>(R.id.txt_nick); pCheckBox->GetEventSet()->subscribeEvent(EVT_STATECHANGED,Subscriber(&CStudentAdapter::OnStudentCheckChanged,this)); pCheckBox->GetEventSet()->setMutedState(true); pCheckBox->SetCheck(stuInfo.bChecked); pCheckBox->GetEventSet()->setMutedState(false); pCheckBox->SetWindowText(SStringT().Format(_T("%s(%u)"),stuInfo.strNick,stuInfo.imid)); pItem->FindChildByID(R.id.txt_loyal_degree)->SetWindowText(SStringT().Format(_T("%d"),stuInfo.nLoyalDegree)); pItem->FindChildByID(R.id.txt_time_span)->SetWindowText(stuInfo.tm1.Format(_T("%Y/%m/%d") + SStringT(_T(" - ")) + stuInfo.tm2.Format(_T("%Y/%m/%d")))); } } }
Subscriber MsgMarketDepthTopDiff::GetSubscriber(SymbolIdType eSymbolId, PushType ePushType) { QJsonObject js; js.insert(szAttributeName[AN_SYMBOLID], szSymbolIdType[eSymbolId]); js.insert(szAttributeName[AN_PUSHTYPE], szPushType[ePushType]); return Subscriber(MsgType(), js); }
void SPropertyItemColor::OnInplaceActive(bool bActive) { SPropertyItemText::OnInplaceActive(bActive); if(bActive) { LRESULT lr=m_pEdit->SSendMessage(EM_SETEVENTMASK,0,ENM_CHANGE); m_pEdit->GetEventSet()->subscribeEvent(EventRENotify::EventID,Subscriber(&SPropertyItemColor::OnReNotify,this)); } }
BOOL SSpinButtonCtrl::CreateChildren(pugi::xml_node xmlNode) { if(!__super::CreateChildren(xmlNode)) return FALSE; m_btnUp = FindChildByName(KBTN_UP); m_btnDown = FindChildByName(KBTN_DOWN); SASSERT(m_btnUp &&m_btnDown); if(!m_btnDown || !m_btnUp) return FALSE; m_btnUp->SetAttribute(L"focusable",L"0"); m_btnDown->SetAttribute(L"focusable",L"0"); m_btnUp->GetEventSet()->subscribeEvent(EventCmd::EventID,Subscriber(&SSpinButtonCtrl::OnUpDownClick,this)); m_btnDown->GetEventSet()->subscribeEvent(EventCmd::EventID,Subscriber(&SSpinButtonCtrl::OnUpDownClick,this)); OnValueChanged(); return TRUE; }
BOOL SFlyWnd::CreateChildren( pugi::xml_node xmlNode ) { BOOL bRet = SWindow::CreateChildren(xmlNode); if(!bRet) return FALSE; SToggle *pSwitch = FindChildByName2<SToggle>(NAME_SWITCH); if(pSwitch) { pSwitch->GetEventSet()->subscribeEvent(EventCmd::EventID,Subscriber(&SFlyWnd::OnSwitchClick,this)); } return TRUE; }
BOOL SSearchDropdownList::CreateChildren(pugi::xml_node xmlNode) { BOOL bRet = __super::CreateChildren(xmlNode); if(!bRet) return FALSE; SEdit *pEdit = FindChildByName2<SEdit>(KName_SearchEdit); if(!pEdit) { return FALSE; } pEdit->SSendMessage(EM_SETEVENTMASK,0,ENM_CHANGE); pEdit->GetEventSet()->subscribeEvent(EVT_RE_NOTIFY,Subscriber(&SSearchDropdownList::OnEditNotify,this)); m_xmlDropdown.append_copy(xmlNode.child(KNode_PopupStyle)); return TRUE; }
void CFolderScanHandler::OnInit(SWindow *pRoot) { m_pPageRoot = pRoot->FindChildByName(L"page_folderscan"); SASSERT(m_pPageRoot); SWindow *pEditDir = m_pPageRoot->FindChildByName(L"edit_dir"); SASSERT(pEditDir); IDropTarget *pDT = new CDropTarget(this); m_pPageRoot->GetContainer()->RegisterDragDrop(pEditDir->GetSwnd(),pDT); pDT->Release(); m_pTreelist = m_pPageRoot->FindChildByName2<SFolderTreeList>(L"tree_dir"); SASSERT(m_pTreelist); m_pTreelist->GetFolderTreeCtrl()->GetEventSet()->subscribeEvent(EventTCDbClick::EventID,Subscriber(&CFolderScanHandler::OnTreeDbclick,this)); }