Public Member Functions | Private Member Functions | Private Attributes

FileIO Class Reference

Save/Load Window. More...

#include <FileIO.h>

Inheritance diagram for FileIO:
Window Control Broadcaster Listener

List of all members.

Public Member Functions

 FileIO (const std::string &filePath, int x, int y, FileIoMode mode=MODE_LOAD)
 ~FileIO ()
StringList getFileSelection () const
void setMode (FileIoMode mode)
FileIoMode getMode () const
void rescanCurrentDirectory ()

Private Member Functions

void windowInit ()
 Instructs derived Window objects to initialize themselves.
void push (Event *event)
void scanDirectory (const std::string &filePath)
ControlgetChild (const std::string &childName) const

Private Attributes

FileIoMode mMode
ListBoxlstBox
TextFieldtxtFilepath
ButtonbtnCancel
ButtonbtnAction
std::string mFileSelection
std::string mCurrentDirectory
std::string mFileExtension
StringList mDirectoryList

Detailed Description

Save/Load Window.

The FileIO Window will fire an EVENT_GUI_NOTIFY event when the action button is clicked on. Clients of the FileIO Window should subscribe directly to the FileIO Window, generally as follows:

mFileIO->addEventListener(this);

Any Listener object can be subscribed to the FileIO Window. The Listener::push(Event*) function should respond to the event and check the ID field (Event::getId()). The ID will be "FileIO".


Constructor & Destructor Documentation

FileIO::FileIO ( const std::string &  filePath,
int  x,
int  y,
FileIoMode  mode = MODE_LOAD 
)
FileIO::~FileIO (  )  [inline]

Member Function Documentation

Control* FileIO::getChild ( const std::string &  childName  )  const [inline, private, virtual]

Reimplemented from Control.

StringList FileIO::getFileSelection (  )  const

Returns a list of selected file names.

Note:
Until multiple file selection is implemented this function will return a StringList with only one entry.
FileIoMode FileIO::getMode (  )  const [inline]
void FileIO::push ( Event event  )  [private, virtual]

Reimplemented from Control.

void FileIO::rescanCurrentDirectory (  ) 

Instructs FileIO to rescan the current working directory for files.

void FileIO::scanDirectory ( const std::string &  filePath  )  [private]
void FileIO::setMode ( FileIoMode  mode  ) 

Sets the mode of the FileIO Window.

Effectively changes the title and action Button actions.

Parameters:
mode Can be MODE_LOAD, MODE_SAVE or MODE_SAVEAS.
void FileIO::windowInit (  )  [private, virtual]

Instructs derived Window objects to initialize themselves.

Note:
This function must be overridden in derived objects.

When deriving a Window Control, windowInit() must be overridden. This is the function where one would create and add new Control objects as well as specify various attributes such as color, size, position, etc.

Reimplemented from Window.


Member Data Documentation

ListBox* FileIO::lstBox [private]
std::string FileIO::mCurrentDirectory [private]
std::string FileIO::mFileExtension [private]
std::string FileIO::mFileSelection [private]

The documentation for this class was generated from the following files:
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines