1 /* windows - general window functions */
2 /* XLISP-STAT 2.1 Copyright (c) 1990, by Luke Tierney */
3 /* Additions to Xlisp 2.1, Copyright (c) 1989 by David Michael Betz */
4 /* You may give out copies of this software; for conditions see the */
5 /* file COPYING included with this distribution. */
10 /* external variables */
11 extern LVAL s_true
, s_title
, s_size
, s_location
, sk_allocate
;
13 /**************************************************************************/
15 /** Utility Functions **/
17 /**************************************************************************/
19 VOID get_window_bounds
P5C(LVAL
, object
, int *, left
, int *, top
, int *, width
, int *, height
)
23 size
= slot_value(object
, s_size
);
24 location
= slot_value(object
, s_location
);
25 if (consp(size
) && fixp(car(size
)) && consp(cdr(size
)) && fixp(car(cdr(size
)))) {
26 *width
= getfixnum(car(size
));
27 *height
= getfixnum(car(cdr(size
)));
29 if (consp(location
) && fixp(car(location
))
30 && consp(cdr(location
)) && fixp(car(cdr(location
)))) {
31 *left
= getfixnum(car(location
));
32 *top
= getfixnum(car(cdr(location
)));
36 /***********************************************************************/
38 /** General Window Methods Functions **/
40 /***********************************************************************/
44 LVAL object
= xlgaobject();
45 IVIEW_WINDOW w
= (IVIEW_WINDOW
) GETWINDOWADDRESS(object
);
47 if (IVIEW_WINDOW_NULL(w
)) {
48 send_message(object
, sk_allocate
);
49 w
= (IVIEW_WINDOW
) GETWINDOWADDRESS(object
);
51 if (! IVIEW_WINDOW_NULL(w
)) StShowWindow(w
);
57 LVAL object
= xlgaobject();
58 IVIEW_WINDOW w
= (IVIEW_WINDOW
) GETWINDOWADDRESS(object
);
60 if (! IVIEW_WINDOW_NULL(w
)) StHideWindow(w
);
64 LVAL
xswindow_title(V
)
70 object
= xlgaobject();
71 w
= (IVIEW_WINDOW
) GETWINDOWADDRESS(object
);
74 set_slot_value(object
, s_title
, title
);
75 if (! IVIEW_WINDOW_NULL(w
)) {
76 str
= (char *) getstring(title
);
80 return(slot_value(object
, s_title
));
83 static LVAL window_dimensions
P2C(int, which
, int, frame
)
87 int a
, b
, set
= FALSE
;
89 object
= xlgaobject();
92 a
= getfixnum(xlgafixnum());
93 b
= getfixnum(xlgafixnum());
97 w
= (IVIEW_WINDOW
) GETWINDOWADDRESS(object
);
98 slot
= (which
== 'L') ? s_location
: s_size
;
101 if (! frame
) set_slot_value(object
, slot
, integer_list_2(a
, b
));
102 if (! IVIEW_WINDOW_NULL(w
)) {
104 case 'L': StWSetLocation(w
, a
, b
, frame
); break;
105 case 'S': StWSetSize(w
, a
, b
, frame
); break;
109 if (! IVIEW_WINDOW_NULL(w
)) {
112 StWGetLocation(w
, &a
, &b
, FALSE
);
113 set_slot_value(object
, slot
, integer_list_2(a
, b
));
114 if (frame
) StWGetLocation(w
, &a
, &b
, TRUE
);
117 StWGetSize(w
, &a
, &b
, FALSE
);
118 set_slot_value(object
, slot
, integer_list_2(a
, b
));
119 if (frame
) StWGetSize(w
, &a
, &b
, TRUE
);
122 return(integer_list_2(a
, b
));
124 else return(slot_value(object
, slot
));
127 LVAL
xswindow_location(V
) { return(window_dimensions('L', FALSE
)); }
128 LVAL
xswindow_size(V
) { return(window_dimensions('S', FALSE
)); }
129 LVAL
xswindow_frame_location(V
) { return(window_dimensions('L', TRUE
)); }
130 LVAL
xswindow_frame_size(V
) { return(window_dimensions('S', TRUE
)); }
132 /**************************************************************************/
134 /** Screen Info Functions **/
136 /**************************************************************************/
138 LVAL
xsscreen_size(V
)
142 StGetScreenSize(&width
, &height
);
143 return(integer_list_2(width
, height
));
146 LVAL
xsscreen_has_color(V
)
148 return((StScreenHasColor()) ? s_true
: NIL
);
151 LVAL
xssystem_has_windows(V
)
153 return((StHasWindows()) ? s_true
: NIL
);
156 LVAL
xsflush_graphics(V
)