MCPcopy Create free account
hub / github.com/SOUI2/soui / SetSel

Method SetSel

SOUI/src/control/STileView.cpp:771–836  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

769}
770
771void STileView::SetSel(int iItem, BOOL bNotify)
772{
773 if(!m_adapter)
774 {
775 return;
776 }
777
778 if(iItem >= m_adapter->getCount())
779 {
780 return;
781 }
782
783 if(iItem < 0)
784 {
785 iItem = -1;
786 }
787
788 int nOldSel = m_iSelItem;
789 int nNewSel = iItem;
790
791 m_iSelItem = nNewSel;
792 if(bNotify)
793 {
794 EventLVSelChanging evt(this);
795 evt.bCancel = FALSE;
796 evt.iOldSel = nOldSel;
797 evt.iNewSel = nNewSel;
798 FireEvent(evt);
799 if(evt.bCancel)
800 {
801 //Cancel SetSel and restore selection state
802 m_iSelItem = nOldSel;
803 return;
804 }
805 }
806
807 if(nOldSel == nNewSel)
808 {
809 return;
810 }
811
812 m_iSelItem = nOldSel;
813 SItemPanel *pItem = GetItemPanel(nOldSel);
814 if(pItem)
815 {
816 pItem->GetFocusManager()->ClearFocus();
817 pItem->ModifyItemState(0, WndState_Check);
818 RedrawItem(pItem);
819 }
820 m_iSelItem = nNewSel;
821 pItem = GetItemPanel(nNewSel);
822 if(pItem)
823 {
824 pItem->ModifyItemState(WndState_Check, 0);
825 RedrawItem(pItem);
826 }
827
828 if(bNotify)

Callers

nothing calls this directly

Calls 3

ClearFocusMethod · 0.80
ModifyItemStateMethod · 0.80
getCountMethod · 0.45

Tested by

no test coverage detected