Mercurial > ~dholland > hg > ag > index.cgi
view examples/dsl/screen.h @ 3:e23ad76d0588
Document the LaTeX packages used in the install notes.
author | David A. Holland |
---|---|
date | Sun, 26 Apr 2009 18:23:33 -0400 |
parents | 13d2b8934445 |
children | a02e9434072e |
line wrap: on
line source
/***** AnaGram Programming Examples A Dos Script Language Screen Control Class Definitions Copyright 1993 Parsifal Software. All Rights Reserved. This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages arising from the use of this software. Permission is granted to anyone to use this software for any purpose, including commercial applications, and to alter it and redistribute it freely, subject to the following restrictions: 1. The origin of this software must not be misrepresented; you must not claim that you wrote the original software. If you use this software in a product, an acknowledgment in the product documentation would be appreciated but is not required. 2. Altered source versions must be plainly marked as such, and must not be misrepresented as being the original software. 3. This notice may not be removed or altered from any source distribution. *****/ #ifndef SCREEN_H #define SCREEN_H #include "pair.h" #define COLOR(fg,bg) (((bg & 0xf) << 4) | (fg & 0xf)) #ifdef __386__ #define INT int386 #define COLOR_ADAPTER_ADDRESS 0XB8000 #else #define INT int86 #define COLOR_ADAPTER_ADDRESS 0XB8000000 #endif // char_cell class class char_cell { public: unsigned char data, color; char_cell() {data = color = 0;} char_cell(int d, int c) { data = (unsigned char) d, color = (unsigned char) c; } char_cell(int d, int fg, int bg) { data = (unsigned char) d, color = (unsigned char) COLOR(fg,bg); } char_cell &operator = (int d) { data = (unsigned char) d; return *this; } }; // Protect Display class protect_display { char_cell *p; unsigned n; pair<int> cursor_position; public: protect_display(); ~protect_display(); }; // Screen Rectangle class class screen_rect{ public: pair <int> pos, size; // position and size of screen_rect pair <int> jm; // justification mode // No constructors or destructors defined // Build a screen rectangle at absolute coordinates friend screen_rect at(int, int, int); // Build a screen rectangle at relative coordinates screen_rect at(int,int,int = 0); // Build a single line rectange at absolute coordinates friend screen_rect line(int, int, int, int = 0); // Build a single line rectangle at relative coordinates screen_rect line(int,int,int,int = 0) const; // Read the contents of a screen rectangle friend char_cell *contents(const screen_rect &); // Set the contents of a screen rectangle screen_rect &operator << (const char_cell *); // Build a sub-rectangle of given width, depth screen_rect rect(int w, int d, int jm = 11); // Draw a box around a screen rectangle friend screen_rect box(screen_rect); // Display data in rectangle screen_rect &operator << (const char_cell &p); screen_rect &operator << (const int); screen_rect &operator << (const char *s); // Tint a rectangle screen_rect &tint(int color); screen_rect &tint(int fg, int bg); // Set cursor relative to rectangle screen_rect &set_cursor(const int = 0, const int = 0); }; screen_rect at(int, int, int = 0); #endif