Skip to content

Commit

Permalink
Scheduled transactions: Tweak layout
Browse files Browse the repository at this point in the history
* Simplified to use group layout.

* Adjust the Payee column to its widest entry.

* Fix typo.
  • Loading branch information
humdingerb committed May 26, 2024
1 parent c278629 commit 0595691
Showing 1 changed file with 13 additions and 12 deletions.
25 changes: 13 additions & 12 deletions src/ScheduleListWindow.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,6 @@ class ScheduleListView : public BView {

BButton* fRemoveButton;
BList fTransList;
HelpButton* fHelpButton;

float fBestWidth;
};
Expand Down Expand Up @@ -75,28 +74,28 @@ ScheduleListView::ScheduleListView(const char* name, const int32& flags)
fListView->AddColumn(new BStringColumn(B_TRANSLATE("Frequency"),
StringWidth(B_TRANSLATE("Frequency")) + 20, 25, 300, B_ALIGN_LEFT),
3);
fListView->AddColumn(new BStringColumn(B_TRANSLATE("Next Ppyment"),
fListView->AddColumn(new BStringColumn(B_TRANSLATE("Next Payment"),
StringWidth(B_TRANSLATE("Next payment")) + 20, 25, 300, B_ALIGN_LEFT),
4);

float maxwidth = RefreshScheduleList();
fBestWidth = (fRemoveButton->Frame().Width() * 2) + 45;
fBestWidth = MAX(fBestWidth, maxwidth + 35);

fHelpButton =
HelpButton* helpButton =
new HelpButton(B_TRANSLATE("Help: Scheduled transaction"), "Scheduled Transaction.txt");

// clang-format off
BLayoutBuilder::Group<>(this, B_VERTICAL)
.SetInsets(15, 15)
.AddGrid(1.0f, 1.0f)
.Add(fListView, 0, 0, 3)
.AddGrid(1.0f, 1.0f, 0, 1, 3)
.AddGlue(0, 0)
.Add(fHelpButton, 1, 0)
.Add(fRemoveButton, 2, 0)
.End()
.End()
.SetInsets(B_USE_DEFAULT_SPACING)
.Add(fListView)
.AddGroup(B_HORIZONTAL)
.AddGlue()
.Add(helpButton)
.Add(fRemoveButton)
.End()
.End();
// clang-format on
}


Expand Down Expand Up @@ -255,6 +254,8 @@ ScheduleListView::RefreshScheduleList(void)
row->SetField(new BStringField(string.String()), 4);
}

fListView->ColumnAt(0)->SetWidth(maxwidth + 30);

return fListView->PreferredSize().Width();
}

Expand Down

0 comments on commit 0595691

Please sign in to comment.