home *** CD-ROM | disk | FTP | other *** search
- // WINMGR.CPP - Example of multiple window management and help system.
- // COPYRIGHT (C) 1991. All Rights Reserved.
- // Zinc Software Incorporated. Pleasant Grove, Utah USA
-
- #include <ui_win.hpp>
- #include "winmgr.hlh"
-
- #ifndef ZIL_MSWINDOWS // ---------------------------------------------------------
-
- main()
- {
- // Initialize the display, trying for graphics first.
- UI_DISPLAY *display = new UI_DOS_BGI_DISPLAY;
- if (!display->installed)
- {
- delete display;
- display = new UI_DOS_TEXT_DISPLAY;
- }
-
- // Initialize the event manager.
- UI_EVENT_MANAGER *eventManager = new UI_EVENT_MANAGER(100, display);
- *eventManager + new UI_BIOS_KEYBOARD + new UI_MS_MOUSE + new UI_CURSOR;
-
- #else // ZIL_MSWINDOWS -----------------------------------------------------------
-
- #pragma argsused
- int PASCAL WinMain( HANDLE hInstance, HANDLE hPrevInstance, LPSTR lpszCmdLine, int nCmdShow )
- {
- // Initialize the display.
- UI_DISPLAY *display = new UI_MSWINDOWS_DISPLAY(hInstance, hPrevInstance, nCmdShow);
- if (!display->installed)
- {
- delete display;
- return 1;
- }
-
- // Initialize the event manager and add three devices to it.
- UI_EVENT_MANAGER *eventManager = new UI_EVENT_MANAGER(100, display);
- *eventManager + new UI_MSWINDOWS_MESSAGE;
-
- #endif // ZIL_MSWINDOWS -----------------------------------------------------------
-
- // Initialize the window manager.
- UI_WINDOW_MANAGER *windowManager =
- new UI_WINDOW_MANAGER(display, eventManager);
-
- // Initialize the help window system.
- _helpSystem = new UI_HELP_WINDOW_SYSTEM("winmgr",
- windowManager, HELP_GENERAL);
-
- // Initialize the error window system.
- _errorSystem = new UI_ERROR_WINDOW_SYSTEM;
-
- // Create both notepads.
- UIW_WINDOW *notepad1 = new UIW_WINDOW(4, 5, 66, 12,
- WOF_NO_FLAGS, WOAF_NO_FLAGS, HELP_NOTEPAD);
-
- UIW_WINDOW *notepad2 = new UIW_WINDOW(9, 10, 65, 12,
- WOF_NO_FLAGS, WOAF_NO_FLAGS, HELP_NOTEPAD);
-
- // Add window objects to notepad1.
- *notepad1
- + new UIW_BORDER
- + new UIW_MAXIMIZE_BUTTON
- + new UIW_MINIMIZE_BUTTON
- + new UIW_SYSTEM_BUTTON
- + new UIW_TITLE("Notepad 1", WOF_JUSTIFY_CENTER)
-
- + new UIW_PROMPT(2, 1, "To:", WOF_NO_FLAGS)
- + new UIW_STRING(6, 1, 15, "Everyone", 40, STF_NO_FLAGS,
- WOF_BORDER)
-
- + new UIW_PROMPT(28, 1, "Date:", WOF_NO_FLAGS)
- + new UIW_DATE(35, 1, 20, &UI_DATE(), "",
- DTF_SYSTEM | DTF_ALPHA_MONTH, WOF_BORDER)
-
- + new UIW_PROMPT(2, 2, "Message:", WOF_NO_FLAGS)
- + new UIW_TEXT(2, 3, 60, 4, "", 1028, TXF_NO_FLAGS, WOF_BORDER);
-
- // Add window objects to notepad2.
- *notepad2
- + new UIW_BORDER
- + new UIW_MAXIMIZE_BUTTON
- + new UIW_MINIMIZE_BUTTON
- + new UIW_SYSTEM_BUTTON
- + new UIW_TITLE("Notepad 2", WOF_JUSTIFY_CENTER)
-
- + new UIW_PROMPT(2, 1, "To:", WOF_NO_FLAGS)
- + new UIW_STRING(6, 1, 15, "Everyone", 40, STF_NO_FLAGS,
- WOF_BORDER)
-
- + new UIW_PROMPT(28, 1, "Date:", WOF_NO_FLAGS)
- + new UIW_DATE(35, 1, 20, &UI_DATE(), "",
- DTF_SYSTEM | DTF_ALPHA_MONTH, WOF_BORDER)
-
- + new UIW_PROMPT(2, 2, "Message:", WOF_NO_FLAGS)
- + new UIW_TEXT(2, 3, 60, 4, "", 1028, TXF_NO_FLAGS, WOF_BORDER);
-
- // Add notepads to the window manager.
- *windowManager + notepad1 + notepad2;
-
- // Wait for user response.
- int ccode;
- UI_EVENT event;
- do
- {
- eventManager->Get(event, Q_NORMAL);
- ccode = windowManager->Event(event);
- } while (ccode != L_EXIT && ccode != S_NO_OBJECT);
-
- // Clean up.
- delete _helpSystem;
- delete _errorSystem;
- delete windowManager;
- delete eventManager;
- delete display;
- }
-