guiGraphCtrl.h

Engine/source/gui/editor/guiGraphCtrl.h

More...

Classes:

Public Typedefs

Public Functions

Detailed Description

Public Typedefs

typedef GuiGraphCtrl::GraphType GuiGraphType 

Public Functions

DefineEnumType(GuiGraphType )

 1
 2//-----------------------------------------------------------------------------
 3// Copyright (c) 2012 GarageGames, LLC
 4//
 5// Permission is hereby granted, free of charge, to any person obtaining a copy
 6// of this software and associated documentation files (the "Software"), to
 7// deal in the Software without restriction, including without limitation the
 8// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
 9// sell copies of the Software, and to permit persons to whom the Software is
10// furnished to do so, subject to the following conditions:
11//
12// The above copyright notice and this permission notice shall be included in
13// all copies or substantial portions of the Software.
14//
15// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
20// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
21// IN THE SOFTWARE.
22//-----------------------------------------------------------------------------
23
24#ifndef _GUIGRAPHCTRL_H_
25#define _GUIGRAPHCTRL_H_
26
27#ifndef _GUICONTROL_H_
28#include "gui/core/guiControl.h"
29#endif
30
31class GuiGraphCtrl : public GuiControl
32{
33   public:
34   
35      typedef GuiControl Parent;
36
37      enum Constants
38      {
39         MaxPlots = 6,
40         MaxDataPoints = 200
41      };
42
43      enum GraphType {
44         Point,
45         Polyline,
46         Filled,
47         Bar
48      };
49
50   protected:
51   
52      F32 mCenterY;
53      StringTableEntry mAutoPlot[ MaxPlots ];
54      U32 mAutoPlotDelay[ MaxPlots ];
55      SimTime mAutoPlotLastDisplay[ MaxPlots ];
56      LinearColorF mGraphColor[ MaxPlots ];
57      Vector< F32> mGraphData[ MaxPlots ];
58      F32 mGraphMax[ MaxPlots ];
59      GraphType mGraphType[ MaxPlots ];
60
61      GFXStateBlockRef  mSolidSB;
62      GFXStateBlockRef  mBlendSB;
63      
64   public:
65      
66      GuiGraphCtrl();
67
68      void addDatum( S32 plotID, F32 v );
69      F32  getDatum( S32 plotID, S32 samples );
70      void addAutoPlot( S32 plotID, const char *variable, S32 update );
71      void removeAutoPlot( S32 plotID);
72      void setGraphType( S32 plotID, GraphType graphType );
73      F32 getMax( S32 plotID ) const { return mGraphMax[ plotID ]; }
74      void setMax( S32 plotID, F32 max ) { mGraphMax[ plotID ] = max; }
75
76      // GuiControl.
77      virtual void onRender(Point2I offset, const RectI &updateRect);
78
79      DECLARE_CONOBJECT(GuiGraphCtrl);
80      DECLARE_CATEGORY( "Gui Other" );
81      DECLARE_DESCRIPTION( "A control that allows to plot curve graphs." );
82      
83      static void initPersistFields();
84};
85
86typedef GuiGraphCtrl::GraphType GuiGraphType;
87DefineEnumType( GuiGraphType );
88
89#endif
90