From 929896f5c52c189e9bed459e65b324f22405268b Mon Sep 17 00:00:00 2001 From: Oskar Chodowicz Date: Wed, 20 Feb 2019 12:21:36 +0100 Subject: [PATCH] Remove code duplication Change-Id: Ia02aa3a473ab2612448d5a0bd84d0153c461dd28 --- src/Button.cpp | 5 +---- src/CtxPopup.cpp | 4 +--- src/Layout.cpp | 3 +-- src/Popup.cpp | 4 +--- 4 files changed, 4 insertions(+), 12 deletions(-) diff --git a/src/Button.cpp b/src/Button.cpp index 428f292..abc0ad6 100644 --- a/src/Button.cpp +++ b/src/Button.cpp @@ -11,13 +11,10 @@ Button::Button(Widget *parent) } Button::Button(Widget *parent, std::function onClick, const TranslatedString &text, const std::string &style) + : Button(parent) { - uniqueObj_.reset(elm_button_add(parent->getObject())); - setWeightHint(EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); - setAlignHint(EVAS_HINT_FILL, 0.5); setText(text); if (!style.empty()) setStyle(style); setEvasSmartCallback("clicked", onClick); - show(); } diff --git a/src/CtxPopup.cpp b/src/CtxPopup.cpp index 2f15807..f476985 100644 --- a/src/CtxPopup.cpp +++ b/src/CtxPopup.cpp @@ -9,11 +9,9 @@ CtxPopup::CtxPopup(Widget *parent) } CtxPopup::CtxPopup(Widget *parent, bool disableAutoHide) - : Widget(parent) + : CtxPopup(parent) { - uniqueObj_.reset(elm_ctxpopup_add(parent->getObject())); setAutoHide(disableAutoHide); - show(); } void CtxPopup::setAutoHide(bool autoHide) diff --git a/src/Layout.cpp b/src/Layout.cpp index d3d5422..9f3b2c5 100644 --- a/src/Layout.cpp +++ b/src/Layout.cpp @@ -11,9 +11,8 @@ Layout::Layout(Widget *parent) } Layout::Layout(Widget *parent, const std::string &edjeFile, const std::string &group) - : Widget(parent) + : Layout(parent) { - uniqueObj_.reset(elm_layout_add(parent->getObject())); setWeightHint(EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); std::string edjePath; diff --git a/src/Popup.cpp b/src/Popup.cpp index d21b49b..ee8cdb8 100644 --- a/src/Popup.cpp +++ b/src/Popup.cpp @@ -9,11 +9,9 @@ Popup::Popup(Widget *parent) } Popup::Popup(Widget *parent, const TranslatedString &title) + : Popup(parent) { - uniqueObj_.reset(elm_popup_add(parent->getObject())); setPartText("title,text", title); - setWeightHint(EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); - show(); } void Popup::setOrientation(Elm_Popup_Orient orientation) -- 2.7.4