WidgetLoadFile Class Template Reference
[Widgets]

LoadFileDialog class. More...

Inherits AspectFileFilter, and WidgetFileCommon.

List of all members.

Public Types

typedef WidgetLoadFile< Parent > ObjectType
 Object type.
typedef WidgetLoadFile< 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.
std::vector< SmartUtil::tstring > showDialogMultiSelect ()
 Shows the dialog.


Detailed Description

template<class Parent>
class SmartWin::WidgetLoadFile< Parent >

LoadFileDialog class.

loadfile.PNG
Class for showing a LoadFileDialog box.
Either derive from it or call WidgetFactory::createLoadFile.
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 and HWND in the Parent template parameter.
the complete signature of the function will then be "HWND parent()"


Member Typedef Documentation

typedef WidgetLoadFile< 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.
Use the inherited functions AspectFileFilter::addFilter and AspectFileFilter::activeFilter
before calling this function, if you wish the dialog to show only certain types of files.

std::vector< SmartUtil::tstring > showDialogMultiSelect (  ) 

Shows the dialog.

Returns an empty vector if user press cancel.
Returns a vector of "file paths" if user presses ok.
Use the inherited functions AspectFileFilter::addFilter and AspectFileFilter::activeFilter
before calling this function, if you wish the dialog to show only certain types of files.

Back to SmartWin website
SourceForge.net Logo