Showing changes from revision #2 to #3:
Added | Removed | Changed
Entry | |
---|---|
R0 | Flags |
R1 | renderer called to render the object (SWI number or pointer to C/assembler function) |
R2 | Pointer to block holding registers for SWI / function parameters |
R3 | Pointer to 16-byte block containing drag box |
R4 | Pointer to optional block containing bounding box |
Exit | |
---|---|
R0 | Preserved |
R1 | Preserved |
R2 | Preserved |
R3 | Preserved |
R4 | Preserved |
The purpose of this call is to start dragging an object.
As per the DragASprite_Start, this SWI starts the dragging process (calling DragASprite_Start and in turn Wimp_DragBox on the clients behalf), usually in response to a Drag (Mouse_Click) Event.
The renderer can be a C (or assembler) function or a SWI (determined by setting bits 16 and 17 in the flags word).
e.g.
void start_drag(...) { _kernel_swi_regs regs, render; render.r[1] = (int) &icon; /* oh dear, bug in the wimp */ render.r[4] =0; render.r[5] =0; regs.r[0] = some flags; regs.r[1] = Wimp_PlotIcon; regs.r[2] = (int) &render; regs.r[3] = (int) &bbox; _kernel_swi(DragAnObject_Start,®s,®s); }
void _my_render(data) { /* do the render */ }
void start_drag(...) { _kernel_swi_regs regs; int render[4]; /* render[0] ... render[3] will be passed to the function as parameters */ render[0] = (int) data required by renderer; /* tell it we're a function and a module */ regs.r[0] = some flags + (1<<16) + (1<<17); regs.r[1] = (int) _my_render; regs.r[2] = (int) &render; regs.r[3] = (int) &bbox; _kernel_swi(DragAnObject_Start,®s,®s); }