Right align Add and Remove buttons

This commit is contained in:
John Scipione
2013-04-27 19:40:21 -04:00
parent 56fe9fad23
commit c00d064252
+11 -9
View File
@@ -1956,25 +1956,27 @@ void
FindPanel::SetUpAddRemoveButtons(BBox* box) FindPanel::SetUpAddRemoveButtons(BBox* box)
{ {
BButton* removeButton = dynamic_cast<BButton*>(box->FindView("remove")); BButton* removeButton = dynamic_cast<BButton*>(box->FindView("remove"));
if (removeButton == NULL) { if (removeButton != NULL) {
BButton* addButton = new BButton("add", B_TRANSLATE("Add"), removeButton->SetEnabled(fAttrGrid->CountRows() > 1);
new BMessage(kAddItem)); return;
addButton->SetTarget(this); }
removeButton = new BButton("remove", B_TRANSLATE("Remove"), removeButton = new BButton("remove", B_TRANSLATE("Remove"),
new BMessage(kRemoveItem)); new BMessage(kRemoveItem));
removeButton->SetEnabled(false); removeButton->SetEnabled(false);
removeButton->SetTarget(this); removeButton->SetTarget(this);
BButton* addButton = new BButton("add", B_TRANSLATE("Add"),
new BMessage(kAddItem));
addButton->SetTarget(this);
BGroupLayout* layout = dynamic_cast<BGroupLayout*>(box->GetLayout()); BGroupLayout* layout = dynamic_cast<BGroupLayout*>(box->GetLayout());
BLayoutBuilder::Group<>(layout) BLayoutBuilder::Group<>(layout)
.AddGroup(B_HORIZONTAL) .AddGroup(B_HORIZONTAL)
.Add(addButton) .AddGlue()
.Add(removeButton) .Add(removeButton)
.AddGlue(); .Add(addButton)
} .End();
// enable remove button as needed
removeButton->SetEnabled(fAttrGrid->CountRows() > 1);
} }