mirror of
https://github.com/tuxbox-neutrino/neutrino.git
synced 2025-08-26 23:13:13 +02:00
hintbox: allow usage of hint icons and loader icon with short hints too
Only NEUTRINO_ICON_LOADER must be specified as picon parameter.
This commit is contained in:
@@ -482,77 +482,71 @@ 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<void> &Slot, int timeout, bool show_background)
|
||||
int ShowHintS(const char * const Text, const sigc::slot<void> &Slot, int timeout, bool show_background, const char * const Picon)
|
||||
{
|
||||
int res = messages_return::none;
|
||||
|
||||
sigc::signal<void> 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<void> &Slot, int timeout, bool show_background)
|
||||
int ShowHintS(const neutrino_locale_t Text, const sigc::slot<void> &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<void> &Slot, int timeout, bool show_background)
|
||||
int ShowHintS(const std::string& Text, const sigc::slot<void> &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<hint_message_data_t> &v_hint_data)
|
||||
@@ -564,7 +558,8 @@ int ShowHintS(const std::vector<hint_message_data_t>& 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;
|
||||
|
@@ -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
|
||||
@@ -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<void> &Slot, int timeout = HINTBOX_DEFAULT_TIMEOUT, bool show_background = true);
|
||||
int ShowHintS(const char * const Text, const sigc::slot<void> &Slot, int timeout = HINTBOX_DEFAULT_TIMEOUT, bool show_background = true);
|
||||
int ShowHintS(const std::string &Text, const sigc::slot<void> &Slot, int timeout = HINTBOX_DEFAULT_TIMEOUT, bool show_background = true);
|
||||
int ShowHintS(const neutrino_locale_t Text, const sigc::slot<void> &Slot, int timeout = HINTBOX_DEFAULT_TIMEOUT, bool show_background = true, const char * const Picon = NULL);
|
||||
int ShowHintS(const char * const Text, const sigc::slot<void> &Slot, int timeout = HINTBOX_DEFAULT_TIMEOUT, bool show_background = true, const char * const Picon = NULL);
|
||||
int ShowHintS(const std::string &Text, const sigc::slot<void> &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<hint_message_data_t> &v_hint_data);
|
||||
|
Reference in New Issue
Block a user