Debugger: fix empty button on alerts with only 2 buttons

When no debuginfo is available from packages, the alert has only two
buttons. This was not handled correctly, leading to a small empty button
being present.

Change-Id: I44de1101f7cd539da5c582eaf34bb1476aa9ab20
Reviewed-on: https://review.haiku-os.org/c/haiku/+/6462
Reviewed-by: waddlesplash <[email protected]>
This commit is contained in:
PulkoMandy
2023-05-20 14:52:26 +00:00
committed by waddlesplash
parent 6a06a56256
commit 217bbbf423
@@ -68,13 +68,28 @@ AlertWithCheckbox::AlertWithCheckbox(const char* title, const char* messageText,
message->SetExplicitMinSize(BSize(width, B_SIZE_UNSET));
}
fDontAskAgain = new BCheckBox("checkbox",
checkboxLabel, NULL);
fDontAskAgain = new BCheckBox("checkbox", checkboxLabel, NULL);
BButton* button1 = new BButton(label1, label1, new BMessage(kButton1Message));
BButton* button2 = new BButton(label2, label2, new BMessage(kButton2Message));
BButton* button3 = new BButton(label3, label3, new BMessage(kButton3Message));
button1->MakeDefault(true);
BGroupView* buttonGroup = new BGroupView(B_HORIZONTAL);
BLayoutBuilder::Group<> layoutBuilder(buttonGroup);
layoutBuilder.AddGlue();
if (label1) {
BButton* button = new BButton(label1, label1, new BMessage(kButton1Message));
button->MakeDefault(true);
layoutBuilder.Add(button);
}
if (label2) {
BButton* button = new BButton(label2, label2, new BMessage(kButton2Message));
layoutBuilder.Add(button);
}
if (label3) {
BButton* button = new BButton(label3, label3, new BMessage(kButton3Message));
layoutBuilder.Add(button);
}
BLayoutBuilder::Group<>(this)
.AddGroup(B_HORIZONTAL)
@@ -86,12 +101,7 @@ AlertWithCheckbox::AlertWithCheckbox(const char* title, const char* messageText,
.Add(fDontAskAgain)
.AddGlue()
.End()
.AddGroup(B_HORIZONTAL)
.AddGlue()
.Add(button1)
.Add(button2)
.Add(button3)
.End()
.Add(buttonGroup)
.End()
.End();