Improved order of widgets in Config panel

Tab navigation didn't work properly
This commit is contained in:
Dimitris Panokostas 2020-02-06 00:32:12 +01:00
parent bdde8cbf15
commit 1e809165b2

View file

@ -208,6 +208,49 @@ void InitPanelConfig(const struct _ConfigCategory& category)
{
configButtonActionListener = new ConfigButtonActionListener();
ReadConfigFileList();
configsList = new ConfigsListModel();
configsList->InitConfigsList();
configsListActionListener = new ConfigsListActionListener();
lstConfigs = new gcn::UaeListBox(configsList);
lstConfigs->setSize(category.panel->getWidth() - 2 * DISTANCE_BORDER - 22, 232);
lstConfigs->setBaseColor(colTextboxBackground);
lstConfigs->setBackgroundColor(colTextboxBackground);
lstConfigs->setWrappingEnabled(true);
lstConfigs->setId("ConfigList");
lstConfigs->addActionListener(configsListActionListener);
scrAreaConfigs = new gcn::ScrollArea(lstConfigs);
scrAreaConfigs->setBorderSize(1);
scrAreaConfigs->setPosition(DISTANCE_BORDER, DISTANCE_BORDER);
scrAreaConfigs->setSize(category.panel->getWidth() - 2 * DISTANCE_BORDER - 2, 252);
scrAreaConfigs->setScrollbarWidth(20);
scrAreaConfigs->setBackgroundColor(colTextboxBackground);
lblName = new gcn::Label("Name:");
lblName->setSize(lblName->getWidth(), lblName->getHeight());
lblName->setAlignment(gcn::Graphics::RIGHT);
txtName = new gcn::TextField();
txtName->setSize(300, TEXTFIELD_HEIGHT);
txtName->setBackgroundColor(colTextboxBackground);
lblDesc = new gcn::Label("Description:");
lblDesc->setSize(lblDesc->getWidth(), lblDesc->getHeight());
lblDesc->setAlignment(gcn::Graphics::RIGHT);
txtDesc = new gcn::TextField();
txtDesc->setSize(300, TEXTFIELD_HEIGHT);
txtDesc->setBackgroundColor(colTextboxBackground);
category.panel->add(scrAreaConfigs);
category.panel->add(lblName, DISTANCE_BORDER,
scrAreaConfigs->getY() + scrAreaConfigs->getHeight() + DISTANCE_NEXT_Y);
category.panel->add(txtName, DISTANCE_BORDER + lblDesc->getWidth() + 8,
scrAreaConfigs->getY() + scrAreaConfigs->getHeight() + DISTANCE_NEXT_Y);
category.panel->add(lblDesc, DISTANCE_BORDER, txtName->getY() + txtName->getHeight() + DISTANCE_NEXT_Y);
category.panel->add(txtDesc, DISTANCE_BORDER + lblDesc->getWidth() + 8,
txtName->getY() + txtName->getHeight() + DISTANCE_NEXT_Y);
cmdLoad = new gcn::Button("Load");
cmdLoad->setSize(BUTTON_WIDTH, BUTTON_HEIGHT);
cmdLoad->setBaseColor(gui_baseCol);
@ -235,52 +278,7 @@ void InitPanelConfig(const struct _ConfigCategory& category)
buttonX += BUTTON_WIDTH + DISTANCE_NEXT_X;
buttonX = category.panel->getWidth() - DISTANCE_BORDER - BUTTON_WIDTH;
category.panel->add(cmdDelete, buttonX, buttonY);
lblName = new gcn::Label("Name:");
lblName->setSize(lblName->getWidth(), lblName->getHeight());
lblName->setAlignment(gcn::Graphics::RIGHT);
txtName = new gcn::TextField();
txtName->setSize(300, TEXTFIELD_HEIGHT);
txtName->setId("ConfigName");
txtName->setBackgroundColor(colTextboxBackground);
lblDesc = new gcn::Label("Description:");
lblDesc->setSize(lblDesc->getWidth(), lblDesc->getHeight());
lblDesc->setAlignment(gcn::Graphics::RIGHT);
txtDesc = new gcn::TextField();
txtDesc->setSize(300, TEXTFIELD_HEIGHT);
txtDesc->setId("ConfigDesc");
txtDesc->setBackgroundColor(colTextboxBackground);
ReadConfigFileList();
configsList = new ConfigsListModel();
configsList->InitConfigsList();
configsListActionListener = new ConfigsListActionListener();
lstConfigs = new gcn::UaeListBox(configsList);
lstConfigs->setSize(category.panel->getWidth() - 2 * DISTANCE_BORDER - 22, 232);
lstConfigs->setBaseColor(colTextboxBackground);
lstConfigs->setBackgroundColor(colTextboxBackground);
lstConfigs->setWrappingEnabled(true);
lstConfigs->setId("ConfigList");
lstConfigs->addActionListener(configsListActionListener);
scrAreaConfigs = new gcn::ScrollArea(lstConfigs);
scrAreaConfigs->setBorderSize(1);
scrAreaConfigs->setPosition(DISTANCE_BORDER, DISTANCE_BORDER);
scrAreaConfigs->setSize(category.panel->getWidth() - 2 * DISTANCE_BORDER - 2, 252);
scrAreaConfigs->setScrollbarWidth(20);
scrAreaConfigs->setBackgroundColor(colTextboxBackground);
category.panel->add(scrAreaConfigs);
category.panel->add(lblName, DISTANCE_BORDER,
scrAreaConfigs->getY() + scrAreaConfigs->getHeight() + DISTANCE_NEXT_Y);
category.panel->add(txtName, DISTANCE_BORDER + lblDesc->getWidth() + 8,
scrAreaConfigs->getY() + scrAreaConfigs->getHeight() + DISTANCE_NEXT_Y);
category.panel->add(lblDesc, DISTANCE_BORDER, txtName->getY() + txtName->getHeight() + DISTANCE_NEXT_Y);
category.panel->add(txtDesc, DISTANCE_BORDER + lblDesc->getWidth() + 8,
txtName->getY() + txtName->getHeight() + DISTANCE_NEXT_Y);
if (strlen(last_active_config) == 0)
{
if (strlen(last_loaded_config) == 0)