home *** CD-ROM | disk | FTP | other *** search
- #include "headers.h"
- #include "bbc.h"
- #include "wimp.h"
- #include "wimpt.h"
- #include "win.h"
- #include "os.h"
- #include "coords.h"
- #include "template.h"
- #include "swis.h"
- #include "kernel.h"
- #include "werr.h"
- #include <stdio.h>
- #include <string.h>
-
- void set_origin(wimp_redrawstr *r, int *x, int *y)
- {
- *x = coords_x_toscreen(*x, (coords_cvtstr *)&r->box);
- *y = coords_y_toscreen(*y, (coords_cvtstr *)&r->box);
- }
-
- void open_front(wimp_w handle)
- {
- wimp_wstate state;
- if (wimpt_complain(wimp_get_wind_state(handle, &state)) == 0) {
- state.o.behind = -1;
- wimpt_noerr(wimp_open_wind(&state.o));
- }
- }
-
- BOOL create_window(char *name, wimp_w *handle)
- {
- wimp_wind *window = template_syshandle(name);
- if (window == 0) return FALSE;
- return (wimpt_complain(wimp_create_wind(window, handle)) == 0);
- }
-
- void force_redraw(wimp_w handle, int x, int y, int width, int height)
- {
- wimp_redrawstr redraw;
-
- redraw.w = handle;
- redraw.box.x0 = x;
- redraw.box.y0 = y;
- redraw.box.x1 = x+width;
- redraw.box.y1 = y+height;
- redraw.scx = 0;
- redraw.scy = 0;
- redraw.g.x0 = 0;
- redraw.g.y0 = 0;
- redraw.g.x1 = 0;
- redraw.g.y1 = 0;
-
- wimp_force_redraw(&redraw);
- }
-
- void force_redraw_all(wimp_w handle)
- {
- force_redraw(handle, 0, -10000,10000,10000); /* a big window!! */
- }
-
- void align_bottom(wimp_wstate *state, int y)
- {
- state->o.y += (coords_y_toscreen(y, (coords_cvtstr *)&state->o.box) - state->o.box.y0);
- wimpt_noerr(wimp_open_wind(&state->o));
- }
-
- void flush_keyboard()
- {
- os_swi3(OS_Byte,15,1,0);
- }
-
- void input_focus(wimp_w handle)
- {
- wimp_caretstr caret;
-
- caret.w = handle;
- caret.i = -1;
- caret.x = caret.y = 0;
- caret.height = 1<<25;
- caret.index = 0;
- wimp_set_caret_pos(&caret);
- }
-
- void error()
- {
- _kernel_oserror *err = _kernel_last_oserror();
- if (err != NULL) werr(FALSE, err->errmess);
- }
-
- BOOL icon_selected(wimp_w handle, wimp_i icon)
- {
- wimp_icon state;
- wimp_get_icon_info(handle, icon, &state);
- return ((state.flags & wimp_ISELECTED) != 0);
- }
-