home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
DP Tool Club 31
/
CDASC_31_1996_juillet_aout.iso
/
vrac
/
tvrw31d.zip
/
APP.SKL
next >
Wrap
Text File
|
1996-04-16
|
6KB
|
269 lines
!
! Application source skeleton file.
!
! Copyright (c) 1995-96 Balázs Scheidler
! This file is part of Turbo Vision Resource WorkShop
!
! Lines that begin with '!' are comments. All other lines are copied to the
! generated output.
!
! Lines that begin with ` are quoted lines. Quoted lines are directly copied
! to output WITHOUT macro expansion. Use this if you need something in a line
! beginning with $(
!
! The following macros are defined in this file:
!
! $(FULLNAME) = fully expanded filename
! $(FILENAME) = 8+3 filename
! $(FNAME) = 8 char file name
! $(FEXT) = 3 char extension
! $(DESCRIPTION)= The description of the project
! $(VERSION) = the version of this project
! $(AUTHOR) = the author of the project
! $(APPNAME) = the name of the application
! $(STATNAME) = resource ID of the StatusLine
! $(MENUNAME) = resource ID of the MenuBar
!
! You can also use a conditional "macro". It is called $(IFDEF xxxx), where
! xxxx is one of the below listed strings. TVRW will ignore the lines
! between $(IFDEF) and $(ENDIF) if the symbol xxxx is not defined.
! NOTE: DO NOT write anything else in lines which contain $(IFDEF) and
! $(ENDIF)
!
! xxxx can be one of the following:
! CPP
! PASCAL
!
! anything else: true if you gave them in the Sourcer Options dialog
! Defines inputline.
!
! These macros are case insensitive.
!
$(IFDEF PASCAL)
{**************************************************************************
$(FILENAME), $(APPNAME) main program
Copyright (c) 1996 $(AUTHOR)
Generated by Turbo Vision Resource WorkShop
**************************************************************************}
$(ENDIF)
$(IFDEF CPP)
/**************************************************************************
$(FILENAME), $(APPNAME) main module
Copyright (c) 1996 $(AUTHOR)
Generated by Turbo Vision Resource WorkShop
**************************************************************************/
$(ENDIF)
$(IFDEF PASCAL)
program $(FNAME);
uses
Drivers, Objects, Views, Dialogs, Menus, Validate, App;
$(IFDEF RESOURCES)
var
ResFile: PResourceFile;
$(ENDIF)
type
T$(APPNAME) = Object(TApplication)
constructor Init;
destructor Done; virtual;
procedure HandleEvent(var Event: TEvent); virtual;
procedure InitMenuBar; virtual;
procedure InitStatusLine; virtual;
end;
constructor T$(APPNAME).Init;
begin
$(IFDEF RESOURCES)
ResFile := New(PResourceFile, Init(New(PBufStream, Init('$(APPNAME).RES', stOpenRead, 4096))));
RegisterObjects;
RegisterViews;
RegisterDialogs;
RegisterValidate;
RegisterMenus;
RegisterApp;
$(ENDIF)
inherited Init;
end;
destructor T$(APPNAME).Done;
begin
inherited Done;
$(IFDEF RESOURCES)
Dispose(ResFile, Done);
$(ENDIF)
end;
procedure T$(APPNAME).HandleEvent(var Event: TEvent);
begin
inherited HandleEvent(Event);
case Event.What of
evCommand:
case Event.Command of
0: ; { This is only needed to make this code compilable }
end;
end;
end;
procedure T$(APPNAME).InitMenuBar;
var
R: TRect;
begin
GetExtent(R);
R.B.Y := R.A.Y + 1;
$(IFDEF RESOURCES)
MenuBar := PMenuBar(ResFile^.Get('$(MENUNAME)'));
MenuBar^.ChangeBounds(R);
$(ENDIF)
end;
procedure T$(APPNAME).InitStatusLine;
var
R: TRect;
begin
GetExtent(R);
R.A.Y := R.B.Y - 1;
$(IFDEF RESOURCES)
StatusLine := PStatusLine(ResFile^.Get('$(STATNAME)'));
StatusLine^.ChangeBounds(R);
$(ENDIF)
end;
var
$(APPNAME): T$(APPNAME);
begin
$(APPNAME).Init;
$(APPNAME).Run;
$(APPNAME).Done;
end.
$(ENDIF)
$(IFDEF CPP)
#define Uses_TApplication
#define Uses_TKeys
#define Uses_TRect
#define Uses_TMenuBar
#define Uses_TSubMenu
#define Uses_TMenuItem
#define Uses_TStatusLine
#define Uses_TStatusItem
#define Uses_TStatusDef
#define Uses_TDeskTop
#define Uses_TButton
#define Uses_TLabel
#define Uses_TStaticText
#define Uses_TParamText
#define Uses_TMemo
#define Uses_TListBox
#define Uses_TSortedListBox
#define Uses_TScrollBar
#define Uses_THistory
#define Uses_TInputLine
#define Uses_TCheckBoxes
#define Uses_TRadioButtons
#define Uses_TPXPictureValidator
#define Uses_TStringLookupValidator
#define Uses_TRangeValidator
#define Uses_TDialog
$(IFDEF RESOURCES)
#define Uses_TResourceFile
$(ENDIF)
#include <tvision\tv.h>
$(IFDEF RESOURCES)
__link(RButton);
__link(RLabel);
__link(RStaticText);
__link(RParamText);
__link(RMemo);
__link(RListBox);
__link(RSortedListBox);
__link(RScrollBar);
__link(RHistory);
__link(RInputLine);
__link(RCheckBoxes);
__link(RRadioButtons);
__link(RPXPictureValidator);
__link(RStringLookupValidator);
__link(RRangeValidator);
__link(RDialog);
$(ENDIF)
$(IFDEF RESOURCES)
char resFileName[] = "$(APPNAME).RES";
TResourceFile *resFile;
$(ENDIF)
// application definition...
class T$(APPNAME) : public TApplication
{
public:
T$(APPNAME)();
~T$(APPNAME)();
virtual void handleEvent(TEvent &);
static TStatusLine *initStatusLine( TRect r );
static TMenuBar *initMenuBar( TRect r );
};
// application constructor
T$(APPNAME)::T$(APPNAME)() :
TProgInit(&T$(APPNAME)::initStatusLine,
&T$(APPNAME)::initMenuBar,
&T$(APPNAME)::initDeskTop)
{
$(IFDEF RESOURCES)
resFile = new TResourceFile(new fpstream(resFileName, ios:in|ios:binary));
$(ENDIF)
}
// application destructor
T$(APPNAME)::~T$(APPNAME)()
{
$(IFDEF RESOURCES)
destroy(resFile);
$(ENDIF)
TApplication::~TApplication();
}
void T$(APPNAME)::handleEvent(TEvent &event)
{
TApplication::handleEvent(event);
switch (event.what) {
case evCommand:
break;
}
}
TStatusLine *T$(APPNAME)::initStatusLine(TRect r)
{
$(IFDEF RESOURCES)
return (TStatusLine *) resFile->get("$(STATNAME)");
$(ELSE)
return TApplication::initStatusLine(r);
$(ENDIF)
}
TMenuBar *T$(APPNAME)::initMenuBar( TRect r )
{
$(IFDEF RESOURCES)
return (TMenuBar *) resFile->get("$(MENUNAME)");
$(ELSE)
return TApplication::initMenuBar(r);
$(ENDIF)
}
int main()
{
T$(APPNAME) $(APPNAME);
$(APPNAME).run();
return 0;
}
$(ENDIF)