HRESULT CRomList::OnRescanRoms( char *szPath, BOOL& bHandled ) { DeleteItems(0, m_ListData.size()); strcpy(szRoms, "GAME:\\ROMS\\"); strcat(szRoms, "*.*"); m_ListData.clear(); HANDLE hFind; WIN32_FIND_DATAA oFindData; hFind = FindFirstFile(szRoms, &oFindData); if (hFind != INVALID_HANDLE_VALUE) { do { m_ListData.push_back(_strlwr(oFindData.cFileName)); } while (FindNextFile(hFind, &oFindData)); std::sort(m_ListData.begin(),m_ListData.end()); } InsertItems( 0, m_ListData.size() ); bHandled = TRUE; return( S_OK ); }
HRESULT CXlinkBuddyList::LoadBuddyList(void) { // Our list is swapping, let's block out changes bIsLoaded = false; // Refresh our copy of the arena item CKaiBuddyManager::getInstance().getBuddyInfo(&m_pBuddyList); CKaiBuddyManager::getInstance().getBuddyLookupInfo(&m_BuddyNames); int nSize = m_nCurrentListSize = (int)m_pBuddyList.size(); // Local Variables unsigned int nCurrentSel = 0; unsigned int nCurrentTop = 0; // Set our current selection if( nSize > 0 && GetCurSel() == -1 ) nCurrentSel = 0; else nCurrentSel = GetCurSel(); // Set our top most item nCurrentTop = GetTopItem(); // Now let's clear our entire list, so we can update it DeleteItems(0, GetItemCount()); // Now let's add in our new list items if( nSize > 0 ) { InsertItems( 0, nSize ); if( bInitializeList == true ) { nCurrentTop = 0; bInitializeList = false; } else if( (int)nCurrentTop > nSize ) { nCurrentTop = nSize; } } // Restore list position SetTopItem(nCurrentTop); SetCurSel(nCurrentSel); // Notify that the list has been loaded if(nSize > 0 ) bIsLoaded = true; // Return Successfully return S_OK; }
HRESULT CGamesList::OnSetListContent(FSDMessageSetListContent * pSetListContent, BOOL &bHandled ) { // Unpack the message and store into local vector m_vListContent = pSetListContent->pVec; if(m_vListContent != NULL) SetListSize((int)m_vListContent->size()); // Local variables used unsigned int nCurrentSel = 0; int nCurrentTop = 0; // If interested, save current list position for later use if(pSetListContent->bRetainSelection){ if(GetListSize() > 0 && GetCurSel() == -1) nCurrentSel = 0; else nCurrentSel = GetCurSel(); nCurrentTop = GetTopItem(); if (nCurrentTop == -1) nCurrentTop = 0; } // Clear the current list and prepare the list to use a new data vector DeleteItems(0, GetItemCount()); if(pSetListContent->pVec != NULL){ InsertItems(0, pSetListContent->pVec->size()); if( nCurrentTop > pSetListContent->pVec->size() ) nCurrentTop = pSetListContent->pVec->size(); } // Restore list position SetTopItem(nCurrentTop); SetCurSel(nCurrentSel); if(pSetListContent->pVec != NULL) GameContentManager::getInstance().RefreshCurrentContent(m_CurrentGame, nCurrentSel, pSetListContent->pVec->size()); // Return Successfully bHandled = TRUE; return S_OK; }
BOOL EXTreeCtrl::PopulateItem(HTREEITEM hParent) { IXTreeItem *pItem = NULL; if (hParent == TVI_ROOT && m_pRootMember != NULL) // TOP FRAME { pItem = m_pRootMember; } else { pItem = (IXTreeItem *)GetItemData(hParent); } SetPopulationCount(0, 0); InsertItems(hParent,pItem); // set to full SetPopulationCount(1, 1); return TRUE; }
HRESULT CAchievementList::OnInit(XUIMessageInit *pInitData, BOOL& bHandled) { DebugMsg("AchievementList","AchievementList Init"); AchievementIconPaths.szMissingAchievementIcon = strtowstr(AchievementManager::getInstance().GetAchievementSetting("MISSINGACHIEVEMENTPATH")); m_sListState = GameContentManager::getInstance().getGameListSnapshot(false); if(m_sListState.CurrentGame == NULL) return S_OK; wstring szGameID = m_sListState.CurrentGame->ContentRef->getId(); m_AchievementList.ListSize = AchievementManager::getInstance().GetAchievementCount(szGameID); AchievementManager::getInstance().CreateAchievementList(szGameID); InsertItems( 0, m_AchievementList.ListSize); DebugMsg("AchievementList","%d Items inserted into list", m_AchievementList.ListSize); SetCurSel(0); return S_OK; }
//##ModelId=474D30580139 BOOL COptionFriends::OnInitDialog() { CPropertyPage::OnInitDialog(); m_pParent = (COptionsSheet *)GetParent(); m_List.SetExtendedStyle(LVS_EX_FULLROWSELECT); InitListCtrlCols(); InsertItems(); m_SendRecieve.SetCheck(CGetSetOptions::GetLogSendReceiveErrors()); m_bDisableRecieve.SetCheck(CGetSetOptions::GetDisableRecieve()); m_PlaceOnClipboard = g_Opt.m_csIPListToPutOnClipboard; m_csPassword = g_Opt.m_csPassword; m_csAdditionalPasswords = CGetSetOptions::GetExtraNetworkPassword(false); UpdateData(FALSE); theApp.m_Language.UpdateOptionFriends(this); return FALSE; }
EDA_LIST_DIALOG::EDA_LIST_DIALOG( EDA_DRAW_FRAME* aParent, const wxString& aTitle, const wxArrayString& aItemHeaders, const std::vector<wxArrayString>& aItemList, const wxString& aSelection, void( *aCallBackFunction )( wxString&, void* ), void* aCallBackFunctionData, bool aSortList ) : EDA_LIST_DIALOG_BASE( aParent, wxID_ANY, aTitle ) { m_sortList = aSortList; m_cb_func = aCallBackFunction; m_cb_data = aCallBackFunctionData; m_itemsListCp = &aItemList; for( unsigned i = 0; i < aItemHeaders.Count(); i++ ) { wxListItem column; column.SetId( i ); column.SetText( aItemHeaders.Item( i ) ); m_listBox->InsertColumn( i, column ); } InsertItems( aItemList, 0 ); if( m_cb_func == NULL ) { m_messages->Show( false ); m_staticTextMsg->Show( false ); } for( unsigned col = 0; col < aItemHeaders.Count(); ++col ) { m_listBox->SetColumnWidth( col, wxLIST_AUTOSIZE ); #if !wxCHECK_VERSION( 2, 9, 0 ) // include the column header in the width decision, wx 2.8 forgets this: wxListItem col_info; m_listBox->GetColumn( col, col_info ); wxString header = col_info.GetText(); int headerz = GetTextSize( header, m_listBox ).x; // A reasonable column header has about 14 pixels of whitespace // in addition to the width of the text itself. headerz += 14; if( headerz > col_info.GetWidth() ) { col_info.SetWidth( headerz ); m_listBox->SetColumn( col, col_info ); } #endif } #if !wxCHECK_VERSION( 2, 9, 0 ) // wx 2.8.x has bug in wxListCtrl WRT honoring the omission of wxHSCROLL, at least // on gtk2. Fix by setting minimum width so horizontal wxListCtrl scrolling is // not needed on 2.8.x because of minumum visible width setting: { int width = 0; for( unsigned col = 0; col < aItemHeaders.Count(); ++col ) { width += m_listBox->GetColumnWidth( col ) + 2; } wxSize sz = m_listBox->GetSize(); sz.SetWidth( width ); m_listBox->SetMinSize( sz ); } #endif Fit(); Centre(); if( !!aSelection ) { for( unsigned row = 0; row < aItemList.size(); ++row ) { if( aItemList[row][0] == aSelection ) { m_listBox->SetItemState( row, wxLIST_STATE_SELECTED, wxLIST_STATE_SELECTED ); m_listBox->EnsureVisible( row ); break; } } } // DIALOG_SHIM needs a unique hash_key because classname is not sufficient // because so many dialogs share this same class, with different numbers of // columns, different column names, and column widths. m_hash_key = TO_UTF8( aTitle ); m_filterBox->SetFocus(); }