The Battle for Wesnoth  1.13.4+dev
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
Public Member Functions | Protected Member Functions | Private Attributes | List of all members
dialogs::file_dialog Class Reference

#include <filechooser.hpp>

Inheritance diagram for dialogs::file_dialog:
Inheritance graph

Public Member Functions

 file_dialog (CVideo &video, const std::string &file_path, const std::string &title, const std::string &default_file_name, bool show_directory_buttons)
 
virtual
gui::dialog::dimension_measurements 
layout (int xloc=-1, int yloc=-1)
 
std::string get_choice () const
 Return the chosen file. More...
 
void select_file (const std::string &file)
 
void set_autocomplete (bool value)
 
- Public Member Functions inherited from gui::dialog
 dialog (CVideo &video, const std::string &title="", const std::string &message="", const DIALOG_TYPE type=MESSAGE, const style &dialog_style=default_style)
 
virtual ~dialog ()
 
void set_image (dialog_image *const img)
 
void set_image (surface surf, const std::string &caption="")
 
void set_menu (menu *const m)
 
void set_menu (const std::vector< std::string > &menu_items, menu::sorter *sorter=nullptr)
 
void set_menu_items (const std::vector< std::string > &menu_items, bool keep_selection=false)
 Changes (or sets, if not previously set) the dialog's menu items to the provided list. More...
 
void add_pane (preview_pane *const pp)
 
void set_panes (std::vector< preview_pane * > panes)
 
void set_textbox (dialog_textbox *const box)
 
void set_textbox (const std::string &text_widget_label="", const std::string &text_widget_text="", const int text_widget_max_chars=256, const unsigned int text_box_width=font::relative_size(350))
 
void add_button (dialog_button *const btn, BUTTON_LOCATION loc)
 
void add_button (dialog_button_info btn_info, BUTTON_LOCATION loc=BUTTON_EXTRA)
 
void add_option (const std::string &label, bool checked=false, BUTTON_LOCATION loc=BUTTON_CHECKBOX, const std::string &help_string="")
 
void set_layout (dimension_measurements &new_dim)
 
dimension_measurements get_layout () const
 
dialog_frameget_frame ()
 
void set_basic_behavior (DIALOG_TYPE type)
 
int show (int xloc, int yloc)
 
int show ()
 
int result () const
 
menuget_menu ()
 
bool done () const
 
std::string textbox_text () const
 
dialog_textboxget_textbox () const
 
bool option_checked (unsigned int option_index=0)
 
CVideoget_video ()
 

Protected Member Functions

void action (gui::dialog_process_info &dp_info)
 
void set_save_text (const std::string &filename)
 
std::string unformat_filename (const std::string &filename) const
 
std::string format_filename (const std::string &filename) const
 
std::string format_dirname (const std::string &dirname) const
 
- Protected Member Functions inherited from gui::dialog
void set_result (const int result)
 
void refresh ()
 
labelget_message () const
 

Private Attributes

bool show_directory_buttons_
 
gui::file_menufiles_list_
 
int last_selection_
 
std::string last_textbox_text_
 
std::string chosen_file_
 
std::string default_file_name_
 
bool autocomplete_
 

Additional Inherited Members

- Public Types inherited from gui::dialog
enum  BUTTON_LOCATION {
  BUTTON_STANDARD, BUTTON_EXTRA, BUTTON_EXTRA_LEFT, BUTTON_CHECKBOX,
  BUTTON_CHECKBOX_LEFT, BUTTON_HELP, BUTTON_TOP
}
 
typedef dialog_frame::style style
 
- Static Public Member Functions inherited from gui::dialog
static void delete_empty_menu ()
 Explicit freeing of class static resources. More...
 
- Static Public Attributes inherited from gui::dialog
static const styledefault_style = dialog_frame::default_style
 
static const stylemessage_style = dialog_frame::message_style
 
static const style hotkeys_style
 
static const int message_font_size = font::SIZE_PLUS
 
static const int caption_font_size = font::SIZE_LARGE
 
static const int max_menu_width = -1
 
static const size_t left_padding = font::relative_size(10)
 
static const size_t right_padding = font::relative_size(10)
 
static const size_t image_h_pad = font::relative_size( 10)
 
static const size_t top_padding = font::relative_size(10)
 
static const size_t bottom_padding = font::relative_size(10)
 

Detailed Description

Definition at line 30 of file filechooser.hpp.

Constructor & Destructor Documentation

dialogs::file_dialog::file_dialog ( CVideo video,
const std::string file_path,
const std::string title,
const std::string default_file_name,
bool  show_directory_buttons 
)

Member Function Documentation

void dialogs::file_dialog::action ( gui::dialog_process_info dp_info)
protectedvirtual
std::string dialogs::file_dialog::format_dirname ( const std::string dirname) const
protected
std::string dialogs::file_dialog::format_filename ( const std::string filename) const
protected
std::string dialogs::file_dialog::get_choice ( ) const
inline

Return the chosen file.

Definition at line 37 of file filechooser.hpp.

References chosen_file_.

Referenced by dialogs::show_file_chooser_dialog(), and dialogs::show_file_chooser_dialog_save().

gui::dialog::dimension_measurements dialogs::file_dialog::layout ( int  xloc = -1,
int  yloc = -1 
)
virtual
void dialogs::file_dialog::select_file ( const std::string file)
void dialogs::file_dialog::set_autocomplete ( bool  value)
inline

Definition at line 41 of file filechooser.hpp.

References autocomplete_.

Referenced by dialogs::show_file_chooser_dialog_save().

void dialogs::file_dialog::set_save_text ( const std::string filename)
protected
std::string dialogs::file_dialog::unformat_filename ( const std::string filename) const
protected

Definition at line 123 of file filechooser.cpp.

References gui::file_menu::add_path(), files_list_, and gui::file_menu::get_directory().

Referenced by action().

Member Data Documentation

bool dialogs::file_dialog::autocomplete_
private

Definition at line 57 of file filechooser.hpp.

Referenced by action(), and set_autocomplete().

std::string dialogs::file_dialog::chosen_file_
private

Definition at line 55 of file filechooser.hpp.

Referenced by action(), get_choice(), and select_file().

std::string dialogs::file_dialog::default_file_name_
private

Definition at line 56 of file filechooser.hpp.

Referenced by file_dialog(), and format_filename().

gui::file_menu* dialogs::file_dialog::files_list_
private
int dialogs::file_dialog::last_selection_
private

Definition at line 53 of file filechooser.hpp.

Referenced by action().

std::string dialogs::file_dialog::last_textbox_text_
private

Definition at line 54 of file filechooser.hpp.

Referenced by action().

bool dialogs::file_dialog::show_directory_buttons_
private

Definition at line 51 of file filechooser.hpp.

Referenced by file_dialog(), and layout().


The documentation for this class was generated from the following files: