// 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. #ifndef BBOPTION_H #define BBOPTION_H #include #ifndef DISPLAYWIDTH #define DISPLAYWIDTH 160 #endif ////////////////////////////////////////////////////////////////////////////////////////// /// BBOption class BBOption: public Field { public: typedef enum { eUnselected, eSelected, eDisabled, eRequired } EState; public: BBOption(const char* label, EState state=eUnselected) : RowHeight(LcdGetFontHeight(0)), Label(label), State(state){ Prev = this; Next = this; } virtual ~BBOption(void) {} public: //---Forced overrides virtual FIELDTYPE GetFieldType( FIELDTYPE * pDerived = NULL ) { return (FIELDTYPE)103; } virtual void ResetDimensionDependentData() { RowHeight = LcdGetFontHeight(0); } virtual int QueryLineHeight(int const MaximumRelevant) { return RowHeight; } public: virtual int GetHeight() const { return RowHeight; } virtual int GetHeight(int width) const { return RowHeight; } virtual int GetHeightMax() const { return RowHeight; } virtual int GetHeightMin() const { return RowHeight; } virtual int GetWidth() const { return DISPLAYWIDTH; } virtual int GetWidth(int height) const { return DISPLAYWIDTH; } virtual int GetWidthMax() const { return DISPLAYWIDTH; } virtual int GetWidthMin() const { return DISPLAYWIDTH; } virtual void Paint(Graphics& g); // virtual void Redraw(void) { Field::Redraw(); } virtual int OnScroll(int axis, int directionMagnitude) { return directionMagnitude; } virtual bool OnKey(int event, char character, int flags); virtual XYRect GetFocusRect(void) const { return XYRect(0,0,DISPLAYWIDTH,RowHeight); } public: EState GetValue(void) { return State; } void SetValue(EState state); void AddPeer(BBOption& peer); void SetChars(EState state, char symbol); private: static unsigned char Symbols[eRequired+1]; int RowHeight; const char *Label; EState State; // bool Selected; BBOption *Prev, *Next; // char Enabled, Disabled; }; #endif