home *** CD-ROM | disk | FTP | other *** search
/ ARM Club 1 / ARM_CLUB_CD.iso / contents / apps / audio / p / sequencer / !Sequencer / c / wimplib < prev   
Encoding:
Text File  |  1990-02-20  |  2.0 KB  |  96 lines

  1. #include "headers.h"
  2. #include "bbc.h"
  3. #include "wimp.h"
  4. #include "wimpt.h"
  5. #include "win.h"
  6. #include "os.h"
  7. #include "coords.h"
  8. #include "template.h"
  9. #include "swis.h"
  10. #include "kernel.h"
  11. #include "werr.h"
  12. #include <stdio.h>
  13. #include <string.h>
  14.  
  15. void set_origin(wimp_redrawstr *r, int *x, int *y)
  16. {
  17.   *x = coords_x_toscreen(*x, (coords_cvtstr *)&r->box);
  18.   *y = coords_y_toscreen(*y, (coords_cvtstr *)&r->box);
  19. }
  20.  
  21. void open_front(wimp_w handle)
  22. {
  23.   wimp_wstate state;
  24.   if (wimpt_complain(wimp_get_wind_state(handle, &state)) == 0) {
  25.     state.o.behind = -1;
  26.     wimpt_noerr(wimp_open_wind(&state.o));
  27.   }
  28. }
  29.  
  30. BOOL create_window(char *name, wimp_w *handle)
  31. {
  32.   wimp_wind *window = template_syshandle(name);  
  33.   if (window == 0) return FALSE;
  34.   return (wimpt_complain(wimp_create_wind(window, handle)) == 0);
  35. }
  36.  
  37. void force_redraw(wimp_w handle, int x, int y, int width, int height)
  38. {
  39.   wimp_redrawstr redraw;
  40.   
  41.   redraw.w = handle;
  42.   redraw.box.x0 = x;
  43.   redraw.box.y0 = y;
  44.   redraw.box.x1 = x+width;
  45.   redraw.box.y1 = y+height;
  46.   redraw.scx = 0;
  47.   redraw.scy = 0;
  48.   redraw.g.x0 = 0;
  49.   redraw.g.y0 = 0;
  50.   redraw.g.x1 = 0;
  51.   redraw.g.y1 = 0;
  52.  
  53.   wimp_force_redraw(&redraw);
  54. }
  55.  
  56. void force_redraw_all(wimp_w handle)
  57. {
  58.   force_redraw(handle, 0, -10000,10000,10000);  /* a big window!! */
  59. }
  60.  
  61. void align_bottom(wimp_wstate *state, int y)
  62. {
  63.   state->o.y += (coords_y_toscreen(y, (coords_cvtstr *)&state->o.box) - state->o.box.y0);
  64.   wimpt_noerr(wimp_open_wind(&state->o));
  65. }   
  66.  
  67. void flush_keyboard()
  68. {
  69.   os_swi3(OS_Byte,15,1,0);
  70. }
  71.  
  72. void input_focus(wimp_w handle)
  73. {
  74.   wimp_caretstr caret;
  75.  
  76.   caret.w = handle;
  77.   caret.i = -1;
  78.   caret.x = caret.y = 0;
  79.   caret.height = 1<<25;
  80.   caret.index = 0;
  81.   wimp_set_caret_pos(&caret);
  82. }
  83.  
  84. void error()
  85. {   
  86.   _kernel_oserror *err = _kernel_last_oserror();
  87.   if (err != NULL) werr(FALSE, err->errmess);
  88. }
  89.  
  90. BOOL icon_selected(wimp_w handle, wimp_i icon)
  91. {
  92.   wimp_icon state;
  93.   wimp_get_icon_info(handle, icon, &state);
  94.   return ((state.flags & wimp_ISELECTED) != 0);
  95. }                   
  96.