VSTGUI  4.10
Graphical User Interface Framework not only for VST plugins
 All Classes Namespaces Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
CNewFileSelector Class Referencefinal

New file selector class. More...

+ Inheritance diagram for CNewFileSelector:


struct  Impl

Public Types

enum  Style { kSelectFile, kSelectSaveFile, kSelectDirectory }

Public Member Functions

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

Static Public Member Functions

static const CFileExtensiongetAllFilesExtension ()
 get the all files extension

Static Public Attributes

static IdStringPtr kSelectEndMessage = "CNewFileSelector Select End Message"

Protected Member Functions

 ~CNewFileSelector () noexceptoverride

Protected Attributes

std::unique_ptr< Implimpl

CFileSelector running

using CallbackFunc = std::function< void(CNewFileSelector *)>
static CNewFileSelectorcreate (CFrame *parent=nullptr, Style style=kSelectFile)
 create a new instance
 CNewFileSelector (PlatformFileSelectorPtr &&platformFileSelector, CFrame *parent)
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
void cancel ()
 cancel running the file selector
bool runModal ()
 run as modal dialog

Detailed Description

New file selector class.


Running the file selector

void MyClass::runFileSelector ()
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)
CNewFileSelector* sel = dynamic_cast<CNewFileSelector*>(sender);
if (sel)
// do anything with the selected files here
return parent::notify (sender, message);

Member Typedef Documentation

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

Member Enumeration Documentation

enum Style

select file(s) selector style


select save file selector style


select directory style

Constructor & Destructor Documentation

CNewFileSelector ( PlatformFileSelectorPtr &&  platformFileSelector,
CFrame parent 
~CNewFileSelector ( )

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

CNewFileSelector * create ( CFrame parent = nullptr,
Style  style = kSelectFile 

create a new instance

const CFileExtension & getAllFilesExtension ( )

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
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

bool runModal ( )

run as modal dialog

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

std::unique_ptr<Impl> impl
IdStringPtr kSelectEndMessage = "CNewFileSelector Select End Message"

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