-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathBaseWidget.cpp
122 lines (108 loc) · 3.22 KB
/
BaseWidget.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
//------------------------------------------------------------------------
// BaseWidget.cpp
// Joe Kniss
// base class for direct manipulation widgets
// 2-27-01
// ________ ____ ___
// | \ / | / /
// +---+ \/ |/ /
// +--+| |\ /| <
// | || | \ / | |\ \
// | | \/ | | \ \
// \_____| |__| \__\
// Copyright 2001
// Joe Michael Kniss
//-------------------------------------------------------------------------
#include "BaseWidget.h"
//
//=======================================================================
//------ Widget Standard constructior -----------------------------------
//=======================================================================
//
Widget::Widget()
{
//name = 0;
busy = false;
}
//=======================================================================
//------ Initialize the basics ------------------------------------------
void Widget::widgetInit()
{
barRad = (float).015;
barSlice = 10;
barStack = 2;
ballRad = (float)(barRad * 1.50);
ballSlice = 10;
coneRad = barRad;
qobj = gluNewQuadric();
gluQuadricDrawStyle(qobj, GLU_FILL);
gluQuadricNormals(qobj, GLU_SMOOTH);
}
//=======================================================================
//------ Free the basics ------------------------------------------------
void Widget::widgetFree()
{
gluDeleteQuadric(qobj);
}
//=======================================================================
//------ Default draw func ----------------------------------------------
void Widget::draw()
{
/*I don't do anything, yet*/
}
//=======================================================================
//----- callbacks should return 0 when the object wants to be released---
//-----------------------------------------------------------------------
int Widget::pickcb(int data1,
int data2,
float x, float y, float z)
{
return 0;
}
//-----------------------------------------------------------------------
int Widget::movecb(float x, float y, float z)
{
return 1;
}
//-----------------------------------------------------------------------
int Widget::keycb(char key)
{
return 1;
}
//-----------------------------------------------------------------------
int Widget::Xkeycb(unsigned int ks)
{
return 1;
}
//-----------------------------------------------------------------------
int Widget::mousecb(WdgMouseButton button,
WdgMouseState state,
float x, float y, float z)
{
return 1;
}
//-----------------------------------------------------------------------
void Widget::resize(int x, int y)
{
winWidth = x;
winHeight = y;
}
//-----------------------------------------------------------------------
int Widget::releasecb()
{
return 0;
}
//-----------------------------------------------------------------------
void Widget::transparent()
{
gluQuadricDrawStyle(qobj, GLU_SILHOUETTE);
ballSlice = 5;
barSlice = 3;
}
//-----------------------------------------------------------------------
void Widget::fill()
{
gluQuadricDrawStyle(qobj, GLU_FILL);
ballSlice = 10;
barSlice = 10;
}