cc_frm_window: add paramter for frame width into constructors

setFrameThickness() has no effect
This commit is contained in:
2019-10-27 16:24:47 +01:00
parent 15a310be47
commit c82d1a9b27
2 changed files with 59 additions and 43 deletions

View File

@@ -59,7 +59,7 @@ using namespace std;
//sub class CComponentsWindow inherit from CComponentsForm //sub class CComponentsWindow inherit from CComponentsForm
CComponentsWindow::CComponentsWindow(CComponentsForm *parent) CComponentsWindow::CComponentsWindow(CComponentsForm *parent)
{ {
init(0, 0, 800, 600, "", "", parent, CC_SHADOW_OFF, COL_FRAME_PLUS_0, COL_MENUCONTENT_PLUS_0, COL_SHADOW_PLUS_0); init(0, 0, 800, 600, "", "", parent, CC_SHADOW_OFF, COL_FRAME_PLUS_0, COL_MENUCONTENT_PLUS_0, COL_SHADOW_PLUS_0, 0);
} }
CComponentsWindow::CComponentsWindow( const int& x_pos, const int& y_pos, const int& w, const int& h, CComponentsWindow::CComponentsWindow( const int& x_pos, const int& y_pos, const int& w, const int& h,
@@ -67,12 +67,13 @@ CComponentsWindow::CComponentsWindow( const int& x_pos, const int& y_pos, const
const string& iconname, const string& iconname,
CComponentsForm *parent, CComponentsForm *parent,
int shadow_mode, int shadow_mode,
fb_pixel_t color_frame, const fb_pixel_t& color_frame,
fb_pixel_t color_body, const fb_pixel_t& color_body,
fb_pixel_t color_shadow) const fb_pixel_t& color_shadow,
const int& frame_width)
{ {
string s_caption = locale_caption != NONEXISTANT_LOCALE ? g_Locale->getText(locale_caption) : ""; string s_caption = locale_caption != NONEXISTANT_LOCALE ? g_Locale->getText(locale_caption) : "";
init(x_pos, y_pos, w, h, s_caption, iconname, parent, shadow_mode, color_frame, color_body, color_shadow); init(x_pos, y_pos, w, h, s_caption, iconname, parent, shadow_mode, color_frame, color_body, color_shadow, frame_width);
} }
CComponentsWindow::CComponentsWindow( const int& x_pos, const int& y_pos, const int& w, const int& h, CComponentsWindow::CComponentsWindow( const int& x_pos, const int& y_pos, const int& w, const int& h,
@@ -80,22 +81,24 @@ CComponentsWindow::CComponentsWindow( const int& x_pos, const int& y_pos, const
const string& iconname, const string& iconname,
CComponentsForm *parent, CComponentsForm *parent,
int shadow_mode, int shadow_mode,
fb_pixel_t color_frame, const fb_pixel_t& color_frame,
fb_pixel_t color_body, const fb_pixel_t& color_body,
fb_pixel_t color_shadow) const fb_pixel_t& color_shadow,
const int& frame_width)
{ {
init(x_pos, y_pos, w, h, caption, iconname, parent, shadow_mode, color_frame, color_body, color_shadow); init(x_pos, y_pos, w, h, caption, iconname, parent, shadow_mode, color_frame, color_body, color_shadow, frame_width);
} }
CComponentsWindowMax::CComponentsWindowMax( const string& caption, CComponentsWindowMax::CComponentsWindowMax( const string& caption,
const string& iconname, const string& iconname,
CComponentsForm *parent, CComponentsForm *parent,
int shadow_mode, int shadow_mode,
fb_pixel_t color_frame, const fb_pixel_t& color_frame,
fb_pixel_t color_body, const fb_pixel_t& color_body,
fb_pixel_t color_shadow) const fb_pixel_t& color_shadow,
const int& frame_width)
:CComponentsWindow(0, 0, 0, 0, caption, :CComponentsWindow(0, 0, 0, 0, caption,
iconname, parent, shadow_mode, color_frame, color_body, color_shadow) iconname, parent, shadow_mode, color_frame, color_body, color_shadow, frame_width)
{ {
cc_item_type.id = CC_ITEMTYPE_FRM_WINDOW_MAX; cc_item_type.id = CC_ITEMTYPE_FRM_WINDOW_MAX;
cc_item_type.name = "cc_window_max"; cc_item_type.name = "cc_window_max";
@@ -105,12 +108,13 @@ CComponentsWindowMax::CComponentsWindowMax( neutrino_locale_t locale_caption,
const string& iconname, const string& iconname,
CComponentsForm *parent, CComponentsForm *parent,
int shadow_mode, int shadow_mode,
fb_pixel_t color_frame, const fb_pixel_t& color_frame,
fb_pixel_t color_body, const fb_pixel_t& color_body,
fb_pixel_t color_shadow) const fb_pixel_t& color_shadow,
const int& frame_width)
:CComponentsWindow(0, 0, 0, 0, :CComponentsWindow(0, 0, 0, 0,
locale_caption != NONEXISTANT_LOCALE ? g_Locale->getText(locale_caption) : "", locale_caption != NONEXISTANT_LOCALE ? g_Locale->getText(locale_caption) : "",
iconname, parent, shadow_mode, color_frame, color_body, color_shadow) iconname, parent, shadow_mode, color_frame, color_body, color_shadow, frame_width)
{ {
cc_item_type.id = CC_ITEMTYPE_FRM_WINDOW_MAX; cc_item_type.id = CC_ITEMTYPE_FRM_WINDOW_MAX;
cc_item_type.name = "cc_window_max_localized"; cc_item_type.name = "cc_window_max_localized";
@@ -120,10 +124,11 @@ void CComponentsWindow::init( const int& x_pos, const int& y_pos, const int& w,
const string& caption, const string& caption,
const string& iconname, const string& iconname,
CComponentsForm *parent, CComponentsForm *parent,
int shadow_mode, const int& shadow_mode,
fb_pixel_t color_frame, const fb_pixel_t& color_frame,
fb_pixel_t color_body, const fb_pixel_t& color_body,
fb_pixel_t color_shadow) const fb_pixel_t& color_shadow,
const int& frame_width)
{ {
//CComponentsForm //CComponentsForm
cc_item_type.id = CC_ITEMTYPE_FRM_WINDOW; cc_item_type.id = CC_ITEMTYPE_FRM_WINDOW;
@@ -135,6 +140,7 @@ void CComponentsWindow::init( const int& x_pos, const int& y_pos, const int& w,
y = y_pos; y = y_pos;
width = w; width = w;
height = h; height = h;
fr_thickness = fr_thickness_old = frame_width;
ccw_h_footer = 0; //auto ccw_h_footer = 0; //auto
initWindowSize(); initWindowSize();
initWindowPos(); initWindowPos();
@@ -215,12 +221,13 @@ void CComponentsWindow::initHeader()
//set header properties //TODO: assigned properties with internal header objekt have no effect! //set header properties //TODO: assigned properties with internal header objekt have no effect!
if (ccw_head){ if (ccw_head){
ccw_head->setWidth(width-2*fr_thickness); ccw_head->setWidth(width-2*fr_thickness);
ccw_head->setPos(fr_thickness, fr_thickness); ccw_head->setPos(0, 0);
ccw_head->setIcon(ccw_icon_name); ccw_head->setIcon(ccw_icon_name);
ccw_head->setCaption(ccw_caption, ccw_align_mode, ccw_col_head_text); ccw_head->setCaption(ccw_caption, ccw_align_mode, ccw_col_head_text);
ccw_head->setContextButton(ccw_buttons); ccw_head->setContextButton(ccw_buttons);
ccw_head->setCorner(corner_rad, CORNER_TOP); ccw_head->setCorner(corner_rad, CORNER_TOP);
ccw_head->setColorBody(ccw_col_head); ccw_head->setColorBody(ccw_col_head);
ccw_h_footer = ccw_head->getHeight();
} }
} }
@@ -233,9 +240,8 @@ void CComponentsWindow::initFooter()
if (ccw_footer){ if (ccw_footer){
if (ccw_h_footer) if (ccw_h_footer)
ccw_footer->setHeight(ccw_h_footer); ccw_footer->setHeight(ccw_h_footer);
ccw_footer->setPos(cc_xr + fr_thickness, cc_yr + height - ccw_footer->getHeight()- fr_thickness); ccw_footer->setPos(0, cc_yr + height - ccw_footer->getHeight()- 2*fr_thickness);
ccw_footer->setWidth(width/*-2*fr_thickness*/); ccw_footer->setWidth(width-2*fr_thickness);
ccw_footer->enableShadow(false/*shadow*/);
ccw_footer->setCorner(corner_rad, CORNER_BOTTOM); ccw_footer->setCorner(corner_rad, CORNER_BOTTOM);
ccw_footer->setButtonFont(ccw_button_font); ccw_footer->setButtonFont(ccw_button_font);
ccw_footer->setColorBody(ccw_col_footer); ccw_footer->setColorBody(ccw_col_footer);
@@ -305,7 +311,7 @@ void CComponentsWindow::initBody()
w_l_sidebar = ccw_left_sidebar->getWidth(); w_l_sidebar = ccw_left_sidebar->getWidth();
if (ccw_right_sidebar) if (ccw_right_sidebar)
w_r_sidebar = ccw_right_sidebar->getWidth(); w_r_sidebar = ccw_right_sidebar->getWidth();
int h_body = height - h_header - h_footer - fr_thickness; int h_body = height - h_header - h_footer - 2*fr_thickness;
int x_body = w_l_sidebar; int x_body = w_l_sidebar;
int w_body = width-2*fr_thickness - w_l_sidebar - w_r_sidebar; int w_body = width-2*fr_thickness - w_l_sidebar - w_r_sidebar;

View File

@@ -31,6 +31,7 @@
#define CCW_PERCENT - //placeholder for negative sign '-', used for discret dimensions parameters #define CCW_PERCENT - //placeholder for negative sign '-', used for discret dimensions parameters
//! Sub class of CComponentsForm. Shows a window with prepared items. //! Sub class of CComponentsForm. Shows a window with prepared items.
/*! /*!
CComponentsWindow provides prepared items like header, footer and a container for CComponentsWindow provides prepared items like header, footer and a container for
@@ -113,10 +114,12 @@ class CComponentsWindow : public CComponentsForm, CCHeaderTypes
const std::string& caption, const std::string& caption,
const std::string& iconname, const std::string& iconname,
CComponentsForm *parent, CComponentsForm *parent,
int shadow_mode, const int& shadow_mode,
fb_pixel_t color_frame, const fb_pixel_t& color_frame,
fb_pixel_t color_body, const fb_pixel_t& color_body,
fb_pixel_t color_shadow); const fb_pixel_t& color_shadow,
const int& frame_width
);
///initialize width and height ///initialize width and height
void initWindowSize(); void initWindowSize();
///initialize position ///initialize position
@@ -125,6 +128,7 @@ class CComponentsWindow : public CComponentsForm, CCHeaderTypes
///returns true, if current page is changed, see also: setCurrentPage() ///returns true, if current page is changed, see also: setCurrentPage()
bool isPageChanged(); bool isPageChanged();
public: public:
enum enum
{ {
@@ -171,6 +175,8 @@ class CComponentsWindow : public CComponentsForm, CCHeaderTypes
* @li optional: expects type fb_pixel_t, defines color color, default = COL_MENUCONTENT_PLUS_0 * @li optional: expects type fb_pixel_t, defines color color, default = COL_MENUCONTENT_PLUS_0
* @param[in] color_shadow * @param[in] color_shadow
* @li optional: expects type fb_pixel_t, defines shadow color, default = COL_SHADOW_PLUS_0 * @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
* *
* @note Discret dimensions parameters: values < 0 to -100 will be interpreted as percent values related to screen. * @note Discret dimensions parameters: values < 0 to -100 will be interpreted as percent values related to screen.
* For better readability please use placeholder 'CCW_PERCENT' as negative sign '-' \n * For better readability please use placeholder 'CCW_PERCENT' as negative sign '-' \n
@@ -185,9 +191,10 @@ class CComponentsWindow : public CComponentsForm, CCHeaderTypes
const std::string& iconname = "", const std::string& iconname = "",
CComponentsForm *parent = NULL, CComponentsForm *parent = NULL,
int shadow_mode = CC_SHADOW_OFF, int shadow_mode = CC_SHADOW_OFF,
fb_pixel_t color_frame = COL_FRAME_PLUS_0, const fb_pixel_t& color_frame = COL_FRAME_PLUS_0,
fb_pixel_t color_body = COL_MENUCONTENT_PLUS_0, const fb_pixel_t& color_body = COL_MENUCONTENT_PLUS_0,
fb_pixel_t color_shadow = COL_SHADOW_PLUS_0); const fb_pixel_t& color_shadow = COL_SHADOW_PLUS_0,
const int& frame_width = 0);
/** /**
* advanced constructor for CComponentsWindow, provides parameters for the most required properties * advanced constructor for CComponentsWindow, provides parameters for the most required properties
@@ -200,9 +207,10 @@ class CComponentsWindow : public CComponentsForm, CCHeaderTypes
const std::string& iconname = "", const std::string& iconname = "",
CComponentsForm *parent = NULL, CComponentsForm *parent = NULL,
int shadow_mode = CC_SHADOW_OFF, int shadow_mode = CC_SHADOW_OFF,
fb_pixel_t color_frame = COL_FRAME_PLUS_0, const fb_pixel_t& color_frame = COL_FRAME_PLUS_0,
fb_pixel_t color_body = COL_MENUCONTENT_PLUS_0, const fb_pixel_t& color_body = COL_MENUCONTENT_PLUS_0,
fb_pixel_t color_shadow = COL_SHADOW_PLUS_0); const fb_pixel_t& color_shadow = COL_SHADOW_PLUS_0,
const int& frame_width = 0);
virtual ~CComponentsWindow(){}; virtual ~CComponentsWindow(){};
@@ -415,7 +423,7 @@ class CComponentsWindow : public CComponentsForm, CCHeaderTypes
/** /**
* Reinit position and dimensions and reinitialize mostly elemenatary properties * Reinit position and dimensions and reinitialize mostly elemenatary properties
*/ */
void Refresh(){initCCWItems();}; void Refresh(){initCCWItems();}
/** /**
* Paint window * Paint window
@@ -458,9 +466,10 @@ class CComponentsWindowMax : public CComponentsWindow
CComponentsWindowMax( const std::string& caption, const std::string& iconname = "", CComponentsWindowMax( const std::string& caption, const std::string& iconname = "",
CComponentsForm *parent = NULL, CComponentsForm *parent = NULL,
int shadow_mode = CC_SHADOW_OFF, int shadow_mode = CC_SHADOW_OFF,
fb_pixel_t color_frame = COL_FRAME_PLUS_0, const fb_pixel_t& color_frame = COL_FRAME_PLUS_0,
fb_pixel_t color_body = COL_MENUCONTENT_PLUS_0, const fb_pixel_t& color_body = COL_MENUCONTENT_PLUS_0,
fb_pixel_t color_shadow = COL_SHADOW_PLUS_0); const fb_pixel_t& color_shadow = COL_SHADOW_PLUS_0,
const int& frame_width = 0);
/** /**
* Simple constructor for CComponentsWindow, this shows only a centered window based up current screen settings * Simple constructor for CComponentsWindow, this shows only a centered window based up current screen settings
@@ -472,9 +481,10 @@ class CComponentsWindowMax : public CComponentsWindow
CComponentsWindowMax( neutrino_locale_t locale_caption, const std::string& iconname = "", CComponentsWindowMax( neutrino_locale_t locale_caption, const std::string& iconname = "",
CComponentsForm *parent = NULL, CComponentsForm *parent = NULL,
int shadow_mode = CC_SHADOW_OFF, int shadow_mode = CC_SHADOW_OFF,
fb_pixel_t color_frame = COL_FRAME_PLUS_0, const fb_pixel_t& color_frame = COL_FRAME_PLUS_0,
fb_pixel_t color_body = COL_MENUCONTENT_PLUS_0, const fb_pixel_t& color_body = COL_MENUCONTENT_PLUS_0,
fb_pixel_t color_shadow = COL_SHADOW_PLUS_0); const fb_pixel_t& color_shadow = COL_SHADOW_PLUS_0,
const int& frame_width = 0);
}; };
#endif #endif