home *** CD-ROM | disk | FTP | other *** search
- // Zinc Interface Library - DISPLAY.CPP
- // COPYRIGHT (C) 1990, 1991. All Rights Reserved.
- // Zinc Software Incorporated. Pleasant Grove, Utah USA
-
- #include "ui_dsp.hpp"
-
- UI_DISPLAY::UI_DISPLAY(int _isText, int _cellWidth, int _cellHeight) :
- UI_REGION_LIST(),
- isText(_isText), cellWidth(_cellWidth), cellHeight(_cellHeight),
- installed(FALSE), lines(0), columns(0), eventManager(NULL)
- {
- }
-
- UI_DISPLAY::~UI_DISPLAY(void)
- {
- }
-
- void UI_DISPLAY::RegionDefine(int screenID, int left, int top, int right,
- int bottom)
- {
- UI_REGION region;
- region.left = left;
- region.top = top;
- region.right = right;
- region.bottom = bottom;
-
- // See if it is a full screen definition.
- if (region.left <= 0 && region.top <= 0 && region.right >= columns - 1 && region.bottom >= lines - 1)
- {
- UI_REGION_LIST::Destroy();
- Add(0, new UI_REGION_ELEMENT(screenID, 0, 0, columns - 1, lines - 1));
- return;
- }
-
- // Throw away regions with a negative width or height.
- if (region.right < region.left || region.bottom < region.top)
- return;
-
- // Throw away regions that are completely off the screen.
- if (region.left >= columns || region.right < 0 ||
- region.top >= lines || region.bottom < 0)
- return;
-
- // Clip regions partially off the screen to fit on the screen.
- if (region.left < 0)
- region.left = 0;
- if (region.right >= columns)
- region.right = columns - 1;
- if (region.top < 0)
- region.top = 0;
- if (region.bottom >= lines)
- region.bottom = lines - 1;
-
- // Split any overlapping regions.
- Split(screenID, region);
-
- // Define the new display region.
- Add(0, new UI_REGION_ELEMENT(screenID, ®ion));
- }
-