home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Chip 1997 October
/
Chip_1997-10_cd.bin
/
tema
/
sybase
/
powerj
/
hpp.z
/
WFILEDLG.HPP
< prev
next >
Wrap
C/C++ Source or Header
|
1996-11-19
|
8KB
|
225 lines
/* %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Copyright (C) 1994, by WATCOM International Inc. All rights %
% reserved. No part of this software may be reproduced or %
% used in any form or by any means - graphic, electronic or %
% mechanical, including photocopying, recording, taping or %
% information storage and retrieval systems - except with the %
% written permission of WATCOM International Inc. %
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
*/
/*************************************************************************
*
* WFileDialog -- FileDialog class
*
*
* Events:
*
* FolderChange --
*
* NewFileType --
*
* SharingViolation --
*
*************************************************************************/
#ifndef _WFILEDIALOG_HPP_INCLUDED
#define _WFILEDIALOG_HPP_INCLUDED
#ifndef _WNO_PRAGMA_PUSH
#pragma pack(push,8);
#pragma enum int;
#endif
#ifndef _WCOMDLG_HPP_INCLUDED
# include "wcomdlg.hpp"
#endif
// WFileFilter
//
// Used for building filter lists.
struct WFileFilter {
const WChar *title;
const WChar *pattern;
};
// Styles
typedef WULong WFDStyle;
#define WFDSReadOnly ((WFDStyle)0x00000001L)
#define WFDSOverWritePrompt ((WFDStyle)0x00000002L)
#define WFDSHideReadOnly ((WFDStyle)0x00000004L)
#define WFDSNoChangeDir ((WFDStyle)0x00000008L)
#define WFDSShowHelp ((WFDStyle)0x00000010L)
#define WFDSEnableHook ((WFDStyle)0x00000020L)
#define WFDSEnableTemplate ((WFDStyle)0x00000040L)
#define WFDSEnableTemplateHandle ((WFDStyle)0x00000080L)
#define WFDSNoValidate ((WFDStyle)0x00000100L)
#define WFDSAllowMultiSelect ((WFDStyle)0x00000200L)
#define WFDSExtensionDifferent ((WFDStyle)0x00000400L)
#define WFDSPathMustExist ((WFDStyle)0x00000800L)
#define WFDSFileMustExist ((WFDStyle)0x00001000L)
#define WFDSCreatePrompt ((WFDStyle)0x00002000L)
#define WFDSShareAware ((WFDStyle)0x00004000L)
#define WFDSNoReadOnlyReturn ((WFDStyle)0x00008000L)
#define WFDSNoTestFileCreate ((WFDStyle)0x00010000L)
#define WFDSNoNetworkButton ((WFDStyle)0x00020000L)
#define WFDSNoLongNames ((WFDStyle)0x00040000L)
#define WFDSExplorer ((WFDStyle)0x00080000L)
#define WFDSNoDereferenceLinks ((WFDStyle)0x00100000L)
// WFileDialog
//
// Used to display open/save dialog.
class WCMCLASS WFileDialog : public WCommonDialog {
WDeclareSubclass( WFileDialog, WCommonDialog );
public:
WFileDialog();
~WFileDialog();
/*******************************************************
* Properties
*******************************************************/
// BufferSize
//
// Sets the buffer size to be used.
WULong GetBufferSize() const;
WBool SetBufferSize( WULong bufferSize );
// ButtonLabel
//
// Sets an alternative label for the Open/Save button.
// An empty string means to use the system default.
WString GetButtonLabel() const;
WBool SetButtonLabel( const WChar *label );
// FileCount
//
// Number of files selected after dialog returns
// or to initially display. Always at least 1.
WULong GetFileCount() const;
WBool SetFileCount( WULong count=1 );
// FilePath
//
// The path of the file that was selected. Use this
// to set the initial file path as well. If multiple
// files were selected, use the optional parm to GetFilePath
// to return the files from 0..FileCount-1.
WFilePath GetFilePath( WULong whichFile=0 ) const;
WBool SetFilePath( const WFilePath & path, WULong whichFile=0 );
// FilterList
//
// Sets the list of filters that will be used. Note
// that the dialog does not make a private copy of
// the list. The list is just an array of WFileFilters,
// the last one being NULL.
const WFileFilter *GetFilterList() const;
WBool SetFilterList( const WFileFilter *list );
// InitialDirectory
//
// Sets the initial directory used by the file dialog.
// If empty string, uses the current directory.
WString GetInitialDirectory() const;
WBool SetInitialDirectory( const WString & initDir );
// MultiSelect
//
// Sets/gets the multiselect state. Note that if you
// call SetFilePath to set multiple file paths, or set
// the file count to > 1, this mode is automatically turned on.
WBool GetMultiSelect() const;
WBool SetMultiSelect( WBool on );
// Style
//
// Set the styles used by the file dialog. Note that
// the WFDSEnableHook style will ALWAYS be enabled.
WFDStyle GetStyle() const;
WBool SetStyle( WFDStyle style );
/*******************************************************
* Methods
*******************************************************/
// ChangeStyle
//
// Use to turn a specific style on or off.
WBool ChangeStyle( WFDStyle style, WBool on );
// PromptForOpen
//
// Display the "Open" dialog and wait for it to be dismissed.
// The first form uses the current settings. The second
// is a convenience function.
WBool PromptForOpen();
WBool PromptForOpen( WWindow *owner, const WChar *initialPath,
const WChar *title,
const WFileFilter filterList[] );
// PromptForSave
//
// Display the "Save as" dialog and wait for it to be dismissed.
WBool PromptForSave();
WBool PromptForSave( WWindow *owner, const WChar *initialPath,
const WChar *title,
const WFileFilter filterList[] );
/********************************************************
* Static Properties
********************************************************/
// The default filter: "All Files (*.*)"
static const WFileFilter * GetDefaultFilterList();
/********************************************************
* Notifications
********************************************************/
void OnDialogInitialize( WWindowHandle hWnd, WWindowHandle focus );
private:
void *PackOFN();
WBool UnpackOFN( WBool ok );
private:
void *_ofn;
const WFileFilter *_filterList;
WString _buttonLabel;
WString _initialDir;
WULong _fileCount;
WFilePath **_fileList;
WULong _bufferSize;
};
#ifndef _WNO_PRAGMA_PUSH
#pragma enum pop;
#pragma pack(pop);
#endif
#endif // _WFILEDIALOG_HPP_INCLUDED