1 /* Copyright (C) 2007-2008 The Android Open Source Project 2 ** 3 ** This software is licensed under the terms of the GNU General Public 4 ** License version 2, as published by the Free Software Foundation, and 5 ** may be copied, distributed, and modified under those terms. 6 ** 7 ** This program is distributed in the hope that it will be useful, 8 ** but WITHOUT ANY WARRANTY; without even the implied warranty of 9 ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 10 ** GNU General Public License for more details. 11 */ 12 #ifndef _ANDROID_SKIN_COMPOSER_H 13 #define _ANDROID_SKIN_COMPOSER_H 14 15 #include "android/skin/rect.h" 16 #include "android/skin/region.h" 17 #include "android/utils/reflist.h" 18 19 /* the composer displays stacked surfaces on a target window/SDL_Surface */ 20 21 typedef enum { 22 SKIN_PLATE_SURFACE = 0, 23 SKIN_PLATE_GROUP, 24 SKIN_PLATE_SPACE 25 } SkinPlateType; 26 27 typedef union SkinPlate SkinPlate; 28 typedef struct SkinViewport SkinViewport; 29 30 struct SkinPlateAny { 31 SkinPlateType type; /* class pointer */ 32 SkinPlate* parent; /* parent container */ 33 SkinPos pos; /* position relative to parent */ 34 SkinRegion region[1]; /* the plate's region */ 35 char isVisible; /* flag: TRUE iff the region is visible */ 36 char isOpaque; /* flag: TRUE iff the region is opaque */ 37 }; 38 39 40 typedef void (*SkinPlateDrawFunc)( void* user, SkinRegion* region, SkinPos* apos, SkinViewport* viewport, int opaque ); 41 typedef void (*SkinPlateDoneFunc)( void* user ); 42 43 struct SkinPlateSurface { 44 struct SkinPlateAny any; 45 void* user; 46 SkinPlateDrawFunc draw; 47 SkinPlateDoneFunc done; 48 }; 49 50 struct SkinPlateGroup { 51 struct SkinPlateAny any; 52 char hasRegion; 53 char hasOpaqueRegion; 54 SkinRegion opaqueRegion[1]; 55 ARefList children[1]; 56 }; 57 58 struct SkinPlateSpace { 59 struct SkinPlateGroup group; 60 ARefList viewports[1]; 61 }; 62 63 64 union SkinPlate { 65 struct SkinPlateAny any; 66 struct SkinPlateSurface surface; 67 struct SkinPlateGroup group; 68 struct SkinPlateSpace space; 69 }; 70 71 72 extern SkinPlate* skin_plate_surface( SkinPlate* parent, 73 SkinPos* pos, 74 SkinRegion* region, 75 void* user, 76 SkinPlateDrawFunc draw, 77 SkinPlateDoneFunc done ); 78 79 extern SkinPlate* skin_plate_group( SkinPlate* parent, SkinPos* pos ); 80 81 extern SkinPlate* skin_plate_space( void ); 82 83 extern void skin_plate_free( SkinPlate* plate ); 84 extern void skin_plate_invalidate( SkinPlate* plate, SkinRegion* region ); 85 extern void skin_plate_set_pos( SkinPlate* plate, int x, int y ); 86 extern void skin_plate_set_visible( SkinPlate* plate, int isVisible ); 87 extern void skin_plate_set_opaque( SkinPlate* plate, int isOpaque ); 88 89 struct SkinViewport { 90 SkinPlate* space; 91 SkinRect rect; 92 void* surface; 93 SkinPos spos; 94 SkinRegion update[1]; 95 }; 96 97 extern SkinViewport* skin_viewport( SkinPlate* space, SkinRect* rect, void* surface, int sx, int sy ); 98 extern void skin_viewport_free( SkinViewport* v ); 99 extern void skin_viewport_invalidate( SkinViewport* v, SkinRegion* r ); 100 extern void skin_viewport_redraw( SkinViewport* v ); 101 102 #endif /* _ANDROID_SKIN_COMPOSER_H */ 103