home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
High Voltage Shareware
/
high1.zip
/
high1
/
DIR41
/
DFPP02.ZIP
/
TEST.CPP
< prev
next >
Wrap
C/C++ Source or Header
|
1993-08-15
|
2KB
|
88 lines
// ------------- test.cpp
#include "dflatpp.h"
#include "fileopen.h"
extern MenuBarItem aMenu[];
// ------- application definition
class myAppl : public Application {
String fname;
public:
myAppl() : Application("Test: " VERSION, aMenu)
{ SetAttribute(SIZEABLE | MOVEABLE); }
// ----- menu command functions
void CmNew() {}
void CmOpen();
void CmSave();
void CmSaveAs();
void CmInsert() {}
void CmExit() { CloseWindow(); }
};
#define Ap void (Application::*)()
// --------- MenuSelection objects
MenuSelection
NewCmd ("~New", (Ap) &myAppl::CmNew ),
OpenCmd ("~Open...", (Ap) &myAppl::CmOpen ),
SaveCmd ("~Save", (Ap) &myAppl::CmSave ),
SaveAsCmd ("Save ~As...", (Ap) &myAppl::CmSaveAs ),
ExitCmd ("E~xit Alt+F4", (Ap) &myAppl::CmExit, ALT_F4 ),
InsertCmd ("~Insert Ins", (Ap) &myAppl::CmInsert, On, INS ),
WordWrapCmd ("~Word wrap", On );
// --------- File menu definition
MenuSelection *File[] = {
&NewCmd,
&OpenCmd,
&SaveCmd,
&SaveAsCmd,
&SelectionSeparator,
&ExitCmd,
0
};
MenuSelection *Options[] = {
&InsertCmd,
&WordWrapCmd,
0
};
// --------- menu bar definition
MenuBarItem aMenu[] = {
MenuBarItem( "~File", File ),
MenuBarItem( "~Options", Options ),
MenuBarItem( 0 )
};
main()
{
myAppl ma;
ma.Execute();
return 0;
}
void myAppl::CmOpen()
{
FileOpen fo;
fo.Execute();
if (fo.OKExit()) {
fname = String(fo.FileName());
// ....
}
}
void myAppl::CmSave()
{
}
void myAppl::CmSaveAs()
{
SaveAs sa;
sa.Execute();
if (sa.OKExit()) {
fname = String(sa.FileName());
// ....
}
}