GlistEngine
Loading...
Searching...
No Matches
gGUIGraph.h
Go to the documentation of this file.
1/****************************************************************************
2 * Copyright (c) 2014 Nitra Games Ltd., Istanbul, Turkey *
3 * *
4 * Permission is hereby granted, free of charge, to any person obtaining a *
5 * copy of this software and associated documentation files (the *
6 * "Software"), to deal in the Software without restriction, including *
7 * without limitation the rights to use, copy, modify, merge, publish, *
8 * distribute, distribute with modifications, sublicense, and/or sell *
9 * 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 should not be *
13 * deleted from the source form of the Software. *
14 * *
15 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS *
16 * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF *
17 * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. *
18 * IN NO EVENT SHALL THE ABOVE COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, *
19 * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR *
20 * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR *
21 * THE USE OR OTHER DEALINGS IN THE SOFTWARE. *
22 * *
23 * Except as contained in this notice, the name(s) of the above copyright *
24 * holders shall not be used in advertising or otherwise to promote the *
25 * sale, use or other dealings in this Software without prior written *
26 * authorization. *
27 ****************************************************************************/
28
29/****************************************************************************
30 * Author: Noyan Culum, Utku Sarialan, 2022 *
31 ****************************************************************************/
32
33/*
34 * gGUIGraph.h
35 *
36 * Created on: Sep 23, 2022
37 * Author: noyan
38 */
39
40#ifndef UI_GGUIGRAPH_H_
41#define UI_GGUIGRAPH_H_
42
43#include "gGUIControl.h"
44
49class gGUIGraph: public gGUIControl {
50public:
52 virtual ~gGUIGraph();
53
54 virtual void set(gBaseApp* root, gBaseGUIObject* topParentGUIObject, gBaseGUIObject* parentGUIObject, int parentSlotLineNo, int parentSlotColumnNo, int x, int y, int w, int h);
55
56 virtual void setMaxX(int maxX);
57 int getMaxX();
58 virtual void setMinX(int minX);
59 int getMinX();
60 virtual void setMaxY(int maxY);
61 int getMaxY();
62 virtual void setMinY(int minY);
63 int getMinY();
64
67
68 void setTitleX(std::string titleX);
69 std::string getTitleX();
70 void setTitleY(std::string titleY);
71 std::string getTitleY();
72
73 virtual void setLabelCountX(int labelCount);
75 virtual void setLabelCountY(int labelCount);
77
78 virtual void enableRange(bool isRangeEnabled);
79 virtual void setRange(float rangeStart, float rangeEnd);
82
83 void draw();
84
85 virtual void clear();
86
87protected:
89 float axisxw, axisyh;
90 float maxy, miny, maxx, minx;
97
98private:
99 void drawBackground();
100 void drawLabels();
101 virtual void drawGraph();
102 void updateLabelsX();
103 void updateLabelsY();
104 int countDigits(int number);
105 float labelwidthx, labelwidthy;
106 std::string axisytitle, axisxtitle;
107 std::vector<int> labelsx;
108 std::vector<int> labelsy;
109 std::vector<float> floatlabelsx;
110 std::vector<float> floatlabelsy;
111 std::vector<int> labelsteps;
112};
113
114#endif /* UI_GGUIGRAPH_H_ */
Definition gBaseApp.h:16
Definition gBaseGUIObject.h:18
gBaseApp * root
Definition gBaseGUIObject.h:147
Definition gGUIControl.h:29
Definition gGUIGraph.h:49
void setTitleX(std::string titleX)
float axisxw
Definition gGUIGraph.h:89
virtual void setLabelCountY(int labelCount)
float largestvaluex
Definition gGUIGraph.h:91
int labelcounty
Definition gGUIGraph.h:94
int rangestart
Definition gGUIGraph.h:95
int getMaxY()
int getLabelCountY()
float axisystart
Definition gGUIGraph.h:88
virtual void setMinX(int minX)
virtual void setRange(float rangeStart, float rangeEnd)
float axisxstart
Definition gGUIGraph.h:88
float largestvaluey
Definition gGUIGraph.h:91
bool floatlabelsenabled
Definition gGUIGraph.h:93
float smallestvaluex
Definition gGUIGraph.h:91
float axisx2
Definition gGUIGraph.h:88
float axisx1
Definition gGUIGraph.h:88
virtual void set(gBaseApp *root, gBaseGUIObject *topParentGUIObject, gBaseGUIObject *parentGUIObject, int parentSlotLineNo, int parentSlotColumnNo, int x, int y, int w, int h)
int getRangeStart()
virtual void setMaxX(int maxX)
int labelcountx
Definition gGUIGraph.h:94
void enableGridlinesX(bool isEnabled)
virtual void setMaxY(int maxY)
int getRangeEnd()
float minx
Definition gGUIGraph.h:90
int getLabelCountX()
bool rangeenabled
Definition gGUIGraph.h:96
float smallestvaluey
Definition gGUIGraph.h:91
virtual void enableRange(bool isRangeEnabled)
int getMaxX()
virtual void setMinY(int minY)
float maxx
Definition gGUIGraph.h:90
int getMinY()
bool gridlinesxenabled
Definition gGUIGraph.h:92
float axisyh
Definition gGUIGraph.h:89
void draw()
std::string getTitleY()
float miny
Definition gGUIGraph.h:90
float maxy
Definition gGUIGraph.h:90
void setTitleY(std::string titleY)
virtual void clear()
bool gridlinesyenabled
Definition gGUIGraph.h:92
float axisy1
Definition gGUIGraph.h:88
int rangeend
Definition gGUIGraph.h:95
std::string getTitleX()
int getMinX()
virtual ~gGUIGraph()
virtual void setLabelCountX(int labelCount)
void enableGridlinesY(bool isEnabled)
float axisy2
Definition gGUIGraph.h:88