Colobot
|
File selector dialog. More...
#include <src/ui/filedialog.h>
Public Member Functions | |
CFileDialog () | |
Constructor. More... | |
~CFileDialog () | |
Destructor. More... | |
Set dialog type, starting, event processing, and stopping | |
enum class | Type { None , Open , Save , Folder } |
Identifies the type of dialog to display. More... | |
void | StartDialog () |
Disables other windows and creates the dialog window. More... | |
void | StopDialog () |
Enables other windows and deletes the dialog window. More... | |
bool | EventProcess (const Event &event) |
Event processing. More... | |
void | SetDialogType (CFileDialog::Type type) |
Set the type of dialog to use. More... | |
CFileDialog::Type | GetDialogType () |
Get the type of dialog. More... | |
File name settings | |
void | SetAutoExtension (const std::string &ext) |
Set the extension that may be appended to a file name. More... | |
void | AddOptionalExtension (const std::string &ext) |
Define extensions that will be accepted as part of a valid file name. More... | |
void | SetFilename (const std::string &filename) |
Set the filename that appears in the edit box when the dialog opens. More... | |
std::string | GetFilename () |
Get the filename that was selected or typed. More... | |
void | SetConfirmOverwrite (bool doCheck) |
Set whether to check if a file exists when the 'Save' button is pressed, and if the file exists, an "Overwrite existing file?" message is shown. More... | |
Dialog window properties | |
void | SetWindowEvent (EventType type) |
Set EventType for the dialog window. If not set, a unique EventType will be used. More... | |
EventType | GetWindowEvent () |
Get EventType for the dialog window. More... | |
void | SetWindowPos (Math::Point pos) |
Set the initial position of the window. More... | |
Math::Point | GetWindowPos () |
Get the position of the window. More... | |
void | SetWindowDim (Math::Point dim) |
Set the initial size of the window. More... | |
Math::Point | GetWindowDim () |
Get the size of the window. More... | |
void | SetWindowTitle (const std::string &name) |
Set the text for the title bar of the dialog. This setting will override the default title text for the dialog. More... | |
Settings for Public and Private check boxes | |
void | SetUsePublicPrivate (bool usePublic) |
Set whether to create Public and Private check boxes. More... | |
void | SetPublic (bool bPublic) |
Set initial state for Public and Private check boxes. More... | |
bool | GetPublic () |
Get the state of Public and Private check boxes. More... | |
void | SetPublicFolder (const std::string &dir) |
Set the path for the folder associated with the Public check box. More... | |
void | SetPrivateFolder (const std::string &dir) |
Set the path for the folder associated with the Private check box. More... | |
Folder settings | |
void | SetBasePath (const std::string &dir) |
Set the initial path for the folder whose contents are displayed. This setting is overridden by Public/Private settings. More... | |
std::string | GetBasePath () |
Get the initial path or Public/Private folder path. More... | |
void | SetSubFolderPath (const std::string &dir) |
Set the initial subfolder whose contents are displayed. More... | |
std::string | GetSubFolderPath () |
Get the current subfolder shown by the dialog. More... | |
File selector dialog.
Create the dialog and set the type of dialog.
Initial settings and start the dialog.
Handle events for the dialog.
|
strong |
Ui::CFileDialog::CFileDialog | ( | ) |
Constructor.
Ui::CFileDialog::~CFileDialog | ( | ) |
Destructor.
void Ui::CFileDialog::StartDialog | ( | ) |
Disables other windows and creates the dialog window.
void Ui::CFileDialog::StopDialog | ( | ) |
Enables other windows and deletes the dialog window.
|
inline |
Set the type of dialog to use.
|
inline |
Get the type of dialog.
|
inline |
Set EventType for the dialog window. If not set, a unique EventType will be used.
|
inline |
Get EventType for the dialog window.
|
inline |
Set the initial position of the window.
|
inline |
Get the position of the window.
|
inline |
Set the initial size of the window.
|
inline |
Get the size of the window.
|
inline |
Set the text for the title bar of the dialog. This setting will override the default title text for the dialog.
void Ui::CFileDialog::SetUsePublicPrivate | ( | bool | usePublic | ) |
Set whether to create Public and Private check boxes.
usePublic | If true, Public and Private check boxes will be added to the dialog. |
void Ui::CFileDialog::SetPublic | ( | bool | bPublic | ) |
Set initial state for Public and Private check boxes.
bPublic | If true, the Public check box will be marked. |
bool Ui::CFileDialog::GetPublic | ( | ) |
Get the state of Public and Private check boxes.
void Ui::CFileDialog::SetPublicFolder | ( | const std::string & | dir | ) |
Set the path for the folder associated with the Public check box.
dir | Path to 'Public' folder. |
void Ui::CFileDialog::SetPrivateFolder | ( | const std::string & | dir | ) |
Set the path for the folder associated with the Private check box.
dir | Path to 'Private' folder. |
void Ui::CFileDialog::SetBasePath | ( | const std::string & | dir | ) |
Set the initial path for the folder whose contents are displayed. This setting is overridden by Public/Private settings.
std::string Ui::CFileDialog::GetBasePath | ( | ) |
Get the initial path or Public/Private folder path.
void Ui::CFileDialog::SetSubFolderPath | ( | const std::string & | dir | ) |
Set the initial subfolder whose contents are displayed.
dir | Name of a subfolder. Ex. "subfolder/anotherFolder/oneMoreFolder" |
std::string Ui::CFileDialog::GetSubFolderPath | ( | ) |
Get the current subfolder shown by the dialog.
Returns empty string if the dialog is showing GetBasePath().
|
inline |
Set the extension that may be appended to a file name.
If any extensions are defined, the dialog will only show files with those extensions.
ext | A string with an extension. Ex. ".txt" |
|
inline |
Define extensions that will be accepted as part of a valid file name.
ext | A string with an extension. Ex. ".txt" |
void Ui::CFileDialog::SetFilename | ( | const std::string & | filename | ) |
Set the filename that appears in the edit box when the dialog opens.
std::string Ui::CFileDialog::GetFilename | ( | ) |
Get the filename that was selected or typed.
|
inline |
Set whether to check if a file exists when the 'Save' button is pressed, and if the file exists, an "Overwrite existing file?" message is shown.
doCheck | true to check if a file exists when the 'Save' button is pressed. |