2007-12-30 17:41:49 +01:00
|
|
|
/***************************************************************************
|
|
|
|
|
|
|
|
gb.draw.h
|
|
|
|
|
2011-12-31 03:39:20 +01:00
|
|
|
(c) 2000-2012 Benoît Minisini <gambas@users.sourceforge.net>
|
2007-12-30 17:41:49 +01:00
|
|
|
|
|
|
|
This program is free software; you can redistribute it and/or modify
|
|
|
|
it under the terms of the GNU General Public License as published by
|
2009-08-17 12:41:51 +02:00
|
|
|
the Free Software Foundation; either version 2, or (at your option)
|
2007-12-30 17:41:49 +01:00
|
|
|
any later version.
|
|
|
|
|
|
|
|
This program is distributed in the hope that it will be useful,
|
|
|
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
GNU General Public License for more details.
|
|
|
|
|
|
|
|
You should have received a copy of the GNU General Public License
|
|
|
|
along with this program; if not, write to the Free Software
|
2011-06-03 02:51:09 +02:00
|
|
|
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
|
2011-12-31 03:39:20 +01:00
|
|
|
MA 02110-1301, USA.
|
2007-12-30 17:41:49 +01:00
|
|
|
|
|
|
|
***************************************************************************/
|
|
|
|
|
|
|
|
#ifndef __GB_DRAW_H
|
|
|
|
#define __GB_DRAW_H
|
|
|
|
|
|
|
|
#include "gb_common.h"
|
|
|
|
#include "gambas.h"
|
|
|
|
|
|
|
|
#define GB_DRAW_ALIGN_DEFAULT (-1)
|
2009-01-03 23:24:02 +01:00
|
|
|
#define GB_DRAW_COLOR_DEFAULT (-1)
|
2007-12-30 17:41:49 +01:00
|
|
|
|
2008-03-18 11:04:10 +01:00
|
|
|
enum {
|
|
|
|
GB_DRAW_STATE_NORMAL = 0,
|
2009-09-08 14:22:03 +02:00
|
|
|
GB_DRAW_STATE_DISABLED = 1,
|
2010-08-06 16:36:45 +02:00
|
|
|
GB_DRAW_STATE_FOCUS = 2,
|
|
|
|
GB_DRAW_STATE_HOVER = 4,
|
|
|
|
GB_DRAW_STATE_ACTIVE = 8
|
2008-03-18 11:04:10 +01:00
|
|
|
};
|
|
|
|
|
2009-01-17 00:12:10 +01:00
|
|
|
typedef
|
|
|
|
void *GB_PICTURE;
|
|
|
|
|
|
|
|
typedef
|
|
|
|
struct {
|
|
|
|
int width;
|
|
|
|
int height;
|
|
|
|
}
|
|
|
|
GB_PICTURE_INFO;
|
|
|
|
|
|
|
|
#ifndef __GB_IMAGE_DEFINED
|
|
|
|
#define __GB_IMAGE_DEFINED
|
|
|
|
typedef
|
|
|
|
void *GB_IMAGE;
|
|
|
|
#endif
|
|
|
|
|
2009-12-24 03:02:05 +01:00
|
|
|
#ifndef __GB_COLOR_DEFINED
|
|
|
|
#define __GB_COLOR_DEFINED
|
|
|
|
typedef
|
|
|
|
unsigned int GB_COLOR;
|
|
|
|
#endif
|
|
|
|
|
2007-12-30 17:41:49 +01:00
|
|
|
typedef
|
|
|
|
void *GB_FONT;
|
|
|
|
|
|
|
|
#define DRAW_INTERFACE_VERSION 1
|
|
|
|
|
|
|
|
typedef
|
|
|
|
struct {
|
|
|
|
int version;
|
2009-12-28 02:19:27 +01:00
|
|
|
struct {
|
|
|
|
void *(*GetCurrent)();
|
|
|
|
void (*Begin)(void *);
|
|
|
|
void (*End)();
|
|
|
|
}
|
|
|
|
Paint;
|
2007-12-30 17:41:49 +01:00
|
|
|
}
|
|
|
|
DRAW_INTERFACE;
|
|
|
|
|
|
|
|
#define DRAW_NORMALIZE(x, y, w, h, sx, sy, sw, sh, width, height) \
|
|
|
|
if (sw < 0) sw = width; \
|
|
|
|
if (sh < 0) sh = height; \
|
2011-05-01 04:54:51 +02:00
|
|
|
if (w < 0) w = sw; \
|
|
|
|
if (h < 0) h = sh; \
|
|
|
|
if (sx < 0) sw += sx, sx = 0; \
|
|
|
|
if (sy < 0) sh += sy, sy = 0; \
|
2007-12-30 17:41:49 +01:00
|
|
|
if (sw > ((width) - sx)) \
|
|
|
|
sw = ((width) - sx); \
|
|
|
|
if (sh > ((height) - sy)) \
|
2011-05-01 04:54:51 +02:00
|
|
|
sh = ((height) - sy); \
|
|
|
|
if (sx >= (width) || sy >= (height) || sw <= 0 || sh <= 0) \
|
|
|
|
return;
|
2007-12-30 17:41:49 +01:00
|
|
|
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
|
|
|