PersonView::PersonView(const char* name, const char* categoryAttribute, const entry_ref *ref) : BGridView(), fLastModificationTime(0), fGroups(NULL), fControls(20, false), fCategoryAttribute(categoryAttribute), fPictureView(NULL), fSaving(false) { SetName(name); SetFlags(Flags() | B_WILL_DRAW); fRef = ref; BFile* file = NULL; if (fRef != NULL) file = new BFile(fRef, B_READ_ONLY); // Add picture "field", using ID photo 35mm x 45mm ratio fPictureView = new PictureView(70, 90, ref); BGridLayout* layout = GridLayout(); float spacing = be_control_look->DefaultItemSpacing(); layout->SetInsets(spacing, spacing, spacing, spacing); layout->AddView(fPictureView, 0, 0, 1, 5); layout->ItemAt(0, 0)->SetExplicitAlignment( BAlignment(B_ALIGN_CENTER, B_ALIGN_TOP)); if (file != NULL) file->GetModificationTime(&fLastModificationTime); delete file; }
void PartitionsPage::PageCompleted() { BGridLayout* layout = (BGridLayout*)fPartitions->GetLayout(); int32 index = 0; for (int32 row = 0; row < layout->CountRows(); row += 3, index++) { BCheckBox* showBox = dynamic_cast<BCheckBox*>(layout->ItemAt(0, row)->View()); BTextControl* nameControl = dynamic_cast<BTextControl*>(layout->ItemAt(1, row)->View()); if (nameControl == NULL || showBox == NULL) debugger("partitions page is broken"); BMessage partition; if (fSettings->FindMessage("partition", index, &partition) != B_OK) continue; partition.ReplaceBool("show", showBox->Value() != 0); partition.ReplaceString("name", nameControl->Text()); fSettings->ReplaceMessage("partition", index, &partition); } }