34 find_widget<toggle_button>(
"show_all"),
42 listbox& existing_addons = find_widget<listbox>(
"existing_addons");
45 if(selected_row == 0) {
48 }
else if(selected_row == 1 && find_widget<toggle_button>(
"show_all").get_value_bool()) {
60 toggle_button& show_all = find_widget<toggle_button>(
"show_all");
66 listbox& existing_addons = find_widget<listbox>(
"existing_addons");
67 existing_addons.
clear();
69 std::vector<std::string> dirs;
73 {
"existing_addon_id",
widget_item{{
"label",
_(
"New Add-on")}, {
"tooltip",
_(
"Create a new add-on")}}},
75 existing_addons.
add_row(new_addon);
80 widget_item{{
"label",
_(
"Mainline")}, {
"tooltip",
_(
"Mainline multiplayer scenarios")}}},
82 existing_addons.
add_row(mainline);
86 for(
const std::string& dir : dirs) {
93 if(dir ==
prefs::get().editor_chosen_addon()) {
void populate_list(bool show_all)
virtual void post_show() override
Actions to be taken after the window has been shown.
Abstract base class for all modal dialogs.
widget * find(const std::string_view id, const bool must_be_active) override
See widget::find.
grid & add_row(const widget_item &item, const int index=-1)
When an item in the list is selected by the user we need to update the state.
const grid * get_row_grid(const unsigned row) const
Returns the grid of the wanted row.
bool select_row(const unsigned row, const bool select=true)
Selects a row.
void clear()
Removes all the rows in the listbox, clearing it.
int get_selected_row() const
Returns the first selected row.
unsigned get_item_count() const
Returns the number of items in the listbox.
Declarations for File-IO.
static std::string _(const char *str)
void get_files_in_dir(const std::string &dir, std::vector< std::string > *files, std::vector< std::string > *dirs, name_mode mode, filter_mode filter, reorder_mode reorder, file_tree_checksum *checksum)
Get a list of all files and/or directories in a given directory.
static bool file_exists(const bfs::path &fpath)
std::string get_addons_dir()
REGISTER_DIALOG(editor_edit_unit)
void connect_signal_mouse_left_click(dispatcher &dispatcher, const signal &signal)
Connects a signal handler for a left mouse button click.
std::map< std::string, widget_item > widget_data
std::map< std::string, t_string > widget_item