mirror of
https://github.com/tuxbox-neutrino/neutrino.git
synced 2025-08-28 16:01:20 +02:00
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:
@@ -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,
|
||||
|
Reference in New Issue
Block a user