17 #define GETTEXT_DOMAIN "wesnoth-lib"
31 std::string const &title,
bool show_directory_buttons,
35 file_dialog d(video, filename, title,
"", show_directory_buttons);
36 if (!type_a_head.empty())
38 if(d.
show(xloc, yloc) >= 0) {
47 bool show_directory_buttons,
51 file_dialog d(video, filename, title, default_file_name, show_directory_buttons);
53 if (!type_a_head.empty())
55 if(d.
show(xloc, yloc) >= 0) {
63 bool show_directory_buttons) :
65 show_directory_buttons_(show_directory_buttons),
73 const unsigned file_list_height = (video.
gety() / 2);
102 std::map<gui::dialog_button *, std::pair<int,int> >
::iterator i;
105 const int btn_h = i->first->height();
106 int& btn_y = i->second.second;
107 y_max = std::max<int>(y_max, btn_y + btn_h);
115 y_shift = y_max - std::max<int>(textbox_bottom_y, label_bottom_y);
134 if(last_delim != std::string::npos) {
135 return filename.substr(last_delim + 1);
165 std::string::size_type pos_first = 0;
166 if((pos_first = tmp.find_first_of(
"\\/", 1)) != std::string::npos)
168 dir_prefix = tmp.substr(0, pos_first) +
"/...";
169 tmp = tmp.substr(pos_first);
172 static const int prefix_width =
font::line_width(dir_prefix, menu_font_size);
175 while(
font::line_width(tmp, menu_font_size) + filler_width + prefix_width > 390 && tmp.length() != 0)
177 std::string::size_type
pos;
178 if((pos = tmp.find_first_of(
"\\/", 1)) != std::string::npos)
179 tmp = tmp.substr(pos, tmp.length());
181 tmp = tmp.substr(1, tmp.length());
184 return dir_prefix + tmp;
190 const size_t filename_dot = fn.find_last_of(
'.');
208 ,
_(
"Deletion of the file failed."));
224 ,
_(
"Creation of the directory failed."));
int show_file_chooser_dialog_save(CVideo &video, std::string &filename, std::string const &title, const std::string &default_file_name, bool show_directory_buttons, const std::string &type_a_head, int xloc, int yloc)
Show a filechooser dialog in a "save" mode, that is, without relying on autocomplete to allow saving ...
dialog_textbox & get_textbox() const
void set_result(const int result)
void set_autocomplete(bool value)
const std::string & set_text(const std::string &text)
void set_textbox(dialog_textbox *const box)
void set_save_text(const std::string &filename)
void show_transient_error_message(CVideo &video, const std::string &message, const std::string &image, const bool message_use_markup)
Shows a transient error message to the user.
std::string get_choice() const
Return the chosen file.
void add_button(dialog_button *const btn, BUTTON_LOCATION loc)
bool show_directory_buttons_
void set_text(const std::string &text, const SDL_Color &color=font::NORMAL_COLOR)
int show(int xloc, int yloc)
std::string textbox_text() const
std::string format_filename(const std::string &filename) const
void set_cursor_pos(const int cursor_pos)
static UNUSEDNOWARN std::string _(const char *str)
void set_menu(menu *const m)
virtual gui::dialog::dimension_measurements layout(int xloc=-1, int yloc=-1)
int show_file_chooser_dialog(CVideo &video, std::string &filename, std::string const &title, bool show_directory_buttons, const std::string &type_a_head, int xloc, int yloc)
Show a dialog where the user can navigate through files and select a file.
void select_file(const std::string &file)
Various uncategorised dialogs.
void action(gui::dialog_process_info &dp_info)
std::string last_textbox_text_
void set_selection(const int selstart, const int selend)
file_dialog(CVideo &video, const std::string &file_path, const std::string &title, const std::string &default_file_name, bool show_directory_buttons)
std::string unformat_filename(const std::string &filename) const
static bool execute(std::string &folder_name, CVideo &video)
The execute function; see tdialog for more information.
std::map< dialog_button *, std::pair< int, int > > buttons
gui::file_menu * files_list_
label * get_label() const
std::string default_file_name_
std::string format_dirname(const std::string &dirname) const
GLsizei const GLcharARB ** string
int line_width(const std::string &line, int font_size, int style)
Determine the width of a line of text given a certain font size.
void set_layout(dimension_measurements &new_dim)
label & get_message() const