1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160
|
/* windows - general window functions */
/* XLISP-STAT 2.1 Copyright (c) 1990, by Luke Tierney */
/* Additions to Xlisp 2.1, Copyright (c) 1989 by David Michael Betz */
/* You may give out copies of this software; for conditions see the */
/* file COPYING included with this distribution. */
#include "xlisp.h"
#include "xlstat.h"
/* external variables */
extern LVAL s_true, s_title, s_size, s_location, sk_allocate;
/**************************************************************************/
/** **/
/** Utility Functions **/
/** **/
/**************************************************************************/
VOID get_window_bounds P5C(LVAL, object, int *, left, int *, top, int *, width, int *, height)
{
LVAL size, location;
size = slot_value(object, s_size);
location = slot_value(object, s_location);
if (consp(size) && fixp(car(size)) && consp(cdr(size)) && fixp(car(cdr(size)))) {
*width = getfixnum(car(size));
*height = getfixnum(car(cdr(size)));
}
if (consp(location) && fixp(car(location))
&& consp(cdr(location)) && fixp(car(cdr(location)))) {
*left = getfixnum(car(location));
*top = getfixnum(car(cdr(location)));
}
}
/***********************************************************************/
/** **/
/** General Window Methods Functions **/
/** **/
/***********************************************************************/
LVAL xsshowwindow(V)
{
LVAL object = xlgaobject();
IVIEW_WINDOW w = (IVIEW_WINDOW) GETWINDOWADDRESS(object);
if (IVIEW_WINDOW_NULL(w)) {
send_message(object, sk_allocate);
w = (IVIEW_WINDOW) GETWINDOWADDRESS(object);
}
if (! IVIEW_WINDOW_NULL(w)) StShowWindow(w);
return(NIL);
}
LVAL xshidewindow(V)
{
LVAL object = xlgaobject();
IVIEW_WINDOW w = (IVIEW_WINDOW) GETWINDOWADDRESS(object);
if (! IVIEW_WINDOW_NULL(w)) StHideWindow(w);
return(NIL);
}
LVAL xswindow_title(V)
{
IVIEW_WINDOW w;
LVAL object, title;
char *str;
object = xlgaobject();
w = (IVIEW_WINDOW) GETWINDOWADDRESS(object);
if (moreargs()) {
title = xlgastring();
set_slot_value(object, s_title, title);
if (! IVIEW_WINDOW_NULL(w)) {
str = (char *) getstring(title);
StWSetTitle(w, str);
}
}
return(slot_value(object, s_title));
}
static LVAL window_dimensions P2C(int, which, int, frame)
{
LVAL object, slot;
IVIEW_WINDOW w;
int a, b, set = FALSE;
object = xlgaobject();
if (moreargs()) {
set = TRUE;
a = getfixnum(xlgafixnum());
b = getfixnum(xlgafixnum());
}
xllastarg();
w = (IVIEW_WINDOW) GETWINDOWADDRESS(object);
slot = (which == 'L') ? s_location : s_size;
if (set) {
if (! frame) set_slot_value(object, slot, integer_list_2(a, b));
if (! IVIEW_WINDOW_NULL(w)) {
switch (which) {
case 'L': StWSetLocation(w, a, b, frame); break;
case 'S': StWSetSize(w, a, b, frame); break;
}
}
}
if (! IVIEW_WINDOW_NULL(w)) {
switch (which) {
case 'L':
StWGetLocation(w, &a, &b, FALSE);
set_slot_value(object, slot, integer_list_2(a, b));
if (frame) StWGetLocation(w, &a, &b, TRUE);
break;
case 'S':
StWGetSize(w, &a, &b, FALSE);
set_slot_value(object, slot, integer_list_2(a, b));
if (frame) StWGetSize(w, &a, &b, TRUE);
break;
}
return(integer_list_2(a, b));
}
else return(slot_value(object, slot));
}
LVAL xswindow_location(V) { return(window_dimensions('L', FALSE)); }
LVAL xswindow_size(V) { return(window_dimensions('S', FALSE)); }
LVAL xswindow_frame_location(V) { return(window_dimensions('L', TRUE)); }
LVAL xswindow_frame_size(V) { return(window_dimensions('S', TRUE)); }
/**************************************************************************/
/** **/
/** Screen Info Functions **/
/** **/
/**************************************************************************/
LVAL xsscreen_size(V)
{
int width, height;
StGetScreenSize(&width, &height);
return(integer_list_2(width, height));
}
LVAL xsscreen_has_color(V)
{
return((StScreenHasColor()) ? s_true : NIL);
}
LVAL xssystem_has_windows(V)
{
return((StHasWindows()) ? s_true : NIL);
}
LVAL xsflush_graphics(V)
{
StFlushGraphics();
return(NIL);
}
|