/****************************************************************************
GLUI User Interface Toolkit
---------------------------
glui_control.cpp - top-level GLUI_Control class
--------------------------------------------------
Copyright (c) 1998 Paul Rademacher
WWW: http://sourceforge.net/projects/glui/
Forums: http://sourceforge.net/forum/?group_id=92496
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 2.1 of the License, or (at your option) any later version.
This library 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
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
License along with this library; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*****************************************************************************/
#include "glui_internal_control.h"
int _glui_draw_border_only = 0;
/*************************** Drawing Utility routines *********************/
/* Redraw this control. */
void GLUI_Control::redraw(void) {
if (glui==NULL || hidden) return;
if (glui->should_redraw_now(this))
translate_and_draw_front();
}
/** Redraw everybody in our window. */
void GLUI_Control::redraw_window(void) {
if (glui==NULL || hidden) return;
if ( glui->get_glut_window_id() == -1 ) return;
int orig = set_to_glut_window();
glutPostRedisplay();
restore_window(orig);
}
/* GLUI_Control::translate_and_draw_front() ********/
void GLUI_Control::translate_and_draw_front()
{
GLUI_DRAWINGSENTINAL_IDIOM
glMatrixMode( GL_MODELVIEW );
glPushMatrix();
translate_to_origin();
draw(0,0);
glPopMatrix();
}
/********** GLUI_Control::set_to_bkgd_color() ********/
void GLUI_Control::set_to_bkgd_color( void )
{
if ( NOT glui )
return;
glColor3ub( glui->bkgd_color.r, glui->bkgd_color.g, glui->bkgd_color.b );
}
/******** GLUI_Control::draw_box_inwards_outline() ********/
void GLUI_Control::draw_box_inwards_outline( int x_min, int x_max, int y_min, int y_max )
{
glBegin( GL_LINES );
glColor3f( .5, .5, .5 );
glVertex2i( x_min, y_min ); glVertex2i( x_max, y_min );
glVertex2i( x_min, y_min ); glVertex2i( x_min, y_max );
glColor3f( 1., 1., 1. );
glVertex2i( x_min, y_max ); glVertex2i( x_max, y_max );
glVertex2i( x_max, y_max ); glVertex2i( x_max, y_min );
if ( enabled )
glColor3f( 0., 0., 0. );
else
glColor3f( .25, .25, .25 );
glVertex2i( x_min+1, y_min+1 ); glVertex2i( x_max-1, y_min+1 );
glVertex2i( x_min+1, y_min+1 ); glVertex2i( x_min+1, y_max-1 );
glColor3f( .75, .75, .75 );
glVertex2i( x_min+1, y_max-1 ); glVertex2i( x_max-1, y_max-1 );
glVertex2i( x_max-1, y_max-1 ); glVertex2i( x_max-1, y_min+1 );
glEnd();
}
/******* GLUI_Control::draw_box() **********/
void GLUI_Control::draw_box( int x_min, int x_max, int y_min, int y_max, float r, float g, float b)
{
if