ntk-chtheme: Add new color scheme. Save/restore selection color.
[ntk.git] / test / CubeView.h
blob1d2f89a9a498d12e5dc9917e1b84e8f609f211c3
1 //
2 // "$Id: CubeView.h 7913 2010-11-29 18:18:27Z greg.ercolano $"
3 //
4 // CubeView class definitions for the Fast Light Tool Kit (FLTK).
5 //
6 // Copyright 1998-2010 by Bill Spitzak and others.
7 //
8 // This library is free software; you can redistribute it and/or
9 // modify it under the terms of the GNU Library General Public
10 // License as published by the Free Software Foundation; either
11 // version 2 of the License, or (at your option) any later version.
13 // This library is distributed in the hope that it will be useful,
14 // but WITHOUT ANY WARRANTY; without even the implied warranty of
15 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
16 // Library General Public License for more details.
18 // You should have received a copy of the GNU Library General Public
19 // License along with this library; if not, write to the Free Software
20 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
21 // USA.
23 // Please report all bugs and problems on the following page:
25 // http://www.fltk.org/str.php
28 #ifndef CUBEVIEW_H
29 #define CUBEVIEW_H 1
30 #include <config.h>
31 #include <FL/Fl.H>
32 #if HAVE_GL
33 # include <FL/Fl_Gl_Window.H>
34 # include <FL/gl.h>
35 #else
36 # include <FL/Fl_Box.H>
37 #endif /* HAVE_GL */
39 #include <stdlib.h>
41 #if HAVE_GL
42 class CubeView : public Fl_Gl_Window {
43 #else
44 class CubeView : public Fl_Box {
45 #endif /* HAVE_GL */
47 public:
48 // this value determines the scaling factor used to draw the cube.
49 double size;
51 CubeView(int x,int y,int w,int h,const char *l=0);
53 /* Set the rotation about the vertical (y ) axis.
55 * This function is called by the horizontal roller in CubeViewUI and the
56 * initialize button in CubeViewUI.
58 void v_angle(float angle){vAng=angle;};
60 // Return the rotation about the vertical (y ) axis.
61 float v_angle(){return vAng;};
63 /* Set the rotation about the horizontal (x ) axis.
65 * This function is called by the vertical roller in CubeViewUI and the
66 * initialize button in CubeViewUI.
69 void h_angle(float angle){hAng=angle;};
71 // the rotation about the horizontal (x ) axis.
72 float h_angle(){return hAng;};
74 /* Sets the x shift of the cube view camera.
76 * This function is called by the slider in CubeViewUI and the
77 * initialize button in CubeViewUI.
79 void panx(float x){xshift=x;};
80 /* Sets the y shift of the cube view camera.
82 * This function is called by the slider in CubeViewUI and the
83 * initialize button in CubeViewUI.
85 void pany(float y){yshift=y;};
87 #if HAVE_GL
88 /*The widget class draw() override.
90 *The draw() function initialize Gl for another round o f drawing
91 * then calls specialized functions for drawing each of the
92 * entities displayed in the cube view.
95 void draw();
96 #endif /* HAVE_GL */
97 private:
99 /* Draw the cube boundaries
101 *Draw the faces of the cube using the boxv[] vertices, using
102 * GL_LINE_LOOP for the faces. The color is \#defined by CUBECOLOR.
104 #if HAVE_GL
105 void drawCube();
106 #else
107 void drawCube() { }
108 #endif /* HAVE_GL */
110 float vAng,hAng;
111 float xshift,yshift;
114 float boxv0[3];float boxv1[3];
115 float boxv2[3];float boxv3[3];
116 float boxv4[3];float boxv5[3];
117 float boxv6[3];float boxv7[3];
120 #endif
123 // End of "$Id: CubeView.h 7913 2010-11-29 18:18:27Z greg.ercolano $".