TreeTable::~TreeTable() { SetTreeTableModel(NULL); for (int32 i = CountColumns() - 1; i >= 0; i--) RemoveColumn(ColumnAt(i)); }
void ListView1::SaveAllStates() { BMessage *msg=new BMessage(); SaveState(msg); switch(CDMode) { case DATACD_INDEX: { ((Application1 *)be_app)->CM->SetMessage(DATA_CD_LIST_STATE, msg); break; } case AUDIOCD_INDEX: { ((Application1 *)be_app)->CM->SetMessage(AUDIO_CD_LIST_STATE, msg); break; } case BOOTABLECD_INDEX: { ((Application1 *)be_app)->CM->SetMessage(BOOTABLE_CD_LIST_STATE, msg); break; } case CDEXTRA_INDEX: { ((Application1 *)be_app)->CM->SetMessage(CD_EXTRA_LIST_STATE, msg); break; } case DVDVIDEO_INDEX: { ((Application1 *)be_app)->CM->SetMessage(DVD_VIDEO_LIST_STATE, msg); break; } default: break; } for (int32 i=0; i<CountColumns(); i++) { //SetColumnVisible(ColumnAt(i), false); } }
void ListView1::SetAudioCDList() { while (CountRows()>0) RemoveRow(0); while (CountColumns()>0) { BColumn *col=ColumnAt(0); //SetColumnVisible(col, true); RemoveColumn(col);/* switch(col->LogicalFieldNum()) { case FILENAME_FIELD: { ((Application1 *)be_app)->CM->SetInt16(FILENAMECOLUMN_WIDTH, (int16)col->Width()); break; } case SIZE_FIELD: { ((Application1 *)be_app)->CM->SetInt16(SIZECOLUMN_WIDTH, (int16)col->Width()); break; } default: { break; } }*/ delete col; } SetSortingEnabled(false); AddColumn(new BIntegerColumn(_T("Track"), // "TRACKNUMBERCOLUMN_TITLE" 30.0, 30.0, 55.0, B_ALIGN_RIGHT), TRACKNUMBER_FIELD); AddColumn(new BStringColumn(_T("Pause"), // "PREGAPCOLUMN_TITLE" 50.0, 50.0, 50.0,1, B_ALIGN_RIGHT), PREGAP_FIELD); AddColumn(new BStringColumn(_T("File name"), // "TRACKNAMECOLUMN_TITLE" 120.0, 60.0, 900.0,0), TRACKNAME_FIELD); AddColumn(new BStringColumn(_T("Duration"), // "LENGTHCOLUMN_TITLE" 80.0, 70.0, 90.0,0, B_ALIGN_RIGHT), LENGTH_FIELD); AddColumn(new BSizeColumn(_T("Size"), // "BYTESCOLUMN_TITLE" 50.0, 30.0, 70.0,B_ALIGN_RIGHT), BYTES_FIELD); AddColumn(new BStringColumn(_T("Indices"), // "INDEXCOLUMN_TITLE" 120.0, 50.0, 250.0,0), INDEX_FIELD); AddColumn(new BStringColumn(_T("CD text"), // "CDTEXTCOLUMN_TITLE" 120.0, 50.0, 250.0,0), CDTEXT_FIELD); for (int32 i=0; i<CountColumns(); i++) { SetColumnVisible(ColumnAt(i), true); } for (int32 i=0; i<CountColumns(); i++) { SetColumnVisible(ColumnAt(i), false); } for (int32 i=0; i<CountColumns(); i++) { SetColumnVisible(ColumnAt(i), true); } }
void ListView1::SetListMode(int32 mode) { /* if (((CDMode==DATACD_INDEX) || (CDMode==BOOTABLECD_INDEX) || (CDMode==DVDVIDEO_INDEX)) && ((mode==DATACD_INDEX) || (mode==BOOTABLECD_INDEX) || (mode==DVDVIDEO_INDEX))) return; if (((CDMode==AUDIOCD_INDEX) || (CDMode==CDEXTRA_INDEX)) && ((mode==AUDIOCD_INDEX) || (mode==CDEXTRA_INDEX))) return; */ // save old state SaveAllStates(); CDMode=mode; switch(mode) { case DATACD_INDEX: { SetDataCDList(); if (((Application1 *)be_app)->CM->HasData(DATA_CD_LIST_STATE)) LoadState(((Application1 *)be_app)->CM->GetMessage(DATA_CD_LIST_STATE)); break; } case AUDIOCD_INDEX: { SetAudioCDList(); if (((Application1 *)be_app)->CM->HasData(AUDIO_CD_LIST_STATE)) LoadState(((Application1 *)be_app)->CM->GetMessage(AUDIO_CD_LIST_STATE)); break; } case BOOTABLECD_INDEX: { SetDataCDList(); if (((Application1 *)be_app)->CM->HasData(BOOTABLE_CD_LIST_STATE)) LoadState(((Application1 *)be_app)->CM->GetMessage(BOOTABLE_CD_LIST_STATE)); break; } case CDEXTRA_INDEX: { SetAudioCDList(); if (((Application1 *)be_app)->CM->HasData(CD_EXTRA_LIST_STATE)) LoadState(((Application1 *)be_app)->CM->GetMessage(CD_EXTRA_LIST_STATE)); break; } case DVDVIDEO_INDEX: { SetDataCDList(); if (((Application1 *)be_app)->CM->HasData(DVD_VIDEO_LIST_STATE)) LoadState(((Application1 *)be_app)->CM->GetMessage(DVD_VIDEO_LIST_STATE)); break; } default: break; } for (int32 i=0; i<CountColumns(); i++) { SetColumnVisible(ColumnAt(i), true); } for (int32 i=0; i<CountColumns(); i++) { SetColumnVisible(ColumnAt(i), false); } for (int32 i=0; i<CountColumns(); i++) { SetColumnVisible(ColumnAt(i), true); } SelectionChanged(); Window1 *window1=(Window1 *)Window(); ((BButton *)window1->view1->iconBAR->ChildViewAt("bar_parent"))->SetEnabled((mode==DATACD_INDEX)||(mode==BOOTABLECD_INDEX)||(mode==DVDVIDEO_INDEX)); ((BButton *)window1->view1->iconBAR->ChildViewAt("bar_newfolder"))->SetEnabled((mode==DATACD_INDEX)||(mode==BOOTABLECD_INDEX)||(mode==DVDVIDEO_INDEX)); ((BTextControl *)window1->view1->iconBAR->ChildViewAt("bar_path"))->SetEnabled((mode==DATACD_INDEX)||(mode==BOOTABLECD_INDEX)||(mode==DVDVIDEO_INDEX)); }
void ListView1::SetDataCDList() { while (CountRows()>0) RemoveRow(0); while (CountColumns()>0) { BColumn *col=ColumnAt(0); //SetColumnVisible(col, true); RemoveColumn(col); /* switch(col->LogicalFieldNum()) { case TRACKNUMBER_FIELD: { ((Application1 *)be_app)->CM->SetInt16(TRACKNUMBERCOLUMN_WIDTH, (int16)col->Width()); break; } case TRACKNAME_FIELD: { ((Application1 *)be_app)->CM->SetInt16(TRACKNAMECOLUMN_WIDTH, (int16)col->Width()); break; } case LENGTH_FIELD: { ((Application1 *)be_app)->CM->SetInt16(LENGTHCOLUMN_WIDTH, (int16)col->Width()); break; } case BYTES_FIELD: { ((Application1 *)be_app)->CM->SetInt16(BYTESCOLUMN_WIDTH, (int16)col->Width()); break; } case INDEX_FIELD: { ((Application1 *)be_app)->CM->SetInt16(INDEXCOLUMN_WIDTH, (int16)col->Width()); break; } case CDTEXT_FIELD: { ((Application1 *)be_app)->CM->SetInt16(CDTEXTCOLUMN_WIDTH, (int16)col->Width()); break; } default: { break; } } */ delete col; } SetSortingEnabled(true); AddColumn(new BBitmapColumn(_T("Icon"), // "FILEICONCOLUMN_TITLE" 18.0,18.0,18.0, B_ALIGN_CENTER), ICON_FIELD); AddColumn(new BFileColumn(_T("File name"), // "FILENAMECOLUMN_TITLE" 200.0, 60.0, 900.0,0), FILENAME_FIELD); AddColumn(new BSizeColumn(_T("Size"), // "SIZECOLUMN_TITLE" 50.0, 20.0, 120.0,B_ALIGN_RIGHT), SIZE_FIELD); ColumnAt(FILENAME_FIELD)->SetEditFlags(B_EDIT_EXIT_RETURN); ColumnAt(FILENAME_FIELD)->SetColumnFlags(ColumnAt(FILENAME_FIELD)->GetColumnFlags() | B_ALLOW_COLUMN_EDIT); ColumnAt(ICON_FIELD)->SetColumnFlags(B_ALLOW_COLUMN_NONE); ColumnAt(ICON_FIELD)->SetShowHeading(false); SetSortColumn(ColumnAt(FILENAME_FIELD), false, true); for (int32 i=0; i<CountColumns(); i++) { SetColumnVisible(ColumnAt(i), true); } for (int32 i=0; i<CountColumns(); i++) { SetColumnVisible(ColumnAt(i), false); } for (int32 i=0; i<CountColumns(); i++) { SetColumnVisible(ColumnAt(i), true); } }
/*-------------------------------------------------------------------- FUNCTION: AlignControls(); RETURNS: <void> PURPOSE: Performs the alignment of the extra controls. --------------------------------------------------------------------*/ void CTreePropertySheet::AlignControls() { int nTotalHeight_TopPane=GetHeight(m_anRowHeight_TopPane); int nTotalHeight_BottomPane=GetHeight(m_anRowHeight_BottomPane); int nVertArrange; int nMaxWidth=0; CRect rcClient; GetClientRect(&rcClient); // Determine the maximum width of all rows for(nVertArrange=tps_above;nVertArrange<=tps_below;nVertArrange++) { int nRow,nRows; CArray<cRowInfo,cRowInfo&>& pane=(nVertArrange==tps_above)? m_anRowHeight_TopPane: m_anRowHeight_BottomPane; nRows =pane.GetSize(); for(nRow=0;nRow<nRows;nRow++) { int nWidth; nWidth =GetWidth(nVertArrange,nRow); nMaxWidth =max(nWidth,nMaxWidth); } } // Get the maximum of the actual dialog width and 'nMaxWidth' // (to get the overall width) nMaxWidth =max(rcClient.Width(),nMaxWidth); // Align the controls' width (to make those with 'width' is -1 // equally spaced) for(nVertArrange=tps_above;nVertArrange<=tps_below;nVertArrange++) { int nRow,nRows; CArray<cRowInfo,cRowInfo&>& pane=(nVertArrange==tps_above)? m_anRowHeight_TopPane: m_anRowHeight_BottomPane; nRows =pane.GetSize(); for(nRow=0;nRow<nRows;nRow++) { int nWidth; nWidth =GetWidth(nVertArrange,nRow); AssignFillerSpace(nVertArrange,nRow,nMaxWidth-nWidth); } } // Resize the dialog AddPaneSpace(nMaxWidth, nTotalHeight_TopPane, nTotalHeight_BottomPane); // Calculate each controls' position CRect rcPage; GetPage(0)->GetWindowRect(&rcPage); ScreenToClient(&rcPage); int nCurXPos; int nCurYPos; int nTopPos; if(m_bSpecialCaption) nTopPos =m_nCaptionHeight; else nTopPos =0; for(nVertArrange=tps_above;nVertArrange<=tps_below;nVertArrange++) { int nRow,nRows; CArray<cRowInfo,cRowInfo&>& pane=(nVertArrange==tps_above)? m_anRowHeight_TopPane: m_anRowHeight_BottomPane; nRows =pane.GetSize(); if(nVertArrange==tps_above) nCurYPos=nTopPos; else nCurYPos=rcPage.bottom+m_nSpaceBottom; for(nRow=0;nRow<nRows;nRow++) { int nCol,nCols; nCols =CountColumns(nVertArrange,nRow); nCurXPos =0; for(nCol=0;nCol<nCols;nCol++) { cControlPos *pCur=GetControl(nVertArrange,nRow,nCol); pCur->rcFinalPos.left =nCurXPos; pCur->rcFinalPos.right =nCurXPos+pCur->nWidth; pCur->rcFinalPos.top =nCurYPos+pane[nRow].nExtraTop; pCur->rcFinalPos.bottom =nCurYPos+pane[nRow].nHeight+pane[nRow].nExtraTop; PlaceControl(pCur); nCurXPos +=pCur->nWidth; } nCurYPos +=pane[nRow].nHeight+pane[nRow].nExtraBottom+pane[nRow].nExtraTop; } } if(m_bSpecialCaption) { CRect rcTemp; GetWindowRect(&rcTemp); m_rcCaptionBar.top =0; m_rcCaptionBar.left =0; m_rcCaptionBar.bottom=m_nCaptionHeight; m_rcCaptionBar.right=rcTemp.Width(); } else { m_rcCaptionBar.left =m_nSpaceLeft+m_nTreeWidth+m_nSpaceMid; m_rcCaptionBar.top =m_nSpaceTop+nTotalHeight_TopPane; m_rcCaptionBar.right =rcPage.right; m_rcCaptionBar.bottom =m_nSpaceTop+nTotalHeight_TopPane+m_nCaptionHeight; } }