home *** CD-ROM | disk | FTP | other *** search
- #define Uses_TApplication
- #define Uses_TMenuBar
- #define Uses_TMenu
- #define Uses_TMenuItem
- #define Uses_TSubMenu
- #define Uses_TStatusLine
- #define Uses_THintStatusLine
- #define Uses_TStatusDef
- #define Uses_TStatusItem
- #define Uses_TKeys
- #define Uses_TEvent
- #define Uses_TDeskTop
- #define Uses_TCollection
- #define Uses_THint
- #define Uses_MsgBox
- #define Uses_TPalette
- #define Uses_fpstream
-
- #if __BORLANDC__ < 0x452 && !defined(__WIN32__)
- #include <help.h>
- #else
- #include <tvision\help.h>
- #endif
-
- #include <string.h>
-
- #include "INSTAL_H.H"
- #include "INSTAL_C.H"
- #include "INSTAL_D.H"
-
- #include "supply.h"
-
- char **argv;
-
- class TMyApp : public TApplication
- {
- static THint *Hints[300];
-
- public:
- TMyApp();
- void additionalInit();
- void additionalDone();
- void handleEvent(TEvent &event);
- static TStatusLine *initStatusLine(TRect r);
- static TMenuBar *initMenuBar(TRect r);
- void getEvent(TEvent &event);
- TPalette &getPalette() const;
- void CallInstaluj();
- void CallAboutBox();
- };
-
- THint *TMyApp::Hints[300];
-
-
-
- TStatusLine *TMyApp::initStatusLine(TRect r)
- {
- r.a.y=r.b.y-1;
-
- TStatusDef &def1 = *new TStatusDef(hc_M_Instalace,hc_M_Instalace_Oproduktu)+
- *new TStatusItem("~F1~ Pomoc",kbF1,cmHelp)+
- *new TStatusItem("~Alt-X~ Konec",kbAltX,cmQuit);
-
- TStatusDef &def2 = *new TStatusDef(hc_D_AboutBox,hc_D_Instaluj+99)+
- *new TStatusItem("~F1~ Pomoc",kbF1,cmHelp);
-
- TStatusDef &def3 = *new TStatusDef(hcNoContext,hcNoContext)+
- *new TStatusItem("~Alt-X~ Konec",kbAltX,cmQuit)+
- *new TStatusItem("~F10~ Menu",kbF10,cmMenu);
-
- TStatusDef &def4 = *new TStatusDef(hcHelpWindowActive,hcHelpWindowActive)+
- *new TStatusItem("~ESC~ Zav⌐i",kbEsc,cmClose)+
- *new TStatusItem("",kbF5,cmZoom);
-
- TStatusDef &def5 = *new TStatusDef(hcDragging,hcDragging)+
- *new TStatusItem("Objekt je p⌐esouván...",kbNoKey,cmResize);
-
- return (new THintStatusLine(r,
- def1
- + def2
- + def3
- + def4
- + def5, Hints));
- }
-
-
- TMenuBar *TMyApp::initMenuBar(TRect r)
- {
- r.b.y=r.a.y+1;
- TMenuItem *top1 = new TMenuItem("~I~nstalace",kbNoKey, new TMenu(
- *new TMenuItem("~O~ produktu...",cmAbout,kbNoKey,hc_M_Instalace_Oproduktu)+
- *new TMenuItem("~I~nstaluj",cmInstaluj,kbNoKey,hc_M_Instalace_Instaluj)+
- newLine()+
- *new TMenuItem("~K~onec",cmQuit,kbAltX,hc_M_Instalace_Konec,"Alt-X")
- ),hc_M_Instalace);
-
-
- return (new TMenuBar(r, new TMenu(
- *top1)));
- }
-
-
-
- void TMyApp::additionalInit()
- {
- #include "INSTAL_N.INC"
- Hints[20]=NULL;
-
- }
-
- void TMyApp::additionalDone()
- {
- int loop=0;
-
- while (Hints[loop]!=NULL) delete Hints[loop++];
- }
-
- void TMyApp::getEvent(TEvent &event)
- {
- TApplication::getEvent(event);
-
- if (event.what==evCommand && event.message.command==cmHelp)
- {
- TWindow *w;
- THelpFile *hFile;
- fpstream *helpStrm;
- static Boolean helpInUse = False;
-
- char HelpFile[128];
- strcpy(HelpFile,argv[0]);
- while(HelpFile[strlen(HelpFile)-1]!='\\') HelpFile[strlen(HelpFile)-1]='\0';
- strcat(HelpFile,"INSTAL.HLP");
-
- if (helpInUse == False)
- {
- helpInUse = True;
- helpStrm = new fpstream(HelpFile, ios::in|ios::binary|ios::nocreate);
- hFile = new THelpFile(*helpStrm);
- if (!helpStrm)
- {
- messageBox("Nemohu otevrit soubor s napovedou", mfError | mfOKButton);
- delete hFile;
- }
- else
- {
- w = new THelpWindow(hFile, getHelpCtx());
- TRect r=w->getBounds();
- r.grow(8,1);
- w->changeBounds(r);
- strcpy((char *) w->title,"Napoveda");
- w->flags &= ~wfGrow & ~wfZoom;
- w->helpCtx=hcHelpWindowActive;
- if (validView(w)!=0) execView(w);
- destroy(w);
- }
- helpInUse = False;
- }
- clearEvent(event);
- }
- }
-
- TPalette &TMyApp::getPalette() const
- {
- #if _TV_VERSION < 0x0200
- static TPalette newcolor ( cpColor cHelpColor, sizeof( cpColor cHelpColor )-1 );
- static TPalette newblackwhite( cpBlackWhite cHelpBlackWhite, sizeof( cpBlackWhite cHelpBlackWhite)-1 );
- static TPalette newmonochrome( cpMonochrome cHelpMonochrome, sizeof( cpMonochrome cHelpMonochrome)-1 );
- static TPalette *palettes[] = {&newcolor, &newblackwhite, &newmonochrome};
-
- return *(palettes[appPalette]);
- #else
- return TApplication::getPalette();
- #endif
- }
-
- TMyApp::TMyApp() : TProgInit(&TMyApp::initStatusLine,
- &TMyApp::initMenuBar,
- &TMyApp::initDeskTop)
- {
- Result = AboutBox();
- }
-
- void TMyApp::handleEvent(TEvent &event)
- {
- TApplication::handleEvent(event);
- if (event.what == evCommand)
- {
- switch (event.message.command)
- {
- case cmInstaluj : CallInstaluj(); break;
- case cmAbout : CallAboutBox(); break;
- default : return;
- }
- }
- clearEvent(event);
- }
-
-
-
-
- void TMyApp::CallInstaluj()
- {
- TInstalujData D;
- ushort Result = Instaluj(D,False);
- }
-
- void TMyApp::CallAboutBox()
- {
- ushort Result = AboutBox();
- }
-
- #pragma -wpar
-
- void main(int argc, char *argv[])
- {
- ::argv=argv;
-
- TMyApp AppInstance;
-
- AppInstance.additionalInit();
- AppInstance.run();
- AppInstance.additionalDone();
- }
-
- // ************ Generated by TVGen 3.0 **************
-