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

New file selector class. More...

#include <cfileselector.h>

+ Inheritance diagram for CNewFileSelector:

Public Types

enum  Style { kSelectFile, kSelectSaveFile, kSelectDirectory }
 

Static Public Member Functions

static const CFileExtensiongetAllFilesExtension ()
 get the all files extension More...
 

Static Public Attributes

static const char * kSelectEndMessage = "CNewFileSelector Select End Message"
 

Protected Member Functions

 CNewFileSelector (CFrame *frame=0)
 
 ~CNewFileSelector ()
 
virtual bool runInternal (CBaseObject *delegate)=0
 
virtual void cancelInternal ()=0
 
virtual bool runModalInternal ()=0
 

Protected Attributes

CFrameframe
 
char * title
 
char * initialPath
 
char * defaultSaveName
 
const CFileExtensiondefaultExtension
 
bool allowMultiFileSelection
 
std::list< CFileExtensionextensions
 
std::vector< char * > result
 

CFileSelector running

static CNewFileSelectorcreate (CFrame *parent=0, Style style=kSelectFile)
 create a new instance More...
 
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...
 

CFileSelector setup

void setTitle (const char *title)
 set title of file selector More...
 
void setInitialDirectory (const char *path)
 set initial directory (UTF8 string) More...
 
void setDefaultSaveName (const char *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...
 

CFileSelector result

int getNumSelectedFiles () const
 get number of selected files More...
 
const char * getSelectedFile (int index) const
 get selected file. Result is only valid as long as the instance of CNewFileSelector is valid. More...
 

Reference Counting Methods

virtual void forget ()
 decrease refcount and delete object if refcount == 0 More...
 
virtual void remember ()
 increase refcount More...
 
long getNbReference () const
 get refcount More...
 

Message Methods

virtual CMessageResult notify (CBaseObject *sender, const char *message)
 

Detailed Description

New file selector class.

Usage

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

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 = 0)
protected
~CNewFileSelector ( )
protected

Member Function Documentation

void addFileExtension ( const CFileExtension extension)

add a file extension

void cancel ( )

cancel running the file selector

virtual void cancelInternal ( )
protectedpure virtual
static CNewFileSelector* create ( CFrame parent = 0,
Style  style = kSelectFile 
)
static

create a new instance

virtual void forget ( )
inlinevirtualinherited

decrease refcount and delete object if refcount == 0

Reimplemented in CDrawContext.

const CFileExtension & getAllFilesExtension ( )
static

get the all files extension

long getNbReference ( ) const
inlineinherited

get refcount

int getNumSelectedFiles ( ) const

get number of selected files

const char * getSelectedFile ( int  index) const

get selected file. Result is only valid as long as the instance of CNewFileSelector is valid.

virtual CMessageResult notify ( CBaseObject sender,
const char *  message 
)
inlinevirtualinherited
virtual void remember ( )
inlinevirtualinherited

increase refcount

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)
protectedpure virtual
bool runModal ( )

run as modal dialog

virtual bool runModalInternal ( )
protectedpure 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 char *  name)

set initial save name (UTF8 string)

void setInitialDirectory ( const char *  path)

set initial directory (UTF8 string)

void setTitle ( const char *  title)

set title of file selector

Member Data Documentation

bool allowMultiFileSelection
protected
const CFileExtension* defaultExtension
protected
char* defaultSaveName
protected
std::list<CFileExtension> extensions
protected
CFrame* frame
protected
char* initialPath
protected
const char * kSelectEndMessage = "CNewFileSelector Select End Message"
static
std::vector<char*> result
protected
char* title
protected

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