home *** CD-ROM | disk | FTP | other *** search
- /*========================================================*/
- /* HINTSTAT.CPP */
- /* (C) 1993 Michael Maier & DMV-Verlag */
- /* Das Programm zeigt, wie in der Statuszeile zusätzliche */
- /* Hilfstexte ausgegeben werden können. */
- /* Compiler: Turbo C++ 3.0, Borland C++ 3.1 */
- /*========================================================*/
-
- #define Uses_TEventQueue
- #define Uses_TEvent
- #define Uses_TApplication
- #define Uses_TKeys
- #define Uses_TRect
- #define Uses_TMenuBar
- #define Uses_TSubMenu
- #define Uses_TMenuItem
- #define Uses_TMenuBox
- #define Uses_TStatusLine
- #define Uses_TStatusItem
- #define Uses_TStatusDef
- #define Uses_TDeskTop
- #define Uses_TView
- #define Uses_TWindow
- #include <tv.h>
-
- #include "stdio.h"
-
- const int cmNew = 200;
- const int cmOpen = 201;
- const int cmSave = 202;
-
- const int hcNew = 1000;
- const int hcOpen = 1001;
- const int hcSave = 1002;
- const int hcExit = 1003;
- const int hcZoom = 1004;
- const int hcNext = 1005;
- const int hcClose = 1006;
- const int hcFile = 1007;
- const int hcWindow = 1008;
-
-
- const char *apstrHilfetexte[] =
- {
- "Legt eine neue Datei an",
- "Lädt eine bestehende Datei in den Speicher",
- "Speichert die Datei auf Diskette",
- "Verläßt das Programm",
- "Vergrößert das aktive Fenster",
- "Wechselt zum nächsten Fenster",
- "Schließt das aktive Fenster",
- "Enthält Funktionen zum Dateihandling/Programmende",
- "Enthält Funktionen zum Fensterhandling",
- NULL
- };
-
- class THintStatusLine: public TStatusLine
- {
- public:
- THintStatusLine(const TRect& bounds,
- TStatusDef& aDefs);
- virtual const char* hint (ushort aHelpCtx);
- };
-
-
- THintStatusLine::THintStatusLine(const TRect& bounds,
- TStatusDef& aDefs): TStatusLine(bounds, aDefs)
- {
- };
-
-
- const char *THintStatusLine::hint (ushort aHelpCtx)
- {
- if(aHelpCtx >= hcNew && aHelpCtx <= hcWindow)
- return(apstrHilfetexte[aHelpCtx - 1000]);
- else
- return("");
- };
-
- class THintStatusApp: public TApplication
- {
- public:
- THintStatusApp();
- static TStatusLine *initStatusLine(TRect r);
- static TMenuBar *initMenuBar(TRect r);
- };
-
- THintStatusApp::THintStatusApp() :
- TProgInit(&THintStatusApp::initStatusLine,
- &THintStatusApp::initMenuBar,
- &THintStatusApp::initDeskTop)
- {
- }
-
- TMenuBar *THintStatusApp::initMenuBar(TRect r)
- {
- r.b.y = r.a.y + 1;
-
- TSubMenu& sub1 =
- *new TSubMenu("~D~atei", kbAltF) +
- *new TMenuItem("~N~eu", cmNew, kbF4, hcNew, "F4") +
- *new TMenuItem("~Ö~ffnen", cmOpen, kbF3, hcOpen, "F3")+
- *new TMenuItem("~S~peichern", cmSave, kbF2, hcSave,
- "F2") + newLine() +
- *new TMenuItem("Quit", cmQuit, cmQuit, hcExit,
- "Alt-X");
- sub1.helpCtx = hcFile;
-
- TSubMenu& sub2 =
- *new TSubMenu("~F~enster", kbAltW) +
- *new TMenuItem("~N~ächstes", cmNext, kbF6, hcNext,"F6")+
- *new TMenuItem("~V~ergrößern", cmZoom, kbF5, hcZoom,
- "F5") +
- *new TMenuItem("~S~chließen", cmClose, kbAltF3,
- hcClose, "Alt-F3");
- sub2.helpCtx = hcWindow;
-
- return(new TMenuBar(r, sub1 + sub2));
- }
-
-
- TStatusLine *THintStatusApp::initStatusLine(TRect r)
- {
- r.a.y = r.b.y - 1;
- return new THintStatusLine(r, *new TStatusDef(0, 0xFFFF) +
- *new TStatusItem("~F10~ Menu", kbF10, cmMenu) +
- *new TStatusItem(0, kbAltX, cmQuit));
- }
-
- int main()
- {
- THintStatusApp HintStatusApp;
- HintStatusApp.run();
- return(0);
- }
-
- /*========================================================*/
- /* Ende von HINTSTAT.CPP */
-