// Copyright (c) Sean Walton 1999-2006 All rights reserved // // Standard disclaimer: you use it --> you're responsible // Standard license: you can use it in any way, but keep // my copyright attached. #include "Pager.h" #include "Ui32.h" #include "Ribbon.h" #define AEP_DATA 240 #define MAXROWS 10 #define MAXCOLS 6 #define MAXCHARS 6 #define CELLWIDTH 26 #define CELLHEIGHT (LcdGetFontHeight(0)) class Grid: public Field { public: typedef enum { eNone, eRow, eColumn, eCell } ESelectBy; public: Grid(unsigned char nrows, unsigned char ncols, unsigned char width=CELLWIDTH); virtual ~Grid(void) {} public: //---Forced overrides virtual FIELDTYPE GetFieldType( FIELDTYPE * pDerived = NULL ) { return (FIELDTYPE)100; } virtual void ResetDimensionDependentData() {} virtual int QueryLineHeight(int const MaximumRelevant) { return CELLHEIGHT; } public: virtual int GetHeight() const { return rows*CELLHEIGHT; } virtual int GetHeight(int width) const { return rows*CELLHEIGHT; } virtual int GetHeightMax() const { return rows*CELLHEIGHT; } virtual int GetHeightMin() const { return rows*CELLHEIGHT; } virtual int GetWidth() const { return 160; } virtual int GetWidth(int height) const { return 160; } virtual int GetWidthMax() const { return 160; } virtual int GetWidthMin() const { return 160; } virtual void Paint(Graphics& g); // virtual bool OnKey(int event, char character, int flags); virtual int OnScroll(int axis, int directionMagnitude); virtual XYRect GetFocusRect(void) const; public: // void Clear(void); // void SetCell(int row, int col, char *str); void SetNumColumns(int cols) const { columns = cols; Redraw(); } int GetNumColumns(void) const { return columns; } int GetNumRows(void) const { return rows; } void SetColumnWidth(unsigned char Width); void SetSelectBy(ESelectBy select) { selectBy = select; } ESelectBy GetSelectBy(void) { return selectBy; } private: // char tab[MAXROWS][MAXCOLS][MAXCHARS]; unsigned char rows, columns; unsigned char cellwidth[MAXCOLS]; signed char selected; unsigned short Width; ESelectBy selectBy; };