BSize PartitionListView::PreferredSize() { // Remove default size for parameters + partition type column BSize size = BColumnListView::PreferredSize(); size.width -= ColumnAt(kParametersColumn)->Width() + ColumnAt(kPartitionTypeColumn)->Width(); return size; }
TreeTable::~TreeTable() { SetTreeTableModel(NULL); for (int32 i = CountColumns() - 1; i >= 0; i--) RemoveColumn(ColumnAt(i)); }
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 PackageListView::AllAttached() { BColumnListView::AllAttached(); SetSortingEnabled(true); SetSortColumn(ColumnAt(0), false, true); }
/*********************************************************** * Destructor ***********************************************************/ HListView::~HListView() { HPrefs* prefs = ((HApp*)be_app)->Prefs(); for (int16 i = 1; i <= 6; i++) { CLVColumn* col = ColumnAt(i); BString name = "col"; name << (int32)i; int16 width = static_cast<int16>(col->Width()); prefs->SetData(name.String(), width); } SetInvocationMessage(NULL); SetSelectionMessage(NULL); }
bool TreeTable::GetToolTipAt(BPoint point, BToolTip** _tip) { if (fToolTipProvider == NULL) return AbstractTable::GetToolTipAt(point, _tip); // get the table row BRow* row = RowAt(point); if (row == NULL) return AbstractTable::GetToolTipAt(point, _tip); TreeTableRow* treeRow = dynamic_cast<TreeTableRow*>(row); // get the table column BColumn* column = ColumnAt(point); int32 columnIndex = column != NULL ? column->LogicalFieldNum() : -1; TreeTablePath path; _GetPathForNode(treeRow->Node(), path); return fToolTipProvider->GetToolTipForTablePath(path, columnIndex, _tip); }
void TeamListView::SetShownColumns(int32 mask) { CLVColumn *col; col = ColumnAt(name_ndx); col->SetShown(mask & Options::name_col); col = ColumnAt(id_ndx); col->SetShown(mask & Options::id_col); col = ColumnAt(state_ndx); col->SetShown(mask & Options::state_col); col = ColumnAt(priority_ndx); col->SetShown(mask & Options::priority_col); col = ColumnAt(areas_ndx); col->SetShown(mask & Options::memory_col); col = ColumnAt(CPU_ndx); col->SetShown(mask & Options::cpu_col); }
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); } }
void ColumnListView::MouseDown(BPoint point) { int prevColumn = _selectedColumn; int32 numberOfColumns = fColumnDisplayList.CountItems(); float xleft = point.x; for(int32 Counter = 0; Counter < numberOfColumns; Counter++) { CLVColumn* Column = (CLVColumn*)fColumnDisplayList.ItemAt(Counter); if(Column->IsShown()) { if (xleft > 0) { xleft -= Column->Width(); if (xleft <= 0) { SetSelectedColumnIndex(GetActualIndexOf(Counter)); break; } } } } int32 ItemIndex = IndexOf(point); if(ItemIndex >= 0) { CLVListItem* ClickedItem = (CLVListItem*)BListView::ItemAt(ItemIndex); if(ClickedItem->fSuperItem) if(ClickedItem->fExpanderButtonRect.Contains(point)) { if(ClickedItem->IsExpanded()) Collapse(ClickedItem); else Expand(ClickedItem); return; } } // If it's a right-click, hoist up the popup-menu const char * selectedText = NULL; CLVColumn * col = ColumnAt(_selectedColumn); if (col) { BPopUpMenu * popup = col->GetPopup(); if (popup) { BMessage * msg = Window()->CurrentMessage(); int32 buttons; if ((msg->FindInt32("buttons", &buttons) == B_NO_ERROR)&&(buttons == B_SECONDARY_MOUSE_BUTTON)) { BPoint where(point); Select(IndexOf(where)); ConvertToScreen(&where); BMenuItem * result = popup->Go(where, false); if (result) selectedText = result->Label(); } } } int prevRow = CurrentSelection(); BListView::MouseDown(point); int curRow = CurrentSelection(); if ((_editMessage != NULL)&&((selectedText)||((_selectedColumn == prevColumn)&&(curRow == prevRow)))) { // Send mouse message... BMessage temp(*_editMessage); temp.AddInt32("column", _selectedColumn); temp.AddInt32("row", CurrentSelection()); if (selectedText) temp.AddString("text", selectedText); else temp.AddInt32("mouseClick", 0); _editTarget.SendMessage(&temp); } }