-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathViewModeGroup.cpp
68 lines (59 loc) · 1.76 KB
/
ViewModeGroup.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
/*
* ViewModeGroup.cpp
* Created by Zachary Ferguson
* Source file for the ViewModeGroup class, a child class of the Fl_Group class
* for getting the viewing mode.
*/
#include "ViewModeGroup.h"
/* Constructor for creating a new CreateMesh_Widget. */
/* Requires the x,y coordinates of the new CreateMesh_Widget. */
ViewModeGroup::ViewModeGroup(int x, int y) : Fl_Group(x, y, 110, 115,
"Viewing Modes")
{
/* Group for how to draw the mesh. */
this->box(FL_ENGRAVED_FRAME);
this->align(Fl_Align(FL_ALIGN_TOP|FL_ALIGN_INSIDE));
/* Display wire frame button. */
this->wireframeB = new Fl_Round_Button(x+10, y+20, 89, 24, "Wireframe");
this->wireframeB->type(102);
this->wireframeB->down_box(FL_ROUND_DOWN_BOX);
/* Display solid button. */
this->solidB = new Fl_Round_Button(x+10, y+50, 89, 24, "Solid");
this->solidB->type(102);
this->solidB->down_box(FL_ROUND_DOWN_BOX);
/* Display both button. */
this->bothB = new Fl_Round_Button(x+10, y+80, 89, 24, "Both");
this->bothB->value(1);
this->bothB->type(102);
this->bothB->down_box(FL_ROUND_DOWN_BOX);
this->end();
}
/* Destructor for this CreateMesh_Widget. */
ViewModeGroup::~ViewModeGroup()
{
/* Delete the child buttons. */
delete this->wireframeB;
delete this->solidB;
delete this->bothB;
}
/* Sets the callback function to cb with an argument of p. */
void ViewModeGroup::callback(Fl_Callback* cb, void *p)
{
/* Set the callbacks of the children. */
this->wireframeB->callback(cb, p);
this->solidB->callback(cb, p);
this->bothB->callback(cb, p);
}
/* Get the viewing mode. Returns a ViewingMode enum value. */
ViewingMode ViewModeGroup::getViewMode()
{
if(this->wireframeB->value())
{
return WIREFRAME;
}
else if(this->solidB->value())
{
return SOLID;
}
return BOTH;
}