~ubuntu-branches/ubuntu/edgy/glui/edgy

« back to all changes in this revision

Viewing changes to glui_separator.cpp

  • Committer: Bazaar Package Importer
  • Author(s): Marcelo E. Magallon
  • Date: 2001-09-23 12:57:28 UTC
  • Revision ID: james.westby@ubuntu.com-20010923125728-qbts7xit2eg1ogo2
Tags: upstream-2.1.0.beta
ImportĀ upstreamĀ versionĀ 2.1.0.beta

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
  This program is freely distributable without licensing fees and is
 
14
  provided without guarantee or warrantee expressed or implied. This
 
15
  program is -not- in the public domain.
 
16
 
 
17
*****************************************************************************/
 
18
 
 
19
#include "glui.h"
 
20
#include "stdinc.h"
 
21
 
 
22
/****************************** GLUI_Separator::draw() **********/
 
23
 
 
24
void    GLUI_Separator::draw( int x, int y )
 
25
{
 
26
  int width, indent, orig;
 
27
  int           cont_x, cont_y, cont_w, cont_h, cont_x_off, cont_y_off;
 
28
 
 
29
  if ( NOT can_draw() )
 
30
    return;
 
31
 
 
32
  orig = set_to_glut_window();
 
33
 
 
34
  if ( parent() != NULL ) {
 
35
    get_this_column_dims(&cont_x, &cont_y, &cont_w, &cont_h, 
 
36
                         &cont_x_off, &cont_y_off);
 
37
 
 
38
    width = cont_w - cont_x_off*2;
 
39
  }
 
40
  else {
 
41
    width = this->w;
 
42
  }
 
43
 
 
44
  indent = width * .05;
 
45
 
 
46
  glLineWidth( 1.0 );
 
47
  glBegin( GL_LINES );
 
48
  glColor3f( .5, .5, .5 );
 
49
  glVertex2i( indent,       GLUI_SEPARATOR_HEIGHT/2-1 );    
 
50
  glVertex2i( width-indent, GLUI_SEPARATOR_HEIGHT/2-1 );    
 
51
 
 
52
  glColor3f( 1., 1., 1. );
 
53
  glVertex2i( indent,       GLUI_SEPARATOR_HEIGHT/2 );    
 
54
  glVertex2i( width-indent, GLUI_SEPARATOR_HEIGHT/2 );    
 
55
  glEnd();
 
56
 
 
57
  restore_window(orig);
 
58
}
 
59
 
 
60