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 #ifdef HAVE_CONFIG_H
00022 # include "config.h"
00023 #endif
00024
00025 #include "../intl.h"
00026 #include "intinwidget.h"
00027
00028 #ifdef HAVE_CTYPE_H
00029 # include <ctype.h>
00030 #endif
00031
00032 #ifdef HAVE_STDLIB_H
00033 # include <stdlib.h>
00034 #endif
00035
00036 using namespace YAPET::UI;
00037
00038 IntInWidget::IntInWidget (int sx, int sy, int w, int ml, bool ro)
00039 throw (UIException) : InputWidget (sx, sy, w, ml, ro) {
00040 }
00041
00042 IntInWidget::~IntInWidget() {
00043 }
00044
00045 void
00046 IntInWidget::processInput (int ch) throw (UIException) {
00047 if (isdigit (ch) )
00048 InputWidget::processInput (ch);
00049 }
00050
00051 unsigned long
00052 IntInWidget::getInt() const {
00053 if (!hasText() ) return 0;
00054
00055 return strtol (getText().c_str(), NULL, 10);
00056 }
00057
00058 void
00059 IntInWidget::setInt(unsigned long i) {
00060 const int size = 40;
00061 char buff[size];
00062 snprintf(buff,size,"%lu", i);
00063 setText(buff);
00064 }