Tweak preferences layout

This commit is contained in:
Jaidyn Ann 2021-05-30 22:04:45 -05:00
parent 70c6001189
commit ca2e05915d
4 changed files with 13 additions and 20 deletions

View File

@ -8,8 +8,7 @@
#include <Button.h> #include <Button.h>
#include <ControlLook.h> #include <ControlLook.h>
#include <GroupLayout.h> #include <LayoutBuilder.h>
#include <GroupLayoutBuilder.h>
#include <ListView.h> #include <ListView.h>
#include <PopUpMenu.h> #include <PopUpMenu.h>
#include <ScrollView.h> #include <ScrollView.h>
@ -73,24 +72,22 @@ PreferencesAccounts::PreferencesAccounts()
ToolButton* proto = new ToolButton("Add", NULL); ToolButton* proto = new ToolButton("Add", NULL);
proto->SetMenu(fProtosMenu); proto->SetMenu(fProtosMenu);
fDelButton = new ToolButton("Del", new BMessage(kDelAccount)); fDelButton = new BButton("Del", new BMessage(kDelAccount));
fEditButton = new ToolButton("Edit...", new BMessage(kEditAccount)); fEditButton = new BButton("Edit" B_UTF8_ELLIPSIS, new BMessage(kEditAccount));
fDelButton->SetEnabled(false); fDelButton->SetEnabled(false);
fEditButton->SetEnabled(false); fEditButton->SetEnabled(false);
const float spacing = be_control_look->DefaultItemSpacing(); BLayoutBuilder::Group<>(this, B_VERTICAL)
.SetInsets(B_USE_DEFAULT_SPACING)
SetLayout(new BGroupLayout(B_HORIZONTAL, spacing));
AddChild(BGroupLayoutBuilder(B_VERTICAL)
.Add(scrollView) .Add(scrollView)
.AddGroup(B_HORIZONTAL, spacing) .AddGroup(B_HORIZONTAL)
.SetInsets(0, 0, 0, 15)
.Add(proto) .Add(proto)
.Add(fDelButton) .Add(fDelButton)
.AddGlue() .AddGlue()
.Add(fEditButton) .Add(fEditButton)
.End() .End()
.SetInsets(spacing, spacing, spacing, spacing) .End();
);
} }

View File

@ -24,8 +24,8 @@ public:
private: private:
BListView* fListView; BListView* fListView;
BPopUpMenu* fProtosMenu; BPopUpMenu* fProtosMenu;
ToolButton* fDelButton; BButton* fDelButton;
ToolButton* fEditButton; BButton* fEditButton;
void _LoadListView(ProtocolSettings* settings); void _LoadListView(ProtocolSettings* settings);

View File

@ -32,15 +32,12 @@ PreferencesDialog::PreferencesDialog()
BButton* ok = new BButton("OK", new BMessage(kApply)); BButton* ok = new BButton("OK", new BMessage(kApply));
const float spacing = be_control_look->DefaultItemSpacing();
BLayoutBuilder::Group<>(this, B_VERTICAL) BLayoutBuilder::Group<>(this, B_VERTICAL)
.Add(tabView) .Add(tabView)
.AddGroup(B_HORIZONTAL) .AddGroup(B_HORIZONTAL)
.AddGlue() .AddGlue()
.Add(ok) .Add(ok)
.SetInsets(spacing, spacing, 0, 0) .End();
.End()
.SetInsets(spacing, spacing, spacing, spacing);
CenterOnScreen(); CenterOnScreen();
} }
@ -57,3 +54,5 @@ PreferencesDialog::MessageReceived(BMessage* msg)
BWindow::MessageReceived(msg); BWindow::MessageReceived(msg);
} }
} }

View File

@ -37,7 +37,6 @@ ToolButton::ToolButton(const char* name, const char* label,
fMenu(NULL), fMenu(NULL),
fPreferredSize(-1, -1) fPreferredSize(-1, -1)
{ {
SetFontSize(be_plain_font->Size() * 0.85f);
} }
@ -49,7 +48,6 @@ ToolButton::ToolButton(const char* label, BMessage* message)
fMenu(NULL), fMenu(NULL),
fPreferredSize(-1, -1) fPreferredSize(-1, -1)
{ {
SetFontSize(be_plain_font->Size() * 0.85f);
} }
@ -60,7 +58,6 @@ ToolButton::ToolButton(BMessage* archive)
fMenu(NULL), fMenu(NULL),
fPreferredSize(-1, -1) fPreferredSize(-1, -1)
{ {
SetFontSize(be_plain_font->Size() * 0.85f);
} }