90 FilterIndex(
src.FilterIndex),
91 InitialDir(
src.InitialDir),
115 FlagsEx =
src.FlagsEx;
117 FilterIndex =
src.FilterIndex;
118 InitialDir =
src.InitialDir;
120 MaxPath =
src.MaxPath;
125 SetFilter(
src.Filter);
167 if (*
i.Current() ==
_T(
'|'))
189#if defined(OPENFILENAME_SIZE_VERSION_400)
204#if WINVER >= 0x500 && !defined(WINELIB)
207 ofn.lpfnHook =
nullptr;
209 ofn.lpstrFilter = Data.
Filter;
214 ofn.lpstrDefExt = Data.
DefExt;
242 ofn.lpstrTitle =
title ? &Title[0] :
nullptr;
260 ofn.lpstrTitle = &Title[0];
295 else if (
msg == TOpenSaveDialog::ShareViMsgId)
305 WARN(
r !=
OFN_SHAREWARN,
_T(
"ShareViolation returned unexpected value in Explorer-style dialog:") <<
r);
311 _T(
"ShareViolation returned undefined value: ") <<
r);
370 Data.Flags = ofn.Flags;
371 Data.FilterIndex =
static_cast<int>(ofn.nFilterIndex);
404 Data.Flags = ofn.Flags;
405 Data.FilterIndex = ofn.nFilterIndex;
464 os.writeString(
_W2A(FileName));
465 os.fwriteString(
_W2A(Filter));
469 os.fwriteString(
_W2A(InitialDir));
470 os.fwriteString(
_W2A(DefExt));
517 auto v = std::vector<tstring>{};
521 CHECK(
static_cast<int>(p - FileName) < MaxPath);
536 while (*p !=
_T(
'\0'))
539 const auto f =
d +
_T(
'\\') +
n;
542 CHECK(
static_cast<int>(p - FileName) < MaxPath);
#define WARN(condition, message)
#define PRECONDITION(condition)
Derived from TDialog, TCommonDialog is the abstract base class for TCommonDialog objects.
bool SetMsgResult(TResult result)
Sets the dialog procedure message result (DWLP_MSGRESULT) and returns true.
virtual INT_PTR DialogFunction(TMsgId, TParam1, TParam2)
Override this to process messages within the dialog function.
static INT_PTR CALLBACK StdDlgProc(HWND, UINT, WPARAM, LPARAM) noexcept
Callback procs for hooking TDialog to native window.
int DoExecute()
Creates the TFileOpenDialog object.
TFileOpenDialog(TWindow *parent, TData &data, TResId templateId=0, LPCTSTR title=nullptr, TModule *module=nullptr)
Constructs and initializes the TFileOpen object based on information in the TOpenSaveDialog::TData da...
int DoExecute()
Creates the TFileSaveDialog object.
TFileSaveDialog(TWindow *parent, TData &data, TResId templateId=0, LPCTSTR title=nullptr, TModule *module=nullptr)
Constructs and initializes the TFileOpen object based on the TOpenSaveDialog::TData structure,...
ObjectWindows dynamic-link libraries (DLLs) construct an instance of TModule, which acts as an object...
TNotify is a thin wrapper around the NMHDR structure.
TOpenSaveDialog structure contains information about the user's file open or save selection.
TData & operator=(const TData &src)
TCHAR * FileName
Holds the name of the file to be saved or opened.
TData(uint32 flags=0, LPCTSTR filter=nullptr, TCHAR *customFilter=nullptr, LPCTSTR initialDir=nullptr, LPCTSTR defExt=nullptr, int maxPath=0, int filterIndex=0, uint32 flagsEx=0)
Constructs a TOpenSaveDialog::TData structure.
int FilterIndex
FilterIndex indicates which filter to use initially when displaying file names.
LPCTSTR InitialDir
Directory to use initially when displaying file names.
~TData()
Destructs a TOpenSaveDialog::TData structure.
uint32 Flags
Flag contains one or more of the following constants:
TCHAR * Filter
Filter holds the filter to use initially when displaying file names.
LPCTSTR DefExt
Default extension to use when saving file names.
auto GetFileNames() const -> std::vector< tstring >
Returns a vector containing the full paths of every file entry in member FileName.
void SetFilter(LPCTSTR filter=nullptr)
Makes a copy of the filter list used to display the file names.
TOpenSaveDialog is the base class for modal dialogs that let you open and save a file under a specifi...
TOpenSaveDialog(TWindow *parent, TData &data, TResId templateId=0, LPCTSTR title=nullptr, TModule *module=nullptr)
auto DialogFunction(TMsgId, TParam1, TParam2) -> INT_PTR override
Handles CDN_SHAREVIOLATION and the older SHAREVISTRING registered message.
virtual int ShareViolation()
If a sharing violation occurs when a file is opened or saved, ShareViolation is called to obtain a re...
void Init(TResId templateId)
Initializes a TOpenSaveDialog object with the current resource ID.
static uint GetMajorVersion()
TWindow, derived from TEventHandler and TStreamableBase, provides window-specific behavior and encaps...
TWindow * GetParentO() const
Return the OWL's parent for this window.
TModule * GetModule() const
Returns a pointer to the module object.
HWND GetHandle() const
Returns the handle of the window.
ipstream, a specialized input stream derivative of pstream, is the base class for reading (extracting...
Base class for writing streamable objects.
Definition of classes for CommonControl encapsulation.
#define DEFINE_RESPONSE_TABLE1(cls, base)
Macro to define a response table for a class with one base.
char * strnewdup(const char *s, size_t minAllocSize=0)
Object Windows Library (OWLNext Core)
UINT TMsgId
Message ID type.
LPARAM TParam2
Second parameter type.
WPARAM TParam1
First parameter type.
Definition of TOpenSave abstract, TFileOpen, TFileSave common Dialog classes.