Make Shortcuts prefs window resizable
Use layoutmanagement aware c'tors and SetExplicitMaxSize(). Fixes #12849.
This commit is contained in:
@@ -114,9 +114,7 @@ ShortcutsWindow::ShortcutsWindow()
|
|||||||
{
|
{
|
||||||
ShortcutsSpec::InitializeMetaMaps();
|
ShortcutsSpec::InitializeMetaMaps();
|
||||||
|
|
||||||
float spacing = be_control_look->DefaultItemSpacing();
|
BMenuBar* menuBar = new BMenuBar("Menu Bar");
|
||||||
|
|
||||||
BMenuBar* menuBar = new BMenuBar(BRect(0, 0, 0, 0), "Menu Bar");
|
|
||||||
|
|
||||||
BMenu* fileMenu = new BMenu(B_TRANSLATE("File"));
|
BMenu* fileMenu = new BMenu(B_TRANSLATE("File"));
|
||||||
fileMenu->AddItem(new BMenuItem(B_TRANSLATE("Open KeySet" B_UTF8_ELLIPSIS),
|
fileMenu->AddItem(new BMenuItem(B_TRANSLATE("Open KeySet" B_UTF8_ELLIPSIS),
|
||||||
@@ -188,29 +186,16 @@ ShortcutsWindow::ShortcutsWindow()
|
|||||||
fColumnListView->SetSelectionMode(B_SINGLE_SELECTION_LIST);
|
fColumnListView->SetSelectionMode(B_SINGLE_SELECTION_LIST);
|
||||||
fColumnListView->SetTarget(this);
|
fColumnListView->SetTarget(this);
|
||||||
|
|
||||||
fAddButton = new BButton(BRect(0, 0, 0, 0), "add",
|
fAddButton = new BButton("add", B_TRANSLATE("Add new shortcut"),
|
||||||
B_TRANSLATE("Add new shortcut"), new BMessage(ADD_HOTKEY_ITEM),
|
new BMessage(ADD_HOTKEY_ITEM), B_FOLLOW_BOTTOM);
|
||||||
B_FOLLOW_BOTTOM);
|
|
||||||
fAddButton->ResizeToPreferred();
|
|
||||||
fAddButton->MoveBy(spacing,
|
|
||||||
Bounds().bottom - fAddButton->Bounds().bottom - spacing);
|
|
||||||
|
|
||||||
fRemoveButton = new BButton(BRect(0, 0, 0, 0), "remove",
|
fRemoveButton = new BButton("remove",
|
||||||
B_TRANSLATE("Remove selected shortcut"),
|
B_TRANSLATE("Remove selected shortcut"),
|
||||||
new BMessage(REMOVE_HOTKEY_ITEM), B_FOLLOW_BOTTOM);
|
new BMessage(REMOVE_HOTKEY_ITEM), B_FOLLOW_BOTTOM);
|
||||||
fRemoveButton->ResizeToPreferred();
|
|
||||||
fRemoveButton->MoveBy(fAddButton->Frame().right + spacing,
|
|
||||||
Bounds().bottom - fRemoveButton->Bounds().bottom - spacing);
|
|
||||||
|
|
||||||
fRemoveButton->SetEnabled(false);
|
fRemoveButton->SetEnabled(false);
|
||||||
|
|
||||||
fSaveButton = new BButton(BRect(0, 0, 0, 0), "save",
|
fSaveButton = new BButton("save", B_TRANSLATE("Save & apply"),
|
||||||
B_TRANSLATE("Save & apply"), new BMessage(SAVE_KEYSET),
|
new BMessage(SAVE_KEYSET), B_FOLLOW_BOTTOM | B_FOLLOW_RIGHT);
|
||||||
B_FOLLOW_BOTTOM | B_FOLLOW_RIGHT);
|
|
||||||
fSaveButton->ResizeToPreferred();
|
|
||||||
fSaveButton->MoveBy(Bounds().right - fSaveButton->Bounds().right - spacing,
|
|
||||||
Bounds().bottom - fSaveButton->Bounds().bottom - spacing);
|
|
||||||
|
|
||||||
fSaveButton->SetEnabled(false);
|
fSaveButton->SetEnabled(false);
|
||||||
|
|
||||||
CenterOnScreen();
|
CenterOnScreen();
|
||||||
@@ -240,6 +225,7 @@ ShortcutsWindow::ShortcutsWindow()
|
|||||||
BLayoutBuilder::Group<>(this, B_VERTICAL, 0)
|
BLayoutBuilder::Group<>(this, B_VERTICAL, 0)
|
||||||
.Add(menuBar)
|
.Add(menuBar)
|
||||||
.AddGroup(B_VERTICAL)
|
.AddGroup(B_VERTICAL)
|
||||||
|
.SetExplicitMaxSize(BSize(B_SIZE_UNLIMITED, B_SIZE_UNSET))
|
||||||
.SetInsets(B_USE_WINDOW_SPACING)
|
.SetInsets(B_USE_WINDOW_SPACING)
|
||||||
.Add(fColumnListView)
|
.Add(fColumnListView)
|
||||||
.AddGroup(B_HORIZONTAL)
|
.AddGroup(B_HORIZONTAL)
|
||||||
|
|||||||
Reference in New Issue
Block a user