glamtk

diff src/imtk.c @ 7:a115dff39a54

rounded crappy buttons
author John Tsiombikas <nuclear@member.fsf.org>
date Fri, 11 Mar 2011 02:25:49 +0200
parents 00a4ea4ee6dc
children cd00a5775373
line diff
     1.1 --- a/src/imtk.c	Wed Mar 09 10:12:31 2011 +0200
     1.2 +++ b/src/imtk.c	Fri Mar 11 02:25:49 2011 +0200
     1.3 @@ -10,6 +10,7 @@
     1.4  #include <GLUT/glut.h>
     1.5  #endif
     1.6  #include "imtk.h"
     1.7 +#include "draw.h"
     1.8  
     1.9  #define CHECKBOX_SIZE	14
    1.10  #define TEXTBOX_SIZE	100
    1.11 @@ -44,11 +45,11 @@
    1.12  
    1.13  /* default colors, can be changed with imtk_set_color */
    1.14  static float colors[][4] = {
    1.15 -	{0.0, 0.0, 0.0},	/* text color */
    1.16 -	{0.7, 0.7, 0.7},	/* base color */
    1.17 -	{0.85, 0.85, 0.85},	/* focus color */
    1.18 -	{1.0, 1.0, 1.0},	/* lit bevel */
    1.19 -	{0.3, 0.3, 0.3}		/* shadowed bevel */
    1.20 +	{0.0, 0.0, 0.0, 0.7},		/* text color */
    1.21 +	{0.6, 0.6, 0.6, 0.7},		/* base color */
    1.22 +	{0.7, 0.7, 0.7, 0.7},	/* focus color */
    1.23 +	{1.0, 1.0, 1.0, 1.0},		/* lit bevel */
    1.24 +	{0.3, 0.3, 0.3, 1.0}		/* shadowed bevel */
    1.25  };
    1.26  
    1.27  static int scr_width = 1, scr_height = 1;
    1.28 @@ -409,6 +410,7 @@
    1.29  
    1.30  	calc_button_size(label, &width, &height);
    1.31  
    1.32 +	/*
    1.33  	glBegin(GL_QUADS);
    1.34  	if(hit_test(x, y, width, height)) {
    1.35  		glColor3fv(colors[IMTK_FOCUS_COLOR]);
    1.36 @@ -422,6 +424,14 @@
    1.37  	glEnd();
    1.38  
    1.39  	draw_frame(x, y, width, height, active == id ? FRAME_INSET : FRAME_OUTSET);
    1.40 +	*/
    1.41 +
    1.42 +	if(hit_test(x, y, width, height)) {
    1.43 +		imtk_draw_backgroundv(colors[IMTK_FOCUS_COLOR]);
    1.44 +	} else {
    1.45 +		imtk_draw_backgroundv(colors[IMTK_BASE_COLOR]);
    1.46 +	}
    1.47 +	imtk_draw_rect(x, y, width, height, 8);
    1.48  
    1.49  	glColor3fv(colors[IMTK_TEXT_COLOR]);
    1.50  	draw_string(x + 20, y + 15, label);