already_AddRefed<Element> BoxObject::GetParentBox() { nsCOMPtr<nsIDOMElement> el; GetParentBox(getter_AddRefs(el)); nsCOMPtr<Element> ret(do_QueryInterface(el)); return ret.forget(); }
void nsSplitterFrame::GetInitialOrientation(bool& aIsHorizontal) { nsIFrame* box = GetParentBox(); if (box) { aIsHorizontal = !box->IsHorizontal(); } else nsBoxFrame::GetInitialOrientation(aIsHorizontal); }
NS_IMETHODIMP nsSplitterFrame::DoLayout(nsBoxLayoutState& aState) { if (GetStateBits() & NS_FRAME_FIRST_REFLOW) { mInner->mParentBox = GetParentBox(); mInner->UpdateState(); } return nsBoxFrame::DoLayout(aState); }
void CActivityAreaCtrl::UpdateSel( CActivityBox *pSelectedBox ,bool bForceShowAll) { RETURN_ON_REENTRY; wxBusyCursor busycursor; if(pSelectedBox == NULL) { pSelectedBox = m_pLastSelectedBox; } else m_pLastSelectedBox = pSelectedBox; if ( !pSelectedBox ) { if ( wxGetApp().Prefs.bShowAllSongs == 1 ) { wxGetApp().Library.GetAllSongs( g_thePlaylist ); g_PlaylistBox->SetPlaylist( &g_thePlaylist); } return; } //-------------------------------------// //--- which box are we? ---// //--- and which are the other ones? ---// //-------------------------------------// CActivityBox *pOtherBoxes[ActivityBoxesMaxCount-1]; memset( pOtherBoxes ,0,sizeof(pOtherBoxes)); for(size_t i = 0 ; i < ActivityBoxesMaxCount;i++) { if ( pSelectedBox == m_ActivityBox[i] ) { size_t k = 0; if ( wxGetApp().Prefs.eSelStyle == MUSIK_SELECTION_TYPE_NORMAL ) { for(size_t j = i+1 ; j < ActivityBoxesMaxCount; j++) { pOtherBoxes[k] = m_ActivityBox[j]; k++; } } else { // assign not selected boxes to pOtherBoxes array for(size_t j = 0 ; j < WXSIZEOF(pOtherBoxes);j++) { if(k == i) { k++; } if(k > ActivityBoxesMaxCount-1) k = 0; pOtherBoxes[j] = m_ActivityBox[k++]; } } break; } } //-------------------------------------------------// //--- if we're showing unsel, find which is the ---// //--- parent and which are children, if there ---// //--- is no parent already. ---// //-------------------------------------------------// if ( wxGetApp().Prefs.eSelStyle == MUSIK_SELECTION_TYPE_STANDARD || wxGetApp().Prefs.eSelStyle == MUSIK_SELECTION_TYPE_NORMAL ) { if(GetParentBox() == NULL) SetParent( pSelectedBox , false ); } if ( wxGetApp().Prefs.eSelStyle == MUSIK_SELECTION_TYPE_STANDARD || wxGetApp().Prefs.eSelStyle == MUSIK_SELECTION_TYPE_SLOPPY || wxGetApp().Prefs.eSelStyle == MUSIK_SELECTION_TYPE_NORMAL ) { //---------------------------------------------------// //--- if we're hiding unselected entries ---// //--- and reset is clicked or nothing is selected ---// //--- reset all the boxes ---// //---------------------------------------------------// if ( pSelectedBox->IsSelected( 0 ) || pSelectedBox->GetSelectedItemCount() == 0 ) { SetParent( NULL, false ); pSelectedBox->ResetContents(RCM_EnsureVisibilityOfCurrentTopItem); // ensure visibility of top item before reset for(size_t j = 0 ; j < WXSIZEOF(pOtherBoxes);j++) { if ( pOtherBoxes[j] != NULL ) pOtherBoxes[j]->ResetContents(); } if ( wxGetApp().Prefs.bShowAllSongs == 1) { wxGetApp().Library.GetAllSongs( g_thePlaylist ); g_PlaylistBox->SetPlaylist( &g_thePlaylist); return; } else if ( !bForceShowAll &&(pSelectedBox->IsSelected( 0 ) || pSelectedBox->GetSelectedItemCount() == 0 )) { g_thePlaylist.Clear(); g_PlaylistBox->SetPlaylist(&g_thePlaylist); return; } } //-----------------------------------------------// //--- if we're hiding unselected entries ---// //--- and a valid item is clicked, update the ---// //--- other controls with the right values ---// //-----------------------------------------------// else if ( !pSelectedBox->IsSelected( 0 ) && pSelectedBox->GetSelectedItemCount() > 0 ) { if(bForceShowAll) { SetParent( pSelectedBox , false ); pSelectedBox->ResetContents(RCM_PreserveSelectedItems); // ensure visiblility of top item before reset } wxArrayString temp_list; if ( ( wxGetApp().Prefs.eSelStyle == MUSIK_SELECTION_TYPE_STANDARD && GetParentBox() == pSelectedBox ) || wxGetApp().Prefs.eSelStyle == MUSIK_SELECTION_TYPE_NORMAL || wxGetApp().Prefs.eSelStyle == MUSIK_SELECTION_TYPE_SLOPPY ) { for(size_t j = 0 ; j < WXSIZEOF(pOtherBoxes);j++) { if ( pOtherBoxes[j] != NULL ) { pOtherBoxes[j]->GetRelatedList(pSelectedBox , temp_list ); pOtherBoxes[j]->SetContents( temp_list ); } } } } pSelectedBox->SetPlaylist(); } else if ( wxGetApp().Prefs.eSelStyle == MUSIK_SELECTION_TYPE_HIGHLIGHT) { //-------------------------------------------// //--- if we're showing unselected entries ---// //--- and no items are selected, unselect ---// //--- all the corresponding items ---// //-------------------------------------------// if(pSelectedBox->GetSelectedItemCount() == 0) { pSelectedBox->SelectNone(); for(size_t j = 0 ; j < WXSIZEOF(pOtherBoxes);j++) { if ( pOtherBoxes[j] != NULL ) pOtherBoxes[j]->SelectNone(); } if ( wxGetApp().Prefs.bShowAllSongs == 1 ) { wxGetApp().Library.GetAllSongs( g_thePlaylist ); g_PlaylistBox->SetPlaylist(&g_thePlaylist); return; } } else { //----------------------------------------------------// //--- if we're showing unselected entries ---// //--- and one or more items are selected, select ---// //--- all the corresponding items ---// //----------------------------------------------------// wxArrayString rel; wxArrayString all; wxListItem item; int n; for(size_t j = 0 ; j < WXSIZEOF(pOtherBoxes);j++) { if ( pOtherBoxes[j] != NULL ) { pOtherBoxes[j]->GetRelatedList( pSelectedBox, rel ); pOtherBoxes[j]->GetFullList( all ); if ( all.GetCount() > 0 ) { for ( size_t i = 0; i < rel.GetCount(); i++ ) { n = FindStrInArray( &all, rel.Item( i ) ); if ( n != (size_t)-1 ) { all.RemoveAt( n ); all.Insert( rel.Item( i ), i ); } } pOtherBoxes[j]->SetRelated( rel.GetCount() ); pOtherBoxes[j]->SetContents( all ); } } } pSelectedBox->SetRelated( -1 ); pSelectedBox->Update( false ); pSelectedBox->SetPlaylist(); } } }