File selector dialog.
More...
#include <src/ui/filedialog.h>
|
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...
|
|
|
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.
Example usage
Create the dialog and set the type of dialog.
File selector dialog.
Definition: filedialog.h:82
@ Folder
Select Folder dialog.
CFileDialog()
Constructor.
Definition: filedialog.cpp:56
void SetDialogType(CFileDialog::Type type)
Set the type of dialog to use.
Definition: filedialog.h:126
Initial settings and start the dialog.
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 t...
Definition: filedialog.h:172
void SetBasePath(const std::string &dir)
Set the initial path for the folder whose contents are displayed. This setting is overridden by Publi...
Definition: filedialog.cpp:169
void StartDialog()
Disables other windows and creates the dialog window.
Definition: filedialog.cpp:72
Handle events for the dialog.
if (event.type == EVENT_DIALOG_STOP)
{
delete fileDialog;
return true;
}
if (event.type == EVENT_DIALOG_ACTION)
{
delete fileDialog;
return true;
}
void StopDialog()
Enables other windows and deletes the dialog window.
Definition: filedialog.cpp:110
std::string GetSubFolderPath()
Get the current subfolder shown by the dialog.
Definition: filedialog.cpp:184
bool EventProcess(const Event &event)
Event processing.
Definition: filedialog.cpp:551
◆ Type
Identifies the type of dialog to display.
Enumerator |
---|
None | Type was not set.
|
Open | Open dialog.
|
Save | Save dialog.
|
Folder | Select Folder dialog.
|
◆ CFileDialog()
Ui::CFileDialog::CFileDialog |
( |
| ) |
|
◆ ~CFileDialog()
Ui::CFileDialog::~CFileDialog |
( |
| ) |
|
◆ StartDialog()
void Ui::CFileDialog::StartDialog |
( |
| ) |
|
Disables other windows and creates the dialog window.
◆ StopDialog()
void Ui::CFileDialog::StopDialog |
( |
| ) |
|
Enables other windows and deletes the dialog window.
◆ EventProcess()
bool Ui::CFileDialog::EventProcess |
( |
const Event & |
event | ) |
|
◆ SetDialogType()
Set the type of dialog to use.
◆ GetDialogType()
◆ SetWindowEvent()
void Ui::CFileDialog::SetWindowEvent |
( |
EventType |
type | ) |
|
|
inline |
Set EventType for the dialog window. If not set, a unique EventType will be used.
◆ GetWindowEvent()
EventType Ui::CFileDialog::GetWindowEvent |
( |
| ) |
|
|
inline |
Get EventType for the dialog window.
◆ SetWindowPos()
Set the initial position of the window.
◆ GetWindowPos()
Get the position of the window.
◆ SetWindowDim()
Set the initial size of the window.
◆ GetWindowDim()
Get the size of the window.
◆ SetWindowTitle()
void Ui::CFileDialog::SetWindowTitle |
( |
const std::string & |
name | ) |
|
|
inline |
Set the text for the title bar of the dialog. This setting will override the default title text for the dialog.
◆ SetUsePublicPrivate()
void Ui::CFileDialog::SetUsePublicPrivate |
( |
bool |
usePublic | ) |
|
Set whether to create Public and Private check boxes.
- Parameters
-
usePublic | If true, Public and Private check boxes will be added to the dialog. |
◆ SetPublic()
void Ui::CFileDialog::SetPublic |
( |
bool |
bPublic | ) |
|
Set initial state for Public and Private check boxes.
- Parameters
-
bPublic | If true, the Public check box will be marked. |
◆ GetPublic()
bool Ui::CFileDialog::GetPublic |
( |
| ) |
|
Get the state of Public and Private check boxes.
- Returns
- true if Public check box is marked and false for Private.
◆ SetPublicFolder()
void Ui::CFileDialog::SetPublicFolder |
( |
const std::string & |
dir | ) |
|
Set the path for the folder associated with the Public check box.
- Parameters
-
dir | Path to 'Public' folder. |
◆ SetPrivateFolder()
void Ui::CFileDialog::SetPrivateFolder |
( |
const std::string & |
dir | ) |
|
Set the path for the folder associated with the Private check box.
- Parameters
-
dir | Path to 'Private' folder. |
◆ SetBasePath()
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.
◆ GetBasePath()
std::string Ui::CFileDialog::GetBasePath |
( |
| ) |
|
Get the initial path or Public/Private folder path.
◆ SetSubFolderPath()
void Ui::CFileDialog::SetSubFolderPath |
( |
const std::string & |
dir | ) |
|
Set the initial subfolder whose contents are displayed.
- Parameters
-
dir | Name of a subfolder. Ex. "subfolder/anotherFolder/oneMoreFolder" |
◆ GetSubFolderPath()
std::string Ui::CFileDialog::GetSubFolderPath |
( |
| ) |
|
Get the current subfolder shown by the dialog.
- Returns
- A string with a folder name and subsequent folders separated by forward slash.
Returns empty string if the dialog is showing GetBasePath().
◆ SetAutoExtension()
void Ui::CFileDialog::SetAutoExtension |
( |
const std::string & |
ext | ) |
|
|
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.
- Parameters
-
ext | A string with an extension. Ex. ".txt" |
◆ AddOptionalExtension()
void Ui::CFileDialog::AddOptionalExtension |
( |
const std::string & |
ext | ) |
|
|
inline |
Define extensions that will be accepted as part of a valid file name.
- Parameters
-
ext | A string with an extension. Ex. ".txt" |
◆ SetFilename()
void Ui::CFileDialog::SetFilename |
( |
const std::string & |
filename | ) |
|
Set the filename that appears in the edit box when the dialog opens.
◆ GetFilename()
std::string Ui::CFileDialog::GetFilename |
( |
| ) |
|
Get the filename that was selected or typed.
- Returns
- The filename that was typed in the edit box.
◆ SetConfirmOverwrite()
void Ui::CFileDialog::SetConfirmOverwrite |
( |
bool |
doCheck | ) |
|
|
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.
- Parameters
-
doCheck | true to check if a file exists when the 'Save' button is pressed. |
The documentation for this class was generated from the following files:
- src/ui/filedialog.h
- src/ui/filedialog.cpp