Initialize libbullet git in 2.0_beta.
[platform/upstream/libbullet.git] / Extras / glui / glui_column.cpp
1 /****************************************************************************
2   GLUI User Interface Toolkit
3   ---------------------------
4
5      glui_column.cpp - GLUI_Column control class
6
7
8           --------------------------------------------------
9
10   Copyright (c) 1998 Paul Rademacher
11
12   WWW:    http://sourceforge.net/projects/glui/
13   Forums: http://sourceforge.net/forum/?group_id=92496
14
15   This library is free software; you can redistribute it and/or
16   modify it under the terms of the GNU Lesser General Public
17   License as published by the Free Software Foundation; either
18   version 2.1 of the License, or (at your option) any later version.
19
20   This library is distributed in the hope that it will be useful,
21   but WITHOUT ANY WARRANTY; without even the implied warranty of
22   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
23   Lesser General Public License for more details.
24
25   You should have received a copy of the GNU Lesser General Public
26   License along with this library; if not, write to the Free Software
27   Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
28
29 *****************************************************************************/
30
31 #include "glui_internal_control.h"
32
33 /******************************** GLUI_Column::GLUI_Column() ************/
34
35 GLUI_Column::GLUI_Column( GLUI_Node *parent, int draw_bar )
36 {
37   common_init();
38   int_val = draw_bar; /* Whether to draw vertical bar or not */
39
40   parent->add_control( this );
41 }
42
43 /**************************************** GLUI_Column::draw() ************/
44
45 void  GLUI_Column::draw( int x, int y )
46 {
47   int   panel_x, panel_y, panel_w, panel_h, panel_x_off, panel_y_off;
48   int   y_diff;
49
50   if ( int_val == 1 ) {  /* Draw a vertical bar */
51     GLUI_DRAWINGSENTINAL_IDIOM
52     if ( parent() != NULL ) {
53       get_this_column_dims(&panel_x, &panel_y, &panel_w, &panel_h, 
54                            &panel_x_off, &panel_y_off);
55
56       y_diff = y_abs - panel_y;
57
58       if ( 0 ) {
59         glLineWidth(1.0);
60         glBegin( GL_LINES );
61         glColor3f( .5, .5, .5 );
62         glVertex2i( -GLUI_XOFF+1, -y_diff + GLUI_SEPARATOR_HEIGHT/2 );
63         glVertex2i( -GLUI_XOFF+1, -y_diff + panel_h - GLUI_SEPARATOR_HEIGHT/2);
64
65         glColor3f( 1.0, 1.0, 1.0 );
66         glVertex2i( -GLUI_XOFF+2, -y_diff + GLUI_SEPARATOR_HEIGHT/2 );
67         glVertex2i( -GLUI_XOFF+2, -y_diff + panel_h - GLUI_SEPARATOR_HEIGHT/2);
68         glEnd();
69       }
70       else {
71         glLineWidth(1.0);
72         glBegin( GL_LINES );
73         glColor3f( .5, .5, .5 );
74         glVertex2i( -2, 0 );
75         glVertex2i( -2, h );
76         /*glVertex2i( 0, -y_diff + GLUI_SEPARATOR_HEIGHT/2 );              */
77         /*glVertex2i( 0, -y_diff + panel_h - GLUI_SEPARATOR_HEIGHT/2);              */
78
79         glColor3f( 1.0, 1.0, 1.0 );
80         glVertex2i( -1, 0 );
81         glVertex2i( -1, h );
82         /*glVertex2i( 1, -y_diff + GLUI_SEPARATOR_HEIGHT/2 );              */
83         /*glVertex2i( 1, -y_diff + panel_h - GLUI_SEPARATOR_HEIGHT/2);              */
84         glEnd();
85       }         
86     } 
87   }
88 }
89