AbaKus – a complex calculator
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

71 lines
2.3KB

  1. #ifndef ABAKUS_RESULTLISTVIEWTEXT_H
  2. #define ABAKUS_RESULTLISTVIEWTEXT_H
  3. /*
  4. * resultlistviewtext.h - part of abakus
  5. * Copyright (C) 2004, 2005 Michael Pyne <michael.pyne@kdemail.net>
  6. *
  7. * This program is free software; you can redistribute it and/or modify
  8. * it under the terms of the GNU General Public License as published by
  9. * the Free Software Foundation; either version 2 of the License, or
  10. * (at your option) any later version.
  11. *
  12. * This program is distributed in the hope that it will be useful,
  13. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  14. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  15. * GNU General Public License for more details.
  16. *
  17. * You should have received a copy of the GNU General Public License
  18. * along with this program; if not, write to the Free Software
  19. * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  20. */
  21. #include "resultlistview.h"
  22. #include "numerictypes.h"
  23. class TQPainter;
  24. class TQColorGroup;
  25. class TQFontMetrics;
  26. // This class shows the results shown in the MainWindow result pane.
  27. class ResultListViewText : public TDEListViewItem
  28. {
  29. public:
  30. ResultListViewText(TDEListView *listView,
  31. const TQString &text,
  32. const TQString &result,
  33. ResultListViewText *after,
  34. bool isError = false);
  35. ResultListViewText(TDEListView *listView,
  36. const TQString &text,
  37. const Abakus::number_t &result,
  38. ResultListViewText *after,
  39. bool isError = false);
  40. TQString expressionText() const { return m_text; }
  41. TQString resultText() const { return m_result; }
  42. bool wasError() const { return m_wasError; }
  43. unsigned stackPosition() const { return m_stackPosition; }
  44. void setStackPosition(unsigned pos);
  45. // Redisplays the text by calling value.toString again.
  46. void precisionChanged();
  47. // Reimplemented from TDEListViewItem
  48. virtual void paintCell(TQPainter *p, const TQColorGroup &cg, int column, int width, int align);
  49. virtual int width(const TQFontMetrics &fm, const TQListView *lv, int c) const;
  50. // Reimplemented to remove trailing zeroes from results.
  51. virtual void setText(int column, const TQString &text);
  52. private:
  53. TQString m_text, m_result;
  54. bool m_wasError;
  55. unsigned m_stackPosition;
  56. Abakus::number_t m_value;
  57. };
  58. #endif