diff --git a/src/gui/widget/hintbox.cpp b/src/gui/widget/hintbox.cpp index 3059ae80c..97ac3f3ac 100644 --- a/src/gui/widget/hintbox.cpp +++ b/src/gui/widget/hintbox.cpp @@ -482,80 +482,74 @@ int ShowHint(const char * const Caption, const neutrino_locale_t Text, const int } -CHint::CHint(const char * const Text, bool show_background) : CHintBox("" , Text) +CHint::CHint(const char * const Text, bool show_background, const char * const Picon) : CHintBox("" , Text, HINTBOX_MIN_WIDTH, NULL, Picon) { initHint(show_background); } -CHint::CHint(const neutrino_locale_t Text, bool show_background) : CHintBox("" , g_Locale->getText(Text)) +CHint::CHint(const neutrino_locale_t Text, bool show_background, const char * const Picon) : CHintBox("" , g_Locale->getText(Text), HINTBOX_MIN_WIDTH, NULL, Picon) { initHint(show_background); } -int ShowHintS(const char * const Text, int timeout, bool show_background) +int ShowHintS(const char * const Text, int timeout, bool show_background, const char * const Picon) { int res = messages_return::none; - CHint hint(Text, show_background); - CHourGlass hg(CFrameBuffer::getInstance()->getScreenX() + OFFSET_INNER_MID, CFrameBuffer::getInstance()->getScreenY()); + CHint hint(Text, show_background, Picon); hint.setTimeOut(timeout, false); hint.paint(); - hg.paint(); res = hint.exec(); - hg.hide(); hint.hide(); return res; } -int ShowHintS(const char * const Text, const sigc::slot &Slot, int timeout, bool show_background) +int ShowHintS(const char * const Text, const sigc::slot &Slot, int timeout, bool show_background, const char * const Picon) { int res = messages_return::none; sigc::signal OnCall; OnCall.connect(Slot); - CHint hint(Text, show_background); - CHourGlass hg(CFrameBuffer::getInstance()->getScreenX() + OFFSET_INNER_MID, CFrameBuffer::getInstance()->getScreenY()); + CHint hint(Text, show_background, Picon); hint.setTimeOut(timeout, false); hint.paint(); - hg.paint(); OnCall(); res = hint.exec(); - hg.hide(); hint.hide(); return res; } -int ShowHintS(const neutrino_locale_t Text, int timeout, bool show_background) +int ShowHintS(const neutrino_locale_t Text, int timeout, bool show_background, const char * const Picon) { - return ShowHintS(g_Locale->getText(Text), timeout, show_background); + return ShowHintS(g_Locale->getText(Text), timeout, show_background, Picon); } -int ShowHintS(const std::string& Text, int timeout, bool show_background) +int ShowHintS(const std::string& Text, int timeout, bool show_background, const char * const Picon) { - return ShowHintS(Text.c_str(), timeout, show_background); + return ShowHintS(Text.c_str(), timeout, show_background, Picon); } -int ShowHintS(const neutrino_locale_t Text, const sigc::slot &Slot, int timeout, bool show_background) +int ShowHintS(const neutrino_locale_t Text, const sigc::slot &Slot, int timeout, bool show_background, const char * const Picon) { - return ShowHintS(g_Locale->getText(Text), Slot, timeout, show_background); + return ShowHintS(g_Locale->getText(Text), Slot, timeout, show_background, Picon); } -int ShowHintS(const std::string& Text, const sigc::slot &Slot, int timeout, bool show_background) +int ShowHintS(const std::string& Text, const sigc::slot &Slot, int timeout, bool show_background, const char * const Picon) { - return ShowHintS(Text.c_str(), Slot, timeout, show_background); + return ShowHintS(Text.c_str(), Slot, timeout, show_background, Picon); } int ShowHintS(const hint_message_data_t &hint_data) { std::string text = !hint_data.text.empty() ? hint_data.text : g_Locale->getText(hint_data.text_locale); - return ShowHintS(text, hint_data.slot, hint_data.timeout, hint_data.show_background); + return ShowHintS(text, hint_data.slot, hint_data.timeout, hint_data.show_background, hint_data.Picon); } -int ShowHintS(const std::vector& v_hint_data) +int ShowHintS(const std::vector &v_hint_data) { int ret = messages_return::none; for(size_t i=0; i& v_hint_data) ret = ShowHintS(txt, v_hint_data.at(i).slot, v_hint_data.at(i).timeout, - v_hint_data.at(i).show_background); + v_hint_data.at(i).show_background, + v_hint_data.at(i).Picon); } return ret; diff --git a/src/gui/widget/hintbox.h b/src/gui/widget/hintbox.h index 793b8f982..e777fd629 100644 --- a/src/gui/widget/hintbox.h +++ b/src/gui/widget/hintbox.h @@ -106,6 +106,8 @@ class CHintBox : public CComponentsWindow * @li optional: expects type const char*, defines the icon name on the left side of titlebar, default = DEFAULT_HEADER_ICON * @param[in] Picon * @li optional: expects type const char*, defines the picon name on the left side of message text, default = NULL (non Icon) + * special case: If picon == NEUTRINO_ICON_LOADER, then the animated loader icon known from CHourGlass object will be painted. + * @see CHourGlass() * @param[in] header_buttons * @li optional: expects type int, defines the icon name on the right side of titlebar, default = 0 (non Icon) * @see class CComponentsWindow() @@ -274,7 +276,9 @@ class CHintBox : public CComponentsWindow * NO_AUTO_LINEBREAK * AUTO_LINEBREAK_NO_BREAKCHARS * @param[in] Picon - * @li optional: expects type std::string, defines the picon name on the left side of message text, default = NULL (non Icon) + * @li optional: expects type std::string, defines the picon name on the left side of message text, default = NULL (non Icon)\n + * special case: If picon == NEUTRINO_ICON_LOADER, then the animated loader icon known from CHourGlass object will be painted. + * @see CHourGlass() * @param[in] color_text * @li optional: expects type fb_pixel_t, defines the text color, default = COL_MENUCONTENT_TEXT * * @param[in] font_text @@ -342,7 +346,7 @@ class CHintBox : public CComponentsWindow * Text is UTF-8 encoded * @see for possible parameters take a look to CHintBox() */ -int ShowHint(const neutrino_locale_t Caption, const char * const Text, const int Width = HINTBOX_MIN_WIDTH, int timeout = HINTBOX_DEFAULT_TIMEOUT, const char * const Icon = NULL, const char * const Picon = NULL, const int& header_buttons = 0); +int ShowHint(const neutrino_locale_t Caption, const char * const Text, const int Width = HINTBOX_MIN_WIDTH, int timeout = HINTBOX_DEFAULT_TIMEOUT, const char * const Icon = NULL,const char * const Picon = NULL, const int& header_buttons = 0); int ShowHint(const neutrino_locale_t Caption, const neutrino_locale_t Text, const int Width = HINTBOX_MIN_WIDTH, int timeout = HINTBOX_DEFAULT_TIMEOUT, const char * const Icon = NULL, const char * const Picon = NULL, const int& header_buttons = 0); int ShowHint(const char * const Caption, const char * const Text, const int Width = HINTBOX_MIN_WIDTH, int timeout = HINTBOX_DEFAULT_TIMEOUT, const char * const Icon = NULL, const char * const Picon = NULL, const int& header_buttons = 0); int ShowHint(const char * const Caption, const neutrino_locale_t Text, const int Width = HINTBOX_MIN_WIDTH, int timeout = HINTBOX_DEFAULT_TIMEOUT, const char * const Icon = NULL, const char * const Picon = NULL, const int& header_buttons = 0); @@ -375,14 +379,14 @@ class CHint : public CHintBox * @param[in] show_background * @li optional: expects type bool, enable/disable backround paint, default = true */ - CHint(const char * const Text, bool show_background = true); + CHint(const char * const Text, bool show_background = true, const char * const Picon = NULL); /**CHint Constructor * @param[in] Text * @li expects type neutrino_locale_t, this is the message text inside the window, text is UTF-8 encoded * @param[in] show_background * @li optional: expects type bool, enable/disable backround paint, default = true */ - CHint(const neutrino_locale_t Text, bool show_background = true); + CHint(const neutrino_locale_t Text, bool show_background = true, const char * const Picon = NULL); virtual void setDelay(int d) {delay = d;} @@ -404,10 +408,12 @@ typedef struct hint_message_data_t neutrino_locale_t text_locale; int timeout; bool show_background; + const char *Picon; // hint_message_data_t(): text(std::string()), // text_locale(NONEXISTANT_LOCALE), // timeout(HINTBOX_DEFAULT_TIMEOUT), -// show_background(true){} +// show_background(true), +// Picon(NULL){} } hint_message_data_struct_t; /** @@ -421,9 +427,9 @@ typedef struct hint_message_data_t * @li optional: expects type bool, enable/disable backround paint, default = true * @see for possible text parameters take a look to CHintBox() */ -int ShowHintS(const neutrino_locale_t Text, int timeout = HINTBOX_DEFAULT_TIMEOUT, bool show_background = true); -int ShowHintS(const char * const Text, int timeout = HINTBOX_DEFAULT_TIMEOUT, bool show_background = true); -int ShowHintS(const std::string &Text, int timeout = HINTBOX_DEFAULT_TIMEOUT, bool show_background = true); +int ShowHintS(const neutrino_locale_t Text, int timeout = HINTBOX_DEFAULT_TIMEOUT, bool show_background = true, const char * const Picon = NULL); +int ShowHintS(const char * const Text, int timeout = HINTBOX_DEFAULT_TIMEOUT, bool show_background = true, const char * const Picon = NULL); +int ShowHintS(const std::string &Text, int timeout = HINTBOX_DEFAULT_TIMEOUT, bool show_background = true, const char * const Picon = NULL); /** * Simplified methodes to show hintboxes without titlebar and footer with mounted function as slot for custom action @@ -443,9 +449,9 @@ int ShowHintS(const std::string &Text, int timeout = HINTBOX_DEFAULT_TIMEOUT, bo * @param[in] show_background * @li optional: expects type bool, enable/disable backround paint, default = true */ -int ShowHintS(const neutrino_locale_t Text, const sigc::slot &Slot, int timeout = HINTBOX_DEFAULT_TIMEOUT, bool show_background = true); -int ShowHintS(const char * const Text, const sigc::slot &Slot, int timeout = HINTBOX_DEFAULT_TIMEOUT, bool show_background = true); -int ShowHintS(const std::string &Text, const sigc::slot &Slot, int timeout = HINTBOX_DEFAULT_TIMEOUT, bool show_background = true); +int ShowHintS(const neutrino_locale_t Text, const sigc::slot &Slot, int timeout = HINTBOX_DEFAULT_TIMEOUT, bool show_background = true, const char * const Picon = NULL); +int ShowHintS(const char * const Text, const sigc::slot &Slot, int timeout = HINTBOX_DEFAULT_TIMEOUT, bool show_background = true, const char * const Picon = NULL); +int ShowHintS(const std::string &Text, const sigc::slot &Slot, int timeout = HINTBOX_DEFAULT_TIMEOUT, bool show_background = true, const char * const Picon = NULL); int ShowHintS(const hint_message_data_t &hint_data); int ShowHintS(const std::vector &v_hint_data);