commit of gtapi for os2
This commit is contained in:
110
harbour/source/rtl/gtos2.c
Normal file
110
harbour/source/rtl/gtos2.c
Normal file
@@ -0,0 +1,110 @@
|
||||
/*
|
||||
* GTOS2.C: Video subsystem for OS/2 compilers.
|
||||
*
|
||||
* This module is based on VIDMGR by Andrew Clarke and modified for
|
||||
* the Harbour project
|
||||
*/
|
||||
|
||||
#define INCL_KBD
|
||||
#define INCL_VIO
|
||||
#define INCL_DOSPROCESS
|
||||
|
||||
#include <string.h>
|
||||
#include <os2.h>
|
||||
#include <gtapi.h>
|
||||
|
||||
#ifndef KBDTRF_FINAL_CHAR_IN
|
||||
#define KBDTRF_FINAL_CHAR_IN FINAL_CHAR_IN
|
||||
#endif
|
||||
|
||||
static void gtSetCursorSize(char start, char end);
|
||||
static void gtGetCursorSize(char *start, char *end);
|
||||
|
||||
void gtInit(void)
|
||||
{
|
||||
}
|
||||
|
||||
void gtDone(void)
|
||||
{
|
||||
}
|
||||
|
||||
char gtGetScreenWidth(void)
|
||||
{
|
||||
VIOMODEINFO vi;
|
||||
vi.cb = sizeof(VIOMODEINFO);
|
||||
VioGetMode(&vi, 0);
|
||||
return vi.col;
|
||||
}
|
||||
|
||||
char gtGetScreenHeight(void)
|
||||
{
|
||||
VIOMODEINFO vi;
|
||||
vi.cb = sizeof(VIOMODEINFO);
|
||||
VioGetMode(&vi, 0);
|
||||
return vi.row;
|
||||
}
|
||||
|
||||
void gtGotoXY(char x, char y)
|
||||
{
|
||||
VioSetCurPos((USHORT) (y - 1), (USHORT) (x - 1), 0);
|
||||
}
|
||||
|
||||
static void gtSetCursorSize(char start, char end)
|
||||
{
|
||||
VIOCURSORINFO vi;
|
||||
vi.yStart = start;
|
||||
vi.cEnd = end;
|
||||
vi.cx = 0;
|
||||
vi.attr = 0;
|
||||
VioSetCurType(&vi, 0);
|
||||
}
|
||||
|
||||
static void gtGetCursorSize(char *start, char *end)
|
||||
{
|
||||
VIOCURSORINFO vi;
|
||||
VioGetCurType(&vi, 0);
|
||||
*start = vi.yStart;
|
||||
*end = vi.cEnd;
|
||||
}
|
||||
|
||||
void gtSetCursorStyle(int style)
|
||||
{
|
||||
/* TODO: need to implement this */
|
||||
}
|
||||
|
||||
int gtGetCursorStyle(void)
|
||||
{
|
||||
/* TODO: need to implement this */
|
||||
int rc=0;
|
||||
|
||||
return(rc);
|
||||
}
|
||||
|
||||
void gtPuts(char x, char y, char attr, char *str)
|
||||
{
|
||||
VioWrtCharStrAtt(str, (USHORT) strlen(str), (USHORT) (y - 1), (USHORT) (x - 1), (PBYTE) &attr, 0);
|
||||
}
|
||||
|
||||
void gtGetText(char x1, char y1, char x2, char y2, char *dest)
|
||||
{
|
||||
USHORT width;
|
||||
char y;
|
||||
width = (USHORT) ((x2 - x1 + 1) * 2);
|
||||
for (y = y1; y <= y2; y++)
|
||||
{
|
||||
VioReadCellStr((PBYTE) dest, &width, (USHORT) (y - 1), (USHORT) (x1 - 1), 0);
|
||||
dest += width;
|
||||
}
|
||||
}
|
||||
|
||||
void gtPutText(char x1, char y1, char x2, char y2, char *srce)
|
||||
{
|
||||
USHORT width;
|
||||
char y;
|
||||
width = (USHORT) ((x2 - x1 + 1) * 2);
|
||||
for (y = y1; y <= y2; y++)
|
||||
{
|
||||
VioWrtCellStr((PBYTE) srce, width, (USHORT) (y - 1), (USHORT) (x1 - 1), 0);
|
||||
srce += width;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user