home *** CD-ROM | disk | FTP | other *** search
/ Piper's Pit BBS/FTP: ibm 0040 - 0049 / ibm0040-0049 / ibm0040.tar / ibm0040 / ZINC_5.ZIP / WINSRC.ZIP / MIN.CPP < prev    next >
Encoding:
C/C++ Source or Header  |  1991-06-01  |  1.6 KB  |  67 lines

  1. //    Zinc Interface Library - MIN.CPP
  2. //    COPYRIGHT (C) 1990, 1991.  All Rights Reserved.
  3. //    Zinc Software Incorporated.  Pleasant Grove, Utah  USA
  4.  
  5. #include "ui_win.hpp"
  6. #include <string.h>
  7.  
  8. UIW_MINIMIZE_BUTTON::UIW_MINIMIZE_BUTTON() :
  9.     UIW_BUTTON(0, 0, 0, 0, BTF_NO_FLAGS, WOF_JUSTIFY_CENTER | WOF_NON_FIELD_REGION,
  10.         UIW_MINIMIZE_BUTTON::MinimizeUserFunction)
  11. {
  12.     // Initialize the minimize button information.
  13.     windowID[0] = ID_MINIMIZE_BUTTON;
  14.     windowID[1] = ID_BUTTON;
  15.     search.type = ID_MINIMIZE_BUTTON;
  16.     search.numberID = NUMID_MINIMIZE;
  17.     strcpy(search.stringID, "NUMID_MINIMIZE");
  18.  
  19.     hotKey = HOT_KEY_MINIMIZE;
  20.     woAdvancedFlags |= WOAF_NON_CURRENT;
  21.  
  22.     // Set MS Windows flags.
  23.     MSWindowsStyle |= WS_MINIMIZEBOX;
  24. }
  25.  
  26. int UIW_MINIMIZE_BUTTON::Event(const UI_EVENT &event)
  27. {
  28.     // Switch on the event type.
  29.     int ccode = event.type;
  30.     switch (ccode)
  31.     {
  32.     case S_INITIALIZE:
  33.         if (parent)
  34.             parent->MSWindowsStyle |= MSWindowsStyle;
  35.         break;
  36.  
  37.     case S_CREATE:
  38.     case S_SIZE:
  39.         int height, width;
  40.         width = GetSystemMetrics(SM_CXSIZE);
  41.         height = GetSystemMetrics(SM_CYCAPTION) - 1;
  42.         UI_WINDOW_OBJECT::RegionMax(TRUE);
  43.         true.top -= 1;
  44.         true.right += 1;
  45.         true.bottom = true.top + height - 1;
  46.         true.left = true.right - width + 1;
  47.         break;
  48.  
  49.     default:
  50.         ccode = UI_WINDOW_OBJECT::Event(event);
  51.         break;
  52.     }
  53.  
  54.     // Return the control code.
  55.     return (ccode);
  56. }
  57.  
  58. #ifdef ZIL_STORE
  59. #pragma argsused
  60. void UIW_MINIMIZE_BUTTON::Store(const char *name, UI_STORAGE *file, USHORT storeFlags)
  61. {
  62.     file->Store(search.type);
  63.     if (!FlagSet(storeFlags, S_SUB_LEVEL))
  64.         file->ObjectSize(name, search);
  65. }
  66. #endif
  67.