21 #ifndef __ANTARES_TOOLBOX_COMPONENT_DATAGRID_RENDERER_H__
22 #define __ANTARES_TOOLBOX_COMPONENT_DATAGRID_RENDERER_H__
24 #include <yuni/core/event.h>
25 #include <antares/date/date.h>
26 #include <wx/colour.h>
28 #include <antares/study/study.h>
32 #pragma warning(disable : 4250)
35 namespace Antares::Component::Datagrid
49 class IRenderer:
public Yuni::IEventObserver<IRenderer>
56 cellStyleDefaultAlternate,
57 cellStyleDefaultDisabled,
58 cellStyleDefaultAlternateDisabled,
59 cellStyleDefaultCenter,
60 cellStyleDefaultCenterAlternate,
61 cellStyleDefaultCenterDisabled,
62 cellStyleDefaultCenterAlternateDisabled,
69 cellStyleConstraintEnabled,
70 cellStyleConstraintDisabled,
71 cellStyleConstraintNoWeight,
72 cellStyleConstraintWeight,
73 cellStyleConstraintWeightCount,
74 cellStyleConstraintOperator,
75 cellStyleConstraintType,
76 cellStyleLayerDisabled,
77 cellStyleFilterYearByYearOn,
78 cellStyleFilterYearByYearOff,
79 cellStyleFilterSynthesisOn,
80 cellStyleFilterSynthesisOff,
81 cellStyleFilterUndefined,
82 cellStyleAdqPatchVirtual,
83 cellStyleAdqPatchOutside,
84 cellStyleAdqPatchInside,
89 static const wxChar* CellStyleToCSSClass(CellStyle s);
90 static void CellStyleToCSSClass(CellStyle s, Yuni::String& str);
105 virtual bool valid()
const = 0;
152 virtual wxString
asString(
int x,
int y)
const;
156 virtual double asDouble(
int x,
int y)
const;
163 void appendCellValue(
int x,
int y, Yuni::String& s)
const;
174 virtual bool cellValue(
int x,
int y,
const Yuni::String& value) = 0;
179 virtual void resetColors(
int x,
int y, wxColour& background, wxColour& textForeground)
const
184 virtual IRenderer::CellStyle cellStyle(
int,
int y)
const;
185 IRenderer::CellStyle cellStyleWithNumericCheck(
int x,
int y)
const;
187 virtual wxColour cellBackgroundColor(
int,
int)
const;
188 virtual wxColour cellTextColor(
int,
int)
const;
245 virtual bool onMatrixResize(uint oldX, uint oldY, uint& newX, uint& newY);
278 virtual void applyLayerFiltering(
size_t layerID,
VGridHelper* gridHelper);
303 #include "renderer.hxx"
Data provider for Datagrids.
Definition: renderer.h:50
virtual bool circularShiftRowsUntilDate(MonthName month, uint daymonth)
Rotate all rows until a given date.
Definition: renderer.hxx:119
virtual ~IRenderer()
Destructor.
Definition: renderer.cpp:169
virtual bool ensureDataAreLoaded()
Make sure all data are effectively loaded.
Definition: renderer.hxx:37
Data::Study::Ptr study
Attached study (if any)
Definition: renderer.h:287
virtual double asDouble(int x, int y) const
Read a cell as a double.
Definition: renderer.hxx:109
virtual int internalHeight() const
The real height of the matrix in memory.
Definition: renderer.hxx:32
virtual double cellNumericValue(int x, int y) const =0
Get the floating value of a Cell.
virtual wxColour verticalBorderColor(int x, int y) const
Get the color of the vertical right border.
Definition: renderer.hxx:69
virtual bool cellValue(int x, int y, const Yuni::String &value)=0
Try to modify a cell value.
virtual void onMatrixLoad()
Event triggered right after a matrix was loaded by the renderer.
Definition: renderer.h:250
virtual wxString cellValue(int x, int y) const =0
Get the string representation of a Cell.
virtual uint maxWidthResize() const
The most suitable column count.
Definition: renderer.hxx:79
virtual void resizeMatrixToXColumns(uint)
Resize the internal matrix with a given col count.
Definition: renderer.h:232
virtual wxString asString(int x, int y) const
Read a cell as a string.
Definition: renderer.hxx:104
virtual void hintForColumnWidth(int x, wxString &out) const
String to use.
Definition: renderer.hxx:99
virtual wxString rowCaption(int rowIndx) const =0
Get the caption of a row.
virtual int internalWidth() const
The real width of the matrix in memory.
Definition: renderer.hxx:27
Yuni::Event< void()> onRefresh
Event on refresh.
Definition: renderer.h:282
virtual bool onMatrixResize(uint oldX, uint oldY, uint &newX, uint &newY)
Event trigerred before resizing a matrix.
Definition: renderer.hxx:64
virtual int width() const =0
The effective width of the grid.
virtual void onStudyClosed()
Event: the study has been closed.
Definition: renderer.cpp:180
virtual int cellAlignment(int x, int y) const
Get the alignment of a cell (-1: left, 0: center, +1: right)
Definition: renderer.hxx:89
virtual void onScroll()
A scroll event has been triggered.
Definition: renderer.h:272
virtual Date::Precision precision()
Time Precision.
Definition: renderer.hxx:114
virtual int height() const =0
The effective height of the grid.
virtual wxString columnCaption(int colIndx) const =0
Get the caption of a column.
virtual wxColour horizontalBorderColor(int x, int y) const
Get the color of the horizontal bottom border.
Definition: renderer.hxx:74
virtual void onStudyLoaded()
Event: the study has been loaded.
Definition: renderer.cpp:175
virtual void onSelectCell(uint, uint)
A cell has been selected.
Definition: renderer.h:267
bool invalidate
True to invalidate the current data and force a refresh for the next call to DBGrid:onDraw.
Definition: renderer.h:290
IRenderer()
Default constructor.
Definition: renderer.cpp:160
Date::Precision dataGridPrecision
The real precision asked by the datagrid.
Definition: renderer.h:285
virtual uint maxHeightResize() const
The most suitable column count.
Definition: renderer.hxx:84
virtual int columnWidthCustom(int x) const
Get how the a column must resize (0: auto, >0: specific width, <0: use custom string)
Definition: renderer.hxx:94
Wrapper between a wxGridTableBase and a renderer
Definition: gridhelper.h:42