Initial
This commit is contained in:
68
test/FILEHELP.HPP
Normal file
68
test/FILEHELP.HPP
Normal file
@@ -0,0 +1,68 @@
|
||||
#ifndef _FILEHELP_HPP
|
||||
#define _FILEHELP_HPP
|
||||
#include <string.h>
|
||||
#include <common/windows.hpp>
|
||||
//#include <mdiwin/windowsx.hpp>
|
||||
#include <common/owner.hpp>
|
||||
#include <common/dwindow.hpp>
|
||||
|
||||
class SelectFile : public DWindow
|
||||
{
|
||||
public:
|
||||
enum Mode{Read,Write};
|
||||
SelectFile(HWND hParent,Mode readWrite=Read);
|
||||
~SelectFile();
|
||||
void SetAttribute(WORD attribute);
|
||||
void SetExtension(const char * extension);
|
||||
void SetFileSpec(const char * fileSpec);
|
||||
int GetFileName(char *buffer,WORD length);
|
||||
private:
|
||||
enum {MaxTextLength=96};
|
||||
enum {DefaultAttribute=0x4010};
|
||||
int DlgProc(UINT message,WPARAM wParam,LPARAM lParam);
|
||||
void Initialize();
|
||||
void SelChange();
|
||||
void DoubleClick();
|
||||
void SetExtended();
|
||||
int CheckFileNameSpec();
|
||||
LPSTR lstrrchr(LPSTR,char);
|
||||
LPSTR lstrchr(LPSTR,char);
|
||||
|
||||
|
||||
char mszDefExt[MaxTextLength];
|
||||
char mszFileName[MaxTextLength];
|
||||
char mszFileSpec[MaxTextLength];
|
||||
char mszDirectory[MaxTextLength];
|
||||
char mcLastChar;
|
||||
short mnEditLen;
|
||||
int mLastDrive;
|
||||
WORD mwFileAttribute;
|
||||
OFSTRUCT mPof;
|
||||
HFILE mfd;
|
||||
HWND mhParent;
|
||||
HINSTANCE mhInstance;
|
||||
Mode mMode;
|
||||
OwnerDraw mOwnerDraw;
|
||||
};
|
||||
|
||||
inline
|
||||
void SelectFile::SetAttribute(WORD nAttribute)
|
||||
{
|
||||
mwFileAttribute=nAttribute;
|
||||
}
|
||||
|
||||
inline
|
||||
void SelectFile::SetExtension(const char *szExtension)
|
||||
{
|
||||
::strncpy(mszDefExt,szExtension,sizeof(mszDefExt)-1);
|
||||
mszDefExt[sizeof(mszDefExt)-1]='\0';
|
||||
}
|
||||
|
||||
inline
|
||||
void SelectFile::SetFileSpec(const char *szFileSpec)
|
||||
{
|
||||
::strncpy(mszFileSpec,szFileSpec,sizeof(mszFileSpec)-1);
|
||||
mszFileSpec[sizeof(mszFileSpec)-1]='\0';
|
||||
}
|
||||
#endif
|
||||
|
||||
Reference in New Issue
Block a user