/
FxChooser.cpp
53 lines (42 loc) · 1.14 KB
/
FxChooser.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
#include "FxChooser.h"
#include "i18n.h"
#include "debugging/ScopedDebugTimer.h"
#include "wxutil/dataview/ThreadedDeclarationTreePopulator.h"
#include "wxutil/decl/DeclarationSelector.h"
namespace ui
{
class FxSelector :
public wxutil::DeclarationSelector
{
private:
constexpr static const char* const FX_ICON = "icon_fx.png";
public:
FxSelector(wxWindow* parent) :
DeclarationSelector(parent, decl::Type::Fx)
{
Populate();
}
void Populate() override
{
PopulateTreeView(std::make_shared<wxutil::ThreadedDeclarationTreePopulator>(decl::Type::Fx, GetColumns(), FX_ICON));
}
};
FxChooser::FxChooser(wxWindow* parent) :
DeclarationSelectorDialog(decl::Type::SoundShader, _("Choose FX Declaration"), "FxChooser", parent)
{
SetSelector(new FxSelector(this));
}
std::string FxChooser::ChooseDeclaration(const std::string& preselected)
{
FxChooser instance;
if (!preselected.empty())
{
instance.SetSelectedDeclName(preselected);
}
if (instance.ShowModal() == wxID_OK)
{
return instance.GetSelectedDeclName();
}
return ""; // Empty selection on cancel
}
}