home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Windoware
/
WINDOWARE_1_6.iso
/
source
/
winobj
/
winobj.hpp
< prev
next >
Wrap
C/C++ Source or Header
|
1991-01-13
|
6KB
|
135 lines
// Copyright 1991 (c), Lake View Software
// 4321 Harborough Rd.
// Columbus, OH 43220
// Window Object Library
// WinObj.hpp
#if !defined _WINDOW_OBJECTS
#define _WINDOW_OBJECTS true
#include <stdio.h>
#include "win.h"
typedef int (*valid_func)(void *);
extern int w_count;
extern char *Box_char[];
extern int Max_x,Max_y;
extern int get_count;
// Get Object
class GetObj {
public:
GetObj *Prev_get;
GetObj *Next_get;
int y,x;
int len,dec;
int type;
long int *i_obj;
double *d_obj;
char *s_obj;
char style;
char *picture;
valid_func valid;
};
// Window Object
class WinObj {
protected:
int wsc,wsr,wec,wer;
int width,height; // Actual screen space available
int get_attr;
int win_attr; // Default attribute for window
int bor_attr;
int bor_type;
char fill_char; // window fill character
int title_pos; // Title positoin
char *title_str; // Pointer to title string
char *wdata_buf; // Data buffer
char *wattr_buf; // attribute buffer
static WinObj *w_active;
WinObj *next_win;
WinObj *prev_win;
GetObj *Current_get;
GetObj *Last_get;
char opened; // Opened flag
char hidden; // Hidden flag
char needs_display; // Refresh flag
char has_border; // border flag
char has_shadow; // shadow flag
char scroll_h,scroll_v; // scroll arrows flag
unsigned vh,vw; // Virtual height and width
unsigned buf_size; // Window data and attr buf size
unsigned sx,sy; // Start x and y for virtual display
unsigned cur_pos; // Cursor x and y
void reset_window(); // reset all flags
void show_cursor(); // Show cursor in window
void display(); // Display window contents on top
int get_realy(int y); // return screen y for window y
int get_realx(int x); // return screen x for window x
int buf_offset(int y,int x); // returns buffer offset for window x,y
void draw_box (int sr,int sc,int er,int ec,int color,int type);
void draw_border(); // draw the window border
void show_title(); // display title
int get_titlestart(int &len); // get start x of title and length
int input(GetObj *Obj); // Get a read from the screen
int create_get(int y,int x); // create a new get object
void show_get (GetObj *Obj); // Display get on screen with get attr
void update(int start_pos,int len); // Update a portion of window
public:
~WinObj() { close();};
void assign(int v_h=0,int v_w=0); // remote init
WinObj(int v_h=0,int v_w=0);
int set_virtual (int y,int x); // set virtual size
int open (int sr,int sc,int er,int ec,
int btype=W_DOUBLE,int wattr=_BLACK|LGREY,int battr=_BLACK|LGREY);
void set_active(); // makes window current window
void update(); // Update but don't refresh
void close();
int set_attr(int color); // Returns pervios attribute
void set_attr(int color,int y,int x,int cnt=1); // change attr
void set_fill(char fill); // set window fill character.
void change_border(int type,int color=-1);
void title(char *str,int position=W_CENTER);
void shadow(int on_off=W_ON);
void gotoxy(int y=0,int x=0); // Move cursor in window
int pan (int delta_y, int delta_x); // change pan location
int set_pan (int y,int x); // set pan location
void bprintf(char *,...); // Print f in window
void bprintf(int y,int x,char *,...); // xy bprintf
void printf(char *,...); // Print f in window
void printf(int y,int x,char *,...); // xy printf
int center(int y,char *); // center in virtual window
void clr_win(); // Clear window
void clr_eol(); // Clear to end of current line
void del_line(int line_no); // Delete current, line pull up
void ins_line(int line_no); // Ins new line, push down
int get(int y, int x, char *str, char *picture=NULL);
int get(int y, int x, long int &geti,int len=5);
int get(int y, int x, double &getd, int len=10, int dec=2);
int get(int y, int x, char *str, char style);
int valid (int (*func)(void *)); // Valid function
int get_key(int echo=W_NOECHO); // Get single key from keyboard do not echo
int read(); // Read all defined gets
void clear_gets(); // Clear all defined gets
void hide(); // Hide window
void unhide(); // Show window
int move(int y,int x); // Move the window
int size(int new_height,int new_width); // Resize the window
/* Infromation functions */
int do_youown(int y,int x,char &ch,char &attr); // Do you own screen position
WinObj *who_owns(int y,int x,char &ch,char &attr);
unsigned max_x(),max_y(); // return maximum virtual x/y coordinates
int get_scr (int &sr,int &sc,int &er,int &ec); // get coordinates
int get_pan(int &y, int &x); // return current pan coordinates
int wherexy(int &y, int &x); // return current cursor pos
int is_open(); // open status
int ret_char(int y,int x); // get window char
int ret_attr(int y,int x); // get window attr
int text_save(FILE *fp); // save window text
int text_retrieve(FILE *fp); // retrieve text
};
#endif