upiwin/src/stockobj.c
2019-12-11 15:52:49 -07:00

57 lines
1.6 KiB
C
Executable File

#include <stddef.h>
#include <string.h>
#include "wintype.h"
#include "bitmap.h"
/* references to the icon data */
extern uint8_t _binary_i_freehand_bin_start[];
extern uint8_t _binary_i_freehand_bin_end;
extern uint8_t _binary_i_freehand_bin_size;
extern uint8_t _binary_i_line_bin_start[];
extern uint8_t _binary_i_line_bin_end;
extern uint8_t _binary_i_line_bin_size;
extern uint8_t _binary_i_rect_bin_start[];
extern uint8_t _binary_i_rect_bin_end;
extern uint8_t _binary_i_rect_bin_size;
extern uint8_t _binary_i_fillrect_bin_start[];
extern uint8_t _binary_i_fillrect_bin_end;
extern uint8_t _binary_i_fillrect_bin_size;
extern uint8_t _binary_i_undo_bin_start[];
extern uint8_t _binary_i_undo_bin_end;
extern uint8_t _binary_i_undo_bin_size;
extern uint8_t _binary_i_clear_bin_start[];
extern uint8_t _binary_i_clear_bin_end;
extern uint8_t _binary_i_clear_bin_size;
typedef struct tagSTOCKBITMAPDESC {
PCSTR name;
INT32 width;
INT32 height;
const void *data;
} STOCKBITMAPDESC;
static const STOCKBITMAPDESC stock_bitmaps[] = {
{"freehand", 48, 48, _binary_i_freehand_bin_start },
{"line", 48, 48, _binary_i_line_bin_start },
{"rect", 48, 48, _binary_i_rect_bin_start },
{"fillrect", 48, 48, _binary_i_fillrect_bin_start },
{"undo", 48, 48, _binary_i_undo_bin_start },
{"clear", 48, 48, _binary_i_clear_bin_start },
{NULL, 0, 0, NULL }
};
PBITMAP _BMP_GetStock(PCSTR name)
{
INT32 i;
for (i = 0; stock_bitmaps[i].name; ++i)
if (strcmp(name, stock_bitmaps[i].name) == 0)
return BMP_Create(stock_bitmaps[i].width, stock_bitmaps[i].height, stock_bitmaps[i].data);
return NULL;
}