-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMPI_GUIRootWindow.h
94 lines (73 loc) · 2.51 KB
/
MPI_GUIRootWindow.h
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
//
// MPI_GUIRootWindow.h
//
// Description:
// This is the root application window. It deals with window manager issues,
// and contains the workspace.
// There is only one root window and one workspace for the application.
//
#ifndef __MPI_GUIROOTWINDOW_H__
#define __MPI_GUIROOTWINDOW_H__
#include "MPI_Point2D.h"
#include "MPI_Event.h"
#include <sys/time.h>
#include <unistd.h>
class MPI_Scheduler;
class MPI_Workspace;
class MPI_GUIRootWindow
{
private:
// FIXME these events should be in the workspace, since they should be
// callable even without the gui.
class EventNewPolyLine : public MPI_Event {
public:
virtual void execute( void );
EventNewPolyLine( MPI_Workspace* guiworkspace );
private:
MPI_Workspace* workspace_;
};
class EventAppendPolyLinePoint : public MPI_Event {
public:
EventAppendPolyLinePoint( MPI_Workspace* guiworkspace, MPI_Point2D const& point );
virtual void execute( void );
private:
MPI_Workspace* workspace_;
MPI_Point2D point_;
};
class EventEndPolyLine : public MPI_Event {
public:
EventEndPolyLine( MPI_Workspace* guiworkspace );
virtual void execute( void );
private:
MPI_Workspace* workspace_;
};
public:
MPI_GUIRootWindow( MPI_Workspace &workspace, MPI_Scheduler &scheduler );
void start( void );
// FIXME these methods are allowed to be const since they're not changing
// anything in the MPI_GUIRootWindow class, but they're changing the
// contents of the MPI_Scheduler instance. Does that make sense?
// Shouldn't it not allow modification of the scheduler?
// Maybe it's because it's calling static methods, and static methods
// aren't allowed to be const...
void displayCallback( void ) const;
void reshapeCallback( int w, int h );
void idleCallback( void ) const;
void mouseCallback( int button, int state, int x, int y ) const;
void motionCallback( int x, int y ) const;
private:
MPI_Point2D screenToWorldCoords( MPI_Point2D const& point ) const;
MPI_Point2D worldToScreenCoords( MPI_Point2D const& point ) const;
double getRealTime( void ) const;
void initialiseOpenGL( void ) const;
void initialiseGLUT( void ) const;
void registerCallbacks( void ) const;
void createWindow( void ) const;
MPI_Workspace &workspace_;
MPI_Scheduler &scheduler_;
int windowWidth;
int windowHeight;
float pixelsPerWorldUnit;
};
#endif
// vim:sw=4:et:cindent: