46 listbox& existing_addons = find_widget<listbox>(&win,
"existing_addons",
false);
49 if(selected_row == 0) {
52 }
else if(selected_row == 1 && find_widget<toggle_button>(
get_window(),
"show_all",
false).get_value_bool()) {
70 listbox& existing_addons = find_widget<listbox>(
get_window(),
"existing_addons",
false);
71 existing_addons.
clear();
73 std::vector<std::string> dirs;
77 {
"existing_addon_id",
widget_item{{
"label",
_(
"New Add-on")}, {
"tooltip",
_(
"Create a new add-on")}}},
79 existing_addons.
add_row(new_addon);
84 widget_item{{
"label",
_(
"Mainline")}, {
"tooltip",
_(
"Mainline multiplayer scenarios")}}},
86 existing_addons.
add_row(mainline);
90 for(
const std::string& dir : dirs) {
97 if(dir ==
prefs::get().editor_chosen_addon()) {
void populate_list(bool show_all)
virtual void post_show(window &window) override
Actions to be taken after the window has been shown.
virtual void pre_show(window &window) override
Actions to be taken before showing the window.
Abstract base class for all modal dialogs.
window * get_window()
Returns a pointer to the dialog's window.
widget * find(const std::string &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.
base class of top level items, the only item which needs to store the final canvases to draw on.
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
SDL_Window * get_window()