2
* Copyright 2010 Inalogic Inc.
4
* This program is free software: you can redistribute it and/or modify it
5
* under the terms of the GNU Lesser General Public License version 3, as
6
* published by the Free Software Foundation.
8
* This program is distributed in the hope that it will be useful, but
9
* WITHOUT ANY WARRANTY; without even the implied warranties of
10
* MERCHANTABILITY, SATISFACTORY QUALITY or FITNESS FOR A PARTICULAR
11
* PURPOSE. See the applicable version of the GNU Lesser General Public
12
* License for more details.
14
* You should have received a copy of both the GNU Lesser General Public
15
* License version 3 along with this program. If not, see
16
* <http://www.gnu.org/licenses/>
18
* Authored by: Jay Taoko <jay.taoko_AT_gmail_DOT_com>
26
#include "NuxGraphics/GpuDevice.h"
27
#include "NuxGraphics/GLDeviceObjects.h"
28
#include "NuxGraphics/GLSh_DrawFunction.h"
29
#include "TimerProc.h"
34
typedef float (*FunctionCallback) (float);
42
class TimeGraph : public View
45
TimeGraph (const TCHAR *Title, NUX_FILE_LINE_PROTO);
47
virtual long ProcessEvent (IEvent &ievent, long TraverseInfo, long ProcessEventInfo);
48
virtual void Draw (GraphicsEngine &GfxContext, bool force_draw);
49
virtual void DrawContent (GraphicsEngine &GfxContext, bool force_draw);
50
virtual void PostDraw (GraphicsEngine &GfxContext, bool force_draw);
52
void AddValue (float Value);
53
void SetYAxisBounds (float minY, float maxY);
54
unsigned int AddGraph (Color PrimaryColor, Color SecondaryColor);
55
void UpdateGraph (unsigned int index, float Value);
57
void RecvShowBarGraphics (int x, int y, unsigned long button_flags, unsigned long key_flags);
58
void RecvShowCurveGraphics (int x, int y, unsigned long button_flags, unsigned long key_flags);
59
void RecvShowValue (int x, int y, unsigned long button_flags, unsigned long key_flags);
60
void ShowGraphStyle();
61
void ShowColumnStyle();
62
void ShowNumberStyle();
64
void InitializeWidgets();
65
void InitializeLayout();
69
static unsigned int sBufferSize;
74
StaticTextBox *m_GraphTitle;
75
CoreArea *m_GraphArea;
76
CoreArea *m_GraphIcon;
77
CoreArea *m_GraphBarIcon;
78
CoreArea *m_ValueIcon;
96
Graph (Color PrimaryColor, Color SecondaryColor);
97
Graph (const Graph &graph);
98
Graph &operator = (const Graph &graph);
100
void Update (float Value);
103
std::list<float> m_ValueList;
104
// ! Set to true if the graph has been updated during the graphic refresh period.
105
bool m_HasBeenUpdated;
106
Color m_PrimaryColor;
107
Color m_SecondaryColor;
110
unsigned int m_Option;
112
std::vector<Graph> m_DynValueArray;
113
unsigned int m_DynValueCount;
114
bool m_DynValueReceived;
116
void GraphTimerInterrupt (void *v);
117
TimerFunctor *m_ScrollTimerFunctor;
118
TimerHandle m_ScrollTimerHandler;
120
float m_minY, m_maxY;
121
FunctionCallback m_FunctionCallback;
123
IntrusiveSP<IOpenGLBaseTexture> Texture;
124
TextureLayer *m_BackgroundLayer;
125
GLSh_DrawFunction *m_DrawFunctionShader;
131
#endif // TIMEGRAPH_H