home *** CD-ROM | disk | FTP | other *** search
/ CD Actual 14 / CDACTUAL.iso / cdactual / demobin / share / program / c / ZINC.ZIP / D_CLASS.CPP < prev    next >
Encoding:
C/C++ Source or Header  |  1990-07-23  |  1.9 KB  |  66 lines

  1. //    Program name..    Zinc Interface Library
  2. //    Filename......    D_CLASS.CPP
  3. //    
  4. //    COPYRIGHT (C) 1990.  All Rights Reserved.
  5. //    Zinc Software Incorporated.  Pleasant Grove, Utah  USA
  6.  
  7. #include <stdio.h>
  8. #include <stdlib.h>
  9. #include <ui_win.hpp>
  10. #include "d_demo.hpp"
  11.  
  12. const int MAX_WINDOWS = 25;
  13.  
  14. #pragma argsused
  15. void WindowClassic(void *item, UI_EVENT &event)
  16. {
  17.     char title[16];
  18.     UIW_WINDOW *window[MAX_WINDOWS];
  19.     int left, top, width, height;
  20.     int minHeight = _display->isText ? 2 : 28;
  21.     int minWidth = _display->isText ? 15 : 140;
  22.     UI_REGION region;
  23.     region.left = region.top = 0;
  24.     region.right = _display->columns - 1;
  25.     region.bottom = _display->lines - 1;
  26.  
  27.     // Hide the input devices while we display the windows.
  28.     _eventManager->DevicesHide(region);
  29.  
  30.     // Put windows up in random locations on the screen.
  31.     randomize();
  32.     for (int i = 0; i < MAX_WINDOWS; i++)
  33.     {
  34.         sprintf(title, "Window %i", i);
  35.         width = minWidth + random(_display->columns / 2 - minWidth);
  36.         height = minHeight + random(_display->lines / 2 - minHeight);
  37.         left = random(_display->columns - width + 1);
  38.         top = random(_display->lines - height + 1);
  39.         window[i] = UIW_WINDOW::GENERIC(left, top, width, height,
  40.             WOF_NO_FLAGS, WOAF_NO_SIZE, NO_HELP_CONTEXT, title);
  41.         if (i % 3 == 1)
  42.             window[i]->paletteMapTable = _helpPaletteMapTable;
  43.         else if (i % 3 == 2)
  44.             window[i]->paletteMapTable = _errorPaletteMapTable;
  45.         if (!_display->isText)
  46.             window[i]->woStatus |= WOS_GRAPHICS;
  47.         *_windowManager + window[i];
  48.  
  49.         // Give the event manager some time.
  50.         _eventManager->Get(event, Q_NO_BLOCK | Q_BEGIN | Q_NO_DESTROY);
  51.     }
  52.  
  53.     // Take the windows off the screen.
  54.     for (i = 0; i < MAX_WINDOWS; i++)
  55.     {
  56.         *_windowManager - window[i];
  57.         delete window[i];
  58.  
  59.         // Give the event manager some time.
  60.         _eventManager->Get(event, Q_NO_BLOCK | Q_BEGIN | Q_NO_DESTROY);
  61.     }
  62.  
  63.     // Redisplay the input devices.
  64.     _eventManager->DevicesShow(region);
  65. }
  66.