mirror of
https://github.com/RGBCube/serenity
synced 2025-07-25 18:47:34 +00:00
PixelPaint: Allow initial values for the EditGuideDialog
This way we can feed it the values if we wanted to change an existing Guide and handle the default as before. That we have to pass a String here is a bit ugly.
This commit is contained in:
parent
7e2028a3cd
commit
c9e6afe6a8
2 changed files with 15 additions and 2 deletions
|
@ -13,8 +13,10 @@
|
|||
|
||||
namespace PixelPaint {
|
||||
|
||||
EditGuideDialog::EditGuideDialog(GUI::Window* parent_window)
|
||||
EditGuideDialog::EditGuideDialog(GUI::Window* parent_window, String const& offset, Guide::Orientation orientation)
|
||||
: Dialog(parent_window)
|
||||
, m_offset(offset)
|
||||
, m_orientation(orientation)
|
||||
{
|
||||
set_title("Create new Guide");
|
||||
set_icon(parent_window->icon());
|
||||
|
@ -36,6 +38,17 @@ EditGuideDialog::EditGuideDialog(GUI::Window* parent_window)
|
|||
VERIFY(vertical_radio);
|
||||
VERIFY(cancel_button);
|
||||
|
||||
if (orientation == Guide::Orientation::Vertical) {
|
||||
vertical_radio->set_checked(true);
|
||||
m_is_vertical_checked = true;
|
||||
} else if (orientation == Guide::Orientation::Horizontal) {
|
||||
horizontal_radio->set_checked(true);
|
||||
m_is_horizontal_checked = true;
|
||||
}
|
||||
|
||||
if (!offset.is_empty())
|
||||
offset_text_box->set_text(offset);
|
||||
|
||||
horizontal_radio->on_checked = [this](bool checked) { m_is_horizontal_checked = checked; };
|
||||
vertical_radio->on_checked = [this](bool checked) { m_is_vertical_checked = checked; };
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue