/****************************************************************************
 * This file is part of the project AqDiagram.
 * AqDiagram (c) by 2023 Martin Preuss, all rights reserved.
 *
 * The license for this file can be found in the file COPYING which you
 * should have received along with this file.
 ****************************************************************************/

#ifndef AQDG_GRAPH_W_GRAPH_H
#define AQDG_GRAPH_W_GRAPH_H

#include <aqdiagram/placement/object.h>
#include <aqdiagram/graph/graph.h>



/* see https://www.rapidtables.com/web/color/RGB_Color.html */
#define AQDG_GRAPHWIDGET_COL_BLACK      ((uint32_t) 0x00000000)
#define AQDG_GRAPHWIDGET_COL_WHITE      ((uint32_t) 0xFFFFFF00)
#define AQDG_GRAPHWIDGET_COL_RED        ((uint32_t) 0xFF000000)
#define AQDG_GRAPHWIDGET_COL_LIME       ((uint32_t) 0x00FF0000)
#define AQDG_GRAPHWIDGET_COL_BLUE       ((uint32_t) 0x0000FF00)
#define AQDG_GRAPHWIDGET_COL_YELLOW     ((uint32_t) 0xFFFF0000)
#define AQDG_GRAPHWIDGET_COL_CYAN       ((uint32_t) 0x00FFFF00)
#define AQDG_GRAPHWIDGET_COL_MAGENTA    ((uint32_t) 0xFF00FF00)
#define AQDG_GRAPHWIDGET_COL_SILVER     ((uint32_t) 0xC0C0C000)
#define AQDG_GRAPHWIDGET_COL_GRAY       ((uint32_t) 0x80808000)
#define AQDG_GRAPHWIDGET_COL_MAROON     ((uint32_t) 0x80000000)
#define AQDG_GRAPHWIDGET_COL_OLIVE      ((uint32_t) 0x80800000)
#define AQDG_GRAPHWIDGET_COL_GREEN      ((uint32_t) 0x00800000)
#define AQDG_GRAPHWIDGET_COL_PURPLE     ((uint32_t) 0x80008000)
#define AQDG_GRAPHWIDGET_COL_TEAL       ((uint32_t) 0x00808000)
#define AQDG_GRAPHWIDGET_COL_NAVY       ((uint32_t) 0x00008000)

#define AQDG_GRAPHWIDGET_COL_ORANGE     ((uint32_t) 0xFFA50000)
#define AQDG_GRAPHWIDGET_COL_GOLD       ((uint32_t) 0xFFD70000)
#define AQDG_GRAPHWIDGET_COL_TURQUOISE  ((uint32_t) 0x40E0D000)
#define AQDG_GRAPHWIDGET_COL_SKYBLUE    ((uint32_t) 0x87CEEB00)
#define AQDG_GRAPHWIDGET_COL_DEEPPINK   ((uint32_t) 0xFF149300)
#define AQDG_GRAPHWIDGET_COL_COMSILK    ((uint32_t) 0xFFF8DC00)
#define AQDG_GRAPHWIDGET_COL_GAINSBORO  ((uint32_t) 0xDCDCDC00)
#define AQDG_GRAPHWIDGET_COL_WHITESMOKE ((uint32_t) 0xF5F5F500)


enum {
  AQDG_GRAPHWIDGET_PEN_IDX_TITLE=0,
  AQDG_GRAPHWIDGET_PEN_IDX_SUBTITLE,
  AQDG_GRAPHWIDGET_PEN_IDX_AXISLINE,
  AQDG_GRAPHWIDGET_PEN_IDX_AXISLABEL,
  AQDG_GRAPHWIDGET_PEN_IDX_TICKLABELMAINLEVEL,
  AQDG_GRAPHWIDGET_PEN_IDX_TICKLABELSUBLEVEL,
  AQDG_GRAPHWIDGET_PEN_IDX_TICKMAINLEVEL,
  AQDG_GRAPHWIDGET_PEN_IDX_TICKSUBLEVEL,
  AQDG_GRAPHWIDGET_PEN_IDX_GRAPHBACKGROUND,
  AQDG_GRAPHWIDGET_PEN_IDX_GRID1,
  AQDG_GRAPHWIDGET_PEN_IDX_GRID2,
  AQDG_GRAPHWIDGET_PEN_IDX_BACKGROUND,
  AQDG_GRAPHWIDGET_PEN_IDX_CURVE0,
  AQDG_GRAPHWIDGET_PEN_IDX_CURVE1,
  AQDG_GRAPHWIDGET_PEN_IDX_CURVE2,
  AQDG_GRAPHWIDGET_PEN_IDX_CURVE3,
  AQDG_GRAPHWIDGET_PEN_IDX_CURVE4,
  AQDG_GRAPHWIDGET_PEN_IDX_CURVE5,
  AQDG_GRAPHWIDGET_PEN_IDX_CURVE6,
  AQDG_GRAPHWIDGET_PEN_IDX_CURVE7,

  AQDG_GRAPHWIDGET_PEN_IDX_LAST
};



enum {
  AQDG_GRAPHWIDGET_FONT_IDX_TITLE=0,
  AQDG_GRAPHWIDGET_FONT_IDX_SUBTITLE,
  AQDG_GRAPHWIDGET_FONT_IDX_AXISLABEL,
  AQDG_GRAPHWIDGET_FONT_IDX_TICKLABELMAINLEVEL,
  AQDG_GRAPHWIDGET_FONT_IDX_TICKLABELSUBLEVEL,
  AQDG_GRAPHWIDGET_FONT_IDX_LEGEND,

  AQDG_GRAPHWIDGET_FONT_IDX_LAST
};



#ifdef __cplusplus
extern "C" {
#endif



AQDG_API AQDG_OBJECT *AQDG_GraphWidget_new(AQDG_OBJECT *parent, uint32_t options, AQDG_DRAW_CONTEXT *drawContext);
AQDG_API void AQDG_GraphWidget_FinishWithGraph(AQDG_OBJECT *o, AQDG_GRAPH *graph);


AQDG_API void AQDG_GraphWidget_SetupForGraph(AQDG_OBJECT *o, AQDG_GRAPH *graph);


AQDG_API AQDG_GRAPH *AQDG_GraphWidget_GetGraph(const AQDG_OBJECT *o);


AQDG_API int AQDG_GraphWidget_GetPen(const AQDG_OBJECT *o, int idx);
AQDG_API void AQDG_GraphWidget_SetPen(AQDG_OBJECT *o, int idx, int penId);

AQDG_API int AQDG_GraphWidget_GetFont(const AQDG_OBJECT *o, int idx);
AQDG_API void AQDG_GraphWidget_SetFont(AQDG_OBJECT *o, int idx, int fontId);

AQDG_API int AQDG_GraphWidget_CreatePenFromDb(AQDG_OBJECT *o, GWEN_DB_NODE *db, const char *name, uint32_t defColor, int defWidth, int defDash);
AQDG_API int AQDG_GraphWidget_CreateFontFromDb(AQDG_OBJECT *o, GWEN_DB_NODE *db, const char *name, int defaultFontSize);
AQDG_API uint32_t AQDG_GraphWidget_GetStandardCurveColor(int idx, uint32_t defCol);

AQDG_API void AQDG_GraphWidget_SetupDefaultPens(AQDG_OBJECT *o);
AQDG_API void AQDG_GraphWidget_SetupDefaultFonts(AQDG_OBJECT *o);


AQDG_API AQDG_OBJECT *AQDG_GraphWidget_GenerateTimeGraph(const char *sTitle,
                                                         const char *sSubTitle,
                                                         int width,
                                                         int height,
                                                         const char *sYLabel,
                                                         const char *sYUnits,
                                                         int yPrecision);
AQDG_API void AQDG_GraphWidget_AddCurve(AQDG_OBJECT *o);



#ifdef __cplusplus
}
#endif


#endif

