Skip to content

Commit

Permalink
enhancement: re-alight WHDLoad Custom Fields in GUI (#1544)
Browse files Browse the repository at this point in the history
  • Loading branch information
midwan authored Dec 20, 2024
1 parent 7793041 commit 1aa441f
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions src/osdep/gui/ShowCustomFields.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -106,9 +106,8 @@ static ShowCustomFieldsActionListener* showCustomFieldsActionListener;

void create_custom_field(custom_widget& widget, const int number, const std::string& caption, const whdload_custom& custom_field, int& pos_y, const int custom_list_index)
{
constexpr int textfield_width = 350;
constexpr int textfield_width = 300;
constexpr int pos_x1 = DISTANCE_BORDER;
constexpr int pos_x2 = 200;

for (int i = 0; i < number; i++) {
std::string id;
Expand All @@ -118,6 +117,8 @@ void create_custom_field(custom_widget& widget, const int number, const std::str
widget.lbl.emplace_back(label);
wndShowCustomFields->add(label);

int pos_x2 = label->getWidth() + 15;

switch (custom_field.type) {
case bit_type: {
auto checkbox = new gcn::CheckBox(custom_field.label_bit_pairs[i].first);
Expand Down Expand Up @@ -150,6 +151,9 @@ void create_custom_field(custom_widget& widget, const int number, const std::str
case list_type: {
label->setCaption(custom_field.caption);
label->adjustSize();
pos_x2 = textfield_width + 15;
label->setPosition(pos_x2, pos_y);

for (const auto& item : custom_field.labels)
{
custom_list[custom_list_index].add(item);
Expand All @@ -162,7 +166,7 @@ void create_custom_field(custom_widget& widget, const int number, const std::str
dropdown->setForegroundColor(gui_foreground_color);
dropdown->setSelectionColor(gui_selection_color);
dropdown->addActionListener(showCustomFieldsActionListener);
dropdown->setPosition(pos_x2, pos_y);
dropdown->setPosition(pos_x1, pos_y);
widget.list.emplace_back(dropdown);
wndShowCustomFields->add(dropdown);
pos_y += dropdown->getHeight() + 8;
Expand Down

0 comments on commit 1aa441f

Please sign in to comment.