home *** CD-ROM | disk | FTP | other *** search
- // Zinc Interface Library - D_SYS.CPP
- // COPYRIGHT (C) 1990, 1991. All Rights Reserved.
- // Zinc Software Incorporated. Pleasant Grove, Utah USA
-
- #include "ui_dsn.hpp"
- #include "d_help.hlh"
-
- const int ITEM_FIELD = 0x0001;
-
- int UIW_SYSTEM_BUTTON::Editor(const UI_EVENT &event)
- {
- char *windowName = "System button";
-
- int ccode = UI_WINDOW_OBJECT::LogicalEvent(event, ID_SYSTEM_BUTTON);
- switch (ccode)
- {
- case S_PLACE_OBJECT:
- if (_currentObject->Inherited(ID_POP_UP_ITEM))
- {
- menu + _currentObject;
- _currentObject->woFlags |= WOF_NON_FIELD_REGION;
- }
- else
- ccode = S_ERROR;
- break;
-
- case S_EDIT_OBJECT:
- {
- UIW_BUTTON *save, *cancel, *help;
- UIW_MATRIX *itemField;
-
- // Create the system button editor window.
- UIW_WINDOW *window = new UIW_WINDOW(_centerColumn - 35, _centerLine - 7,
- 69, 13, WOF_NO_FLAGS, WOAF_MODAL | WOAF_NO_SIZE);
- *window
- + new UIW_BORDER
- + &(*new UIW_SYSTEM_BUTTON
- + new UIW_POP_UP_ITEM("~Move", MNIF_MOVE, BTF_NO_TOGGLE, WOF_NO_FLAGS)
- + new UIW_POP_UP_ITEM("~Close", MNIF_CLOSE, BTF_NO_TOGGLE, WOF_NO_FLAGS))
- + new UIW_TITLE(windowName)
-
- + new UIW_PROMPT(2, 1, "Items:", WOF_NO_FLAGS)
- + new UIW_SCROLL_BAR(31, 1, 2, 6, SBF_VERTICAL, WOF_NO_FLAGS)
- + (itemField = new UIW_MATRIX(11, 1, 20, 6, 100, 20, 1, 0, MXF_ROWS_FILL, WOF_BORDER, WOAF_NO_FLAGS))
-
- + new UIW_PROMPT(35, 1, "StringID:", WOF_NO_FLAGS)
- + new UIW_STRING(45, 1, 20, search.stringID, 100, STF_VARIABLE_NAME, WOF_NON_SELECTABLE | WOF_AUTO_CLEAR, 0)
-
- + (save = new UIW_BUTTON(14, 9, 10, "~Save",
- BTF_NO_TOGGLE | BTF_AUTO_SIZE,
- WOF_BORDER | WOF_JUSTIFY_CENTER, UI_DESIGN_MANAGER::Save))
- + (cancel = new UIW_BUTTON(29, 9, 10, "~Cancel",
- BTF_NO_TOGGLE | BTF_AUTO_SIZE,
- WOF_BORDER | WOF_JUSTIFY_CENTER, UI_DESIGN_MANAGER::Cancel))
- + (help = new UIW_BUTTON(44, 9, 10, "~Help",
- BTF_NO_TOGGLE | BTF_AUTO_SIZE,
- WOF_BORDER | WOF_JUSTIFY_CENTER, UI_DESIGN_MANAGER::Help));
-
- // Supply the object list (if any).
- int i = 1;
- for (UIW_POP_UP_ITEM *item = menu.First(); item; i++, item = item->Next())
- {
- *itemField + new UIW_OBJECT_ITEM(0, i - 1, 20, (char *)item->DataGet(FALSE), item->value, item);
- item->InformationSet(screenID, display, eventManager,
- windowManager, paletteMapTable, this);
- }
-
- // Identify key fields.
- window->StringID(windowName);
- itemField->NumberID(ITEM_FIELD);
- save->userObject = cancel->userObject = help->userObject = this;
- help->value = HELP_SYSTEM;
-
- *windowManager + window;
- break;
- }
-
- case S_SAVE_OBJECT:
- {
- UIW_WINDOW *window = (UIW_WINDOW *)windowManager->Get(windowName);
-
- menu.Clear();
- UIW_MATRIX *itemField = (UIW_MATRIX *)window->Get(ITEM_FIELD);
- for (UIW_OBJECT_ITEM *item = (UIW_OBJECT_ITEM *)itemField->First(); item; item = item->Next())
- menu.Add(item->object);
- break;
- }
-
- case L_BEGIN_SELECT:
- _currentObject = &menu;
- menu.woAdvancedStatus |= WOAS_EDIT_MODE;
- // if (ui_time() - time > 8)
- // UIW_BUTTON::Event(event);
- // Continue to default.
-
- default:
- ccode = UIW_BUTTON::Editor(event);
- break;
- }
-
- // Return the control code.
- return (ccode);
- }
-