Skip to content

Commit

Permalink
Merge pull request #1587 from OutpostUniverse/resizeFactoryProduction…
Browse files Browse the repository at this point in the history
…Buttons

Resize `FactoryProduction` buttons
  • Loading branch information
DanRStevens authored Feb 16, 2025
2 parents 8c8de9d + 95521fa commit 822c682
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 18 deletions.
32 changes: 18 additions & 14 deletions appOPHD/UI/FactoryProduction.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -20,34 +20,38 @@ FactoryProduction::FactoryProduction() :
mFactory{nullptr},
mProduct{ProductType::PRODUCT_NONE},
mProductGrid{"ui/factory.png", 32, constants::MarginTight},
btnOkay{"Okay", {this, &FactoryProduction::onOkay}},
btnCancel{"Cancel", {this, &FactoryProduction::onCancel}},
chkIdle{"Idle", {this, &FactoryProduction::onCheckBoxIdleChange}},
btnClearSelection{"Clear Selection", {this, &FactoryProduction::onClearSelection}},
btnApply{"Apply", {this, &FactoryProduction::onApply}},
chkIdle{"Idle", {this, &FactoryProduction::onCheckBoxIdleChange}}
btnOkay{"Okay", {this, &FactoryProduction::onOkay}},
btnCancel{"Cancel", {this, &FactoryProduction::onCancel}}
{
size({320, 162});
size({320, 165});

mProductGrid.size({140, 110});
mProductGrid.showTooltip(true);
mProductGrid.hide();
mProductGrid.selectionChanged().connect({this, &FactoryProduction::onProductSelectionChange});
add(mProductGrid, {constants::Margin, 25});

btnOkay.size({40, 20});
add(btnOkay, {233, 138});
chkIdle.size({50, 20});
add(chkIdle, {mProductGrid.size().x + 12, 115});

btnCancel.size({40, 20});
add(btnCancel, {276, 138});
const auto buttonArea = Rectangle<int>::Create(mProductGrid.area().endPoint() + Vector{constants::Margin, constants::MarginTight}, area().inset(constants::Margin).endPoint());
const auto buttonSize = Vector{(buttonArea.size.x - (constants::MarginTight * 2)) / 3, buttonArea.size.y};
const auto buttonSpacing = buttonSize.x + constants::MarginTight;

btnClearSelection.size({mProductGrid.size().x, 20});
add(btnClearSelection, {5, 138});
btnClearSelection.size({mProductGrid.size().x, buttonSize.y});
add(btnClearSelection, {constants::Margin, buttonArea.position.y});

btnApply.size({40, 20});
add(btnApply, {mProductGrid.size().x + 12, btnClearSelection.positionY()});
btnApply.size(buttonSize);
add(btnApply, {buttonArea.position.x, buttonArea.position.y});

chkIdle.size({50, 20});
add(chkIdle, {mProductGrid.size().x + 12, 115});
btnOkay.size(buttonSize);
add(btnOkay, {buttonArea.position.x + buttonSpacing, buttonArea.position.y});

btnCancel.size(buttonSize);
add(btnCancel, {buttonArea.position.x + buttonSpacing * 2, buttonArea.position.y});
}


Expand Down
8 changes: 4 additions & 4 deletions appOPHD/UI/FactoryProduction.h
Original file line number Diff line number Diff line change
Expand Up @@ -48,10 +48,10 @@ class FactoryProduction : public Window

IconGrid mProductGrid;

Button btnOkay;
Button btnCancel;
CheckBox chkIdle;

Button btnClearSelection;
Button btnApply;

CheckBox chkIdle;
Button btnOkay;
Button btnCancel;
};

0 comments on commit 822c682

Please sign in to comment.