// 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 "BBOption.h" ///-------------------------------------------------------------------------------------- /// unsigned char BBOption::Symbols[] = {(char)0x81, (char)0x8D, (char)0x1C, (char)0x06}; void BBOption::Paint(Graphics& g) { char temps[2]; temps[1] = 0; temps[0] = Symbols[State]; g.DrawString(2, 0, temps, 1, GetFont(), 0); g.DrawString(11, 0, Label, strlen(Label), GetFont(), 0); } void BBOption::SetChars(EState state, char symbol) { Symbols[state] = symbol; // BBOption *p; // for ( p = Next; p != this; p = p->Next ) // p->Redraw(); FieldManager *fm = GetManager(); if ( fm != NULL ) fm->Invalidate(); } void BBOption::AddPeer(BBOption& peer) {// BBOption *p; peer.Next = this; peer.Prev = this->Prev; this->Prev->Next = &peer; this->Prev = &peer; peer.SetValue(eUnselected); } void BBOption::SetValue(EState state) { if ( state <= eSelected && (Prev != NULL || Next != NULL) ) { BBOption *p; for ( p = Next; p != this; p = p->Next ) { p->State = eUnselected; // p->Redraw(); } } State = state; // Redraw(); FieldManager *fm = GetManager(); if ( fm != NULL ) fm->Invalidate(); } bool BBOption::OnKey(int event, char character, int flags) { if ( State == eUnselected ) SetValue(eSelected); else if ( State == eSelected ) SetValue(eUnselected); return true; }