VSTGUI 4.5 Graphical User Interface Framework not only for VST plugins

- Main Page
- Related Pages
- Modules
- Namespaces
- Classes

- Class List
- Class Index
- Class Hierarchy
- Class Members

All Classes Namespaces Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
Public Types | Public Member Functions | Static Public Member Functions | Static Public Attributes | Protected Types | Protected Member Functions | Protected Attributes | List of all members
CNewFileSelector Class Referenceabstract

New file selector class. More...

Inheritance diagram for CNewFileSelector:

## Public Types
enum | Style { kSelectFile, kSelectSaveFile, kSelectDirectory }

## Public Member Functions
CBaseObject * | newCopy () const override
CFileSelector setup
void | setTitle (const UTF8String &title)
| set title of file selector More...
void | setInitialDirectory (const UTF8String &path)
| set initial directory (UTF8 string) More...
void | setDefaultSaveName (const UTF8String &name)
| set initial save name (UTF8 string) More...
void | setDefaultExtension (const CFileExtension &extension)
| set default file extension More...
void | setAllowMultiFileSelection (bool state)
| set allow multi file selection (only valid for kSelectFile selector style) More...
void | addFileExtension (const CFileExtension &extension)
| add a file extension More...
void | addFileExtension (CFileExtension &&extension)
| add a file extension More...
CFileSelector result
uint32_t | getNumSelectedFiles () const
| get number of selected files More...
UTF8StringPtr | getSelectedFile (uint32_t index) const
| get selected file. More...
Public Member Functions inherited from CBaseObject
| CBaseObject ()=default
| ~CBaseObject () noexceptoverride=default
| CBaseObject (const CBaseObject &o)
CBaseObject & | operator= (const CBaseObject &obj)
virtual CMessageResult | notify (CBaseObject *sender, IdStringPtr message)
Public Member Functions inherited from ReferenceCounted< T >
| ReferenceCounted ()=default
virtual | ~ReferenceCounted () noexcept=default
| ReferenceCounted (const ReferenceCounted &)
ReferenceCounted & | operator= (const ReferenceCounted &)
void | forget () override
| decrease refcount and delete object if refcount == 0 More...
void | remember () override
| increase refcount More...
virtual int32_t | getNbReference () const
| get refcount More...
virtual void | beforeDelete ()

## Static Public Member Functions
static const CFileExtension & | getAllFilesExtension ()
| get the all files extension More...

## Static Public Attributes
static IdStringPtr | kSelectEndMessage = "CNewFileSelector Select End Message"

## Protected Types
using | FileExtensionList = std::list< CFileExtension >

## Protected Member Functions
| CNewFileSelector (CFrame *frame=nullptr)
| ~CNewFileSelector () noexceptoverride
virtual bool | runInternal (CBaseObject *delegate)=0
virtual void | cancelInternal ()=0
virtual bool | runModalInternal ()=0

## Protected Attributes
CFrame * | frame
UTF8String | title
UTF8String | initialPath
UTF8String | defaultSaveName
const CFileExtension * | defaultExtension
bool | allowMultiFileSelection
FileExtensionList | extensions
std::vector< UTF8String > | result

## CFileSelector running
using | CallbackFunc = std::function< void(CNewFileSelector *)>
static CNewFileSelector * | create (CFrame *parent=nullptr, Style style=kSelectFile)
| create a new instance More...
bool | run (CallbackFunc &&callback)
bool | run (CBaseObject *delegate)
| the delegate will get a kSelectEndMessage throu the notify method where the sender is this CNewFileSelector object More...
void | cancel ()
| cancel running the file selector More...
bool | runModal ()
| run as modal dialog More...

## Detailed Description

New file selector class.

# Usage

Running the file selector

void MyClass::runFileSelector ()
{
CNewFileSelector* selector = CNewFileSelector::create (getFrame (), CNewFileSelector::kSelectFile);
if (selector)
{
selector->addFileExtension (CFileExtension ("AIFF", "aif", "audio/aiff"));
selector->setDefaultExtension (CFileExtension ("WAVE", "wav"));
selector->setTitle("Choose An Audio File");
selector->run (this);
selector->forget ();
}
}

Getting results

CMessageResult MyClass::notify (CBaseObject* sender, IdStringPtr message)
{
if (message == CNewFileSelector::kSelectEndMessage)
{
CNewFileSelector* sel = dynamic_cast<CNewFileSelector*>(sender);
if (sel)
{
// do anything with the selected files here
return kMessageNotified;
}
}
return parent::notify (sender, message);
}

## Member Typedef Documentation

using CallbackFunc = std::function<void(CNewFileSelector*)>

using FileExtensionList = std::list<CFileExtension>
| protected

## Member Enumeration Documentation

enum Style

Enumerator
kSelectFile | select file(s) selector style
kSelectSaveFile | select save file selector style
kSelectDirectory | select directory style

## Constructor & Destructor Documentation

CNewFileSelector | ( | CFrame * | frame = `nullptr` | ) |
| explicit protected

~CNewFileSelector | ( |  | ) |
| override protected default noexcept

## Member Function Documentation

void addFileExtension | ( | const CFileExtension & | extension | ) |

add a file extension

void addFileExtension | ( | CFileExtension && | extension | ) |

add a file extension

void cancel | ( |  | ) |

cancel running the file selector

virtual void cancelInternal | ( |  | ) |
| protected pure virtual

static CNewFileSelector* create | ( | CFrame * | parent = `nullptr`,
|  | Style | style = `kSelectFile`
| ) |  |
| static

create a new instance

const CFileExtension & getAllFilesExtension | ( |  | ) |
| static

get the all files extension

uint32_t getNumSelectedFiles | ( |  | ) | const

get number of selected files

UTF8StringPtr getSelectedFile | ( | uint32_t | index | ) | const

get selected file.

Result is only valid as long as the instance of CNewFileSelector is valid.

CBaseObject* newCopy | ( |  | ) | const
| inline override

bool run | ( | CallbackFunc && | callback | ) |

bool run | ( | CBaseObject * | delegate | ) |

the delegate will get a kSelectEndMessage throu the notify method where the sender is this CNewFileSelector object

virtual bool runInternal | ( | CBaseObject * | delegate | ) |
| protected pure virtual

bool runModal | ( |  | ) |

run as modal dialog

virtual bool runModalInternal | ( |  | ) |
| protected pure virtual

void setAllowMultiFileSelection | ( | bool | state | ) |

set allow multi file selection (only valid for kSelectFile selector style)

void setDefaultExtension | ( | const CFileExtension & | extension | ) |

set default file extension

void setDefaultSaveName | ( | const UTF8String & | name | ) |

set initial save name (UTF8 string)

void setInitialDirectory | ( | const UTF8String & | path | ) |

set initial directory (UTF8 string)

void setTitle | ( | const UTF8String & | title | ) |

set title of file selector

## Member Data Documentation

bool allowMultiFileSelection
| protected

const CFileExtension* defaultExtension
| protected

UTF8String defaultSaveName
| protected

FileExtensionList extensions
| protected

CFrame* frame
| protected

UTF8String initialPath
| protected

IdStringPtr kSelectEndMessage = "CNewFileSelector Select End Message"
| static

std::vector<UTF8String> result
| protected

UTF8String title
| protected

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

- cfileselector.h
- cfileselector.cpp