edelib 2.0.0

edelib/SevenSeg.h

00001 /*
00002  * $Id: SevenSeg.h 2839 2009-09-28 11:36:20Z karijes $
00003  *
00004  * s7 segment number widget
00005  * Copyright (c) 2005-2007 edelib authors
00006  *
00007  * This library is free software; you can redistribute it and/or
00008  * modify it under the terms of the GNU Lesser General Public
00009  * License as published by the Free Software Foundation; either
00010  * version 2 of the License, or (at your option) any later version.
00011  *
00012  * This library is distributed in the hope that it will be useful,
00013  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00014  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
00015  * Lesser General Public License for more details.
00016  *
00017  * You should have received a copy of the GNU Lesser General Public License
00018  * along with this library. If not, see <http://www.gnu.org/licenses/>.
00019  */
00020 
00021 #ifndef __EDELIB_SEVENSEG_H__
00022 #define __EDELIB_SEVENSEG_H__
00023 
00024 #include "edelib-global.h"
00025 #include <FL/Fl_Widget.H>
00026 
00027 EDELIB_NS_BEGIN
00028 
00042 class EDELIB_API SevenSeg : public Fl_Widget {
00043 private:
00044         int digit;
00045         int segwidth;
00046 
00047         void draw_seg_a(int X, int Y, int W, int H);
00048         void draw_seg_b(int X, int Y, int W, int H);
00049         void draw_seg_c(int X, int Y, int W, int H);
00050         void draw_seg_d(int X, int Y, int W, int H);
00051         void draw_seg_e(int X, int Y, int W, int H);
00052         void draw_seg_f(int X, int Y, int W, int H);
00053         void draw_seg_g(int X, int Y, int W, int H);
00054 
00055 public:
00059         SevenSeg(int X, int Y, int W, int H);
00060 
00064         ~SevenSeg();
00065 #ifndef SKIP_DOCS
00066         virtual void draw(void);
00067 #endif
00068 
00071         void value(int v);
00072 
00076         void value(char c);
00077 
00081         int  value(void) { return digit; }
00082 
00087         void bar_width(int w);
00088 
00092         int  bar_width(void) { return segwidth; }
00093 };
00094 
00095 EDELIB_NS_END
00096 #endif