| 1 |
#ifndef _WINDOW_H_ |
| 2 |
#define _WINDOW_H_ |
| 3 |
|
| 4 |
#include "osd_cpu.h" |
| 5 |
#include "mamedbg.h" |
| 6 |
|
| 7 |
#ifdef GNU |
| 8 |
#define ARGFMT __attribute__((format(printf,2,3))) |
| 9 |
#else |
| 10 |
#define ARGFMT |
| 11 |
#endif |
| 12 |
|
| 13 |
#ifndef DECL_SPEC |
| 14 |
#define DECL_SPEC |
| 15 |
#endif |
| 16 |
|
| 17 |
#ifndef TRUE |
| 18 |
#define TRUE 1 |
| 19 |
#endif |
| 20 |
|
| 21 |
#ifndef FALSE |
| 22 |
#define FALSE 0 |
| 23 |
#endif |
| 24 |
|
| 25 |
#ifndef INVALID |
| 26 |
#define INVALID 0xffffffff |
| 27 |
#endif |
| 28 |
|
| 29 |
#ifndef WIN_EMPTY |
| 30 |
#define WIN_EMPTY 176 /* checkered pattern */ |
| 31 |
#endif |
| 32 |
#ifndef CAPTION_L |
| 33 |
#define CAPTION_L 174 /* >> */ |
| 34 |
#endif |
| 35 |
#ifndef CAPTION_R |
| 36 |
#define CAPTION_R 175 /* << */ |
| 37 |
#endif |
| 38 |
#ifndef FRAME_TL |
| 39 |
#define FRAME_TL 218 /* top, left border */ |
| 40 |
#endif |
| 41 |
#ifndef FRAME_BL |
| 42 |
#define FRAME_BL 192 /* bottom, left border */ |
| 43 |
#endif |
| 44 |
#ifndef FRAME_TR |
| 45 |
#define FRAME_TR 191 /* top, right border */ |
| 46 |
#endif |
| 47 |
#ifndef FRAME_BR |
| 48 |
#define FRAME_BR 217 /* bottom, right border */ |
| 49 |
#endif |
| 50 |
#ifndef FRAME_V |
| 51 |
#define FRAME_V 179 /* vertical line */ |
| 52 |
#endif |
| 53 |
#ifndef FRAME_H |
| 54 |
#define FRAME_H 196 /* horizontal line */ |
| 55 |
#endif |
| 56 |
|
| 57 |
/* This is our window structure */ |
| 58 |
|
| 59 |
struct sWindow |
| 60 |
{ |
| 61 |
UINT8 filler; /* Character */ |
| 62 |
UINT8 prio; /* This window's priority */ |
| 63 |
UINT32 x; /* X Position (in characters) of our window */ |
| 64 |
UINT32 y; /* Y Position (in characters) of our window */ |
| 65 |
UINT32 w; /* X Size of our window (in characters) */ |
| 66 |
UINT32 h; /* Y Size (lines) of our window (in character lengths) */ |
| 67 |
UINT32 cx; /* Current cursor's X position */ |
| 68 |
UINT32 cy; /* Current cursor's Y position */ |
| 69 |
UINT32 flags; /* Window's attributes (below) */ |
| 70 |
UINT8 co_text; /* Default color */ |
| 71 |
UINT8 co_frame; /* Frame color */ |
| 72 |
UINT8 co_title; /* Title color */ |
| 73 |
UINT8 saved_text; /* Character under the cursor position */ |
| 74 |
UINT8 saved_attr; /* Attribute under the cursor position */ |
| 75 |
|
| 76 |
/* Stuff that needs to be saved off differently */ |
| 77 |
|
| 78 |
char *title; /* Window title (if any) */ |
| 79 |
UINT8 *text; /* Pointer to video data - characters */ |
| 80 |
UINT8 *attr; /* Pointer to video data - attributes */ |
| 81 |
|
| 82 |
/* These are the callbacks when certain things happen. All fields have been |
| 83 |
* updated BEFORE the call. Return FALSE if the moves, resizes, closes, |
| 84 |
* refocus aren't accepted. |
| 85 |
*/ |
| 86 |
|
| 87 |
UINT32 (*Resize)(UINT32 idx, struct sWindow *); |
| 88 |
UINT32 (*Close)(UINT32 idx, struct sWindow *); |
| 89 |
UINT32 (*Move)(UINT32 idx, struct sWindow *); |
| 90 |
UINT32 (*Refocus)(UINT32 idx, struct sWindow *); /* Bring it to the front */ |
| 91 |
}; |
| 92 |
|
| 93 |
/* These defines are for various aspects of the window */ |
| 94 |
|
| 95 |
#define BORDER_LEFT 0x01 /* Border on left side of window */ |
| 96 |
#define BORDER_RIGHT 0x02 /* Border on right side of window */ |
| 97 |
#define BORDER_TOP 0x04 /* Border on top side of window */ |
| 98 |
#define BORDER_BOTTOM 0x08 /* Border on bottom side of window */ |
| 99 |
#define HIDDEN 0x10 /* Is it hidden currently? */ |
| 100 |
#define CURSOR_ON 0x20 /* Is the cursor on? */ |
| 101 |
#define NO_WRAP 0x40 /* Do we actually wrap at the right side? */ |
| 102 |
#define NO_SCROLL 0x80 /* Do we actually scroll it? */ |
| 103 |
#define SHADOW 0x100 /* Do we cast a shadow? */ |
| 104 |
#define MOVEABLE 0x200 /* Is this Window moveable? */ |
| 105 |
#define RESIZEABLE 0x400 /* IS this Window resiable? */ |
| 106 |
|
| 107 |
#define MAX_WINDOWS 32 /* Up to 32 windows active at once */ |
| 108 |
#define TAB_STOP 8 /* 8 Spaces for a tab stop! */ |
| 109 |
|
| 110 |
#define AUTO_FIX_XYWH TRUE |
| 111 |
#define NEWLINE_ERASE_EOL TRUE /* Shall newline also erase to end of line? */ |
| 112 |
|
| 113 |
/* Special characters */ |
| 114 |
|
| 115 |
#define CHAR_CURSORON 219 /* Cursor on character */ |
| 116 |
#define CHAR_CURSOROFF 32 /* Cursor off character */ |
| 117 |
|
| 118 |
/* Standard color set for IBM character set. DO NOT ALTER! */ |
| 119 |
|
| 120 |
#define WIN_BLACK DBG_BLACK |
| 121 |
#define WIN_BLUE DBG_BLUE |
| 122 |
#define WIN_GREEN DBG_GREEN |
| 123 |
#define WIN_CYAN DBG_CYAN |
| 124 |
#define WIN_RED DBG_RED |
| 125 |
#define WIN_MAGENTA DBG_MAGENTA |
| 126 |
#define WIN_BROWN DBG_BROWN |
| 127 |
#define WIN_WHITE DBG_LIGHTGRAY |
| 128 |
#define WIN_GRAY DBG_GRAY |
| 129 |
#define WIN_LIGHT_BLUE DBG_LIGHTBLUE |
| 130 |
#define WIN_LIGHT_GREEN DBG_LIGHTGREEN |
| 131 |
#define WIN_LIGHT_CYAN DBG_LIGHTCYAN |
| 132 |
#define WIN_LIGHT_RED DBG_LIGHTRED |
| 133 |
#define WIN_LIGHT_MAGENTA DBG_LIGHTMAGENTA |
| 134 |
#define WIN_YELLOW DBG_YELLOW |
| 135 |
#define WIN_BRIGHT_WHITE DBG_WHITE |
| 136 |
|
| 137 |
#define WIN_BRIGHT 0x08 |
| 138 |
|
| 139 |
/* Externs! */ |
| 140 |
|
| 141 |
extern UINT32 screen_w; |
| 142 |
extern UINT32 screen_h; |
| 143 |
|
| 144 |
extern void win_erase_eol(UINT32 idx, UINT8 bChar); |
| 145 |
extern INT32 win_putc(UINT32 idx, UINT8 bChar); |
| 146 |
extern UINT32 win_open(UINT32 idx, struct sWindow *psWin); |
| 147 |
extern UINT32 win_init_engine(UINT32 w, UINT32 h); |
| 148 |
extern UINT32 win_is_initalized(UINT32 idx); |
| 149 |
extern void win_exit_engine(void); |
| 150 |
extern void win_close(UINT32 idx); |
| 151 |
extern INT32 win_vprintf(UINT32 idx, const char *pszString, va_list arg); |
| 152 |
extern INT32 DECL_SPEC win_printf(UINT32 idx, const char *pszString, ...) ARGFMT; |
| 153 |
extern UINT32 DECL_SPEC win_set_title(UINT32 idx, const char *pszTitle, ... ) ARGFMT; |
| 154 |
extern UINT32 win_get_cx(UINT32 idx); |
| 155 |
extern UINT32 win_get_cy(UINT32 idx); |
| 156 |
extern UINT32 win_get_cx_abs(UINT32 idx); |
| 157 |
extern UINT32 win_get_cy_abs(UINT32 idx); |
| 158 |
extern UINT32 win_get_x_abs(UINT32 idx); |
| 159 |
extern UINT32 win_get_y_abs(UINT32 idx); |
| 160 |
extern UINT32 win_get_w(UINT32 idx); |
| 161 |
extern UINT32 win_get_h(UINT32 idx); |
| 162 |
extern void win_set_w(UINT32 idx, UINT32 w); |
| 163 |
extern void win_set_h(UINT32 idx, UINT32 w); |
| 164 |
extern void win_set_color(UINT32 idx, UINT32 color); |
| 165 |
extern void win_set_title_color(UINT32 idx, UINT32 color); |
| 166 |
extern void win_set_frame_color(UINT32 idx, UINT32 color); |
| 167 |
extern void win_set_curpos(UINT32 idx, UINT32 x, UINT32 y); |
| 168 |
extern void win_set_cursor(UINT32 idx, UINT32 dwCursorState); |
| 169 |
extern void win_hide(UINT32 idx); |
| 170 |
extern void win_show(UINT32 idx); |
| 171 |
extern void win_update(UINT32 idx); |
| 172 |
extern UINT8 win_get_prio(UINT32 idx); |
| 173 |
extern void win_set_prio(UINT32 idx, UINT8 prio); |
| 174 |
extern void win_move(UINT32 idx, UINT32 dwX, UINT32 dwY); |
| 175 |
extern void win_invalidate_video(void); |
| 176 |
|
| 177 |
#endif |