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, state;
|
---|
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 | state = glui->set_front_draw_buffer();
|
---|
34 |
|
---|
35 | if ( parent() != NULL ) {
|
---|
36 | get_this_column_dims(&cont_x, &cont_y, &cont_w, &cont_h,
|
---|
37 | &cont_x_off, &cont_y_off);
|
---|
38 |
|
---|
39 | width = cont_w - cont_x_off*2;
|
---|
40 | }
|
---|
41 | else {
|
---|
42 | width = this->w;
|
---|
43 | }
|
---|
44 |
|
---|
45 | indent = (int)(width * .05);
|
---|
46 |
|
---|
47 | glLineWidth( 1.0 );
|
---|
48 | glBegin( GL_LINES );
|
---|
49 | glColor3f( .5, .5, .5 );
|
---|
50 | glVertex2i( indent, GLUI_SEPARATOR_HEIGHT/2-1 );
|
---|
51 | glVertex2i( width-indent, GLUI_SEPARATOR_HEIGHT/2-1 );
|
---|
52 |
|
---|
53 | glColor3f( 1., 1., 1. );
|
---|
54 | glVertex2i( indent, GLUI_SEPARATOR_HEIGHT/2 );
|
---|
55 | glVertex2i( width-indent, GLUI_SEPARATOR_HEIGHT/2 );
|
---|
56 | glEnd();
|
---|
57 |
|
---|
58 | glui->restore_draw_buffer(state);
|
---|
59 | restore_window(orig);
|
---|
60 | }
|
---|
61 |
|
---|
62 |
|
---|