home *** CD-ROM | disk | FTP | other *** search
- // Zinc Interface Library - MIN.CPP
- // COPYRIGHT (C) 1990, 1991. All Rights Reserved.
- // Zinc Software Incorporated. Pleasant Grove, Utah USA
-
- #include "ui_win.hpp"
- #include <string.h>
-
- UIW_MINIMIZE_BUTTON::UIW_MINIMIZE_BUTTON() :
- UIW_BUTTON(0, 0, 0, 0, BTF_NO_FLAGS,
- WOF_BORDER | WOF_JUSTIFY_CENTER | WOF_NON_FIELD_REGION,
- UIW_MINIMIZE_BUTTON::MinimizeUserFunction)
- {
- // Initialize the minimize button information.
- windowID[0] = ID_MINIMIZE_BUTTON;
- windowID[1] = ID_BUTTON;
- search.type = ID_MINIMIZE_BUTTON;
- search.numberID = NUMID_MINIMIZE;
- strcpy(search.stringID, "NUMID_MINIMIZE");
-
- hotKey = HOT_KEY_MINIMIZE;
- woAdvancedFlags |= WOAF_NON_CURRENT;
- }
-
- int UIW_MINIMIZE_BUTTON::Event(const UI_EVENT &event)
- {
- // Switch on the event type.
- int ccode = event.type;
- switch (ccode)
- {
- case S_CREATE:
- if (string)
- delete string;
- string = ui_strdup(" ");
- // Continue to S_SIZE.
-
- case S_SIZE:
- string[0] = (FlagSet(parent->woAdvancedStatus, WOAS_MINIMIZED)) ?
- 0x12 : 0x19;
- if (display->isText)
- {
- true.top = true.bottom = parent->true.top;
- true.left = parent->true.right - 6;
- true.right = true.left + 2;
- woAdvancedStatus &= ~WOAS_INVALID_REGION;
- }
- else
- {
- int height, width;
- UIW_BUTTON::Information(GET_DEFAULT_HEIGHT, &height);
- UIW_BUTTON::Information(GET_DEFAULT_WIDTH, &width);
- UI_WINDOW_OBJECT::RegionMax(TRUE);
- if (true.top > parent->true.top)
- true.top -= 1;
- if (true.right < parent->true.right)
- true.right += 1;
- true.bottom = true.top + height - 1;
- true.left = true.right - width + 1;
- }
- if (FlagSet(parent->woAdvancedStatus, WOAS_MINIMIZED))
- woStatus |= WOS_SELECTED;
- else
- woStatus &= ~WOS_SELECTED;
- if (FlagSet(parent->woAdvancedStatus, WOAS_MAXIMIZED))
- woFlags |= WOF_NON_SELECTABLE;
- else
- woFlags &= ~WOF_NON_SELECTABLE;
- break;
-
- case S_DISPLAY_INACTIVE:
- if (display->isText)
- break;
- // Continue to S_DISPLAY_ACTIVE.
-
- case S_DISPLAY_ACTIVE:
- if (display->isText)
- lastPalette = NULL;
- // Continue to default.
-
- default:
- ccode = UIW_BUTTON::Event(event);
- break;
- }
-
- // Return the control code.
- return (ccode);
- }
-
- #ifdef ZIL_STORE
- #pragma argsused
- void UIW_MINIMIZE_BUTTON::Store(const char *name, UI_STORAGE *file, USHORT storeFlags)
- {
- file->Store(search.type);
- if (!FlagSet(storeFlags, S_SUB_LEVEL))
- file->ObjectSize(name, search);
- }
- #endif
-