mirror of
https://github.com/tuxbox-fork-migrations/recycled-ni-neutrino.git
synced 2025-09-02 10:21:04 +02:00
Merge remote-tracking branch 'tuxbox/master'
Origin commit data
------------------
Commit: 7497722646
Author: Stefan Seyfried <seife@tuxbox-git.slipkontur.de>
Date: 2017-02-01 (Wed, 01 Feb 2017)
This commit is contained in:
@@ -57,6 +57,7 @@ CCDraw::CCDraw() : COSDFader(g_settings.theme.menu_Content_alpha)
|
||||
cc_save_bg = false;
|
||||
firstPaint = true;
|
||||
is_painted = false;
|
||||
force_paint_bg = false;
|
||||
paint_bg = true;
|
||||
cc_allow_paint = true;
|
||||
cc_enable_frame = true;
|
||||
@@ -546,7 +547,7 @@ void CCDraw::paintFbItems(bool do_save_bg)
|
||||
v_fbdata[i].is_painted = true;
|
||||
}
|
||||
}
|
||||
if (fbtype == CC_FBDATA_TYPE_SHADOW_BOX && ((!is_painted || !fbdata.is_painted)|| shadow_force)) {
|
||||
if (fbtype == CC_FBDATA_TYPE_SHADOW_BOX && ((!is_painted || !fbdata.is_painted)|| shadow_force || force_paint_bg)) {
|
||||
if (fbdata.enabled) {
|
||||
/* here we paint the shadow around the body
|
||||
* on 1st step we check for already cached screen buffer, if true
|
||||
@@ -629,15 +630,37 @@ void CCDraw::paintFbItems(bool do_save_bg)
|
||||
fbdata.pixbuf = getScreen(fbdata.x, fbdata.y, fbdata.dx, fbdata.dy);
|
||||
}
|
||||
}
|
||||
is_painted = v_fbdata[i].is_painted = true;
|
||||
v_fbdata[i].is_painted = true;
|
||||
OnAfterPaintBg();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//set is_painted attribut. if any layer was painted set it to true;
|
||||
if (force_paint_bg){
|
||||
is_painted = false;
|
||||
}else{
|
||||
for(size_t i=0; i< v_fbdata.size(); i++){
|
||||
if (v_fbdata[i].is_painted){
|
||||
is_painted = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//reset is painted ignore flag to default value
|
||||
force_paint_bg = false;
|
||||
|
||||
//pick up signal if filled
|
||||
OnAfterPaintLayers();
|
||||
}
|
||||
|
||||
bool CCDraw::isPainted()
|
||||
{
|
||||
return is_painted;
|
||||
}
|
||||
|
||||
void CCDraw::hide()
|
||||
{
|
||||
OnBeforeHide();
|
||||
@@ -652,8 +675,8 @@ void CCDraw::hide()
|
||||
}
|
||||
}
|
||||
}
|
||||
is_painted = false;
|
||||
firstPaint = true;
|
||||
is_painted = false;
|
||||
OnAfterHide();
|
||||
}
|
||||
|
||||
@@ -732,10 +755,10 @@ void CCDraw::enableShadow(int mode, const int& shadow_width, bool force_paint)
|
||||
|
||||
void CCDraw::paintTrigger()
|
||||
{
|
||||
if (!is_painted)
|
||||
paint1();
|
||||
else
|
||||
if (is_painted)
|
||||
hide();
|
||||
else
|
||||
paint();
|
||||
}
|
||||
|
||||
bool CCDraw::paintBlink(CComponentsTimer* Timer)
|
||||
|
@@ -115,6 +115,8 @@ class CCDraw : public COSDFader, public CComponentsSignals
|
||||
bool firstPaint;
|
||||
///status: true=component was rendered
|
||||
bool is_painted;
|
||||
///status: true= value is_painted would be ignored
|
||||
bool force_paint_bg;
|
||||
///mode: true=activate rendering of basic elements (frame, shadow and body)
|
||||
bool paint_bg;
|
||||
///mode: true=activate rendering of frame
|
||||
@@ -268,7 +270,7 @@ class CCDraw : public COSDFader, public CComponentsSignals
|
||||
virtual void disablePaintCache(){enablePaintCache(false);}
|
||||
|
||||
///returns paint mode, true=item was painted
|
||||
virtual bool isPainted(){return is_painted;}
|
||||
virtual bool isPainted();
|
||||
///allows paint of elementary item parts (shadow, frame and body), similar as background, set it usually to false, if item used in a form, returns true, if mode has changed, also cleans screnn buffer
|
||||
virtual bool doPaintBg(bool do_paint);
|
||||
///allows paint frame around body, default true , NOTE: ignored if frame width = 0
|
||||
@@ -353,10 +355,12 @@ class CCDraw : public COSDFader, public CComponentsSignals
|
||||
*/
|
||||
bool cancelBlink(bool keep_on_screen = false);
|
||||
|
||||
///signal on before paint fb layers, called inside paintFbItems()
|
||||
///signal on before paint fb layers, called before paint fb layers inside paintFbItems()
|
||||
sigc::signal<void> OnBeforePaintLayers;
|
||||
///signal on after paint fb layers, called inside paintFbItems()
|
||||
///signal on after paint fb layers, called after paint fb layers inside paintFbItems()
|
||||
sigc::signal<void> OnAfterPaintLayers;
|
||||
///signal on after paint background, called after paint of background box inside paintFbItems()
|
||||
sigc::signal<void> OnAfterPaintBg;
|
||||
|
||||
/*!
|
||||
Removes current item from screen and
|
||||
|
@@ -335,7 +335,8 @@ void CComponentsForm::exchangeCCItem(CComponentsItem* item_a, CComponentsItem* i
|
||||
void CComponentsForm::paintForm(bool do_save_bg)
|
||||
{
|
||||
//paint body
|
||||
paintInit(do_save_bg);
|
||||
if (!is_painted || force_paint_bg)
|
||||
paintInit(do_save_bg);
|
||||
|
||||
//paint
|
||||
paintCCItems();
|
||||
@@ -519,23 +520,7 @@ void CComponentsForm::paintCCItems()
|
||||
cc_item->allowPaint(item_visible);
|
||||
}
|
||||
}
|
||||
#if 0
|
||||
void CComponentsForm::hide()
|
||||
{
|
||||
// hack: ensure hiding of minitv during hide of forms and inherited classes,
|
||||
// because the handling of minitv items are different to other item types
|
||||
// and need an explizit call of hide()
|
||||
for(size_t i=0; i<v_cc_items.size(); i++) {
|
||||
if (v_cc_items[i]->getItemType() == CC_ITEMTYPE_PIP){
|
||||
v_cc_items[i]->kill();
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
//hide body
|
||||
CComponents::hide();
|
||||
}
|
||||
#endif
|
||||
//erase or paint over rendered objects
|
||||
void CComponentsForm::killCCItems(const fb_pixel_t& bg_color, bool ignore_parent)
|
||||
{
|
||||
@@ -692,3 +677,20 @@ bool CComponentsForm::enableColBodyGradient(const int& enable_mode, const fb_pix
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
void CComponentsForm::forceItemsPaint(bool force)
|
||||
{
|
||||
for (size_t i = 0; i < v_cc_items.size(); i++){
|
||||
dprintf(DEBUG_DEBUG, "\033[33m[CComponentsForm] [%s - %d] found item type = [%d] \033[0m\n", __func__, __LINE__, v_cc_items[i]->getItemType());
|
||||
if (v_cc_items[i]->getItemType() == CC_ITEMTYPE_TEXT){
|
||||
CComponentsText* text = static_cast <CComponentsText*>(v_cc_items[i]);
|
||||
text->forceTextPaint(force);
|
||||
dprintf(DEBUG_DEBUG, "\033[33m[CComponentsForm] [%s - %d] force repaint of item type CC_ITEMTYPE_TEXT [%u] content [%s]\033[0m\n", __func__, __LINE__, i, text->getText().c_str());
|
||||
}
|
||||
if (v_cc_items[i]->getItemType() == CC_ITEMTYPE_LABEL){
|
||||
CComponentsLabel* label = static_cast <CComponentsLabel*>(v_cc_items[i]);
|
||||
label ->forceTextPaint(force);
|
||||
dprintf(DEBUG_DEBUG, "\033[33m[CComponentsForm] [%s - %d] force repaint of item type CC_ITEMTYPE_LABEL [%u] content [%s]\033[0m\n", __func__, __LINE__, i, label->getText().c_str());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@@ -65,6 +65,11 @@ class CComponentsForm : public CComponentsItem
|
||||
const fb_pixel_t& color_body,
|
||||
const fb_pixel_t& color_shadow);
|
||||
|
||||
///force repaint of all possible text items
|
||||
void forceItemsPaint(bool force);
|
||||
///slot for background paint event, reserved for forceItemsPaint()
|
||||
sigc::slot0<void> sl_repaint;
|
||||
|
||||
public:
|
||||
CComponentsForm( const int x_pos = 0, const int y_pos = 0, const int w = 800, const int h = 600,
|
||||
CComponentsForm *parent = NULL,
|
||||
|
@@ -30,7 +30,7 @@
|
||||
|
||||
#include "cc_frm_clock.h"
|
||||
#include <time.h>
|
||||
|
||||
#include <sigc++/bind.h>
|
||||
#include <unistd.h>
|
||||
#include <errno.h>
|
||||
#include <ctype.h>
|
||||
@@ -98,7 +98,10 @@ CComponentsFrmClock::CComponentsFrmClock( const int& x_pos,
|
||||
initParent(parent);
|
||||
|
||||
//init slot for running clock
|
||||
cl_sl = sigc::mem_fun0(*this, &CComponentsFrmClock::ShowTime);
|
||||
cl_sl_show = sigc::mem_fun0(*this, &CComponentsFrmClock::ShowTime);
|
||||
|
||||
//init slot to ensure paint segments after painted background
|
||||
sl_repaint = sigc::bind<0>(sigc::mem_fun1(*this, &CComponentsFrmClock::forceItemsPaint), true);
|
||||
|
||||
//run clock already if required
|
||||
if (activ)
|
||||
@@ -297,6 +300,11 @@ void CComponentsFrmClock::initCCLockItems()
|
||||
x_lbl += v_cc_items[i-1]->getWidth();
|
||||
v_cc_items[i]->setPos(x_lbl, y_lbl);
|
||||
}
|
||||
|
||||
if(!OnAfterPaintBg.empty())
|
||||
OnAfterPaintBg.clear();
|
||||
//init slot to handle repaint of segments if background was repainted
|
||||
OnAfterPaintBg.connect(sl_repaint);
|
||||
}
|
||||
|
||||
|
||||
@@ -321,7 +329,8 @@ bool CComponentsFrmClock::startClock()
|
||||
cl_timer = new CComponentsTimer(0);
|
||||
if (cl_timer->OnTimer.empty()){
|
||||
dprintf(DEBUG_INFO,"\033[33m[CComponentsFrmClock]\t[%s] init slot...\033[0m\n", __func__);
|
||||
cl_timer->OnTimer.connect(cl_sl);
|
||||
cl_timer->OnTimer.connect(cl_sl_show);
|
||||
force_paint_bg = true;
|
||||
}
|
||||
}
|
||||
cl_timer->setTimerInterval(cl_interval);
|
||||
@@ -338,6 +347,7 @@ bool CComponentsFrmClock::stopClock()
|
||||
if (cl_timer){
|
||||
if (cl_timer->stopTimer()){
|
||||
dprintf(DEBUG_INFO, "[CComponentsFrmClock] [%s] stopping clock...\n", __func__);
|
||||
clear();
|
||||
delete cl_timer;
|
||||
cl_timer = NULL;
|
||||
return true;
|
||||
@@ -372,12 +382,12 @@ void CComponentsFrmClock::paint(bool do_save_bg)
|
||||
//prepare items before paint
|
||||
initCCLockItems();
|
||||
|
||||
if (!is_painted)
|
||||
force_paint_bg = false;
|
||||
|
||||
//paint form contents
|
||||
CComponentsForm::paint(do_save_bg);
|
||||
#if 0 //has no effect
|
||||
if (may_blit)
|
||||
frameBuffer->blit();
|
||||
#endif
|
||||
|
||||
}
|
||||
|
||||
void CComponentsFrmClock::setClockFont(Font *font, const int& style)
|
||||
|
@@ -52,7 +52,7 @@ class CComponentsFrmClock : public CComponentsForm, public CCTextScreen
|
||||
|
||||
protected:
|
||||
///slot for timer event, reserved for ShowTime()
|
||||
sigc::slot0<void> cl_sl;
|
||||
sigc::slot0<void> cl_sl_show;
|
||||
|
||||
///refresh interval in seconds
|
||||
int cl_interval;
|
||||
|
@@ -29,6 +29,8 @@
|
||||
#include <neutrino.h>
|
||||
#include "cc_frm_ext_text.h"
|
||||
|
||||
#include <sigc++/bind.h>
|
||||
|
||||
#define DEF_HEIGHT 27
|
||||
#define DEF_LABEL_WIDTH_PERCENT 30
|
||||
|
||||
@@ -112,56 +114,60 @@ void CComponentsExtTextForm::initVarExtTextForm(const int& x_pos, const int& y_p
|
||||
}
|
||||
ccx_label_align = ccx_text_align = CTextBox::NO_AUTO_LINEBREAK;
|
||||
|
||||
//init slot to ensure paint text items after painted background
|
||||
sl_repaint = sigc::bind<0>(sigc::mem_fun1(*this, &CComponentsExtTextForm::forceItemsPaint), true);
|
||||
|
||||
initParent(parent);
|
||||
|
||||
}
|
||||
|
||||
void CComponentsExtTextForm::initLabel()
|
||||
{
|
||||
//initialize label object
|
||||
if (ccx_label_obj == NULL){
|
||||
ccx_label_obj = new CComponentsLabel();
|
||||
ccx_label_obj->doPaintBg(!cc_txt_save_screen);
|
||||
ccx_label_obj->doPaintTextBoxBg(false);
|
||||
ccx_label_obj->enableTboxSaveScreen(cc_txt_save_screen);
|
||||
}
|
||||
//create ccx_label_obj and add to collection
|
||||
ccx_label_obj = new CComponentsLabel(this);
|
||||
ccx_label_obj->doPaintBg(false);
|
||||
}
|
||||
|
||||
//add label object
|
||||
if (!ccx_label_obj->isAdded())
|
||||
addCCItem(ccx_label_obj);
|
||||
|
||||
//set properties
|
||||
//set label properties
|
||||
if (ccx_label_obj){
|
||||
ccx_label_width = (ccx_percent_label_w * width/100);
|
||||
//assign general properties
|
||||
y_text = height/2 - height-2*fr_thickness;
|
||||
ccx_label_obj->setText(ccx_label_text, ccx_label_align, ccx_font);
|
||||
ccx_label_obj->setTextColor(ccx_label_color);
|
||||
ccx_label_obj->setDimensionsAll(0, y_text, ccx_label_width-2*fr_thickness, height-2*fr_thickness);
|
||||
ccx_label_obj->setCorner(this->corner_rad, CORNER_LEFT);
|
||||
ccx_label_obj->setColorBody(col_body);
|
||||
if (cc_body_gradient_enable != cc_body_gradient_enable_old)
|
||||
ccx_label_obj->getCTextBoxObject()->clearScreenBuffer();
|
||||
ccx_label_obj->setTextColor(ccx_label_color);
|
||||
ccx_label_obj->setText(ccx_label_text, ccx_label_align, ccx_font);
|
||||
ccx_label_obj->enableTboxSaveScreen(cc_body_gradient_enable || cc_txt_save_screen);
|
||||
|
||||
//corner of label item
|
||||
ccx_label_obj->setCorner(corner_rad-fr_thickness, CORNER_LEFT);
|
||||
}
|
||||
}
|
||||
|
||||
void CComponentsExtTextForm::initText()
|
||||
{
|
||||
//initialize text object
|
||||
//set text properties
|
||||
if (ccx_text_obj == NULL){
|
||||
ccx_text_obj = new CComponentsText();
|
||||
ccx_text_obj->doPaintBg(!cc_txt_save_screen);
|
||||
ccx_text_obj->doPaintTextBoxBg(false);
|
||||
ccx_text_obj->enableTboxSaveScreen(cc_txt_save_screen);
|
||||
//create ccx_text_obj and add to collection
|
||||
ccx_text_obj = new CComponentsText(this);
|
||||
ccx_text_obj->doPaintBg(false);
|
||||
}
|
||||
|
||||
//add text object
|
||||
if (!ccx_text_obj->isAdded())
|
||||
addCCItem(ccx_text_obj);
|
||||
|
||||
//set properties
|
||||
if (ccx_text_obj){
|
||||
ccx_text_width = width-ccx_label_obj->getWidth();
|
||||
ccx_text_obj->setText(ccx_text, ccx_text_align, ccx_font);
|
||||
ccx_text_obj->setTextColor(ccx_text_color);
|
||||
//assign general properties
|
||||
y_text = height/2 - height-2*fr_thickness;
|
||||
ccx_text_obj->setDimensionsAll(ccx_label_obj->getWidth(), y_text, ccx_text_width-2*fr_thickness, height-2*fr_thickness);
|
||||
ccx_text_obj->setCorner(this->corner_rad, CORNER_RIGHT);
|
||||
ccx_text_obj->setColorBody(col_body);
|
||||
if (cc_body_gradient_enable != cc_body_gradient_enable_old)
|
||||
ccx_text_obj->getCTextBoxObject()->clearScreenBuffer();
|
||||
ccx_text_obj->setTextColor(ccx_text_color);
|
||||
ccx_text_obj->setText(ccx_text, ccx_text_align, ccx_font);;
|
||||
ccx_text_obj->enableTboxSaveScreen(cc_body_gradient_enable || cc_txt_save_screen);
|
||||
|
||||
//corner of text item
|
||||
ccx_text_obj->setCorner(corner_rad-fr_thickness, CORNER_RIGHT);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -216,6 +222,11 @@ void CComponentsExtTextForm::initCCTextItems()
|
||||
{
|
||||
initLabel();
|
||||
initText();
|
||||
|
||||
if(!OnAfterPaintBg.empty())
|
||||
OnAfterPaintBg.clear();
|
||||
//init slot to handle repaint of text if background was repainted
|
||||
OnAfterPaintBg.connect(sl_repaint);
|
||||
}
|
||||
|
||||
void CComponentsExtTextForm::setLabelWidthPercent(const uint8_t& percent_val)
|
||||
|
@@ -30,6 +30,9 @@
|
||||
#include <neutrino.h>
|
||||
#include "cc_frm_header.h"
|
||||
#include <system/debug.h>
|
||||
|
||||
#include <sigc++/bind.h>
|
||||
|
||||
using namespace std;
|
||||
|
||||
//-------------------------------------------------------------------------------------------------------
|
||||
@@ -133,6 +136,9 @@ void CComponentsHeader::initVarHeader( const int& x_pos, const int& y_pos, const
|
||||
cch_cl_sec_format = cch_cl_format;
|
||||
cch_cl_enable_run = false;
|
||||
|
||||
//init slot to ensure paint segments after painted background
|
||||
sl_repaint = sigc::bind<0>(sigc::mem_fun1(*this, &CComponentsHeader::forceItemsPaint), true);
|
||||
|
||||
addContextButton(buttons);
|
||||
initCCItems();
|
||||
initParent(parent);
|
||||
@@ -146,6 +152,8 @@ CComponentsHeader::~CComponentsHeader()
|
||||
|
||||
void CComponentsHeader::setCaption(const std::string& caption, const int& align_mode, const fb_pixel_t& text_color)
|
||||
{
|
||||
if (cch_cl_obj)
|
||||
cch_cl_obj->Stop();
|
||||
cch_text = caption;
|
||||
cch_caption_align = align_mode;
|
||||
cch_col_text = text_color;
|
||||
@@ -153,8 +161,6 @@ void CComponentsHeader::setCaption(const std::string& caption, const int& align_
|
||||
|
||||
void CComponentsHeader::setCaption(neutrino_locale_t caption_locale, const int& align_mode, const fb_pixel_t& text_color)
|
||||
{
|
||||
if (cch_cl_obj)
|
||||
cch_cl_obj->Stop();
|
||||
setCaption(string(g_Locale->getText(caption_locale)), align_mode, text_color);
|
||||
}
|
||||
|
||||
@@ -362,10 +368,12 @@ void CComponentsHeader::enableClock(bool enable, const char* format, const char*
|
||||
{
|
||||
cch_cl_enable = enable;
|
||||
cch_cl_format = format;
|
||||
if (cch_cl_obj && cch_cl_enable)
|
||||
cch_cl_obj->clear();
|
||||
if (sec_format_str)
|
||||
cch_cl_sec_format = sec_format_str;
|
||||
cch_cl_enable_run = run;
|
||||
if (!enable){
|
||||
if (!cch_cl_enable){
|
||||
if (cch_cl_obj){
|
||||
cch_cl_enable_run = false;
|
||||
removeCCItem(cch_cl_obj);
|
||||
@@ -515,6 +523,11 @@ void CComponentsHeader::initCaption()
|
||||
*/
|
||||
//height = max(height, cch_text_obj->getHeight());
|
||||
}
|
||||
|
||||
if(!OnAfterPaintBg.empty())
|
||||
OnAfterPaintBg.clear();
|
||||
//init slot to handle repaint of text if background was repainted
|
||||
OnAfterPaintBg.connect(sl_repaint);
|
||||
}
|
||||
|
||||
void CComponentsHeader::initCCItems()
|
||||
@@ -537,14 +550,14 @@ void CComponentsHeader::initCCItems()
|
||||
//init text
|
||||
initCaption();
|
||||
}
|
||||
|
||||
|
||||
void CComponentsHeader::paint(bool do_save_bg)
|
||||
{
|
||||
//prepare items
|
||||
initCCItems();
|
||||
|
||||
|
||||
//paint form contents
|
||||
paintForm(do_save_bg);
|
||||
CComponentsForm::paint(do_save_bg);
|
||||
|
||||
//start clock if enabled
|
||||
if (cch_cl_obj){
|
||||
@@ -564,3 +577,14 @@ bool CComponentsHeader::enableColBodyGradient(const int& enable_mode, const fb_p
|
||||
return CComponentsForm::enableColBodyGradient(enable_mode, sec_color, dir);
|
||||
}
|
||||
|
||||
void CComponentsHeader::kill(const fb_pixel_t& bg_color, const int& corner_radius, const int& fblayer_type /*fbdata_type*/, bool disable_clock)
|
||||
{
|
||||
if (disable_clock)
|
||||
disableClock();
|
||||
|
||||
int rad = corner_radius;
|
||||
if (corner_radius == -1)
|
||||
rad = corner_rad;
|
||||
|
||||
CComponentsForm::kill(bg_color, rad, fblayer_type);
|
||||
}
|
||||
|
@@ -269,7 +269,7 @@ class CComponentsHeader : public CComponentsForm, public CCTextScreen
|
||||
///hides item, arg: no_restore see hideCCItem()
|
||||
void hide(){disableClock(); CComponents::hide();}
|
||||
///erase current screen without restore of background, it's similar to paintBackgroundBoxRel() from CFrameBuffer
|
||||
virtual void kill(){disableClock(); CComponentsForm::kill();}
|
||||
void kill(const fb_pixel_t& bg_color = COL_BACKGROUND_PLUS_0, const int& corner_radius = -1, const int& fblayer_type = CC_FBDATA_TYPES, bool disable_clock = true);
|
||||
|
||||
///set color gradient on/off, returns true if gradient mode was changed
|
||||
virtual bool enableColBodyGradient(const int& enable_mode, const fb_pixel_t& sec_color = 255 /*=COL_BACKGROUND*/, const int& direction = -1);
|
||||
|
@@ -78,7 +78,7 @@ void CComponentsText::initVarText( const int x_pos, const int y_pos, const int w
|
||||
int shadow_mode,
|
||||
fb_pixel_t color_text, fb_pixel_t color_frame, fb_pixel_t color_body, fb_pixel_t color_shadow)
|
||||
{
|
||||
cc_item_type = CC_ITEMBOX_TEXT;
|
||||
cc_item_type = CC_ITEMTYPE_TEXT;
|
||||
ct_font = font_text;
|
||||
ct_textbox = NULL;
|
||||
ct_text = text;
|
||||
@@ -180,7 +180,7 @@ void CComponentsText::initCCText()
|
||||
//send text to CTextBox object, but force text paint text if force_text_paint option is enabled
|
||||
//this is managed by CTextBox object itself
|
||||
ct_text_sent = ct_textbox->setText(&ct_text, ct_box.iWidth, force_text_paint);
|
||||
|
||||
|
||||
//set current text status, needed by textChanged()
|
||||
if (ct_text_sent){
|
||||
ct_old_text = ct_text;
|
||||
@@ -273,16 +273,19 @@ bool CComponentsText::setTextFromFile(const string& path_to_textfile, const int
|
||||
|
||||
void CComponentsText::paintText(bool do_save_bg)
|
||||
{
|
||||
paintInit(do_save_bg);
|
||||
initCCText();
|
||||
if (!is_painted)
|
||||
paintInit(do_save_bg);
|
||||
|
||||
if (ct_text_sent && cc_allow_paint)
|
||||
ct_textbox->paint();
|
||||
|
||||
ct_text_sent = false;
|
||||
}
|
||||
|
||||
void CComponentsText::paint(bool do_save_bg)
|
||||
{
|
||||
OnBeforePaint();
|
||||
paintText(do_save_bg);
|
||||
}
|
||||
|
||||
@@ -290,8 +293,21 @@ void CComponentsText::hide()
|
||||
{
|
||||
if (ct_textbox)
|
||||
ct_textbox->hide();
|
||||
ct_old_text = "";
|
||||
CComponents::hide();
|
||||
|
||||
ct_old_text.clear();
|
||||
CCDraw::hide();
|
||||
ct_force_text_paint = true;
|
||||
}
|
||||
|
||||
void CComponentsText::kill(const fb_pixel_t& bg_color, const int& corner_radius, const int& fblayer_type)
|
||||
{
|
||||
if (ct_textbox)
|
||||
ct_textbox->hide();
|
||||
|
||||
ct_old_text.clear();
|
||||
force_paint_bg = true;
|
||||
CCDraw::kill(bg_color, corner_radius, fblayer_type);
|
||||
ct_force_text_paint = true;
|
||||
}
|
||||
|
||||
void CComponentsText::setXPos(const int& xpos)
|
||||
|
@@ -138,6 +138,8 @@ class CComponentsText : public CCTextScreen, public CComponentsItem
|
||||
///default members to paint a text box and hide painted text
|
||||
///hide textbox
|
||||
void hide();
|
||||
///remove textbox from screen
|
||||
void kill(const fb_pixel_t& bg_color = COL_BACKGROUND_PLUS_0, const int& corner_radius = -1, const int& fblayer_type = CC_FBDATA_TYPES);
|
||||
///paint text box, parameter do_save_bg: default = true, causes fill of backckrond pixel buffer
|
||||
void paint(bool do_save_bg = CC_SAVE_SCREEN_YES);
|
||||
|
||||
@@ -277,6 +279,22 @@ class CComponentsLabel : public CComponentsText
|
||||
{
|
||||
cc_item_type = CC_ITEMTYPE_LABEL;
|
||||
};
|
||||
|
||||
CComponentsLabel( CComponentsForm *parent,
|
||||
const int x_pos = 10, const int y_pos = 10, const int w = 150, const int h = 50,
|
||||
std::string text = "",
|
||||
const int mode = CTextBox::AUTO_WIDTH,
|
||||
Font* font_text = NULL,
|
||||
const int& font_style = CComponentsText::FONT_STYLE_REGULAR,
|
||||
int shadow_mode = CC_SHADOW_OFF,
|
||||
fb_pixel_t color_text = COL_MENUCONTENTINACTIVE_TEXT,
|
||||
fb_pixel_t color_frame = COL_FRAME_PLUS_0,
|
||||
fb_pixel_t color_body = COL_MENUCONTENT_PLUS_0,
|
||||
fb_pixel_t color_shadow = COL_SHADOW_PLUS_0)
|
||||
:CComponentsText(x_pos, y_pos, w, h, text, mode, font_text, font_style, parent, shadow_mode, color_text, color_frame, color_body, color_shadow)
|
||||
{
|
||||
cc_item_type = CC_ITEMTYPE_LABEL;
|
||||
};
|
||||
};
|
||||
|
||||
#endif
|
||||
|
@@ -147,14 +147,6 @@ enum
|
||||
CC_ALONG_Y = 2
|
||||
};
|
||||
|
||||
enum
|
||||
{
|
||||
CC_ITEMBOX_ICON,
|
||||
CC_ITEMBOX_PICTURE,
|
||||
CC_ITEMBOX_TEXT,
|
||||
CC_ITEMBOX_CLOCK
|
||||
};
|
||||
|
||||
typedef struct cc_element_data_t
|
||||
{
|
||||
int type;
|
||||
|
Reference in New Issue
Block a user