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 / MAX.CPP < prev    next >
Encoding:
C/C++ Source or Header  |  1991-06-01  |  1.6 KB  |  66 lines

  1. //    Zinc Interface Library - MAX.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_MAXIMIZE_BUTTON::UIW_MAXIMIZE_BUTTON(void) :
  9.     UIW_BUTTON(0, 0, 0, 0, BTF_NO_FLAGS, WOF_JUSTIFY_CENTER | WOF_NON_FIELD_REGION,
  10.         UIW_MAXIMIZE_BUTTON::MaximizeUserFunction)
  11. {
  12.     windowID[0] = ID_MAXIMIZE_BUTTON;
  13.     windowID[1] = ID_BUTTON;
  14.     search.type = ID_MAXIMIZE_BUTTON;
  15.     search.numberID = NUMID_MAXIMIZE;
  16.     strcpy(search.stringID, "NUMID_MAXIMIZE");
  17.  
  18.     hotKey = HOT_KEY_MAXIMIZE;
  19.     woAdvancedFlags |= WOAF_NON_CURRENT;
  20.  
  21.     // Set MS Windows flags.
  22.     MSWindowsStyle |= WS_MAXIMIZEBOX;
  23. }
  24.  
  25. int UIW_MAXIMIZE_BUTTON::Event(const UI_EVENT &event)
  26. {
  27.     // Switch on the event type.
  28.     int ccode = event.type;
  29.     switch (ccode)
  30.     {
  31.     case S_INITIALIZE:
  32.         if (parent)
  33.             parent->MSWindowsStyle |= MSWindowsStyle;
  34.         break;
  35.  
  36.     case S_CREATE:
  37.     case S_SIZE:
  38.         int height, width;
  39.         width = GetSystemMetrics(SM_CXSIZE);
  40.         height = GetSystemMetrics(SM_CYCAPTION) - 1;
  41.         UI_WINDOW_OBJECT::RegionMax(TRUE);
  42.         true.top -= 1;
  43.         true.right += 1;
  44.         true.bottom = true.top + height - 1;
  45.         true.left = true.right - width + 1;
  46.         break;
  47.  
  48.     default:
  49.         ccode = UI_WINDOW_OBJECT::Event(event);
  50.         break;
  51.     }
  52.  
  53.     // Return the control code.
  54.     return (ccode);
  55. }
  56.  
  57. #ifdef ZIL_STORE
  58. #pragma argsused
  59. void UIW_MAXIMIZE_BUTTON::Store(const char *name, UI_STORAGE *file, USHORT storeFlags)
  60. {
  61.     file->Store(search.type);
  62.     if (!FlagSet(storeFlags, S_SUB_LEVEL))
  63.         file->ObjectSize(name, search);
  64. }
  65. #endif
  66.