Esempio n. 1
0
void taskbar_progs_draw_client (tbar_progs_t *tbar_progs, s_surface_t *surface, s_desktop_client_t *client, int x, int y, int w, int h)
{
        int x_;
        int w_ = 0;
        int _w = 0;
        char *text;
	s_font_t *font;

	x += 2;
	w -= 4;

	text = (char *) s_malloc(sizeof(char) * (50 + 1));
	snprintf(text, 50, "%s", client->title);

	font = tbar_progs->prog_font;
	s_font_set_str(font, text);
	s_font_set_size(font, h - 8);
	s_font_get_glyph(font);
	s_image_get_handler(font->glyph.img);

	s_fillbox(surface, x, y, w, h, s_rgbcolor(surface, 123, 121, 115));

	if (!client->pri) {
		for (x_ = w - 3; x_ >= 0; x_--) {
			s_putbox(surface, x + 1 + x_, y + 1, 1, h - 2, tbar_progs->prog_img[0]->buf);
		}
		x += 1;
		y += 1;
	} else {
		for (x_ = w - 3; x_ >= 0; x_--) {
			s_putbox(surface, x + 1 + x_, y + 1, 1, h - 2, tbar_progs->prog_img[1]->buf);
		}
	}

	y += 5;
	x += 4;
	w_ = font->glyph.img->w;

	if (font->glyph.img->w > (w - 8)) {
		w_ = w - 8;
		_w = font->glyph.img->w - (w - 8);
	}

	s_putboxpartrgba(surface, x, y, w_, font->glyph.img->h, font->glyph.img->w, font->glyph.img->h, font->glyph.img->rgba, 0, 0);

	s_free(text);
	s_image_uninit(font->glyph.img);
	s_image_init(&(font->glyph.img));
}
Esempio n. 2
0
void taskbar_progs_draw (s_window_t *window)
{
        int x;
        int pos;
        int w = 0;
        s_surface_t *srf;
        tbar_data_t *tbar_data;
        tbar_progs_t *tbar_progs;
        s_desktop_client_t *desktopc;

        pos = 0;
        tbar_data = (tbar_data_t *) window->data;
        tbar_progs = (tbar_progs_t *) tbar_data->tbar_progs;

	if (tbar_progs->desktop->clients->nb_elt > 0) {
		w = ((tbar_progs->rect.w / tbar_progs->desktop->clients->nb_elt) > 125) ? 125 : (tbar_progs->rect.w / tbar_progs->desktop->clients->nb_elt);
	}

	if (s_surface_create(&srf, tbar_progs->rect.w, tbar_progs->rect.h, window->surface->bitsperpixel)) {
		return;
	}

	for (x = 0; x <= tbar_progs->rect.w; x++) {
		s_putboxpart(srf, x, 0, 1, tbar_progs->rect.h, 1, 30, tbar_progs->tbar_img->buf, 0, tbar_progs->rect.y);
	}

	while (!s_list_eol(tbar_progs->desktop->clients, pos)) {
		desktopc = (s_desktop_client_t *) s_list_get(tbar_progs->desktop->clients, pos);
		taskbar_progs_draw_client(tbar_progs, srf, desktopc, w * pos, 0, w, tbar_progs->rect.h);
		pos++;
	}

        s_putbox(window->surface, tbar_progs->rect.x, tbar_progs->rect.y, tbar_progs->rect.w, tbar_progs->rect.h, srf->vbuf);
        s_surface_destroy(srf);
}
Esempio n. 3
0
int main (int argc, char *argv[])
{
	int x = 60;
	int y = 60;
	int w = 400;
	int h = 300;
	int mw = 1000;
	int mh = 1000;
	char *box;
	s_timer_t *timer;
	s_handler_t *hndl;
	s_window_t *window;

	s_window_init(&window);

	s_window_new(window, WINDOW_TYPE_MAIN, NULL);
	mw = window->surface->width;
	mh = window->surface->height;
	box = (char *) s_malloc(sizeof(char) * (mw / 4) * (mh / 4) * window->surface->bytesperpixel);

	s_window_set_title(window, "Demo - %s", argv[0]);
	s_window_set_coor(window, 0, x, y, w, h);

	s_fillbox(window->surface, mw/4, mh/4, mw/4, mh/4, s_rgbcolor(window->surface, 255, 0, 0));
	s_fillbox(window->surface, mw/2, mh/4, mw/4, mh/4, s_rgbcolor(window->surface, 0, 255, 0));
	s_fillbox(window->surface, mw/4, mh/2, mw/4, mh/4, s_rgbcolor(window->surface, 0, 0, 255));
	s_fillbox(window->surface, mw/2, mh/2, mw/4, mh/4, s_rgbcolor(window->surface, 255, 255, 255));

	s_getbox(window->surface, mw/4, mh/4, mw/4, mh/4, box);
	s_putbox(window->surface, 0, 0, mw/4, mh/4, box);
	s_free(box);

	s_fillbox(window->surface, 0, 0, 20, 20, s_rgbcolor(window->surface, 222, 222, 222));
	s_fillbox(window->surface, 2, 2, 16, 16, s_rgbcolor(window->surface, 0, 0, 0));
	s_handler_init(&hndl);
	hndl->type = MOUSE_HANDLER;
	hndl->mouse.x = 2;
	hndl->mouse.y = 2;
	hndl->mouse.w = 16;
	hndl->mouse.h = 16;
	hndl->mouse.p = timer_handler_p;
	hndl->mouse.button = MOUSE_BUTTON_LEFT;
	s_handler_add(window, hndl);

	s_timer_init(&timer);
	timer->timeval = 2000;
	timer->cb = timer0_cb;
	s_timer_add(window, timer);

	s_timer_init(&timer);
	timer->timeval = 2500;
	timer->cb = timer1_cb;
	s_timer_add(window, timer);

	s_window_show(window);
	s_window_main(window);

	return 0;
}
Esempio n. 4
0
static int draw_boxes (s_window_t *window)
{
    int x;
    int y;
    int colors[3];
    s_rect_t rect;
    s_surface_t *surface;

    if (s_surface_create(&surface, window->surface->buf->w, window->surface->buf->h, window->surface->bitsperpixel)) {
        return -1;
    }

    for (y = 0; y < 3; y++) {
        for (x = 0; x < 3; x++) {
            rect.x = x * BOX_W;
            rect.y = y * BOX_H;
            rect.w = BOX_W;
            rect.h = BOX_H;
            if (chars_x == x && chars_y == y) {
                continue;
            } else {
                colors[0] = s_rgbcolor(window->surface, 0, 0, 0);
                colors[1] = s_rgbcolor(window->surface, 0, 0, 0);
            }
            draw_single_box(surface, &rect, chars[chars_type][y * 3 + x], colors, &image_gray);
        }
    }
    {
        colors[0] = s_rgbcolor(window->surface, 0, 0, 0);
        colors[1] = s_rgbcolor(window->surface, 255, 255, 255);
        rect.x = chars_x * BOX_W;
        rect.y = chars_y * BOX_H;
        rect.w = BOX_W;
        rect.h = BOX_H;

        if (chars_select == SELECT_CHAR ||
                chars_highlight == 1) {
            rect.x -= 5;
            rect.y -= 5;
            rect.w += 10;
            rect.h += 10;
            rect.x = MAX(0, rect.x);
            rect.y = MAX(0, rect.y);
            rect.x = MIN(window->surface->buf->w - rect.w, rect.x);
            rect.y = MIN(window->surface->buf->h - rect.h, rect.y);
        }

        draw_single_box(surface, &rect, chars[chars_type][chars_y * 3 + chars_x], colors, &image_orange);
    }

    s_putbox(window->surface, 0, 0, surface->width, surface->height, surface->vbuf);

    s_surface_destroy(surface);
    return 0;
}
Esempio n. 5
0
void taskbar_clock_draw (s_window_t *window, s_timer_t *timer)
{
	int w_;
	time_t t_;
	struct tm *t;
	int _w = 0;
        char *vbuf;
        s_surface_t *srf;
        tbar_data_t *tbar_data;
        tbar_clock_t *tbar_clock;
	int c0 = s_rgbcolor(window->surface, 96, 96, 96);
	int c1 = s_rgbcolor(window->surface, 255, 255, 255);
	int c2 = s_rgbcolor(window->surface, 220, 220, 220);

	tbar_data = (tbar_data_t *) window->data;
	tbar_clock = tbar_data->tbar_clock;

	t_ = time(NULL);
        t = localtime(&t_);

	vbuf = (char *) s_malloc(sizeof(char) * 10);
	if (t->tm_sec & 1) {
		sprintf(vbuf, "%02d:%02d ", t->tm_hour, t->tm_min);
	} else {
		sprintf(vbuf, "%02d %02d ", t->tm_hour, t->tm_min);
	}
	s_font_set_str(tbar_clock->font, vbuf);
	s_free(vbuf);

	s_font_get_glyph(tbar_clock->font);

	if (s_surface_create(&srf, tbar_clock->rect.w, tbar_clock->rect.h, window->surface->bitsperpixel)) {
		return;
	}

	s_fillbox(srf, 0, 0, tbar_clock->rect.w, tbar_clock->rect.h, c0);
	s_fillbox(srf, 1, 1, tbar_clock->rect.w - 1, tbar_clock->rect.h - 1, c1);
	s_fillbox(srf, 1, 1, tbar_clock->rect.w - 2, tbar_clock->rect.h - 2, c2);

	w_ = tbar_clock->font->glyph.img->w;
	if (tbar_clock->font->glyph.img->w > (tbar_clock->rect.w - 6)) {
		w_ = tbar_clock->rect.w - 6;
		_w = tbar_clock->font->glyph.img->w - (tbar_clock->rect.w - 6);
	}
	s_putboxpartrgba(srf, 3, 4, w_, tbar_clock->font->glyph.img->h, tbar_clock->font->glyph.img->w, tbar_clock->font->glyph.img->h, tbar_clock->font->glyph.img->rgba, 0, 0);

        s_putbox(window->surface, tbar_clock->rect.x, tbar_clock->rect.y, tbar_clock->rect.w, tbar_clock->rect.h, srf->vbuf);

        s_surface_destroy(srf);
        return;
}
Esempio n. 6
0
void taskbar_start_menu_icon (s_window_t *window)
{
        s_surface_t *srf;
        tbar_data_t *tbar_data;
        tbar_smenu_t *tbar_smenu;

        tbar_data = (tbar_data_t *) window->data;
        tbar_smenu = (tbar_smenu_t *) tbar_data->tbar_smenu;

        if (s_surface_create(&srf, tbar_smenu->img->w, tbar_smenu->img->h, window->surface->bitsperpixel)) {
        	return;
        }
        s_getbox(window->surface, tbar_smenu->rect.x, tbar_smenu->rect.y, tbar_smenu->img->w, tbar_smenu->img->h, srf->vbuf);
        s_putboxrgba(srf, 0, 0, tbar_smenu->img->w, tbar_smenu->img->h, tbar_smenu->img->rgba);
        s_putbox(window->surface, tbar_smenu->rect.x, tbar_smenu->rect.y, tbar_smenu->img->w, tbar_smenu->img->h, srf->vbuf);
        s_surface_destroy(srf);
}
Esempio n. 7
0
void taskbar_start_menu_handler_p (s_window_t *window, s_event_t *event, s_handler_t *handler)
{
        char *box;
        tbar_data_t *tbar_data;
        tbar_smenu_t *tbar_smenu;

        tbar_data = (tbar_data_t *) window->data;
        tbar_smenu = (tbar_smenu_t *) tbar_data->tbar_smenu;

        while (tbar_data->tbar_smenu->running) {
		usleep(20000);
	}

	box = (char *) s_malloc(tbar_smenu->rect.w * tbar_smenu->rect.h * window->surface->bytesperpixel);
	s_getbox(window->surface, tbar_smenu->rect.x, tbar_smenu->rect.y, tbar_smenu->rect.w, tbar_smenu->rect.h, box);
	s_fillbox(window->surface, tbar_smenu->rect.x, tbar_smenu->rect.y, tbar_smenu->rect.w + 2, tbar_smenu->rect.h + 2, s_rgbcolor(window->surface, 115, 117, 115));
	s_fillbox(window->surface, tbar_smenu->rect.x + 1, tbar_smenu->rect.y + 1, tbar_smenu->rect.w + 1, tbar_smenu->rect.h + 1, s_rgbcolor(window->surface, 255, 255, 255));
	s_putbox(window->surface, tbar_smenu->rect.x + 1, tbar_smenu->rect.y + 1, tbar_smenu->rect.w, tbar_smenu->rect.h, box);
	s_free(box);
	start_menu_start(window, tbar_data->tbar_smenu->progs, window->surface->buf->x, window->surface->buf->y);
}
Esempio n. 8
0
void taskbar_start_menu_handler_rh (s_window_t *window, s_event_t *event, s_handler_t *handler)
{
        int x;
        s_surface_t *srf;
        tbar_data_t *tbar_data;
        tbar_progs_t *tbar_progs;
        tbar_smenu_t *tbar_smenu;

        tbar_data = (tbar_data_t *) window->data;
        tbar_smenu = (tbar_smenu_t *) tbar_data->tbar_smenu;
        tbar_progs = (tbar_progs_t *) tbar_data->tbar_progs;

        if (s_surface_create(&srf, (tbar_smenu->rect.w + tbar_progs->tbar_img->w + 2), (tbar_smenu->rect.h + 2), window->surface->bitsperpixel)) {
        	return;
        }
	for (x = 0; x <= tbar_smenu->rect.w + 2; x++) {
		s_putboxpart(srf, x, 0, tbar_progs->tbar_img->w, tbar_smenu->rect.h + 2, tbar_progs->tbar_img->w, tbar_progs->tbar_img->h, tbar_progs->tbar_img->buf, 0, tbar_smenu->rect.y);
	}
        s_putboxrgba(srf, 0, 0, tbar_smenu->img->w, tbar_smenu->img->h, tbar_smenu->img->rgba);
	s_putbox(window->surface, tbar_smenu->rect.x, tbar_smenu->rect.y, srf->width, srf->height, srf->vbuf);
	s_surface_destroy(srf);
}
Esempio n. 9
0
static int draw_single_box (s_surface_t *wsurface, s_rect_t *rect, osk_char_t c[4], int colors[2], image_bin_t *image_bin)
{
    int i;
    int r;
    int g;
    int b;
    int fh;
    int x = 0;
    int y = 0;
    char *tbuf;
    s_image_t *img;
    s_font_t *font;
    s_surface_t *surface;

    if (s_surface_create(&surface, rect->w, rect->h, wsurface->bitsperpixel)) {
        return -1;
    }

    s_fillbox(surface, 0, 0, rect->w, rect->h, colors[0]);

    s_image_init(&img);
    image_load(img, image_bin->width, image_bin->height, (unsigned char *) image_bin->pixel_data);
    s_image_get_buf(surface, img);
    tbuf = (char *) s_malloc(sizeof(char) * (rect->w - 2) * (rect->h - 2) * surface->bytesperpixel);
    s_scalebox(surface, img->w, img->h, img->buf, rect->w - 2, rect->h - 2, tbuf);
    s_putbox(surface, 1, 1, rect->w - 2, rect->h - 2, tbuf);
    s_free(tbuf);
    s_image_uninit(img);

    fh = rect->h / 3;

    for (i = 0; i < 4; i++) {
        s_font_init(&font, "veramono.ttf");
        s_font_set_str(font, c[i].name);
        s_colorrgb(wsurface, colors[1], &r, &g, &b);
        s_font_set_rgb(font, r, g, b);
        if (strlen(c[i].name) > 1) {
            s_font_set_size(font, fh - 5);
        } else {
            s_font_set_size(font, fh);
        }
        s_font_get_glyph(font);
        s_image_get_handler(font->glyph.img);

        font->glyph.img->handler->x = 0;
        font->glyph.img->handler->y = 0;
        font->glyph.img->handler->w = font->glyph.img->w;
        font->glyph.img->handler->h = font->glyph.img->h;

        switch (i) {
        case 0:
            x = 5;
            y = (rect->h - fh) / 2;
            break;
        case 1:
            x = (rect->w - font->glyph.img->handler->w) / 2;
            y = 2;
            break;
        case 2:
            x = rect->w - font->glyph.img->handler->w - 3;
            y = (rect->h - fh) / 2;
            break;
        case 3:
            y = rect->h - fh - 7;
            x = (rect->w - font->glyph.img->handler->w) / 2;
            break;
        }
        s_putboxpartrgba(surface, x, y + fh - font->glyph.yMax, font->glyph.img->handler->w, font->glyph.img->handler->h, font->glyph.img->w, font->glyph.img->h, font->glyph.img->rgba, font->glyph.img->handler->x, font->glyph.img->handler->y);

        s_font_uninit(font);
    }

    s_putbox(wsurface, rect->x, rect->y, rect->w, rect->h, surface->vbuf);

    s_surface_destroy(surface);
    return 0;
}
Esempio n. 10
0
File: menu.c Progetto: d33tah/whitix
void start_menu_start (s_window_t *pwindow, s_list_t *progs, int wx, int wy)
{
	int p;
	int fy;
	int fx;
	int fw;
	int fh;
	char *file;
	char *tbuf;
	s_surface_t *s;
	s_font_t *font;
	s_image_t *img;
	s_window_t *temp;
	s_handler_t *hndl;
	smenu_prog_t *sprog;
        tbar_data_t *tbar_data;

	fx = 30;
	fy = 22;
	fw = 160;
	fh = progs->nb_elt * fy + 13;
        tbar_data = (tbar_data_t *) pwindow->data;

	tbar_data->tbar_smenu->running = 1;

	s_window_init(&temp);
        s_window_new(temp, WINDOW_TEMP | WINDOW_NOFORM, pwindow);
        s_window_set_coor(temp, 0, wx, wy - fh - 1, fw, fh);

	s_fillbox(temp->surface, 0, 0, temp->surface->buf->w, temp->surface->buf->h, s_rgbcolor(temp->surface, 0, 0, 0));
	s_fillbox(temp->surface, 1, 1, temp->surface->buf->w - 2, temp->surface->buf->h - 2, s_rgbcolor(temp->surface, 255, 255, 255));
	s_fillbox(temp->surface, 1, 1, 24, temp->surface->buf->h - 2, s_rgbcolor(temp->surface, 197, 198, 189));
	
	s_font_init(&font, "arial.ttf");
	s_font_set_size(font, 13);

	p = 0;
	while (!s_list_eol(progs, p)) {
		sprog = (smenu_prog_t *) s_list_get(progs, p++);
		if ((sprog->icon != NULL) && (*(sprog->icon) != '\0')) {
			s_image_init(&img);
			file = (char *) s_malloc(sizeof(char) * (strlen(DESKTOPDIR "/img/icons/") + strlen(sprog->icon) + 1));
			sprintf(file, "%s/img/icons/%s", DESKTOPDIR, sprog->icon);
			s_image_img(file, img);
			s_image_get_handler(img);
			tbuf = (char *) s_malloc(temp->surface->bytesperpixel * 18 * 18);
			if (s_surface_create(&s, img->w, img->h, temp->surface->bitsperpixel)) {
				goto out;
			}
			s_fillbox(s, 0, 0, img->w, img->h, s_rgbcolor(s, 197, 198, 199));
			s_putboxrgba(s, 0, 0, img->w, img->h, img->rgba);
			s_scalebox(temp->surface, img->w, img->h, s->vbuf, 18, 18, tbuf);
			s_putbox(temp->surface, 4, 2 + fy - 16, 18, 18, tbuf);
			s_surface_destroy(s);
out:			s_image_uninit(img);
			s_free(file);
			s_free(tbuf);
		}

		s_font_set_str(font, sprog->name);
		s_font_get_glyph(font);
		s_image_get_handler(font->glyph.img);
		s_putboxrgba(temp->surface, fx, fy - font->glyph.yMax, font->glyph.img->w, font->glyph.img->h, font->glyph.img->rgba);

		s_handler_init(&hndl);
		hndl->type = MOUSE_HANDLER;
		hndl->mouse.x = fx;
		hndl->mouse.y = fy - font->glyph.img->h + font->glyph.img->handler->y;
		hndl->mouse.w = fw - 50;
		hndl->mouse.h = font->glyph.img->h;
		hndl->mouse.p = start_menu_handler;
		hndl->mouse.button = MOUSE_LEFTBUTTON;
		hndl->data = sprog;
		s_handler_add(temp, hndl);

		if (sprog->type == SMENU_MENU) {
			s_font_set_str(font, ">");
			s_font_get_glyph(font);
			s_image_get_handler(font->glyph.img);
			s_putboxrgba(temp->surface, fw - font->glyph.img->w - 10, fy - font->glyph.yMax, font->glyph.img->w, font->glyph.img->h, font->glyph.img->rgba);
		}

		fy += 22;
	}

	s_font_uninit(font);

	s_window_atexit(temp, start_menu_atexit);
	temp->data = tbar_data;

	s_window_show(temp);
	s_window_main(temp);
}
Esempio n. 11
0
void MButton::objectDraw (void)
{
        int x;
        int y;
        int w;
        int h;
        int x_;
        int y_;
	int c[3];
        char *vbuf;
	char text[3];
        s_surface_t s;
	s_font_t *font;
	unsigned int *mat;
	
	if (buttonMines->minesMatrix_[buttonR][buttonC] == 1) {
		this->frameSetStyle((this->frameStyle & SFrame::MShape) | SFrame::Sunken);
	}
	
	SButton::objectDraw();

	if (buttonMines->minesMatrix_[buttonR][buttonC] == 1) {
		if (buttonMines->minesMatrix[buttonR][buttonC] == 0) {
			/* top */
			buttonDrawEmpty(buttonR - 1, buttonC);
			/* top right */
			buttonDrawEmpty(buttonR - 1, buttonC + 1);
			/* right */
			buttonDrawEmpty(buttonR, buttonC + 1);
			/* bottom right */
			buttonDrawEmpty(buttonR + 1, buttonC + 1);
			/* bottom */
			buttonDrawEmpty(buttonR + 1, buttonC);
			/* bottom left */
			buttonDrawEmpty(buttonR + 1, buttonC - 1);
			/* left */
			buttonDrawEmpty(buttonR, buttonC - 1);
			/* top left */
			buttonDrawEmpty(buttonR - 1, buttonC - 1);
		} else if (buttonMines->minesMatrix[buttonR][buttonC] > 0) {
			if ((objectRectContents.rectH - 2) < 0) {
				return;
			}
			s_font_init(&font, "arial.ttf");
			sprintf(text, "%d", (int) (buttonMines->minesMatrix[buttonR][buttonC]));
			s_font_set_str(font, text);
			s_font_set_size(font, objectRectContents.rectH - 2);
			s_font_get_glyph(font);
			s_image_get_handler(font->img);

			switch (buttonMines->minesMatrix[buttonR][buttonC]) {
				case 1: c[0] = 0;	c[1] = 0;	c[2] = 255;	break;
				case 2: c[0] = 0;	c[1] = 136;	c[2] = 0;	break;
				case 3: c[0] = 136;	c[1] = 136;	c[2] = 0;	break;
				case 4: c[0] = 136;	c[1] = 0;	c[2] = 136;	break;
				case 5: c[0] = 255;	c[1] = 0;	c[2] = 0;	break;
				case 6: c[0] = 136;	c[1] = 0;	c[2] = 0;	break;
				case 7: c[0] = 0;	c[1] = 0;	c[2] = 0;	break;
				default:
				case 8: c[0] = 0;	c[1] = 0;	c[2] = 0;	break;
			}

			x_ = objectRectContents.rectX + ((((objectRectContents.rectW - font->img->w) / 2) < 0) ? 0 : ((objectRectContents.rectW - font->img->w) / 2));
			y_ = objectRectContents.rectY + ((((objectRectContents.rectH - font->yMax) / 2) < 0) ? 0 : ((objectRectContents.rectH - font->yMax) / 2));
			w = (objectRectContents.rectW < font->img->w) ? objectRectContents.rectW : font->img->w;
			h = (objectRectContents.rectH < font->img->h) ? objectRectContents.rectH : font->img->h;

		        vbuf = (char *) s_malloc(objectWindow->surface->bytesperpixel * font->img->w * font->img->h + 1);
		        s_getsurfacevirtual(&s, font->img->w, font->img->h, objectWindow->surface->bitsperpixel, vbuf);
		        s_getbox(objectWindow->surface, x_, y_, font->img->w, font->img->h, s.vbuf);

		        mat = font->img->rgba;
			for (y = 0; y < h; y++) {
				for (x = 0; x < w; x++) {
					if (~*mat & 0xff) {
						s_setpixelrgba(&s, x, y, c[0], c[1], c[2], *mat & 0xff);
					}
					mat++;
				}
				mat += font->img->w - w;
			}

			s_putbox(objectWindow->surface, x_, y_, font->img->w, font->img->h, s.vbuf);
        		s_free(vbuf);
        		s_font_uninit(font);
		} else if (buttonMines->minesMatrix[buttonR][buttonC] < 0) {
			x = objectRectContents.rectX + ((((objectRectContents.rectW - buttonMines->minesMine->w) / 2) < 0) ? 0 : ((objectRectContents.rectW - buttonMines->minesMine->w) / 2));
			y = objectRectContents.rectY + ((((objectRectContents.rectH - buttonMines->minesMine->h) / 2) < 0) ? 0 : ((objectRectContents.rectH - buttonMines->minesMine->h) / 2));
			w = (objectRectContents.rectW < buttonMines->minesMine->w) ? objectRectContents.rectW : buttonMines->minesMine->w;
			h = (objectRectContents.rectH < buttonMines->minesMine->h) ? objectRectContents.rectH : buttonMines->minesMine->h;
			s_putboxpartmask(objectWindow->surface, x, y, w, h, buttonMines->minesMine->w, buttonMines->minesMine->h, buttonMines->minesMine->buf, buttonMines->minesMine->mat, 0, 0);
		}
	} else 	if (buttonMines->minesMatrix_[buttonR][buttonC] == 2) {
		x = objectRectContents.rectX + ((((objectRectContents.rectW - buttonMines->minesFlag->w) / 2) < 0) ? 0 : ((objectRectContents.rectW - buttonMines->minesFlag->w) / 2));
		y = objectRectContents.rectY + ((((objectRectContents.rectH - buttonMines->minesFlag->h) / 2) < 0) ? 0 : ((objectRectContents.rectH - buttonMines->minesFlag->h) / 2));
		w = (objectRectContents.rectW < buttonMines->minesFlag->w) ? objectRectContents.rectW : buttonMines->minesFlag->w;
		h = (objectRectContents.rectH < buttonMines->minesFlag->h) ? objectRectContents.rectH : buttonMines->minesFlag->h;
		s_putboxpartmask(objectWindow->surface, x, y, w, h, buttonMines->minesFlag->w, buttonMines->minesFlag->h, buttonMines->minesFlag->buf, buttonMines->minesFlag->mat, 0, 0);
	} else 	if (buttonMines->minesMatrix_[buttonR][buttonC] == 3) {
		if ((objectRectContents.rectH - 2) < 0) {
			return;
		}
		s_font_init(&font, "arial.ttf");
		sprintf(text, "%s", "?");
		s_font_set_str(font, text);
		s_font_set_size(font, objectRectContents.rectH - 2);
		s_font_get_glyph(font);
		s_image_get_handler(font->img);

		x_ = objectRectContents.rectX + ((((objectRectContents.rectW - font->img->w) / 2) < 0) ? 0 : ((objectRectContents.rectW - font->img->w) / 2));
		y_ = objectRectContents.rectY + ((((objectRectContents.rectH - font->yMax) / 2) < 0) ? 0 : ((objectRectContents.rectH - font->yMax) / 2));
		w = (objectRectContents.rectW < font->img->w) ? objectRectContents.rectW : font->img->w;
		h = (objectRectContents.rectH < font->img->h) ? objectRectContents.rectH : font->img->h;
                
		vbuf = (char *) s_malloc(objectWindow->surface->bytesperpixel * font->img->w * font->img->h + 1);
		s_getsurfacevirtual(&s, font->img->w, font->img->h, objectWindow->surface->bitsperpixel, vbuf);
		s_getbox(objectWindow->surface, x_, y_, font->img->w, font->img->h, s.vbuf);

                mat = font->img->rgba;
		for (y = 0; y < h; y++) {
			for (x = 0; x < w; x++) {
				if (~*mat & 0xff) {
					s_setpixelrgba(&s, x, y, 0, 0, 0, *mat & 0xff);
				}
				mat++;
			}
			mat += font->img->w - w;
		}

		s_putbox(objectWindow->surface, x_, y_, font->img->w, font->img->h, s.vbuf);
        	s_free(vbuf);
		s_font_uninit(font);
	}
}