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(); }
void CSysOptionUI::Selected() { if(!m_pWnd){ m_bSelected = true; return; } if(IsSelected()) return; ::SendMessage(*m_pWnd, BM_SETCHECK, BST_CHECKED, 0); if( m_pManager != NULL ) { if( !m_sGroupName.IsEmpty() ) { if( true ) { CStdPtrArray* aOptionGroup = m_pManager->GetOptionGroup(m_sGroupName); for( int i = 0; i < aOptionGroup->GetSize(); i++ ) { auto pControl = static_cast<CSysOptionUI*>(aOptionGroup->GetAt(i)); if( pControl != this && pControl->m_pWnd) { ::SendMessage(pControl->m_pWnd->GetHWND(), BM_SETCHECK, BST_UNCHECKED, 0); } } m_pManager->SendNotify(this, DUI_MSGTYPE_SELECTCHANGED); } } else { m_pManager->SendNotify(this, DUI_MSGTYPE_SELECTCHANGED); } } }
CStdPtrArray::CStdPtrArray(const CStdPtrArray& src) : m_ppVoid(NULL), m_nCount(0), m_nAllocated(0) { for(int i=0; i<src.GetSize(); i++) Add(src.GetAt(i)); }