From c0dc33cfbd309935c19f7efbb64cc4f26fc8f891 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=89milie=20Feral?= Date: Fri, 9 Dec 2016 15:02:23 +0100 Subject: [PATCH] [escher] Make one constructor only for views Change-Id: I304a49995beb59071dd88fcfad8715bdb58e6685 --- escher/include/escher/buffer_text_view.h | 3 +-- escher/include/escher/pointer_text_view.h | 3 +-- escher/include/escher/switch_menu_list_cell.h | 2 +- escher/include/escher/text_view.h | 4 ++-- escher/src/buffer_text_view.cpp | 5 ----- escher/src/pointer_text_view.cpp | 6 ------ escher/src/text_view.cpp | 4 ---- 7 files changed, 5 insertions(+), 22 deletions(-) diff --git a/escher/include/escher/buffer_text_view.h b/escher/include/escher/buffer_text_view.h index 671d94748..c7dae76b4 100644 --- a/escher/include/escher/buffer_text_view.h +++ b/escher/include/escher/buffer_text_view.h @@ -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; diff --git a/escher/include/escher/pointer_text_view.h b/escher/include/escher/pointer_text_view.h index 33e5421bf..8b47e986d 100644 --- a/escher/include/escher/pointer_text_view.h +++ b/escher/include/escher/pointer_text_view.h @@ -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: diff --git a/escher/include/escher/switch_menu_list_cell.h b/escher/include/escher/switch_menu_list_cell.h index 26623ad52..59ea0370a 100644 --- a/escher/include/escher/switch_menu_list_cell.h +++ b/escher/include/escher/switch_menu_list_cell.h @@ -6,7 +6,7 @@ class SwitchMenuListCell : public MenuListCell { public: - SwitchMenuListCell(char * label); + SwitchMenuListCell(char * label = nullptr); View * accessoryView() const override; private: SwitchView m_accessoryView; diff --git a/escher/include/escher/text_view.h b/escher/include/escher/text_view.h index 0434e5dd1..f71f6fa78 100644 --- a/escher/include/escher/text_view.h +++ b/escher/include/escher/text_view.h @@ -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); diff --git a/escher/src/buffer_text_view.cpp b/escher/src/buffer_text_view.cpp index 5a40e4ea5..848f6230a 100644 --- a/escher/src/buffer_text_view.cpp +++ b/escher/src/buffer_text_view.cpp @@ -2,11 +2,6 @@ #include #include -BufferTextView::BufferTextView() : - TextView(0.5f, 0.5f, KDColorBlack, KDColorWhite) -{ -} - BufferTextView::BufferTextView(float horizontalAlignment, float verticalAlignment, KDColor textColor, KDColor backgroundColor) : TextView(horizontalAlignment, verticalAlignment, textColor, backgroundColor) diff --git a/escher/src/pointer_text_view.cpp b/escher/src/pointer_text_view.cpp index 92fc85e87..40fc7e0b6 100644 --- a/escher/src/pointer_text_view.cpp +++ b/escher/src/pointer_text_view.cpp @@ -1,11 +1,5 @@ #include -PointerTextView::PointerTextView() : - TextView(), - m_textPointer(nullptr) -{ -} - PointerTextView::PointerTextView(const char * text, float horizontalAlignment, float verticalAlignment, KDColor textColor, KDColor backgroundColor) : TextView(horizontalAlignment, verticalAlignment, textColor, backgroundColor), diff --git a/escher/src/text_view.cpp b/escher/src/text_view.cpp index b3974699f..524ece4a4 100644 --- a/escher/src/text_view.cpp +++ b/escher/src/text_view.cpp @@ -1,9 +1,5 @@ #include -TextView::TextView() : TextView(0.0f, 0.0f, KDColorBlack, KDColorWhite) -{ -} - TextView::TextView(float horizontalAlignment, float verticalAlignment, KDColor textColor, KDColor backgroundColor) : View(),