CHintBox/CMsgBox: use frames as default for better highlighting

This commit is contained in:
2019-10-27 16:24:47 +01:00
parent c82d1a9b27
commit 9234f67d98
4 changed files with 133 additions and 29 deletions

View File

@@ -67,14 +67,18 @@ CHintBox::CHintBox( const neutrino_locale_t Caption,
const char * const Picon,
const int& header_buttons,
const int& text_mode,
const int& indent): CComponentsWindow( 0, 0, Width,
const int& indent,
const fb_pixel_t& color_frame,
const fb_pixel_t& color_body,
const fb_pixel_t& color_shadow,
const int& frame_width): CComponentsWindow( 0, 0, Width,
HINTBOX_MIN_HEIGHT,
Caption,
string(Icon == NULL ? "" : Icon),
NULL,
CC_SHADOW_ON)
{
init(Text, Width, string(Picon == NULL ? "" : Picon), header_buttons, text_mode, indent);
init(Text, Width, string(Picon == NULL ? "" : Picon), header_buttons, text_mode, indent, color_frame, color_body, color_shadow, frame_width);
}
CHintBox::CHintBox( const char * const Caption,
@@ -84,14 +88,18 @@ CHintBox::CHintBox( const char * const Caption,
const char * const Picon,
const int& header_buttons,
const int& text_mode,
const int& indent):CComponentsWindow( 0, 0, Width,
const int& indent,
const fb_pixel_t& color_frame,
const fb_pixel_t& color_body,
const fb_pixel_t& color_shadow,
const int& frame_width):CComponentsWindow( 0, 0, Width,
HINTBOX_MIN_HEIGHT,
Caption,
string(Icon == NULL ? "" : Icon),
NULL,
CC_SHADOW_ON)
{
init(string(Text), Width, string(Picon == NULL ? "" : Picon), header_buttons, text_mode, indent);
init(string(Text), Width, string(Picon == NULL ? "" : Picon), header_buttons, text_mode, indent, color_frame, color_body, color_shadow, frame_width);
}
CHintBox::CHintBox( const neutrino_locale_t Caption,
@@ -101,14 +109,18 @@ CHintBox::CHintBox( const neutrino_locale_t Caption,
const char * const Picon,
const int& header_buttons,
const int& text_mode,
const int& indent):CComponentsWindow( 0, 0, Width,
const int& indent,
const fb_pixel_t& color_frame,
const fb_pixel_t& color_body,
const fb_pixel_t& color_shadow,
const int& frame_width):CComponentsWindow( 0, 0, Width,
HINTBOX_MIN_HEIGHT,
Caption,
string(Icon == NULL ? "" : Icon),
NULL,
CC_SHADOW_ON)
{
init(g_Locale->getText(Text), Width, string(Picon == NULL ? "" : Picon), header_buttons, text_mode, indent);
init(g_Locale->getText(Text), Width, string(Picon == NULL ? "" : Picon), header_buttons, text_mode, indent, color_frame, color_body, color_shadow, frame_width);
}
CHintBox::CHintBox( const char * const Caption,
@@ -118,24 +130,42 @@ CHintBox::CHintBox( const char * const Caption,
const char * const Picon,
const int& header_buttons,
const int& text_mode,
const int& indent):CComponentsWindow( 0, 0, Width,
const int& indent,
const fb_pixel_t& color_frame,
const fb_pixel_t& color_body,
const fb_pixel_t& color_shadow,
const int& frame_width):CComponentsWindow( 0, 0, Width,
HINTBOX_MIN_HEIGHT,
Caption,
string(Icon == NULL ? "" : Icon),
NULL,
CC_SHADOW_ON)
{
init(g_Locale->getText(Text), Width, string(Picon == NULL ? "" : Picon), header_buttons, text_mode, indent);
init(g_Locale->getText(Text), Width, string(Picon == NULL ? "" : Picon), header_buttons, text_mode, indent, color_frame, color_body, color_shadow, frame_width);
}
void CHintBox::init(const std::string& Text, const int& Width, const std::string& Picon, const int& header_buttons, const int& text_mode, const int& indent)
void CHintBox::init( const std::string& Text,
const int& Width,
const std::string& Picon,
const int& header_buttons,
const int& text_mode,
const int& indent,
const fb_pixel_t& color_frame,
const fb_pixel_t& color_body,
const fb_pixel_t& color_shadow,
const int& frame_width)
{
cc_item_type.name = "wg.hintbox";
int _Width = frameBuffer->scale2Res(Width);
timeout = HINTBOX_DEFAULT_TIMEOUT;
w_indentation = indent;
col_frame = color_frame;
col_body = color_body;
col_shadow = color_shadow;
fr_thickness = frame_width;
hb_font = MSG_FONT;
enable_txt_scroll = false;

View File

@@ -43,6 +43,7 @@
#define W_FRAME OFFSET_INNER_MID
//frame color around hint/message box
#define HINTBOX_DEFAULT_FRAME_COLOR COL_FRAME
#define HINTBOX_DEFAULT_FRAME_WIDTH OFFSET_INNER_SMALL
#define TIMEOUT_BAR_HEIGHT OFFSET_SHADOW/2
#define DEFAULT_HINTBOX_TEXT_MODE (CTextBox::CENTER)
@@ -82,7 +83,11 @@ class CHintBox : public CComponentsWindow
const std::string& Picon,
const int& header_buttons,
const int& text_mode,
const int& indent);
const int& indent,
const fb_pixel_t& color_frame,
const fb_pixel_t& color_body,
const fb_pixel_t& color_shadow,
const int& frame_width);
virtual void ReSize();
void showTimeOutBar(){enableTimeOutBar();}
@@ -127,7 +132,11 @@ class CHintBox : public CComponentsWindow
const char * const Picon = NULL,
const int& header_buttons = 0,
const int& text_mode = DEFAULT_HINTBOX_TEXT_MODE,
const int& indent = W_FRAME);
const int& indent = W_FRAME,
const fb_pixel_t& color_frame = HINTBOX_DEFAULT_FRAME_COLOR,
const fb_pixel_t& color_body = COL_MENUCONTENT_PLUS_0,
const fb_pixel_t& color_shadow = COL_SHADOW_PLUS_0,
const int& frame_width = HINTBOX_DEFAULT_FRAME_WIDTH);
/**CHintBox Constructor
* @param[in] Caption
@@ -141,7 +150,11 @@ class CHintBox : public CComponentsWindow
const char * const Picon = NULL,
const int& header_buttons = 0,
const int& text_mode = DEFAULT_HINTBOX_TEXT_MODE,
const int& indent = W_FRAME);
const int& indent = W_FRAME,
const fb_pixel_t& color_frame = HINTBOX_DEFAULT_FRAME_COLOR,
const fb_pixel_t& color_body = COL_MENUCONTENT_PLUS_0,
const fb_pixel_t& color_shadow = COL_SHADOW_PLUS_0,
const int& frame_width = HINTBOX_DEFAULT_FRAME_WIDTH);
/**CHintBox Constructor
* @param[in] Caption
@@ -157,7 +170,11 @@ class CHintBox : public CComponentsWindow
const char * const Picon = NULL,
const int& header_buttons = 0,
const int& text_mode = DEFAULT_HINTBOX_TEXT_MODE,
const int& indent = W_FRAME);
const int& indent = W_FRAME,
const fb_pixel_t& color_frame = HINTBOX_DEFAULT_FRAME_COLOR,
const fb_pixel_t& color_body = COL_MENUCONTENT_PLUS_0,
const fb_pixel_t& color_shadow = COL_SHADOW_PLUS_0,
const int& frame_width = HINTBOX_DEFAULT_FRAME_WIDTH);
/**CHintBox Constructor
* @param[in] Caption
@@ -173,7 +190,11 @@ class CHintBox : public CComponentsWindow
const char * const Picon = NULL,
const int& header_buttons = 0,
const int& text_mode = DEFAULT_HINTBOX_TEXT_MODE,
const int& indent = W_FRAME);
const int& indent = W_FRAME,
const fb_pixel_t& color_frame = HINTBOX_DEFAULT_FRAME_COLOR,
const fb_pixel_t& color_body = COL_MENUCONTENT_PLUS_0,
const fb_pixel_t& color_shadow = COL_SHADOW_PLUS_0,
const int& frame_width = HINTBOX_DEFAULT_FRAME_WIDTH);
virtual ~CHintBox();
/**

View File

@@ -51,7 +51,11 @@ CMsgBox::CMsgBox( const char* Text,
const int& Height,
const int& ShowButtons,
const msg_result_t& Default_result,
const int& Text_mode) : CHintBox( Title,
const int& Text_mode,
const fb_pixel_t& color_frame,
const fb_pixel_t& color_body,
const fb_pixel_t& color_shadow,
const int& frame_width) : CHintBox( Title,
Text,
Width,
Icon,
@@ -59,7 +63,7 @@ CMsgBox::CMsgBox( const char* Text,
0,
Text_mode)
{
init(Height, ShowButtons, Default_result);
init(Height, ShowButtons, Default_result, color_frame, color_body, color_shadow, frame_width);
}
CMsgBox::CMsgBox( const char* Text,
@@ -70,7 +74,11 @@ CMsgBox::CMsgBox( const char* Text,
const int& Height,
const int& ShowButtons,
const msg_result_t& Default_result,
const int& Text_mode) : CHintBox( locale_Title,
const int& Text_mode,
const fb_pixel_t& color_frame,
const fb_pixel_t& color_body,
const fb_pixel_t& color_shadow,
const int& frame_width) : CHintBox( locale_Title,
Text,
Width,
Icon,
@@ -78,18 +86,32 @@ CMsgBox::CMsgBox( const char* Text,
0,
Text_mode)
{
init(Height, ShowButtons, Default_result);
init(Height, ShowButtons, Default_result, color_frame, color_body, color_shadow, frame_width);
}
void CMsgBox::init(const int& Height, const int& ShowButtons, const msg_result_t& Default_result)
void CMsgBox::init( const int& Height,
const int& ShowButtons,
const msg_result_t& Default_result,
const fb_pixel_t& color_frame,
const fb_pixel_t& color_body,
const fb_pixel_t& color_shadow,
const int& frame_width)
{
cc_item_type.name = "msgbox";
initTimeOut();
col_frame = color_frame;
col_body = color_body;
col_shadow = color_shadow;
fr_thickness = frame_width;
//enable footer and add its height
showFooter(true);
#if 0
ccw_h_footer = ccw_footer->getHeight()+OFFSET_INNER_MID;
ccw_footer->setHeight(ccw_h_footer);
#endif
btn_enable_bg = true;
ccw_col_footer = ccw_body->getColorBody();
ccw_footer->doPaintBg(false);
@@ -421,15 +443,15 @@ int ShowMsg2UTF( const char * const Title,
MSGBOX_MIN_HEIGHT,
ShowButtons,
Default,
Text_mode);
if (color_frame != HINTBOX_DEFAULT_FRAME_COLOR){
msgBox.setFrameThickness(OFFSET_INNER_SMALL);
msgBox.setColorFrame(color_frame);
}
Text_mode,
color_frame,
COL_MENUCONTENT_PLUS_0,
COL_SHADOW_PLUS_0
);
msgBox.enableDefaultResultOnTimeOut(returnDefaultOnTimeout);
msgBox.setTimeOut(Timeout);
msgBox.paint();
msgBox.exec();
int res = msgBox.getResult();

View File

@@ -96,7 +96,13 @@ class CMsgBox : public CHintBox
};
private:
void init(const int& Height = -1, const int& ShowButtons = -1, const msg_result_t& Default_result = mbrNone);
void init( const int& Height,
const int& ShowButtons,
const msg_result_t& Default_result,
const fb_pixel_t& color_frame,
const fb_pixel_t& color_body,
const fb_pixel_t& color_shadow,
const int& frame_width);
void refreshFoot(void);
int mb_show_button;
@@ -160,6 +166,14 @@ class CMsgBox : public CHintBox
* NO_AUTO_LINEBREAK
* AUTO_LINEBREAK_NO_BREAKCHARS
* NOTE: default parameter to find in macro DEFAULT_MSGBOX_TEXT_MODE
* @param[in] color_frame
* @li optional: expects type fb_pixel_t, defines frame color, default = HINTBOX_DEFAULT_FRAME_COLOR
* @param[in] color_body
* @li optional: expects type fb_pixel_t, defines color color, default = COL_MENUCONTENT_PLUS_0
* @param[in] color_shadow
* @li optional: expects type fb_pixel_t, defines shadow color, default = COL_SHADOW_PLUS_0
* @param[in] frame_width
* @li optional: expects type int, defines frame width around, default = 0
*
* @see class CHintBox()
*/
@@ -171,7 +185,12 @@ class CMsgBox : public CHintBox
const int& Height = MSGBOX_MIN_HEIGHT,
const int& ShowButtons = mbCancel,
const msg_result_t& Default_result = mbrNone,
const int& Text_mode = DEFAULT_MSGBOX_TEXT_MODE);
const int& Text_mode = DEFAULT_MSGBOX_TEXT_MODE,
const fb_pixel_t& color_frame = HINTBOX_DEFAULT_FRAME_COLOR,
const fb_pixel_t& color_body = COL_MENUCONTENT_PLUS_0,
const fb_pixel_t& color_shadow = COL_SHADOW_PLUS_0,
const int& frame_width = HINTBOX_DEFAULT_FRAME_WIDTH
);
/**CMsgBox Constructor
* @param[in] Text
@@ -213,7 +232,14 @@ class CMsgBox : public CHintBox
* NO_AUTO_LINEBREAK
* AUTO_LINEBREAK_NO_BREAKCHARS
* NOTE: default parameter to find in macro DEFAULT_MSGBOX_TEXT_MODE
*
* @param[in] color_frame
* @li optional: expects type fb_pixel_t, defines frame color, default = HINTBOX_DEFAULT_FRAME_COLOR
* @param[in] color_body
* @li optional: expects type fb_pixel_t, defines color color, default = COL_MENUCONTENT_PLUS_0
* @param[in] color_shadow
* @li optional: expects type fb_pixel_t, defines shadow color, default = COL_SHADOW_PLUS_0
* @param[in] frame_width
* @li optional: expects type int, defines frame width around, default = 0
* @see class CHintBox()
*/
CMsgBox(const char* Text,
@@ -224,7 +250,12 @@ class CMsgBox : public CHintBox
const int& Height = MSGBOX_MIN_HEIGHT,
const int& ShowButtons = mbCancel,
const msg_result_t& Default_result = mbrNone,
const int& Text_mode = DEFAULT_MSGBOX_TEXT_MODE);
const int& Text_mode = DEFAULT_MSGBOX_TEXT_MODE,
const fb_pixel_t& color_frame = HINTBOX_DEFAULT_FRAME_COLOR,
const fb_pixel_t& color_body = COL_MENUCONTENT_PLUS_0,
const fb_pixel_t& color_shadow = COL_SHADOW_PLUS_0,
const int& frame_width = HINTBOX_DEFAULT_FRAME_WIDTH
);
virtual ~CMsgBox(){};
/**