CMsgBox: rework msgbox classes with Window class implementation

Replacing messagebox, hintbox_ext and some derivated parts with
basic class hintbox and derivated class CMsgBox. This should unify
window handling and avoids maintain of multiple classes with quasi
same purpose and adds more functionality.

TODO: fix and optimize details
This commit is contained in:
2016-04-04 21:57:17 +02:00
parent b8cf8167f4
commit dde298b1b7
81 changed files with 1981 additions and 1697 deletions

View File

@@ -57,6 +57,10 @@ CComponentsForm::CComponentsForm( const int x_pos, const int y_pos, const int w,
corner_type = CORNER_ALL;
cc_item_index = 0;
//add default exit keys for exec handler
v_exit_keys.push_back(CRCInput::RC_home);
v_exit_keys.push_back(CRCInput::RC_setup);
v_cc_items.clear();
append_x_offset = 0;
@@ -69,7 +73,7 @@ CComponentsForm::CComponentsForm( const int x_pos, const int y_pos, const int w,
page_scroll_mode = PG_SCROLL_M_UP_DOWN_KEY;
//connect page scroll slot
sigc::slot3<void, neutrino_msg_t&, neutrino_msg_data_t&, int&> sl = sigc::mem_fun(*this, &CComponentsForm::execPageScroll);
sigc::slot4<void, neutrino_msg_t&, neutrino_msg_data_t&, int&, bool&> sl = sigc::mem_fun(*this, &CComponentsForm::execPageScroll);
this->OnExec.connect(sl);
}
@@ -91,74 +95,65 @@ CComponentsForm::~CComponentsForm()
int CComponentsForm::exec()
{
dprintf(DEBUG_NORMAL, "[CComponentsForm] [%s - %d] \n", __func__, __LINE__);
OnBeforeExec();
//basic values
neutrino_msg_t msg;
neutrino_msg_data_t data;
int res = menu_return::RETURN_REPAINT;
uint64_t timeoutEnd = CRCInput::calcTimeoutEnd(-1);
//required exit keys
msg_list_t exit_keys[2];
exit_keys[0].msg = CRCInput::RC_setup;
exit_keys[1].msg = CRCInput::RC_home;
//allow exec loop
bool cancel_exec = false;
bool exit_loop = false;
while (!exit_loop)
//signal before exec
OnBeforeExec();
while (!cancel_exec)
{
g_RCInput->getMsgAbsoluteTimeout( &msg, &data, &timeoutEnd );
//execute connected slots
OnExec(msg, data, res);
OnExec(msg, data, res, cancel_exec);
//exit loop
execExit(msg, data, res, exit_loop, exit_keys, 2);
execExit(msg, data, res, cancel_exec, v_exit_keys);
if (CNeutrinoApp::getInstance()->handleMsg(msg, data) & messages_return::cancel_all)
{
dprintf(DEBUG_INFO, "[CComponentsForm] [%s - %d] messages_return::cancel_all\n", __func__, __LINE__);
res = menu_return::RETURN_EXIT_ALL;
exit_loop = EXIT;
cancel_exec = EXIT;
}
}
//signal after exec
OnAfterExec();
return res;
}
void CComponentsForm::execKey(neutrino_msg_t& msg, neutrino_msg_data_t& data, int& res, bool& exit_loop, const struct msg_list_t * const msg_list, const size_t& key_count, bool force_exit)
{
for(size_t i = 0; i < key_count; i++){
if (execKey(msg, data, res, exit_loop, msg_list[i].msg, force_exit)){
break;
}
}
}
void CComponentsForm::execKey(neutrino_msg_t& msg, neutrino_msg_data_t& data, int& res, bool& exit_loop, const std::vector<neutrino_msg_t>& v_msg_list, bool force_exit)
void CComponentsForm::execKey(neutrino_msg_t& msg, neutrino_msg_data_t& data, int& res, bool& cancel_exec, const std::vector<neutrino_msg_t>& v_msg_list, bool force_exit)
{
for(size_t i = 0; i < v_msg_list.size(); i++){
if (execKey(msg, data, res, exit_loop, v_msg_list[i], force_exit)){
if (execKey(msg, data, res, cancel_exec, v_msg_list[i], force_exit)){
break;
}
}
}
inline bool CComponentsForm::execKey(neutrino_msg_t& msg, neutrino_msg_data_t& data, int& res, bool& exit_loop, const neutrino_msg_t& msg_val, bool force_exit)
inline bool CComponentsForm::execKey(neutrino_msg_t& msg, neutrino_msg_data_t& data, int& res, bool& cancel_exec, const neutrino_msg_t& msg_val, bool force_exit)
{
if (msg == msg_val){
OnExecMsg(msg, data, res);
if (force_exit)
exit_loop = EXIT;
cancel_exec = EXIT;
return true;
}
return false;
}
void CComponentsForm::execPageScroll(neutrino_msg_t& msg, neutrino_msg_data_t& /*data*/, int& /*res*/)
void CComponentsForm::execPageScroll(neutrino_msg_t& msg, neutrino_msg_data_t& /*data*/, int& /*res*/, bool& /*cancel_exec*/)
{
if (page_scroll_mode == PG_SCROLL_M_OFF)
return;
@@ -178,9 +173,9 @@ void CComponentsForm::execPageScroll(neutrino_msg_t& msg, neutrino_msg_data_t& /
}
}
void CComponentsForm::execExit(neutrino_msg_t& msg, neutrino_msg_data_t& data, int& res, bool& exit_loop, const struct msg_list_t * const msg_list, const size_t& key_count)
void CComponentsForm::execExit(neutrino_msg_t& msg, neutrino_msg_data_t& data, int& res, bool& cancel_exec, const std::vector<neutrino_msg_t>& v_msg_list)
{
execKey(msg, data, res, exit_loop, msg_list, key_count, true);
execKey(msg, data, res, cancel_exec, v_msg_list, true);
}
@@ -558,14 +553,14 @@ void CComponentsForm::setPageCount(const u_int8_t& pageCount)
u_int8_t CComponentsForm::getPageCount()
{
u_int8_t num = 1;
u_int8_t num = 0;
for(size_t i=0; i<v_cc_items.size(); i++){
u_int8_t item_num = v_cc_items[i]->getPageNumber();
num = max(item_num, num);
}
//convert type, possible -Wconversion warnings!
page_count = static_cast<u_int8_t>(num);
page_count = static_cast<u_int8_t>(num+1);
return page_count;
}

View File

@@ -56,6 +56,9 @@ class CComponentsForm : public CComponentsItem
///enable/disable page scrolling, default enabled with page scroll mode up/down keys, see also enablePageScroll()
int page_scroll_mode;
///container for exit keys, default exit keys are CRCInput::RC_home and CRCInput::RC_setup
std::vector <neutrino_msg_t> v_exit_keys;
///initialize basic properties
virtual void Init( const int& x_pos, const int& y_pos, const int& w, const int& h,
const fb_pixel_t& color_frame,
@@ -149,6 +152,11 @@ class CComponentsForm : public CComponentsItem
///exec main method, see also sub exec methods
virtual int exec();
///adds additional exec key to current collection, default exit keys are CRCInput::RC_home and CRCInput::RC_setup
virtual void addExitKey(const neutrino_msg_t& key){v_exit_keys.push_back(key);}
///remove all current exec keys from current collection, NOTE: use addExitKey() if new exec key is required
virtual void removeExitKeys(){v_exit_keys.clear();}
///enum exec loop control
enum
{
@@ -156,38 +164,29 @@ class CComponentsForm : public CComponentsItem
EXIT = 1
};
///execKey() methods handle events for defined neutrino messages, see class CRCInput::, this methodes contains a signal handler named OnExecMsg, so it is possible to connect with any common function or method
///exec sub method for pressed keys, parameters1/2 by rev, parameter3 msg_list as struct contains a list of possible RC-messages for defined message, parameter4 defines size of struct, parameter5 force_exit default = false
virtual void execKey( neutrino_msg_t& msg,
neutrino_msg_data_t& data,
int& res,
bool& exit_loop,
const struct msg_list_t * const msg_list,
const size_t& key_count,
bool force_exit = false);
///exec sub method for pressed keys, parameters1/2 by rev, parameter3 msg_list as vector contains a list of possible RC-messages for defined message, parameter4 force_exit default = false
virtual void execKey( neutrino_msg_t& msg,
neutrino_msg_data_t& data,
int& res,
bool& exit_loop,
bool& cancel_exec,
const std::vector<neutrino_msg_t>& msg_list,
bool force_exit = false);
///exec sub method for pressed key, parameters1/2 by rev, parameter3 force_exit default = false
virtual bool execKey( neutrino_msg_t& msg,
neutrino_msg_data_t& data,
int& res,
bool& exit_loop,
bool& cancel_exec,
const neutrino_msg_t& msg_val,
bool force_exit = false);
///exec sub method for page scroll, parameter1 neutrino_msg_t by rev
virtual void execPageScroll(neutrino_msg_t& msg, neutrino_msg_data_t& data, int& res);
virtual void execPageScroll(neutrino_msg_t& msg, neutrino_msg_data_t& data, int& res, bool& cancel_exec);
///exec sub method for exit loop, parameters by rev
virtual void execExit( neutrino_msg_t& msg,
neutrino_msg_data_t& data,
int& res, bool& exit_loop,
const struct msg_list_t * const msg_list,
const size_t& key_count);
int& res, bool& cancel_exec,
const std::vector<neutrino_msg_t>& v_msg_list);
///enum scroll direction
enum

View File

@@ -124,7 +124,8 @@ void CComponentsButton::initVarButton( const int& x_pos, const int& y_pos, const
cc_btn_font = NULL;
cc_btn_icon = icon_name;
cc_btn_capt = caption;
cc_btn_msg = CRCInput::RC_nokey;
cc_directKey = CRCInput::RC_nokey;
cc_directKeyAlt = cc_directKey;
cc_btn_result = -1;
cc_btn_alias = -1;
@@ -187,12 +188,13 @@ void CComponentsButton::initCaption()
}
//set basic properties
int w_frame = max(fr_thickness, fr_thickness_sel);
if (cc_btn_capt_obj){
//position and size
int x_cap = fr_thickness;
int x_cap = w_frame;
x_cap += cc_btn_icon_obj ? cc_btn_icon_obj->getWidth() : 0;
int w_cap = width - fr_thickness - append_x_offset - x_cap - fr_thickness;
int w_cap = width - w_frame - append_x_offset - x_cap - w_frame;
int h_cap = height*65/100 /*- 2*fr_thickness*/;
/*NOTE:
@@ -201,7 +203,7 @@ void CComponentsButton::initCaption()
but text render isn't wrong here, because capitalized chars or long chars like e. 'q', 'y' are considered!
Therefore we here need other icons or a hack, that considers some different height values.
*/
int y_cap = height/2 - h_cap/2 + fr_thickness/2;
int y_cap = height/2 - h_cap/2 + w_frame/2;
cc_btn_capt_obj->setDimensionsAll(x_cap, y_cap, w_cap, h_cap);
@@ -216,14 +218,14 @@ void CComponentsButton::initCaption()
cc_btn_capt_obj->setTextColor(this->cc_item_enabled ? cc_btn_capt_col : cc_btn_capt_disable_col);
//corner of text item
cc_btn_capt_obj->setCorner(corner_rad-fr_thickness, corner_type);
cc_btn_capt_obj->setCorner(corner_rad-w_frame, corner_type);
}
//handle common position of icon and text inside container required for alignment
int w_required = fr_thickness + append_x_offset;
int w_required = w_frame + append_x_offset;
w_required += cc_btn_icon_obj ? cc_btn_icon_obj->getWidth() + append_x_offset : 0;
w_required += cc_btn_font ? cc_btn_font->getRenderWidth(cc_btn_capt) : 0;
w_required += append_x_offset + fr_thickness;
w_required += append_x_offset + w_frame;
//dynamic width
if (w_required > width){
@@ -235,7 +237,7 @@ void CComponentsButton::initCaption()
int x_icon = width/2 - w_required/2 /*+ fr_thickness + append_x_offset*/;
int w_icon = 0;
if (cc_btn_icon_obj){
x_icon += fr_thickness + append_x_offset;
x_icon += w_frame + append_x_offset;
cc_btn_icon_obj->setXPos(x_icon);
w_icon = cc_btn_icon_obj->getWidth();
/*in case of dynamic changed height of caption or button opbject itself,

View File

@@ -70,8 +70,10 @@ class CComponentsButton : public CComponentsFrmChain, public CCTextScreen
///property: icon name, only icons supported, to find in gui/widget/icons.h
std::string cc_btn_icon;
///property: assigned event message value, see driver/rcinput.h for possible values, default value = CRCInput::RC_nokey, see also setButtonEventMsg(), getButtonEventMsg()
neutrino_msg_t cc_btn_msg;
///property: assigned event message value, see driver/rcinput.h for possible values, default value = CRCInput::RC_nokey, see also setButtonDirectKey(), getButtonDirectKey()
neutrino_msg_t cc_directKey;
///property: assigned an alternate event message value, see driver/rcinput.h for possible values, default value = CRCInput::RC_nokey, see also setButtonDirectKeyAlt(), getButtonDirectKeyAlt()
neutrino_msg_t cc_directKeyAlt;
///property: assigned return value, see also setButtonResult(), getButtonResult(), default value = -1 (not defined)
int cc_btn_result;
///property: assigned alias value, see also setButtonAlias(), getButtonAlias(), default value = -1 (not defined)
@@ -133,7 +135,7 @@ class CComponentsButton : public CComponentsFrmChain, public CCTextScreen
fb_pixel_t color_frame = COL_SHADOW_PLUS_0, fb_pixel_t color_body = COL_BUTTON_BODY, fb_pixel_t color_shadow = COL_SHADOW_PLUS_0);
///set text color
virtual void setButtonTextColor(fb_pixel_t text_color, fb_pixel_t text_color_disabled = COL_MENUCONTENTINACTIVE_TEXT){cc_btn_capt_col = text_color; cc_btn_capt_disable_col = text_color_disabled;}
inline virtual void setButtonTextColor(fb_pixel_t caption_color){cc_btn_capt_col = caption_color;};
/**Member to modify background behavior of embeded caption object.
* @param[in] mode
@@ -162,9 +164,9 @@ class CComponentsButton : public CComponentsFrmChain, public CCTextScreen
virtual void setCaption(const neutrino_locale_t locale_text);
///get caption, type as std::string
virtual std::string getCaptionString(){return cc_btn_capt;};
inline virtual std::string getCaptionString(){return cc_btn_capt;};
///get loacalized caption id, type = neutrino_locale_t
virtual neutrino_locale_t getCaptionLocale(){return cc_btn_capt_locale;};
inline virtual neutrino_locale_t getCaptionLocale(){return cc_btn_capt_locale;};
///property: set font for label caption, parameter as font object, value NULL causes usaage of dynamic font
virtual void setButtonFont(Font* font){cc_btn_font = font; initCCBtnItems();};
@@ -176,17 +178,21 @@ class CComponentsButton : public CComponentsFrmChain, public CCTextScreen
void paint(bool do_save_bg = CC_SAVE_SCREEN_YES);
///assigns an event msg value to button object, parameter1 as neutrino_msg_t, see driver/rcinput.h for possible values
virtual void setButtonEventMsg(const neutrino_msg_t& msg){cc_btn_msg = msg;};
///return an event msg value to button object, see driver/rcinput.h for possible values
inline virtual neutrino_msg_t getButtonEventMsg(){return cc_btn_msg;};
inline virtual void setButtonDirectKey(const neutrino_msg_t& msg){cc_directKey = msg;};
///assigns an alternate event msg value to button object, parameter1 as neutrino_msg_t, see driver/rcinput.h for possible values
inline virtual void setButtonDirectKeyA(const neutrino_msg_t& msg){cc_directKeyAlt = msg;};
///returns an event msg value to button object, see driver/rcinput.h for possible values
inline virtual neutrino_msg_t getButtonDirectKey(){return cc_directKey;};
///returns an alternate event msg value to button object, but returns the primary direct key if no key was defined, see driver/rcinput.h for possible values
inline virtual neutrino_msg_t getButtonDirectKeyA(){return cc_directKeyAlt != CRCInput::RC_nokey ? cc_directKeyAlt : cc_directKey ;};
///assigns an return value to button object, parameter1 as int
virtual void setButtonResult(const int& result_value){cc_btn_result = result_value;};
inline virtual void setButtonResult(const int& result_value){cc_btn_result = result_value;};
///returns current result value of button object
inline virtual int getButtonResult(){return cc_btn_result;};
///assigns an alias value to button object, parameter1 as int, e.g. previous known as mbYes, mbNo... from message boxes
virtual void setButtonAlias(const int& alias_value){cc_btn_alias = alias_value;};
inline virtual void setButtonAlias(const int& alias_value){cc_btn_alias = alias_value;};
///returns an alias value from button object, see also cc_btn_alias
inline virtual int getButtonAlias(){return cc_btn_alias;};
};
@@ -239,6 +245,7 @@ class CComponentsButtonGreen : public CComponentsButton
:CComponentsButton(x_pos, y_pos, w, h, caption, NEUTRINO_ICON_BUTTON_GREEN, parent, selected, enabled, shadow_mode, color_frame, color_body, color_shadow)
{
cc_item_type = CC_ITEMTYPE_BUTTON_GREEN;
};
CComponentsButtonGreen( const int& x_pos, const int& y_pos, const int& w, const int& h,
const neutrino_locale_t& caption_locale,

View File

@@ -144,9 +144,8 @@ void CComponentsFooter::setButtonLabels(const struct button_label_s * const cont
CComponentsButton *btn = new CComponentsButton(0, CC_CENTERED, w_btn_min, (btn_contour ? height-2*fr_thickness : height), txt, icon_name);
btn->setButtonFont(ccf_btn_font);
btn->doPaintBg(btn_contour);
btn->enableFrame(btn_contour);
btn->setButtonTextColor(COL_MENUFOOT_TEXT);
btn->setButtonEventMsg(content[i].btn_msg);
btn->setButtonDirectKey(content[i].directKey);
btn->setButtonDirectKeyA(content[i].directKeyAlt);
btn->setButtonResult(content[i].btn_result);
btn->setButtonAlias(content[i].btn_alias);
@@ -164,6 +163,9 @@ void CComponentsFooter::setButtonLabels(const struct button_label_s * const cont
btn->setColorFrame(f_col);
}
if (btn_contour)
btn->setFrameThickness(3, 3);
chain->addCCItem(btn);
//set x position of next button object
@@ -200,7 +202,8 @@ void CComponentsFooter::setButtonLabels(const struct button_label_l * const cont
for (size_t i= 0; i< label_count; i++){
buttons[i].button = content[i].button;
buttons[i].text = content[i].locale != NONEXISTANT_LOCALE ? g_Locale->getText(content[i].locale) : "";
buttons[i].btn_msg = content[i].btn_msg;
buttons[i].directKey = content[i].directKey;
buttons[i].directKeyAlt = content[i].directKeyAlt;
buttons[i].btn_result = content[i].btn_result;
buttons[i].btn_alias = content[i].btn_alias;
}
@@ -217,7 +220,7 @@ void CComponentsFooter::setButtonLabels(const struct button_label * const conten
buttons[i].locale = content[i].locale;
//NOTE: here are used default values, because old button label struct don't know about this,
//if it possible, don't use this methode!
buttons[i].btn_msg = CRCInput::RC_nokey;
buttons[i].directKey = buttons[i].directKeyAlt = CRCInput::RC_nokey;
buttons[i].btn_result = -1;
buttons[i].btn_alias = -1;
}
@@ -232,7 +235,8 @@ void CComponentsFooter::setButtonLabels(const vector<button_label_l> &v_content,
for (size_t i= 0; i< label_count; i++){
buttons[i].button = v_content[i].button;
buttons[i].locale = v_content[i].locale;
buttons[i].btn_msg = v_content[i].btn_msg;
buttons[i].directKey = v_content[i].directKey;
buttons[i].directKeyAlt = v_content[i].directKeyAlt;
buttons[i].btn_result = v_content[i].btn_result;
buttons[i].btn_alias = v_content[i].btn_alias;
}
@@ -248,7 +252,8 @@ void CComponentsFooter::setButtonLabels(const vector<button_label_s> &v_content,
for (size_t i= 0; i< label_count; i++){
buttons[i].button = v_content[i].button;
buttons[i].text = v_content[i].text;
buttons[i].btn_msg = v_content[i].btn_msg;
buttons[i].directKey = v_content[i].directKey;
buttons[i].directKeyAlt = v_content[i].directKeyAlt;
buttons[i].btn_result = v_content[i].btn_result;
buttons[i].btn_alias = v_content[i].btn_alias;
}
@@ -256,24 +261,39 @@ void CComponentsFooter::setButtonLabels(const vector<button_label_s> &v_content,
setButtonLabels(buttons, label_count, chain_width, label_width);
}
void CComponentsFooter::setButtonLabel(const char *button_icon, const std::string& text, const int& chain_width, const int& label_width, const neutrino_msg_t& msg, const int& result_value, const int& alias_value)
void CComponentsFooter::setButtonLabel( const char *button_icon,
const std::string& text,
const int& chain_width,
const int& label_width,
const neutrino_msg_t& msg,
const int& result_value,
const int& alias_value,
const neutrino_msg_t& directKeyAlt)
{
button_label_s button[1];
button[0].button = button_icon;
button[0].text = text;
button[0].btn_msg = msg;
button[0].directKey = msg;
button[0].directKeyAlt = directKeyAlt;
button[0].btn_result = result_value;
button[0].btn_alias = alias_value;
setButtonLabels(button, 1, chain_width, label_width);
}
void CComponentsFooter::setButtonLabel(const char *button_icon, const neutrino_locale_t& locale, const int& chain_width, const int& label_width, const neutrino_msg_t& msg, const int& result_value, const int& alias_value)
void CComponentsFooter::setButtonLabel( const char *button_icon,
const neutrino_locale_t& locale,
const int& chain_width,
const int& label_width,
const neutrino_msg_t& msg,
const int& result_value,
const int& alias_value,
const neutrino_msg_t& directKeyAlt)
{
string txt = locale != NONEXISTANT_LOCALE ? g_Locale->getText(locale) : "";
setButtonLabel(button_icon, txt, chain_width, label_width, msg, result_value, alias_value);
setButtonLabel(button_icon, txt, chain_width, label_width, msg, result_value, alias_value, directKeyAlt);
}
void CComponentsFooter::showButtonContour(bool show)
@@ -325,3 +345,14 @@ void CComponentsFooter::paintButtons(const int& x_pos,
this->paint(do_save_bg);
}
void CComponentsFooter::setButtonText(const uint& btn_id, const std::string& text)
{
CComponentsItem *item = getButtonChainObject()->getCCItem(btn_id);
if (item){
CComponentsButton *button = static_cast<CComponentsButton*>(item);
button->setCaption(text);
}
else
dprintf(DEBUG_NORMAL, "[CComponentsForm] [%s - %d] Error: can't set button text, possible wrong btn_id=%u, item=%p...\n", __func__, __LINE__, btn_id, item);
}

View File

@@ -34,7 +34,8 @@ typedef struct button_label_s
{
const char * button;
std::string text;
neutrino_msg_t btn_msg;
neutrino_msg_t directKey;
neutrino_msg_t directKeyAlt;
int btn_result;
int btn_alias;
} button_label_s_struct;
@@ -43,7 +44,8 @@ typedef struct button_label_l
{
const char * button;
neutrino_locale_t locale;
neutrino_msg_t btn_msg;
neutrino_msg_t directKey;
neutrino_msg_t directKeyAlt;
int btn_result;
int btn_alias;
} button_label_l_struct;
@@ -106,9 +108,23 @@ class CComponentsFooter : public CComponentsHeader
void setButtonLabels(const struct button_label * const content, const size_t& label_count, const int& chain_width = 0, const int& label_width = 0);
///add single button label with string label type as content, chain_width as int, label width as int
void setButtonLabel(const char *button_icon, const std::string& text, const int& chain_width = 0, const int& label_width = 0, const neutrino_msg_t& msg = CRCInput::RC_nokey, const int& result_value = -1, const int& alias_value = -1);
void setButtonLabel( const char *button_icon,
const std::string& text,
const int& chain_width = 0,
const int& label_width = 0,
const neutrino_msg_t& msg = CRCInput::RC_nokey,
const int& result_value = -1,
const int& alias_value = -1,
const neutrino_msg_t& directKeyAlt = CRCInput::RC_nokey);
///add single button label with locale label type as content, chain_width as int, label width as int
void setButtonLabel(const char *button_icon, const neutrino_locale_t& locale, const int& chain_width = 0, const int& label_width = 0, const neutrino_msg_t& msg = CRCInput::RC_nokey, const int& result_value = -1, const int& alias_value = -1);
void setButtonLabel( const char *button_icon,
const neutrino_locale_t& locale,
const int& chain_width = 0,
const int& label_width = 0,
const neutrino_msg_t& msg = CRCInput::RC_nokey,
const int& result_value = -1,
const int& alias_value = -1,
const neutrino_msg_t& directKeyAlt = CRCInput::RC_nokey);
///causes show/hide countour of button frame and background, parameter bool show, default= true
void showButtonContour(bool show = true);
@@ -120,12 +136,26 @@ class CComponentsFooter : public CComponentsHeader
///returns selected button object, return value as pointer to object, NULL means nothing is selected
CComponentsButton* getSelectedButtonObject();
/*!
Sets a new text to an already predefined button.
1st parameter 'btn_id' accepts current id of an already defined button. 2nd parameter sets the new text as std::string
Usage:
Buttons come with any text eg. 'Ok', 'No', 'Yes' ...whatever and this member allows to manipulate the text via button id.
Button id means the showed button begins from the left position of button chain, starts with value=0, also to get via getButtonChainObject()->getCCItemId([CComponentsButton*])
example: 1st buttons text is 'Hello', 2nd Button's text is 'You!',
Now we want to change the text of 2nd button to 'World", so we must do this:
setButtonText(1, "World");
Wrong id's will be ignored.
*/
void setButtonText(const uint& btn_id, const std::string& text);
///property: set font for label caption, parameter as font object, value NULL causes usage of dynamic font
void setButtonFont(Font* font){ccf_btn_font = font;};
///returns pointer to internal button container
CComponentsFrmChain* getButtonChainObject(){return chain;};
///this is a nearly methode similar with the older button handler find in gui/widget/buttons.h, some parameters are different, but require minimalized input
///this member sets some basic parameters and will paint concurrently on execute, explicit call of paint() is not required
void paintButtons( const int& x_pos,

View File

@@ -222,6 +222,11 @@ class CComponentsWindow : public CComponentsForm
///paint all window items, this overwriting paint() from CComponentsForm
void paint(bool do_save_bg = CC_SAVE_SCREEN_YES);
///adds additional exec key to current collection, default exit keys are CRCInput::RC_home and CRCInput::RC_setup
virtual void addExitKey(const neutrino_msg_t& key){getBodyObject()->addExitKey(key);}
///remove all current exec keys from current collection, NOTE: use addExitKey() if new exec key is required
virtual void removeExitKeys(){getBodyObject()->removeExitKeys();}
};
class CComponentsWindowMax : public CComponentsWindow

View File

@@ -102,7 +102,7 @@ class CComponentsSignals : public sigc::trackable
sigc::signal<void> OnAfterExec;
///signal on execute of CComponentsForm::exec()
sigc::signal<void, neutrino_msg_t&, neutrino_msg_data_t&, int&> OnExec;
sigc::signal<void, neutrino_msg_t&, neutrino_msg_data_t&, int&, bool&> OnExec;
///signal on received message in CComponentsForm::execKey()
sigc::signal<void, neutrino_msg_t&, neutrino_msg_data_t&, int&> OnExecMsg;

View File

@@ -125,9 +125,9 @@ typedef struct cc_screen_data_t
//combination of rc messages with related icon
typedef struct msg_list_t
{
neutrino_msg_t msg;
neutrino_msg_t directKey;
const char* icon;
} key_list_t;
} msg_list_struct_t;
//align types
enum