diff --git a/escher/Makefile b/escher/Makefile index 2f7c224b9..edb9db91f 100644 --- a/escher/Makefile +++ b/escher/Makefile @@ -5,6 +5,7 @@ objs += $(addprefix escher/src/,\ childless_view.o\ button.o\ container.o\ + float_table_view_cell.o\ float_view.o\ header_view_controller.o\ image_view.o\ diff --git a/escher/include/escher.h b/escher/include/escher.h index e5bd8a0ef..44478aceb 100644 --- a/escher/include/escher.h +++ b/escher/include/escher.h @@ -4,6 +4,7 @@ #include #include #include +#include #include #include #include diff --git a/escher/include/escher/float_table_view_cell.h b/escher/include/escher/float_table_view_cell.h new file mode 100644 index 000000000..6bd63d245 --- /dev/null +++ b/escher/include/escher/float_table_view_cell.h @@ -0,0 +1,18 @@ +#ifndef ESCHER_FLOAT_TABLE_VIEW_CELL_H +#define ESCHER_FLOAT_TABLE_VIEW_CELL_H + +#include +#include + +class FloatTableViewCell : public TableViewCell { +public: + FloatTableViewCell(char * label); + View * contentView() const override; + void setHighlighted(bool highlight); + void setFloat(float f); + char * stringFromFloat(); +private: + FloatView m_contentView; +}; + +#endif diff --git a/escher/src/float_table_view_cell.cpp b/escher/src/float_table_view_cell.cpp new file mode 100644 index 000000000..f10eadb1e --- /dev/null +++ b/escher/src/float_table_view_cell.cpp @@ -0,0 +1,26 @@ +#include + +FloatTableViewCell::FloatTableViewCell(char * label) : + TableViewCell(label), + m_contentView(FloatView()) +{ +} + +void FloatTableViewCell::setFloat(float f) { + m_contentView.setFloat(f); +} + +char * FloatTableViewCell::stringFromFloat() { + return m_contentView.buffer(); +} + + +View * FloatTableViewCell::contentView() const { + return (View *)&m_contentView; +} + +void FloatTableViewCell::setHighlighted(bool highlight) { + TableViewCell::setHighlighted(highlight); + KDColor backgroundColor = highlight? Palette::FocusCellBackgroundColor : Palette::CellBackgroundColor; + m_contentView.setBackgroundColor(backgroundColor); +} \ No newline at end of file