[escher] create a class float table view cell

Change-Id: Ie0d0e701d60ccdd492760bcdc5857470fcd1a255
This commit is contained in:
Émilie Feral
2016-10-14 09:55:32 +02:00
parent a7fdf442a9
commit b8b52e2d73
4 changed files with 46 additions and 0 deletions

View File

@@ -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\

View File

@@ -4,6 +4,7 @@
#include <escher/app.h>
#include <escher/button.h>
#include <escher/container.h>
#include <escher/float_table_view_cell.h>
#include <escher/float_view.h>
#include <escher/header_view_controller.h>
#include <escher/image.h>

View File

@@ -0,0 +1,18 @@
#ifndef ESCHER_FLOAT_TABLE_VIEW_CELL_H
#define ESCHER_FLOAT_TABLE_VIEW_CELL_H
#include <escher/table_view_cell.h>
#include <escher/float_view.h>
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

View File

@@ -0,0 +1,26 @@
#include <escher/float_table_view_cell.h>
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);
}