Skip to content

Commit 50b0210

Browse files
committed
[UI] geFlex-based Plugin Chooser window
1 parent a3747d8 commit 50b0210

File tree

1 file changed

+31
-22
lines changed

1 file changed

+31
-22
lines changed

src/gui/dialogs/pluginChooser.cpp

Lines changed: 31 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@
3232
#include "gui/elems/basics/box.h"
3333
#include "gui/elems/basics/button.h"
3434
#include "gui/elems/basics/choice.h"
35+
#include "gui/elems/basics/flex.h"
3536
#include "gui/elems/plugin/pluginBrowser.h"
3637
#include "utils/gui.h"
3738

@@ -42,27 +43,36 @@ gdPluginChooser::gdPluginChooser(int X, int Y, int W, int H, ID channelId, m::Co
4243
, m_conf(c)
4344
, m_channelId(channelId)
4445
{
45-
begin();
46-
47-
/* top area */
48-
Fl_Group* group_top = new Fl_Group(8, 8, w() - 16, 20);
49-
sortMethod = new geChoice(group_top->x(), group_top->y(), 180, 20, "Sort by", 0);
50-
geBox* b1 = new geBox(sortMethod->x() + sortMethod->w(), group_top->y(), 100, 20); // spacer window border <-> menu
51-
group_top->resizable(b1);
52-
group_top->end();
53-
54-
/* center browser */
55-
browser = new v::gePluginBrowser(8, 36, w() - 16, h() - 70);
56-
57-
/* ok/cancel buttons */
58-
Fl_Group* group_btn = new Fl_Group(8, browser->y() + browser->h() + 8, w() - 16, h() - browser->h() - 16);
59-
geBox* b2 = new geBox(8, browser->y() + browser->h(), 100, 20); // spacer window border <-> buttons
60-
addBtn = new geButton(w() - 88, group_btn->y(), 80, 20, "Add");
61-
cancelBtn = new geButton(addBtn->x() - 88, group_btn->y(), 80, 20, "Cancel");
62-
group_btn->resizable(b2);
63-
group_btn->end();
64-
65-
end();
46+
geFlex* container = new geFlex(getContentBounds().reduced({G_GUI_OUTER_MARGIN}), Direction::VERTICAL, G_GUI_OUTER_MARGIN);
47+
{
48+
geFlex* header = new geFlex(Direction::HORIZONTAL, G_GUI_INNER_MARGIN);
49+
{
50+
sortMethod = new geChoice("Sort by", 0);
51+
header->add(sortMethod, 180);
52+
header->add(new geBox());
53+
header->end();
54+
}
55+
56+
browser = new v::gePluginBrowser(0, 0, 0, 0);
57+
58+
geFlex* footer = new geFlex(Direction::HORIZONTAL, G_GUI_INNER_MARGIN);
59+
{
60+
addBtn = new geButton("Add");
61+
cancelBtn = new geButton("Cancel");
62+
footer->add(new geBox());
63+
footer->add(addBtn, 80);
64+
footer->add(cancelBtn, 80);
65+
footer->end();
66+
}
67+
68+
container->add(header, G_GUI_UNIT);
69+
container->add(browser);
70+
container->add(footer, G_GUI_UNIT);
71+
container->end();
72+
}
73+
74+
add(container);
75+
resizable(container);
6676

6777
sortMethod->addItem("Name");
6878
sortMethod->addItem("Category");
@@ -78,7 +88,6 @@ gdPluginChooser::gdPluginChooser(int X, int Y, int W, int H, ID channelId, m::Co
7888
addBtn->shortcut(FL_Enter);
7989
cancelBtn->callback(cb_close, (void*)this);
8090

81-
resizable(browser);
8291
u::gui::setFavicon(this);
8392
show();
8493
}

0 commit comments

Comments
 (0)