[escher] Make one constructor only for views

Change-Id: I304a49995beb59071dd88fcfad8715bdb58e6685
This commit is contained in:
Émilie Feral
2016-12-09 15:02:23 +01:00
parent 32d9f9516a
commit c0dc33cfbd
7 changed files with 5 additions and 22 deletions

View File

@@ -5,8 +5,7 @@
class BufferTextView : public TextView {
public:
BufferTextView();
BufferTextView(float horizontalAlignment, float verticalAlignment,
BufferTextView(float horizontalAlignment = 0.5f, float verticalAlignment = 0.5f,
KDColor textColor = KDColorBlack, KDColor backgroundColor = KDColorWhite);
void setText(const char * text);
const char * text() const override;

View File

@@ -5,8 +5,7 @@
class PointerTextView : public TextView {
public:
PointerTextView();
PointerTextView(const char * text, float horizontalAlignment, float verticalAlignment,
PointerTextView(const char * text = nullptr, float horizontalAlignment = 0.0f, float verticalAlignment = 0.0f,
KDColor textColor = KDColorBlack, KDColor backgroundColor = KDColorWhite);
void setText(const char * text);
protected:

View File

@@ -6,7 +6,7 @@
class SwitchMenuListCell : public MenuListCell {
public:
SwitchMenuListCell(char * label);
SwitchMenuListCell(char * label = nullptr);
View * accessoryView() const override;
private:
SwitchView m_accessoryView;

View File

@@ -6,11 +6,11 @@
class TextView : public View {
public:
TextView();//;: TextView(nullptr, 0.0f, 0.0f);
// alignment = 0 -> align left or top
// alignment = 0.5 -> align center
// alignment = 1.0 -> align right or bottom
TextView(float horizontalAlignment, float verticalAlignment, KDColor textColor, KDColor backgroundColor);
TextView(float horizontalAlignment = 0.0f, float verticalAlignment = 0.0f,
KDColor textColor = KDColorBlack, KDColor backgroundColor = KDColorWhite);
void drawRect(KDContext * ctx, KDRect rect) const override;
void setBackgroundColor(KDColor backgroundColor);
void setTextColor(KDColor textColor);

View File

@@ -2,11 +2,6 @@
#include <string.h>
#include <assert.h>
BufferTextView::BufferTextView() :
TextView(0.5f, 0.5f, KDColorBlack, KDColorWhite)
{
}
BufferTextView::BufferTextView(float horizontalAlignment, float verticalAlignment,
KDColor textColor, KDColor backgroundColor) :
TextView(horizontalAlignment, verticalAlignment, textColor, backgroundColor)

View File

@@ -1,11 +1,5 @@
#include <escher/pointer_text_view.h>
PointerTextView::PointerTextView() :
TextView(),
m_textPointer(nullptr)
{
}
PointerTextView::PointerTextView(const char * text, float horizontalAlignment, float verticalAlignment,
KDColor textColor, KDColor backgroundColor) :
TextView(horizontalAlignment, verticalAlignment, textColor, backgroundColor),

View File

@@ -1,9 +1,5 @@
#include <escher/text_view.h>
TextView::TextView() : TextView(0.0f, 0.0f, KDColorBlack, KDColorWhite)
{
}
TextView::TextView(float horizontalAlignment, float verticalAlignment,
KDColor textColor, KDColor backgroundColor) :
View(),