WidgetSaveFile Class Template Reference
[Widgets]

SaveFileDialog class. More...

Inherits AspectFileFilter, and WidgetFileCommon.

List of all members.

Public Types

typedef WidgetSaveFile< Parent > ObjectType
 Object type.
typedef WidgetSaveFile< Parent > ThisType
 Class type.

Public Member Functions

void activeFilter (unsigned filterNo)
 Sets the active filter to the specified index.
void addFilter (const SmartUtil::tstring &filterName, const SmartUtil::tstring &filter)
 Adds a filter to the object.
void backslashToForwardSlashForUnix (SmartUtil::tstring &filename)
 Ensure filename meets OS expectations for path separators.
unsigned getActiveFilter () const
 Returns the active filter of the object.
void setStartDirectory (SmartUtil::tstring startDir)
 Sets the starting directory of the WidgetLoadFile or WidgetSaveFile Widget.
SmartUtil::tstring showDialog ()
 Shows the dialog.
 WidgetSaveFile (Parent *parent=0)
 Constructor Taking pointer to parent.


Detailed Description

template<class Parent>
class SmartWin::WidgetSaveFile< Parent >

SaveFileDialog class.

savefile.PNG
Class for showing a Save File Dialog.
Either derive from it or call WidgetFactory::createSaveFile.
Related classes Note!
If you wish to use this class with Parent classes other than those from SmartWin++ you need to expose a public function called "parent" taking no arguments returning an HWND.
the complete signature of the function will then be "HWND parent();"


Member Typedef Documentation

typedef WidgetSaveFile< Parent > ObjectType

Object type.

Note, not a pointer!!!!


Member Function Documentation

void activeFilter ( unsigned  filterNo  )  [inherited]

Sets the active filter to the specified index.

If you have added five filters and set the active filter to 3 then the fourth filter you added will be the active filter. Active filter means the default filter used when first showing the dialog.

void addFilter ( const SmartUtil::tstring &  filterName,
const SmartUtil::tstring &  filter 
) [inherited]

Adds a filter to the object.

filterName is the friendly name of the filter, normally this would be e.g. "HTML Files" etc. filter is the actual filter to filter in files to show normally this would be e.g. "*.html".

void backslashToForwardSlashForUnix ( SmartUtil::tstring &  filename  )  [inherited]

Ensure filename meets OS expectations for path separators.

We want WidgetSaveFile and WidgetLoadFile to always return a pathname that meets the OS expectations.
Windows wants: C:.ext
and UnixLinux: /dir/dir/file.ext

Wine produces z:.exe from GetLoadFileName(&ofn) )and GetSaveFileName(&ofn).

So if we are building for wine, we need to convert from the wine output to the Linux format.
IE: convert z:.txt to /home/awebb/file.txt

The assumption is that the C++ standard library is Linux native, and thus needs / pathnames.

unsigned getActiveFilter (  )  const [inherited]

Returns the active filter of the object.

The active filter is the "currently selected" filter of the filter class

void setStartDirectory ( SmartUtil::tstring  startDir  )  [inherited]

Sets the starting directory of the WidgetLoadFile or WidgetSaveFile Widget.

If given your dialog will try to start in the given directory, otherwise it will use the working directory of the process.

SmartUtil::tstring showDialog (  ) 

Shows the dialog.

Returns string() or "empty string" if user press cancel.
Returns a "file path" if user presses ok.

Back to SmartWin website
SourceForge.net Logo