The Android Open Source Project | c24a8e6 | 2009-03-03 19:28:42 -0800 | [diff] [blame] | 1 | /* |
| 2 | * Copyright (C) 2007 The Android Open Source Project |
| 3 | * |
| 4 | * Licensed under the Apache License, Version 2.0 (the "License"); |
| 5 | * you may not use this file except in compliance with the License. |
| 6 | * You may obtain a copy of the License at |
| 7 | * |
| 8 | * http://www.apache.org/licenses/LICENSE-2.0 |
| 9 | * |
| 10 | * Unless required by applicable law or agreed to in writing, software |
| 11 | * distributed under the License is distributed on an "AS IS" BASIS, |
| 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 13 | * See the License for the specific language governing permissions and |
| 14 | * limitations under the License. |
| 15 | */ |
| 16 | |
| 17 | #ifndef _MINUI_H_ |
| 18 | #define _MINUI_H_ |
| 19 | |
| 20 | typedef void* gr_surface; |
| 21 | typedef unsigned short gr_pixel; |
| 22 | |
| 23 | int gr_init(void); |
| 24 | void gr_exit(void); |
| 25 | |
| 26 | int gr_fb_width(void); |
| 27 | int gr_fb_height(void); |
| 28 | gr_pixel *gr_fb_data(void); |
| 29 | void gr_flip(void); |
| 30 | |
| 31 | void gr_color(unsigned char r, unsigned char g, unsigned char b, unsigned char a); |
| 32 | void gr_fill(int x, int y, int w, int h); |
| 33 | int gr_text(int x, int y, const char *s); |
| 34 | int gr_measure(const char *s); |
| 35 | |
| 36 | void gr_blit(gr_surface source, int sx, int sy, int w, int h, int dx, int dy); |
| 37 | unsigned int gr_get_width(gr_surface surface); |
| 38 | unsigned int gr_get_height(gr_surface surface); |
| 39 | |
| 40 | // input event structure, include <linux/input.h> for the definition. |
| 41 | // see http://www.mjmwired.net/kernel/Documentation/input/ for info. |
| 42 | struct input_event; |
| 43 | |
| 44 | // Dream-specific key codes |
| 45 | #define KEY_DREAM_HOME 102 // = KEY_HOME |
| 46 | #define KEY_DREAM_RED 107 // = KEY_END |
| 47 | #define KEY_DREAM_VOLUMEDOWN 114 // = KEY_VOLUMEDOWN |
| 48 | #define KEY_DREAM_VOLUMEUP 115 // = KEY_VOLUMEUP |
| 49 | #define KEY_DREAM_SYM 127 // = KEY_COMPOSE |
| 50 | #define KEY_DREAM_MENU 139 // = KEY_MENU |
| 51 | #define KEY_DREAM_BACK 158 // = KEY_BACK |
| 52 | #define KEY_DREAM_FOCUS 211 // = KEY_HP (light touch on camera) |
| 53 | #define KEY_DREAM_CAMERA 212 // = KEY_CAMERA |
| 54 | #define KEY_DREAM_AT 215 // = KEY_EMAIL |
| 55 | #define KEY_DREAM_GREEN 231 |
| 56 | #define KEY_DREAM_FATTOUCH 258 // = BTN_2 ??? |
| 57 | #define KEY_DREAM_BALL 272 // = BTN_MOUSE |
| 58 | #define KEY_DREAM_TOUCH 330 // = BTN_TOUCH |
| 59 | |
| 60 | int ev_init(void); |
| 61 | void ev_exit(void); |
| 62 | int ev_get(struct input_event *ev, unsigned dont_wait); |
| 63 | |
| 64 | // Resources |
| 65 | |
| 66 | // Returns 0 if no error, else negative. |
| 67 | int res_create_surface(const char* name, gr_surface* pSurface); |
| 68 | void res_free_surface(gr_surface surface); |
| 69 | |
| 70 | #endif |