navibar: add method to set separator line modes

Current behavior is not touched, means: both lines are enabled as default.
This commit is contained in:
2022-01-15 17:16:42 +01:00
parent f46c9abdff
commit e213efe13a
2 changed files with 42 additions and 8 deletions

View File

@@ -63,6 +63,7 @@ CNaviBar::CNaviBar( const int &x_pos,
nb_bottomline = NULL;
nb_lpic_enable = nb_rpic_enable = false;
nb_l_text = nb_r_text = string();
nb_bline_mode = CNaviBar::NB_BLINE_TOP | CNaviBar::NB_BLINE_BOTTOM;
initCCItems();
}
@@ -77,10 +78,19 @@ void CNaviBar::initCCItems()
int grad = g_settings.theme.menu_Separator_gradient_enable ? CC_COLGRAD_COL_DARK_LIGHT_DARK : CC_COLGRAD_OFF;
// small separator line on the top
if (nb_bline_mode & NB_BLINE_TOP)
{
if (!nb_topline)
nb_topline = new CComponentsShapeSquare(0, 0, width, FRAME_WIDTH_MIN, this, CC_SHADOW_OFF);
nb_topline->setColorBody(COL_FRAME);
nb_topline->setColBodyGradient(grad, CFrameBuffer::gradientHorizontal, COL_MENUCONTENT_PLUS_0, CColorGradient::light);
}
else
{
if (nb_topline)
removeCCItem(nb_topline);
nb_topline = NULL;
}
// init left arrow
if (!nb_lpic)
@@ -126,11 +136,20 @@ void CNaviBar::initCCItems()
nb_rText->setXPos(nb_rpic->getXPos() - x_off - nb_rText->getWidth());
// small separator line on the bottom
if (nb_bline_mode & NB_BLINE_BOTTOM)
{
if (!nb_bottomline)
nb_bottomline = new CComponentsShapeSquare(0, height - FRAME_WIDTH_MIN, width, FRAME_WIDTH_MIN, this, CC_SHADOW_OFF);
nb_bottomline->setColorBody(COL_FRAME);
nb_bottomline->setColBodyGradient(grad, CFrameBuffer::gradientHorizontal, COL_MENUCONTENT_PLUS_0, CColorGradient::light);
}
else
{
if (nb_bottomline)
removeCCItem(nb_bottomline);
nb_bottomline = NULL;
}
}
void CNaviBar::paint(const bool &do_save_bg)

View File

@@ -50,6 +50,8 @@ class CNaviBar : public CComponentsFrmChain
std::string nb_l_text;
std::string nb_r_text;
int nb_bline_mode;
void initCCItems();
public:
@@ -87,6 +89,19 @@ class CNaviBar : public CComponentsFrmChain
//~CNaviBar(); //is inherited
enum
{
NB_BLINE_NONE = 0,
NB_BLINE_TOP = 1,
NB_BLINE_BOTTOM = 2,
};
/**
* Enable or disable top or bottom lines, alias separator lines
* @param[in] mode
* @li expects enum
*/
void setBorderLineMode(int mode) {nb_bline_mode = mode; initCCItems();}
/**
* Enable or disable left icon
* @param[in] enable