From 4c71edbd3c6dcdf72b9957a92164a59d5137e9a2 Mon Sep 17 00:00:00 2001 From: Thilo Graf Date: Mon, 23 Jan 2017 21:27:10 +0100 Subject: [PATCH] CComponentsText: add explicit kill methode and add ct_force_text_paint After hide or kill text will does not paint without ct_force_text_paint, so it is required to add this. --- src/gui/components/cc_item_text.cpp | 19 ++++++++++++++++--- src/gui/components/cc_item_text.h | 2 ++ 2 files changed, 18 insertions(+), 3 deletions(-) diff --git a/src/gui/components/cc_item_text.cpp b/src/gui/components/cc_item_text.cpp index 907264dc2..bd37e0d37 100644 --- a/src/gui/components/cc_item_text.cpp +++ b/src/gui/components/cc_item_text.cpp @@ -274,7 +274,8 @@ bool CComponentsText::setTextFromFile(const string& path_to_textfile, const int void CComponentsText::paintText(bool do_save_bg) { initCCText(); - paintInit(do_save_bg); + if (!is_painted) + paintInit(do_save_bg); if (ct_text_sent && cc_allow_paint) ct_textbox->paint(); @@ -291,8 +292,20 @@ void CComponentsText::hide() { if (ct_textbox) ct_textbox->hide(); - ct_old_text = ""; - CComponents::hide(); + + ct_old_text.clear(); + CCDraw::hide(); + ct_force_text_paint = true; +} + +void CComponentsText::kill() +{ + if (ct_textbox) + ct_textbox->hide(); + + ct_old_text.clear(); + CCDraw::kill(); + ct_force_text_paint = true; } void CComponentsText::setXPos(const int& xpos) diff --git a/src/gui/components/cc_item_text.h b/src/gui/components/cc_item_text.h index a8105e1a0..f744efba2 100644 --- a/src/gui/components/cc_item_text.h +++ b/src/gui/components/cc_item_text.h @@ -138,6 +138,8 @@ class CComponentsText : public CCTextScreen, public CComponentsItem ///default members to paint a text box and hide painted text ///hide textbox void hide(); + ///remove textbox from screen + void kill(); ///paint text box, parameter do_save_bg: default = true, causes fill of backckrond pixel buffer void paint(bool do_save_bg = CC_SAVE_SCREEN_YES);