mirror of
https://github.com/UpsilonNumworks/Upsilon.git
synced 2026-03-18 21:30:38 +01:00
[escher] create a class float table view cell
Change-Id: Ie0d0e701d60ccdd492760bcdc5857470fcd1a255
This commit is contained in:
@@ -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\
|
||||
|
||||
@@ -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>
|
||||
|
||||
18
escher/include/escher/float_table_view_cell.h
Normal file
18
escher/include/escher/float_table_view_cell.h
Normal 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
|
||||
26
escher/src/float_table_view_cell.cpp
Normal file
26
escher/src/float_table_view_cell.cpp
Normal 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);
|
||||
}
|
||||
Reference in New Issue
Block a user