From 34a614fbdfe50991df7adeb92f085835bf204ec2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=89milie=20Feral?= Date: Thu, 20 Oct 2016 16:03:16 +0200 Subject: [PATCH] [apps/graph/list] Create a class for the button new function Change-Id: Id9a03b9c7047ca709ee29298f10f7dde216e259a --- apps/graph/Makefile | 1 + apps/graph/list/new_function_cell.cpp | 30 +++++++++++++++++++++++++++ apps/graph/list/new_function_cell.h | 22 ++++++++++++++++++++ 3 files changed, 53 insertions(+) create mode 100644 apps/graph/list/new_function_cell.cpp create mode 100644 apps/graph/list/new_function_cell.h diff --git a/apps/graph/Makefile b/apps/graph/Makefile index 7c37dba9c..73da87c24 100644 --- a/apps/graph/Makefile +++ b/apps/graph/Makefile @@ -10,6 +10,7 @@ app_objs += $(addprefix apps/graph/,\ list/function_cell.o\ list/function_expression_view.o\ list/function_name_view.o\ + list/new_function_cell.o\ list/list_controller.o\ list/parameter_controller.o\ values/abscissa_parameter_controller.o\ diff --git a/apps/graph/list/new_function_cell.cpp b/apps/graph/list/new_function_cell.cpp new file mode 100644 index 000000000..2d5ec470f --- /dev/null +++ b/apps/graph/list/new_function_cell.cpp @@ -0,0 +1,30 @@ +#include "new_function_cell.h" +#include "assert.h" + +namespace Graph { + +NewFunctionCell::NewFunctionCell() : + EvenOddCell(), + m_pointerTextView(PointerTextView("Ajouter une fonction", 0.5f, 0.5f)) +{ +} + +void NewFunctionCell::reloadCell() { + EvenOddCell::reloadCell(); + m_pointerTextView.setBackgroundColor(backgroundColor()); +} + +int NewFunctionCell::numberOfSubviews() const { + return 1; +} + +View * NewFunctionCell::subviewAtIndex(int index) { + assert(index == 0); + return &m_pointerTextView; +} + +void NewFunctionCell::layoutSubviews() { + m_pointerTextView.setFrame(bounds()); +} + +} diff --git a/apps/graph/list/new_function_cell.h b/apps/graph/list/new_function_cell.h new file mode 100644 index 000000000..5340a2978 --- /dev/null +++ b/apps/graph/list/new_function_cell.h @@ -0,0 +1,22 @@ +#ifndef GRAPH_NEW_FUNCTION_CELL_H +#define GRAPH_NEW_FUNCTION_CELL_H + +#include +#include "../even_odd_cell.h" + +namespace Graph { +class NewFunctionCell : public EvenOddCell { +public: + NewFunctionCell(); + void reloadCell() override; + int numberOfSubviews() const override; + View * subviewAtIndex(int index) override; + void layoutSubviews() override; + +protected: + PointerTextView m_pointerTextView; +}; + +} + +#endif