home *** CD-ROM | disk | FTP | other *** search
- // Zinc Interface Library - TITLE.CPP
- // COPYRIGHT (C) 1990, 1991. All Rights Reserved.
- // Zinc Software Incorporated. Pleasant Grove, Utah USA
-
- #include "ui_win.hpp"
- #include <string.h>
-
- UIW_TITLE::UIW_TITLE(char *title, USHORT _woFlags) :
- UIW_BUTTON(0, 0, 0, title, BTF_DOWN_CLICK | BTF_NO_TOGGLE | BTF_NO_3D,
- _woFlags | WOF_BORDER | WOF_NON_FIELD_REGION, UIW_TITLE::TitleUserFunction)
- {
- // Initialize the title information.
- windowID[0] = ID_TITLE;
- windowID[1] = ID_BUTTON;
- search.type = ID_TITLE;
- search.numberID = NUMID_TITLE;
- strcpy(search.stringID, "NUMID_TITLE");
-
- woAdvancedFlags |= WOAF_NON_CURRENT;
- MSWindowsStyle |= WS_CAPTION;
- }
-
- void UIW_TITLE::DataSet(char *_string)
- {
- // Reset the button's string information.
- if (_string)
- {
- if (string && !FlagSet(woFlags, WOF_NO_ALLOCATE_DATA))
- delete string;
- string = FlagSet(woFlags, WOF_NO_ALLOCATE_DATA) ? _string : ui_strdup(_string);
- if (parent && parent->hWnd)
- SetWindowText(parent->hWnd, string);
- }
- if (display && display->isText)
- UI_WINDOW_OBJECT::Redisplay(TRUE);
- else
- UI_WINDOW_OBJECT::Redisplay(FALSE);
- }
-
- int UIW_TITLE::Event(const UI_EVENT &event)
- {
- // Switch on the event type.
- int ccode = event.type;
- switch (ccode)
- {
- case S_INITIALIZE:
- if (parent)
- parent->MSWindowsStyle |= MSWindowsStyle;
- break;
-
- case S_CREATE:
- case S_SIZE:
- if (parent->hWnd)
- SetWindowText(parent->hWnd, string);
-
- int height;
- height = GetSystemMetrics(SM_CYCAPTION) - 1;
- UI_WINDOW_OBJECT::RegionMax(TRUE);
- true.top -= 1;
- true.bottom = true.top + height - 1;
- break;
-
- default:
- // Default to the base class object.
- ccode = UI_WINDOW_OBJECT::Event(event);
- break;
- }
-
- // Return the control code.
- return (ccode);
- }
-
-
- #ifdef ZIL_LOAD
- UIW_TITLE::UIW_TITLE(const char *name, UI_STORAGE *file, USHORT loadFlags) :
- UIW_BUTTON(name, file, loadFlags | L_SUB_LEVEL)
- {
- windowID[0] = ID_TITLE;
- windowID[1] = ID_BUTTON;
- userFunction = UIW_TITLE::TitleUserFunction;
-
- if (!file)
- file = _storage;
- if (!FlagSet(loadFlags, L_SUB_LEVEL) && FlagSet(file->stStatus, STS_TEMPORARY))
- delete file;
- }
- #endif
-
- #ifdef ZIL_STORE
- void UIW_TITLE::Store(const char *name, UI_STORAGE *file, USHORT storeFlags)
- {
- UIW_BUTTON::Store(name, file, storeFlags | S_SUB_LEVEL);
- if (!FlagSet(storeFlags, S_SUB_LEVEL))
- file->ObjectSize(name, search);
- }
- #endif
-
-
-