/**** * * Copyright (c) 1988 by Sun Microsystems, Inc. * @(#)sh_CURSOR.h 22.1 89/08/10 Copyright 1988 Sun Micro * * sh_CURSOR.h - Cursor information for user level code * (needed by shapes.h). The user does not actually know what the * CURSER object looks like. It can only be accessed via the Xxx_Cursor * functions. * ****/ #ifndef _SH_CLASS_CURS /* * Cursor attributes */ typedef enum { CURS_RASTER, /* screen raster associated with cursor */ CURS_COLOR, /* cursor foreground color */ CURS_BACK_COLOR, /* cursor background color */ CURS_ORG, /* current cursor position on screen raster */ CURS_HOT_SPOT, /* cursor hot spot */ CURS_IMAGE_RASTER, /* raster containing cursor image */ CURS_MASK_RASTER, /* raster containing cursor 2D clip mask */ CURS_NEEDS_CUES, /* flag set if cursor needs cues */ CURS_RASTER_SCREEN, /* screen type of cursor raster */ } CURS_attr; /* * Cursor rendering method */ #define CURS_GENERIC 0 #define CURS_OVERLAY 1 #define CURS_HARDWARE 2 #define CURS_FORCED_HARDWARE 3 #define CHK_CURSOR_FLAG(ras) \ { \ extern CURSER sh_cursor; \ extern Unsgn8 sh_cursor_is_visible; \ if (sh_cursor_is_visible && ras->RAS_CURSOR_OVERLAP \ && (sh_cursor->curs_method == CURS_GENERIC)) \ Remove_Cursor(sh_cursor); \ } #define CHK_CURSOR_FLAGS(ras1, ras2) \ { \ extern CURSER sh_cursor; \ extern Unsgn8 sh_cursor_is_visible; \ if (sh_cursor_is_visible \ && (sh_cursor->curs_method == CURS_GENERIC) \ && (ras1->RAS_CURSOR_OVERLAP || ras2->RAS_CURSOR_OVERLAP)) \ Remove_Cursor(sh_cursor); \ } /* check against bounding box in device space */ #define CHK_CURSOR_DEV(ras, ymin, ymax, xmin, xmax) \ { \ extern CURSER sh_cursor; \ extern Unsgn8 sh_cursor_is_visible; \ if ((sh_cursor_is_visible && ras->RAS_CURSOR_OVERLAP \ && (sh_cursor->curs_method == CURS_GENERIC)) \ && !((sh_cursor->CURS_ORG.y + sh_cursor->curs_dim.y < (ymin))\ || (sh_cursor->CURS_ORG.y > (ymax))) \ && !((sh_cursor->CURS_ORG.x + sh_cursor->curs_dim.x < (xmin))\ || (sh_cursor->CURS_ORG.x > (xmax)))) \ Remove_Cursor(sh_cursor); \ } /* check against bounding box in raster space */ #define CHK_CURSOR_RAS(ras, ymin, ymax, xmin, xmax) \ { \ extern CURSER sh_cursor; \ extern Unsgn8 sh_cursor_is_visible; \ if ((sh_cursor_is_visible && ras->RAS_CURSOR_OVERLAP \ && (sh_cursor->curs_method == CURS_GENERIC)) \ && !((fracti(sh_cursor->CURS_ORG.y \ + sh_cursor->curs_dim.y) < (ymin)) \ || (fracti(sh_cursor->CURS_ORG.y) > (ymax))) \ && !((fracti(sh_cursor->CURS_ORG.x \ + sh_cursor->curs_dim.x) < (xmin)) \ || (fracti(sh_cursor->CURS_ORG.x) > (xmax)))) \ Remove_Cursor(sh_cursor); \ } /* * CURSOR operators * * Destroy_Cursor(curs) destroy cursor object * Get_Cursor(curs, attr) get cursor attribute * Set_Cursor(curs, attr, val) set cursor attribute * * INTERNAL * Install_Cursor(curs) install cursor for new screen raster * Remove_Cursor(curs) remove cursor, restoring screen image * Display_Cursor(curs) Display cursor on screen */ #define CURS_OP_Destroy 0 #define CURS_OP_Init 1 #define CURS_OP_Get 2 #define CURS_OP_Set 3 #define CURS_OP_Install 4 #define CURS_OP_Remove 5 #define CURS_OP_Display 6 #define CURS_OPERS 7 #define Create_Cursor() ((CURSER) Create_Obj(CLASS_CURS, 0, 0)) #define Temp_Cursor() ((CURSER) Temp_Obj(CLASS_CURS, 0, 0)) #define Destroy_Cursor Destroy_Obj #ifndef SH_MONITOR #define Get_Cursor(c,a) CAT(a,get) ((CURSER) (c)) #else /* SH_MONITOR */ #define Get_Cursor(c,a) CAT(a,get) ((CURSER)sh_Monitor_Get_Cursor(c)) #endif /* SH_MONITOR */ #define CURS_RASTERget(c) ((c)->CURS_RASTER) #define CURS_COLORget(c) ((c)->CURS_COLOR) #define CURS_BACK_COLORget(c) ((c)->CURS_BACK_COLOR) #define CURS_ORGget(c) ((c)->CURS_ORG) #define CURS_HOT_SPOTget(c) ((c)->CURS_HOT_SPOT) #define CURS_IMAGE_RASTERget(c) ((c)->CURS_IMAGE_RASTER) #define CURS_MASK_RASTERget(c) ((c)->CURS_MASK_RASTER) #define CURS_NEEDS_CUESget(c) ((c)->CURS_NEEDS_CUES) #define CURS_RASTER_SCREENget(c) \ ((int) GetOper_Obj(c, CURS_OP_Get)(c,CURS_RASTER_SCREEN)) #ifndef SH_MONITOR #define Set_Cursor(c,a,v) (*GetOper_Obj(c,CURS_OP_Set)) (c,a,v) #else /* SH_MONITOR */ #define Set_Cursor(c,a,v) (*GetOper_Obj(c,CURS_OP_Set)) ((CURSER)sh_Monitor_Set_Cursor(c),a,v) #endif /* SH_MONITOR */ #define Install_Cursor(c) (*GetOper_Obj(c,CURS_OP_Install)) (c) #define Remove_Cursor(c) (*GetOper_Obj(c,CURS_OP_Remove)) (c) #define Display_Cursor(c) (*GetOper_Obj(c,CURS_OP_Display)) (c) /* * Internal CURSER object structure */ struct class_CURSER { #include "sh_CURSOR.ah" }; #define _SH_CLASS_CURS #endif /* _SH_CLASS_CURS */