InfoWindow: allow some resizing of attribute columns

Fixes #15319
This commit is contained in:
Adrien Destugues
2019-08-31 17:18:22 +02:00
parent 349ab0050a
commit 72ce594753
+12 -7
View File
@@ -21,25 +21,30 @@ int kTypeColumn = 2;
AttributesView::AttributesView(Model* model) AttributesView::AttributesView(Model* model)
: :
BGroupView(B_VERTICAL, 0), BGroupView(B_VERTICAL, 0),
fListView(new BColumnListView("attrs", 0, B_PLAIN_BORDER)) fListView(new BColumnListView("attrs", 0, B_PLAIN_BORDER, false))
{ {
SetName("Attributes"); SetName("Attributes");
AddChild(fListView); AddChild(fListView);
float nameWidth = StringWidth("SYS:PACKAGE_FILE") + 16; float nameWidth = StringWidth("SYS:PACKAGE_FILE") + 16;
float typeWidth = StringWidth("Double-precision floating point number") + 16; float typeMaxWidth = StringWidth("Double-precision floating point number") + 16;
float valueWidth = StringWidth("W") * 64 + 16; float typeWidth = StringWidth("64-bit unsigned integer") + 16;
float valueMaxWidth = StringWidth("W") * 64 + 16;
float valueWidth = StringWidth("(94.00, 95.00) (1920, 1080)") + 16;
BStringColumn* nameColumn = new BStringColumn("Name", nameWidth, nameWidth, BStringColumn* nameColumn = new BStringColumn("Name", nameWidth, nameWidth,
nameWidth, nameWidth); nameWidth, 0);
BStringColumn* typeColumn = new BStringColumn("Type", typeWidth, typeWidth, BStringColumn* typeColumn = new BStringColumn("Type", typeWidth, typeWidth,
typeWidth, typeWidth); typeMaxWidth, 0);
BStringColumn* valueColumn = new BStringColumn("Value", valueWidth, BStringColumn* valueColumn = new BStringColumn("Value", valueWidth,
valueWidth, valueWidth, valueWidth); valueWidth, valueMaxWidth, 0);
fListView->AddColumn(nameColumn, 0); fListView->AddColumn(nameColumn, 0);
fListView->AddColumn(valueColumn, 1); fListView->AddColumn(valueColumn, 1);
fListView->AddColumn(typeColumn, 2); fListView->AddColumn(typeColumn, 2);
SetExplicitMinSize(BSize(typeWidth + valueWidth + nameWidth + 40,
B_SIZE_UNSET));
BNode* node = model->Node(); BNode* node = model->Node();
node->RewindAttrs(); node->RewindAttrs();
@@ -134,7 +139,7 @@ AttributesView::AttributesView(Model* model)
if (info.size == sizeof(BRect)) { if (info.size == sizeof(BRect)) {
BRect value; BRect value;
node->ReadAttr(name, info.type, 0, &value, sizeof(value)); node->ReadAttr(name, info.type, 0, &value, sizeof(value));
representation.SetToFormat("(%f,%f) (%f,%f)", value.left, representation.SetToFormat("(%g,%g) (%g,%g)", value.left,
value.top, value.right, value.bottom); value.top, value.right, value.bottom);
} else { } else {
representation.SetToFormat("<%" B_PRIdOFF " rectangles>", representation.SetToFormat("<%" B_PRIdOFF " rectangles>",