~ubuntu-branches/ubuntu/vivid/emscripten/vivid

« back to all changes in this revision

Viewing changes to tests/bullet/Extras/glui/glui_separator.cpp

  • Committer: Package Import Robot
  • Author(s): Sylvestre Ledru
  • Date: 2013-05-02 13:11:51 UTC
  • Revision ID: package-import@ubuntu.com-20130502131151-q8dvteqr1ef2x7xz
Tags: upstream-1.4.1~20130504~adb56cb
ImportĀ upstreamĀ versionĀ 1.4.1~20130504~adb56cb

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/****************************************************************************
 
2
  
 
3
  GLUI User Interface Toolkit
 
4
  ---------------------------
 
5
 
 
6
     glui_separator.cpp - GLUI_Separator control class
 
7
 
 
8
 
 
9
          --------------------------------------------------
 
10
 
 
11
  Copyright (c) 1998 Paul Rademacher
 
12
 
 
13
  WWW:    http://sourceforge.net/projects/glui/
 
14
  Forums: http://sourceforge.net/forum/?group_id=92496
 
15
 
 
16
  This library is free software; you can redistribute it and/or
 
17
  modify it under the terms of the GNU Lesser General Public
 
18
  License as published by the Free Software Foundation; either
 
19
  version 2.1 of the License, or (at your option) any later version.
 
20
 
 
21
  This library is distributed in the hope that it will be useful,
 
22
  but WITHOUT ANY WARRANTY; without even the implied warranty of
 
23
  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 
24
  Lesser General Public License for more details.
 
25
 
 
26
  You should have received a copy of the GNU Lesser General Public
 
27
  License along with this library; if not, write to the Free Software
 
28
  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
 
29
 
 
30
*****************************************************************************/
 
31
 
 
32
#include "glui_internal_control.h"
 
33
 
 
34
/****************************** GLUI_Separator::GLUI_Separator() **********/
 
35
 
 
36
GLUI_Separator::GLUI_Separator( GLUI_Node *parent )
 
37
{
 
38
  common_init();
 
39
  parent->add_control( this );
 
40
}
 
41
 
 
42
/****************************** GLUI_Separator::draw() **********/
 
43
 
 
44
void    GLUI_Separator::draw( int x, int y )
 
45
{
 
46
  GLUI_DRAWINGSENTINAL_IDIOM
 
47
  
 
48
  int width, indent;
 
49
  int           cont_x, cont_y, cont_w, cont_h, cont_x_off, cont_y_off;
 
50
 
 
51
  if ( parent() != NULL ) {
 
52
    get_this_column_dims(&cont_x, &cont_y, &cont_w, &cont_h, 
 
53
                         &cont_x_off, &cont_y_off);
 
54
 
 
55
    width = cont_w - cont_x_off*2;
 
56
  }
 
57
  else {
 
58
    width = this->w;
 
59
  }
 
60
 
 
61
  indent = (int) floor(width * .05);
 
62
 
 
63
  glLineWidth( 1.0 );
 
64
  glBegin( GL_LINES );
 
65
  glColor3f( .5, .5, .5 );
 
66
  glVertex2i( indent,       GLUI_SEPARATOR_HEIGHT/2-1 );    
 
67
  glVertex2i( width-indent, GLUI_SEPARATOR_HEIGHT/2-1 );    
 
68
 
 
69
  glColor3f( 1., 1., 1. );
 
70
  glVertex2i( indent,       GLUI_SEPARATOR_HEIGHT/2 );    
 
71
  glVertex2i( width-indent, GLUI_SEPARATOR_HEIGHT/2 );    
 
72
  glEnd();
 
73
}
 
74
 
 
75