Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023 #ifndef _INTINWIDGET_H
00024 #define _INTINWIDGET_H
00025
00026 #ifdef HAVE_CONFIG_H
00027 # include "config.h"
00028 #endif
00029
00030 #ifdef HAVE_NCURSES_H
00031 # include <ncurses.h>
00032 #else // HAVE_NCURSES_H
00033 # ifdef HAVE_CURSES_H
00034 # include <curses.h>
00035 # else
00036 # error "Neither curses.h nor ncurses.h available"
00037 # endif // HAVE_CURSES_H
00038 #endif // HAVE_NCURSES_H
00039 #include "curswa.h"
00040
00041 #ifdef HAVE_CMATH
00042 # include <cmath>
00043 #endif
00044
00045 #include "inputwidget.h"
00046
00047 namespace YAPET {
00048 namespace UI {
00049
00050 template<class t> int getDigitsForType() {
00051 return static_cast<int>(std::floor ( std::log10 (std::pow (2, (double) sizeof (t) *8 ) ) ) + 1);
00052 }
00053
00060 class IntInWidget : public InputWidget {
00061 private:
00062 inline const IntInWidget& operator= (const IntInWidget&) {
00063 return *this;
00064 }
00065
00066 protected:
00067 virtual void processInput (int ch) throw (UIException);
00068
00069 public:
00070 IntInWidget (int sx, int sy, int w, int ml = getDigitsForType<unsigned long>(), bool ro = false ) throw (UIException);
00071 inline IntInWidget (int sx, int sy, int w, bool ro ) throw (UIException) :
00072 InputWidget (sx, sy, w, getDigitsForType<unsigned long>() , ro) {}
00073 virtual ~IntInWidget();
00074 unsigned long getInt() const;
00075 void setInt(unsigned long i);
00076 };
00077
00078 }
00079 }
00080 #endif // _INTINWIDGET_