mirror of
https://github.com/tuxbox-neutrino/neutrino.git
synced 2025-09-03 02:41:21 +02:00
Merge remote-tracking branch 'check/next-cc'
...only build-tested, needs fixes
This commit is contained in:
@@ -56,8 +56,8 @@ void CComponents::clearSavedScreen()
|
||||
|
||||
void CComponents::initVarBasic()
|
||||
{
|
||||
x = saved_screen.x = 1;
|
||||
y = saved_screen.y = 1;
|
||||
x = saved_screen.x = 0;
|
||||
y = saved_screen.y = 0;
|
||||
cc_xr = x;
|
||||
cc_yr = y;
|
||||
height = saved_screen.dy = CC_HEIGHT_MIN;
|
||||
|
@@ -110,8 +110,8 @@ void CComponentsForm::initVarForm()
|
||||
//CComponentsForm
|
||||
v_cc_items.clear();
|
||||
cc_item_type = CC_ITEMTYPE_FRM;
|
||||
append_h_offset = 0;
|
||||
append_v_offset = 0;
|
||||
append_x_offset = 0;
|
||||
append_y_offset = 0;
|
||||
}
|
||||
|
||||
void CComponentsForm::addCCItem(CComponentsItem* cc_Item)
|
||||
@@ -303,7 +303,7 @@ void CComponentsForm::paintCCItems()
|
||||
//set required x-position to item:
|
||||
//append vertical
|
||||
if (xpos == CC_APPEND){
|
||||
auto_x += append_h_offset;
|
||||
auto_x += append_x_offset;
|
||||
cc_item->setRealXPos(auto_x + xpos);
|
||||
auto_x += w_item;
|
||||
}
|
||||
@@ -320,7 +320,7 @@ void CComponentsForm::paintCCItems()
|
||||
//set required y-position to item
|
||||
//append hor
|
||||
if (ypos == CC_APPEND){
|
||||
auto_y += append_v_offset;
|
||||
auto_y += append_y_offset;
|
||||
cc_item->setRealYPos(auto_y + ypos);
|
||||
auto_y += h_item;
|
||||
}
|
||||
|
@@ -39,8 +39,8 @@ class CComponentsForm : public CComponentsItem
|
||||
///generates next possible index for an item, see also cc_item_index, getIndex(), setIndex()
|
||||
int genIndex();
|
||||
|
||||
int append_h_offset;
|
||||
int append_v_offset;
|
||||
int append_x_offset;
|
||||
int append_y_offset;
|
||||
public:
|
||||
|
||||
CComponentsForm();
|
||||
@@ -70,7 +70,7 @@ class CComponentsForm : public CComponentsItem
|
||||
///return size (count) of available items
|
||||
virtual size_t size(){return v_cc_items.size();};
|
||||
|
||||
virtual void setAppendOffset(const int &h_offset, const int& v_offset){append_h_offset = h_offset; append_v_offset = v_offset;};
|
||||
virtual void setAppendOffset(const int &x_offset, const int& y_offset){append_x_offset = x_offset; append_y_offset = y_offset;};
|
||||
};
|
||||
|
||||
#endif
|
||||
|
@@ -76,11 +76,10 @@ void CComponentsFrmClock::initVarClock( const int& x_pos, const int& y_pos, cons
|
||||
cl_thread = 0;
|
||||
cl_interval = 1;
|
||||
|
||||
activeClock = true;
|
||||
cl_blink_str = "";
|
||||
paintClock = false;
|
||||
|
||||
activeClock = activ;
|
||||
activeClock = activ;
|
||||
if (activeClock)
|
||||
startThread();
|
||||
}
|
||||
@@ -373,3 +372,12 @@ Font** CComponentsFrmClock::getClockFont()
|
||||
return cl_font;
|
||||
|
||||
}
|
||||
|
||||
void CComponentsFrmClock::setClockActiv(bool activ/* = true*/)
|
||||
{
|
||||
activeClock = activ;
|
||||
if (activ && !cl_thread)
|
||||
startThread();
|
||||
if (!activ && cl_thread)
|
||||
stopThread();
|
||||
}
|
||||
|
@@ -94,7 +94,7 @@ class CComponentsFrmClock : public CComponentsForm
|
||||
|
||||
public:
|
||||
CComponentsFrmClock( const int& x_pos = 1, const int& y_pos = 1, const int& w = 200, const int& h = 48,
|
||||
const char* format_str = "%H:%M", bool activ=true, bool has_shadow = CC_SHADOW_OFF,
|
||||
const char* format_str = "%H:%M", bool activ=false, bool has_shadow = CC_SHADOW_OFF,
|
||||
fb_pixel_t color_frame = COL_LIGHT_GRAY, fb_pixel_t color_body = COL_MENUCONTENT_PLUS_0, fb_pixel_t color_shadow = COL_MENUCONTENTDARK_PLUS_0);
|
||||
virtual ~CComponentsFrmClock();
|
||||
|
||||
@@ -134,7 +134,7 @@ class CComponentsFrmClock : public CComponentsForm
|
||||
virtual void refresh() { initCCLockItems(); }
|
||||
|
||||
///set clock activ/inactiv
|
||||
virtual void setClockActiv(bool activ = true){activeClock = activ;};
|
||||
virtual void setClockActiv(bool activ = true);
|
||||
};
|
||||
|
||||
#endif
|
||||
|
@@ -27,7 +27,7 @@
|
||||
|
||||
#include <global.h>
|
||||
#include <neutrino.h>
|
||||
#include "cc_frm.h"
|
||||
#include "cc_frm_footer.h"
|
||||
|
||||
using namespace std;
|
||||
|
||||
|
53
src/gui/components/cc_frm_footer.h
Normal file
53
src/gui/components/cc_frm_footer.h
Normal file
@@ -0,0 +1,53 @@
|
||||
/*
|
||||
Based up Neutrino-GUI - Tuxbox-Project
|
||||
Copyright (C) 2001 by Steffen Hehn 'McClean'
|
||||
|
||||
Classes for generic GUI-related components.
|
||||
Copyright (C) 2012, 2013, 2014, Thilo Graf 'dbt'
|
||||
|
||||
License: GPL
|
||||
|
||||
This program is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU General Public
|
||||
License as published by the Free Software Foundation; either
|
||||
version 2 of the License, or (at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#ifndef __CC_FORM_FOOTER_H__
|
||||
#define __CC_FORM_FOOTER_H__
|
||||
|
||||
|
||||
#include "cc_frm_header.h"
|
||||
|
||||
/*!
|
||||
CComponentsFooter, sub class of CComponentsHeader provides prepared container for footer
|
||||
Is mostly usable like a header but without caption, and context button icons.
|
||||
*/
|
||||
class CComponentsFooter : public CComponentsHeader
|
||||
{
|
||||
protected:
|
||||
void initVarFooter( const int& x_pos, const int& y_pos, const int& w, const int& h = 0,
|
||||
const int& buttons = 0,
|
||||
bool has_shadow = CC_SHADOW_OFF,
|
||||
fb_pixel_t color_frame = COL_MENUCONTENT_PLUS_6,
|
||||
fb_pixel_t color_body = COL_INFOBAR_SHADOW_PLUS_1,
|
||||
fb_pixel_t color_shadow = COL_MENUCONTENTDARK_PLUS_0);
|
||||
public:
|
||||
CComponentsFooter();
|
||||
CComponentsFooter( const int& x_pos, const int& y_pos, const int& w, const int& h = 0,
|
||||
const int& buttons = 0,
|
||||
bool has_shadow = CC_SHADOW_OFF,
|
||||
fb_pixel_t color_frame = COL_MENUCONTENT_PLUS_6,
|
||||
fb_pixel_t color_body = COL_INFOBAR_SHADOW_PLUS_1,
|
||||
fb_pixel_t color_shadow = COL_MENUCONTENTDARK_PLUS_0);
|
||||
};
|
||||
|
||||
#endif
|
@@ -32,7 +32,7 @@
|
||||
|
||||
//! Sub class of CComponentsForm. Shows a header with prepared items.
|
||||
/*!
|
||||
CComponentsHeader provides prepared items like icon, caption and context button icons
|
||||
CComponentsHeader provides prepared items like icon, caption and context button icons, mostly for usage in menues or simple windows
|
||||
*/
|
||||
class CComponentsHeader : public CComponentsForm
|
||||
{
|
||||
@@ -176,9 +176,9 @@ class CComponentsHeader : public CComponentsForm
|
||||
virtual void paint(bool do_save_bg = CC_SAVE_SCREEN_YES);
|
||||
};
|
||||
|
||||
//! Sub class of CComponentsHeader. Shows a header with prepared items.
|
||||
//! Sub class of CComponentsHeader.
|
||||
/*!
|
||||
CComponentsHeaderLocalized provides prepared items like icon, caption and context button icons
|
||||
CComponentsHeaderLocalized provides prepared items like icon, caption and context button icons, mostly for usage in menues or simple windows
|
||||
Caption is defined with locales.
|
||||
*/
|
||||
class CComponentsHeaderLocalized : public CComponentsHeader
|
||||
@@ -194,28 +194,4 @@ class CComponentsHeaderLocalized : public CComponentsHeader
|
||||
fb_pixel_t color_shadow = COL_MENUCONTENTDARK_PLUS_0);
|
||||
};
|
||||
|
||||
|
||||
/*!
|
||||
CComponentsFooter provides prepared container for footer
|
||||
Is mostly usable like a header but without caption, and context button icons.
|
||||
*/
|
||||
class CComponentsFooter : public CComponentsHeader
|
||||
{
|
||||
protected:
|
||||
void initVarFooter( const int& x_pos, const int& y_pos, const int& w, const int& h = 0,
|
||||
const int& buttons = 0,
|
||||
bool has_shadow = CC_SHADOW_OFF,
|
||||
fb_pixel_t color_frame = COL_MENUCONTENT_PLUS_6,
|
||||
fb_pixel_t color_body = COL_INFOBAR_SHADOW_PLUS_1,
|
||||
fb_pixel_t color_shadow = COL_MENUCONTENTDARK_PLUS_0);
|
||||
public:
|
||||
CComponentsFooter();
|
||||
CComponentsFooter( const int& x_pos, const int& y_pos, const int& w, const int& h = 0,
|
||||
const int& buttons = 0,
|
||||
bool has_shadow = CC_SHADOW_OFF,
|
||||
fb_pixel_t color_frame = COL_MENUCONTENT_PLUS_6,
|
||||
fb_pixel_t color_body = COL_INFOBAR_SHADOW_PLUS_1,
|
||||
fb_pixel_t color_shadow = COL_MENUCONTENTDARK_PLUS_0);
|
||||
};
|
||||
|
||||
#endif
|
||||
|
@@ -35,36 +35,34 @@ using namespace std;
|
||||
//sub class CComponentsIconForm inherit from CComponentsForm
|
||||
CComponentsIconForm::CComponentsIconForm()
|
||||
{
|
||||
initVarIconForm();
|
||||
initVarIconForm(1, 1, 0, 0, vector<string>());
|
||||
}
|
||||
|
||||
|
||||
CComponentsIconForm::CComponentsIconForm(const int x_pos, const int y_pos, const int w, const int h, const std::vector<std::string> &v_icon_names, bool has_shadow,
|
||||
fb_pixel_t color_frame, fb_pixel_t color_body, fb_pixel_t color_shadow)
|
||||
CComponentsIconForm::CComponentsIconForm( const int &x_pos, const int &y_pos, const int &w, const int &h,
|
||||
const std::vector<std::string> &v_icon_names,
|
||||
bool has_shadow,
|
||||
fb_pixel_t color_frame, fb_pixel_t color_body, fb_pixel_t color_shadow)
|
||||
{
|
||||
initVarIconForm();
|
||||
initVarIconForm(x_pos, y_pos, w, h, v_icon_names, has_shadow, color_frame, color_body, color_shadow);
|
||||
}
|
||||
|
||||
void CComponentsIconForm::initVarIconForm( const int &x_pos, const int &y_pos, const int &w, const int &h,
|
||||
const std::vector<std::string> &v_icon_names,
|
||||
bool has_shadow,
|
||||
fb_pixel_t color_frame, fb_pixel_t color_body, fb_pixel_t color_shadow)
|
||||
{
|
||||
cc_item_type = CC_ITEMTYPE_FRM_ICONFORM;
|
||||
|
||||
x = x_pos;
|
||||
y = y_pos;
|
||||
width = w;
|
||||
height = h;
|
||||
v_icons = v_icon_names;
|
||||
shadow = has_shadow;
|
||||
col_frame = color_frame;
|
||||
col_body = color_body;
|
||||
col_shadow = color_shadow;
|
||||
|
||||
v_icons = v_icon_names;
|
||||
}
|
||||
|
||||
void CComponentsIconForm::initVarIconForm()
|
||||
{
|
||||
cc_item_type = CC_ITEMTYPE_FRM_ICONFORM;
|
||||
|
||||
//set default width and height to 0, this causes a dynamic adaptation of width and height of form
|
||||
width = 0;
|
||||
height = 0;
|
||||
|
||||
v_icons.clear();
|
||||
ccif_offset = 2;
|
||||
ccif_icon_align = CC_ICONS_FRM_ALIGN_LEFT;
|
||||
}
|
||||
|
@@ -25,7 +25,6 @@
|
||||
#define __CC_FORM_ICONS_H__
|
||||
|
||||
#include "cc_frm.h"
|
||||
#include "cc_frm_icons.h"
|
||||
|
||||
class CComponentsIconForm : public CComponentsForm
|
||||
{
|
||||
@@ -35,12 +34,20 @@ class CComponentsIconForm : public CComponentsForm
|
||||
void initMaxHeight(int *pheight);
|
||||
|
||||
protected:
|
||||
void initVarIconForm();
|
||||
void initVarIconForm( const int &x_pos, const int &y_pos, const int &w, const int &h,
|
||||
const std::vector<std::string> &v_icon_names,
|
||||
bool has_shadow = CC_SHADOW_OFF,
|
||||
fb_pixel_t color_frame = COL_MENUCONTENT_PLUS_6,
|
||||
fb_pixel_t color_body = COL_MENUHEAD_PLUS_0,
|
||||
fb_pixel_t color_shadow = COL_MENUCONTENTDARK_PLUS_0);
|
||||
|
||||
public:
|
||||
CComponentsIconForm();
|
||||
CComponentsIconForm(const int x_pos, const int y_pos, const int w, const int h, const std::vector<std::string> &v_icon_names, bool has_shadow = CC_SHADOW_OFF,
|
||||
fb_pixel_t color_frame = COL_MENUCONTENT_PLUS_6, fb_pixel_t color_body = COL_MENUHEAD_PLUS_0, fb_pixel_t color_shadow = COL_MENUCONTENTDARK_PLUS_0);
|
||||
CComponentsIconForm( const int &x_pos, const int &y_pos, const int &w, const int &h,
|
||||
const std::vector<std::string> &v_icon_names,
|
||||
bool has_shadow = CC_SHADOW_OFF,
|
||||
fb_pixel_t color_frame = COL_MENUCONTENT_PLUS_6,
|
||||
fb_pixel_t color_body = COL_MENUHEAD_PLUS_0, fb_pixel_t color_shadow = COL_MENUCONTENTDARK_PLUS_0);
|
||||
// ~CComponentsIconForm(); //inherited from CComponentsForm
|
||||
|
||||
void paint(bool do_save_bg = CC_SAVE_SCREEN_YES);
|
||||
|
@@ -63,7 +63,7 @@ CSignalBar::CSignalBar(const int& xpos, const int& ypos, const int& w, const int
|
||||
void CSignalBar::initDimensions()
|
||||
{
|
||||
//set current required dimensions and font size
|
||||
sb_item_height = max(height, SB_MIN_HEIGHT) - 2*fr_thickness - append_h_offset;
|
||||
sb_item_height = max(height, SB_MIN_HEIGHT) - 2*fr_thickness - append_x_offset;
|
||||
sb_item_top = height/2 - sb_item_height/2;
|
||||
if (sb_scale_height == -1)
|
||||
sb_scale_height = sb_item_height;
|
||||
@@ -99,8 +99,8 @@ void CSignalBar::initVarSigBar()
|
||||
{
|
||||
corner_rad = 0;
|
||||
corner_type = 0;
|
||||
append_h_offset = 2;
|
||||
append_v_offset = 2;
|
||||
append_x_offset = 2;
|
||||
append_y_offset = 2;
|
||||
height = SB_MIN_HEIGHT;
|
||||
|
||||
sb_scale_height = -1;
|
||||
@@ -148,9 +148,9 @@ void CSignalBar::initSBarValue()
|
||||
}
|
||||
|
||||
//move and set dimensions
|
||||
int vlbl_x = sb_scale->getXPos() + sb_scale_width + append_v_offset;
|
||||
int vlbl_x = sb_scale->getXPos() + sb_scale_width + append_y_offset;
|
||||
int vlbl_h = sb_scale->getHeight();
|
||||
int vlbl_y = sb_item_height/2 + sb_item_top - vlbl_h/2 - append_h_offset;
|
||||
int vlbl_y = sb_item_height/2 + sb_item_top - vlbl_h/2 - append_x_offset;
|
||||
sb_vlbl->setDimensionsAll(vlbl_x, vlbl_y, sb_vlbl_width, vlbl_h);
|
||||
|
||||
//set current text and body color color
|
||||
@@ -176,7 +176,7 @@ void CSignalBar::initSBarName()
|
||||
//move and set dimensions
|
||||
int lbl_x = sb_vlbl->getXPos()+ sb_vlbl->getWidth();
|
||||
int lbl_h = sb_vlbl->getHeight();
|
||||
int lbl_y = sb_item_height/2 + sb_item_top - lbl_h/2 - append_h_offset;
|
||||
int lbl_y = sb_item_height/2 + sb_item_top - lbl_h/2 - append_x_offset;
|
||||
sb_lbl->setDimensionsAll(lbl_x, lbl_y, sb_lbl_width, lbl_h);
|
||||
|
||||
//set current text and body color
|
||||
@@ -308,7 +308,7 @@ void CSignalBox::initSignalItems()
|
||||
// int corr_y = sbx_bar_height%2;
|
||||
// int sb_h = sbx_bar_height - corr_y;
|
||||
|
||||
int sbar_h = sbx_bar_height - fr_thickness - append_v_offset/2;
|
||||
int sbar_h = sbx_bar_height - fr_thickness - append_y_offset/2;
|
||||
int sbar_w = sbx_bar_width - 2*fr_thickness;
|
||||
int sbar_x = sbx_bar_x + fr_thickness;
|
||||
int scale_h = sbar_h * 76 / 100;
|
||||
|
@@ -63,11 +63,24 @@ CComponentsWindow::CComponentsWindow( const int& x_pos, const int& y_pos, const
|
||||
initVarWindow(x_pos, y_pos, w, h, caption, iconname, has_shadow, color_frame, color_body, color_shadow);
|
||||
}
|
||||
|
||||
CComponentsWindowMax::CComponentsWindowMax(const string& caption, const string& iconname)
|
||||
:CComponentsWindow(0, 0, 0, 0, caption, iconname){};
|
||||
CComponentsWindowMax::CComponentsWindowMax( const string& caption,
|
||||
const string& iconname,
|
||||
bool has_shadow,
|
||||
fb_pixel_t color_frame,
|
||||
fb_pixel_t color_body,
|
||||
fb_pixel_t color_shadow)
|
||||
:CComponentsWindow(0, 0, 0, 0, caption,
|
||||
iconname, has_shadow, color_frame, color_body, color_shadow){};
|
||||
|
||||
CComponentsWindowMax::CComponentsWindowMax(neutrino_locale_t locale_caption, const string& iconname)
|
||||
:CComponentsWindow(0, 0, 0, 0, locale_caption != NONEXISTANT_LOCALE ? g_Locale->getText(locale_caption) : "", iconname){};
|
||||
CComponentsWindowMax::CComponentsWindowMax( neutrino_locale_t locale_caption,
|
||||
const string& iconname,
|
||||
bool has_shadow,
|
||||
fb_pixel_t color_frame,
|
||||
fb_pixel_t color_body,
|
||||
fb_pixel_t color_shadow)
|
||||
:CComponentsWindow(0, 0, 0, 0,
|
||||
locale_caption != NONEXISTANT_LOCALE ? g_Locale->getText(locale_caption) : "",
|
||||
iconname, has_shadow, color_frame, color_body, color_shadow){};
|
||||
|
||||
void CComponentsWindow::initVarWindow( const int& x_pos, const int& y_pos, const int& w, const int& h,
|
||||
const string& caption,
|
||||
@@ -80,13 +93,14 @@ void CComponentsWindow::initVarWindow( const int& x_pos, const int& y_pos, const
|
||||
//CComponentsForm
|
||||
cc_item_type = CC_ITEMTYPE_FRM_WINDOW;
|
||||
|
||||
//using current screen settings for default dimensions, do use full screen if default values for width/height = 0
|
||||
int w_tmp = frameBuffer->getScreenWidth(w == 0 ? true : false);
|
||||
int h_tmp = frameBuffer->getScreenHeight(h == 0 ? true : false);
|
||||
width = w == 0 ? w_tmp : w;
|
||||
height = h == 0 ? h_tmp : h;
|
||||
x = x_pos;
|
||||
y = y_pos;
|
||||
//using current screen settings for default dimensions,
|
||||
//do use full screen (from osd-settings) if default values for width/height = 0
|
||||
x = x_pos;
|
||||
y = y_pos;
|
||||
width = w;
|
||||
height = h;
|
||||
initWindowSize();
|
||||
initWindowPos();
|
||||
|
||||
ccw_caption = caption;
|
||||
ccw_icon_name = iconname;
|
||||
@@ -110,9 +124,31 @@ void CComponentsWindow::initVarWindow( const int& x_pos, const int& y_pos, const
|
||||
initCCWItems();
|
||||
}
|
||||
|
||||
void CComponentsWindow::initWindowSize()
|
||||
{
|
||||
if (cc_parent)
|
||||
return;
|
||||
|
||||
if (width == 0)
|
||||
width = frameBuffer->getScreenWidth();
|
||||
if (height == 0)
|
||||
height = frameBuffer->getScreenHeight();
|
||||
}
|
||||
|
||||
void CComponentsWindow::initWindowPos()
|
||||
{
|
||||
if (cc_parent)
|
||||
return;
|
||||
|
||||
if (x == 0)
|
||||
x = frameBuffer->getScreenX();
|
||||
if (y == 0)
|
||||
y = frameBuffer->getScreenY();
|
||||
}
|
||||
|
||||
void CComponentsWindow::doCenter(){
|
||||
x = cc_parent ? cc_parent->getWidth() - width/2 : frameBuffer->getScreenWidth(true)/2 - width/2;
|
||||
y = cc_parent ? cc_parent->getHeight() - height/2 : frameBuffer->getScreenHeight(true)/2 -height/2;
|
||||
x = cc_parent ? cc_parent->getWidth() - width/2 : getScreenStartX(width);
|
||||
y = cc_parent ? cc_parent->getHeight() - height/2 : getScreenStartY(height);
|
||||
}
|
||||
|
||||
void CComponentsWindow::setWindowCaption(neutrino_locale_t locale_text, const int& align_mode)
|
||||
@@ -129,7 +165,7 @@ void CComponentsWindow::initHeader()
|
||||
//set header properties //TODO: assigned properties with internal header objekt have no effect!
|
||||
if (ccw_head){
|
||||
ccw_head->setWidth(width-2*fr_thickness);
|
||||
// ccw_head->setPos(0, 0);
|
||||
ccw_head->setPos(0, 0);
|
||||
ccw_head->setIcon(ccw_icon_name);
|
||||
ccw_head->setCaption(ccw_caption, ccw_align_mode);
|
||||
ccw_head->setDefaultButtons(ccw_buttons);
|
||||
@@ -176,10 +212,6 @@ void CComponentsWindow::initCCWItems()
|
||||
#ifdef DEBUG_CC
|
||||
printf("[CComponentsWindow] [%s - %d] init items...\n", __func__, __LINE__);
|
||||
#endif
|
||||
initHeader();
|
||||
initFooter();
|
||||
initBody();
|
||||
|
||||
//add/remove header if required
|
||||
if (ccw_show_header){
|
||||
initHeader();
|
||||
@@ -200,6 +232,8 @@ void CComponentsWindow::initCCWItems()
|
||||
}
|
||||
}
|
||||
|
||||
initBody();
|
||||
|
||||
//add header, body and footer items only one time
|
||||
if (ccw_head)
|
||||
if (!ccw_head->isAdded())
|
||||
|
@@ -27,6 +27,7 @@
|
||||
#include "cc_frm.h"
|
||||
#include "cc_frm_icons.h"
|
||||
#include "cc_frm_header.h"
|
||||
#include "cc_frm_footer.h"
|
||||
|
||||
//! Sub class of CComponentsForm. Shows a window with prepared items.
|
||||
/*!
|
||||
@@ -91,6 +92,10 @@ class CComponentsWindow : public CComponentsForm
|
||||
fb_pixel_t color_shadow = COL_MENUCONTENTDARK_PLUS_0);
|
||||
///allow centering of window on screen, mostly senseful for window object without parent
|
||||
void doCenter();
|
||||
///initialize width and height
|
||||
void initWindowSize();
|
||||
///initialize position
|
||||
void initWindowPos();
|
||||
|
||||
public:
|
||||
enum
|
||||
@@ -158,13 +163,19 @@ class CComponentsWindow : public CComponentsForm
|
||||
class CComponentsWindowMax : public CComponentsWindow
|
||||
{
|
||||
public:
|
||||
///simple constructor for CComponentsWindow, provides parameters for caption as string and icon, position of window is general centered and bound
|
||||
///to current screen settings, this shows a window over full screen
|
||||
CComponentsWindowMax(const std::string& caption, const std::string& iconname = "");
|
||||
///simple constructor for CComponentsWindow, provides parameters for caption as string and icon, this shows a centered window based up current screen settings
|
||||
CComponentsWindowMax( const std::string& caption, const std::string& iconname = "",
|
||||
bool has_shadow = CC_SHADOW_OFF,
|
||||
fb_pixel_t color_frame = COL_MENUCONTENT_PLUS_6,
|
||||
fb_pixel_t color_body = COL_MENUCONTENT_PLUS_0,
|
||||
fb_pixel_t color_shadow = COL_MENUCONTENTDARK_PLUS_0);
|
||||
|
||||
///simple constructor for CComponentsWindow, provides parameters for caption from locales and icon, position of window is general centered and bound
|
||||
///to current screen settings, this shows a window over full screen
|
||||
CComponentsWindowMax(neutrino_locale_t locale_caption, const std::string& iconname = "");
|
||||
///simple constructor for CComponentsWindow, provides parameters for caption from locales and icon, this shows a centered window based up current screen settings
|
||||
CComponentsWindowMax( neutrino_locale_t locale_caption, const std::string& iconname = "",
|
||||
bool has_shadow = CC_SHADOW_OFF,
|
||||
fb_pixel_t color_frame = COL_MENUCONTENT_PLUS_6,
|
||||
fb_pixel_t color_body = COL_MENUCONTENT_PLUS_0,
|
||||
fb_pixel_t color_shadow = COL_MENUCONTENTDARK_PLUS_0);
|
||||
};
|
||||
|
||||
#endif
|
||||
|
@@ -40,26 +40,32 @@ using namespace std;
|
||||
|
||||
//-------------------------------------------------------------------------------------------------------
|
||||
//sub class CComponentsPicture from CComponentsItem
|
||||
CComponentsPicture::CComponentsPicture( const int x_pos, const int y_pos, const int w, const int h,
|
||||
const std::string& image_name, const int alignment, bool has_shadow,
|
||||
CComponentsPicture::CComponentsPicture( const int &x_pos, const int &y_pos, const int &w, const int &h,
|
||||
const std::string& image_name, const int &alignment, bool has_shadow,
|
||||
fb_pixel_t color_frame, fb_pixel_t color_background, fb_pixel_t color_shadow)
|
||||
{
|
||||
init(x_pos, y_pos, image_name, alignment, has_shadow, color_frame, color_background, color_shadow);
|
||||
|
||||
width = w;
|
||||
height = h;
|
||||
pic_paint_mode = CC_PIC_IMAGE_MODE_AUTO,
|
||||
|
||||
initVarPicture();
|
||||
init(x_pos, y_pos, w, h, image_name, alignment, has_shadow, color_frame, color_background, color_shadow);
|
||||
}
|
||||
|
||||
void CComponentsPicture::init( int x_pos, int y_pos, const string& image_name, const int alignment, bool has_shadow,
|
||||
void CComponentsPicture::init( const int &x_pos, const int &y_pos, const int &w, const int &h, const string& image_name, const int &alignment, bool has_shadow,
|
||||
fb_pixel_t color_frame, fb_pixel_t color_background, fb_pixel_t color_shadow)
|
||||
{
|
||||
//CComponents, CComponentsItem
|
||||
cc_item_type = CC_ITEMTYPE_PICTURE;
|
||||
|
||||
//CComponents
|
||||
x = pic_x = x_pos;
|
||||
y = pic_y = y_pos;
|
||||
height = h;
|
||||
width = w;
|
||||
shadow = has_shadow;
|
||||
shadow_w = SHADOW_OFFSET;
|
||||
col_frame = color_frame;
|
||||
col_body = color_background;
|
||||
col_shadow = color_shadow;
|
||||
|
||||
//CComponentsPicture
|
||||
pic_paint_mode = CC_PIC_IMAGE_MODE_AUTO,
|
||||
pic_name = image_name;
|
||||
pic_align = alignment;
|
||||
pic_offset = 1;
|
||||
@@ -72,33 +78,24 @@ void CComponentsPicture::init( int x_pos, int y_pos, const string& image_name, c
|
||||
if (pic_name.empty())
|
||||
pic_width = pic_height = 0;
|
||||
|
||||
//CComponents
|
||||
x = pic_x = x_pos;
|
||||
y = pic_y = y_pos;
|
||||
height = 0;
|
||||
width = 0;
|
||||
shadow = has_shadow;
|
||||
shadow_w = SHADOW_OFFSET;
|
||||
col_frame = color_frame;
|
||||
col_body = color_background;
|
||||
col_shadow = color_shadow;
|
||||
initCCItem();
|
||||
}
|
||||
|
||||
void CComponentsPicture::setPicture(const std::string& picture_name)
|
||||
{
|
||||
pic_name = picture_name;
|
||||
initVarPicture();
|
||||
initCCItem();
|
||||
}
|
||||
|
||||
|
||||
void CComponentsPicture::setPictureAlign(const int alignment)
|
||||
{
|
||||
pic_align = alignment;
|
||||
initVarPicture();
|
||||
pic_align = alignment;
|
||||
initCCItem();
|
||||
}
|
||||
|
||||
|
||||
void CComponentsPicture::initVarPicture()
|
||||
void CComponentsPicture::initCCItem()
|
||||
{
|
||||
pic_width = pic_height = 0;
|
||||
pic_painted = false;
|
||||
@@ -146,6 +143,11 @@ void CComponentsPicture::initVarPicture()
|
||||
int sw = (shadow ? shadow_w :0);
|
||||
width = max(max(pic_width, pic_max_w), width) + sw ;
|
||||
height = max(max(pic_height, pic_max_h), height) + sw ;
|
||||
|
||||
#ifdef DEBUG_CC
|
||||
printf("[CComponentsPicture] %s initialized Image: ====>> %s\n\titem x = %d\n\tdx = %d (image dx = %d)\n\titem y = %d\n\titem dy = %d (image dy = %d)\n",
|
||||
__func__, pic_name.c_str(), x, width, pic_width, y, height, pic_height);
|
||||
#endif
|
||||
}
|
||||
|
||||
void CComponentsPicture::initPosition()
|
||||
@@ -181,7 +183,7 @@ void CComponentsPicture::paintPicture()
|
||||
|
||||
if (do_paint && cc_allow_paint){
|
||||
#ifdef DEBUG_CC
|
||||
printf(" [CComponentsPicture] %s: paint image: %s (do_paint=%d)\n", __func__, pic_name.c_str(), do_paint);
|
||||
printf(" [CComponentsPicture] %s: paint image: %s (do_paint=%d) with mode %d\n", __func__, pic_name.c_str(), do_paint, pic_paint_mode);
|
||||
#endif
|
||||
if (pic_paint_mode == CC_PIC_IMAGE_MODE_OFF)
|
||||
pic_painted = frameBuffer->paintIcon(pic_name, pic_x, pic_y, 0 /*pic_max_h*/, pic_offset, pic_paint, pic_paintBg, col_body);
|
||||
@@ -195,7 +197,7 @@ void CComponentsPicture::paintPicture()
|
||||
|
||||
void CComponentsPicture::paint(bool do_save_bg)
|
||||
{
|
||||
initVarPicture();
|
||||
initCCItem();
|
||||
paintInit(do_save_bg);
|
||||
paintPicture();
|
||||
}
|
||||
@@ -207,9 +209,9 @@ void CComponentsPicture::hide(bool no_restore)
|
||||
}
|
||||
|
||||
|
||||
CComponentsChannelLogo::CComponentsChannelLogo( const int x_pos, const int y_pos, const int w, const int h,
|
||||
CComponentsChannelLogo::CComponentsChannelLogo( const int &x_pos, const int &y_pos, const int &w, const int &h,
|
||||
const uint64_t& channelId, const std::string& channelName,
|
||||
const int alignment, bool has_shadow,
|
||||
const int &alignment, bool has_shadow,
|
||||
fb_pixel_t color_frame, fb_pixel_t color_background, fb_pixel_t color_shadow)
|
||||
:CComponentsPicture(x_pos, y_pos, w, h,
|
||||
"", alignment, has_shadow,
|
||||
@@ -246,11 +248,11 @@ void CComponentsChannelLogo::initVarPictureChannellLogo()
|
||||
if (!has_logo)
|
||||
pic_name = tmp_logo;
|
||||
|
||||
// #ifdef DEBUG_CC
|
||||
#ifdef DEBUG_CC
|
||||
printf("\t[CComponentsChannelLogo] %s: init image: %s (has_logo=%d, channel_id=%" PRIu64 ")\n", __func__, pic_name.c_str(), has_logo, channel_id);
|
||||
// #endif
|
||||
#endif
|
||||
|
||||
initVarPicture();
|
||||
initCCItem();
|
||||
}
|
||||
|
||||
void CComponentsChannelLogo::paint(bool do_save_bg)
|
||||
|
@@ -43,9 +43,6 @@ Picture is usable like each other CCItems.
|
||||
class CComponentsPicture : public CComponentsItem
|
||||
{
|
||||
protected:
|
||||
///initialize all required attributes
|
||||
void initVarPicture();
|
||||
|
||||
///some internal modes for icon and image handling
|
||||
enum
|
||||
{
|
||||
@@ -62,25 +59,36 @@ class CComponentsPicture : public CComponentsItem
|
||||
bool pic_paint, pic_paintBg, pic_painted, do_paint;
|
||||
int pic_align, pic_x, pic_y, pic_width, pic_height;
|
||||
int pic_max_w, pic_max_h, pic_paint_mode;
|
||||
|
||||
void init( const int x_pos, const int y_pos, const std::string& image_name, const int alignment, bool has_shadow,
|
||||
fb_pixel_t color_frame, fb_pixel_t color_background, fb_pixel_t color_shadow);
|
||||
|
||||
|
||||
void init( const int &x_pos, const int &y_pos, const int &w, const int &h,
|
||||
const std::string& image_name,
|
||||
const int &alignment,
|
||||
bool has_shadow,
|
||||
fb_pixel_t color_frame,
|
||||
fb_pixel_t color_background,
|
||||
fb_pixel_t color_shadow);
|
||||
|
||||
///initialize all required attributes
|
||||
void initCCItem();
|
||||
///initialize position of picture object dependendly from settings
|
||||
void initPosition();
|
||||
void paintPicture();
|
||||
|
||||
|
||||
public:
|
||||
CComponentsPicture( const int x_pos, const int y_pos, const int w, const int h,
|
||||
const std::string& image_name, const int alignment = CC_ALIGN_HOR_CENTER | CC_ALIGN_VER_CENTER, bool has_shadow = CC_SHADOW_OFF,
|
||||
fb_pixel_t color_frame = COL_MENUCONTENT_PLUS_6, fb_pixel_t color_background = 0, fb_pixel_t color_shadow = COL_MENUCONTENTDARK_PLUS_0);
|
||||
|
||||
CComponentsPicture( const int &x_pos, const int &y_pos, const int &w, const int &h,
|
||||
const std::string& image_name,
|
||||
const int &alignment = CC_ALIGN_HOR_CENTER | CC_ALIGN_VER_CENTER,
|
||||
bool has_shadow = CC_SHADOW_OFF,
|
||||
fb_pixel_t color_frame = COL_MENUCONTENT_PLUS_6,
|
||||
fb_pixel_t color_background = 0,
|
||||
fb_pixel_t color_shadow = COL_MENUCONTENTDARK_PLUS_0);
|
||||
|
||||
virtual inline void setPictureOffset(const unsigned char offset){pic_offset = offset;};
|
||||
virtual inline void setPicturePaint(bool paint_p){pic_paint = paint_p;};
|
||||
virtual inline void setPicturePaintBackground(bool paintBg){pic_paintBg = paintBg;};
|
||||
virtual void setPicture(const std::string& picture_name);
|
||||
virtual void setPictureAlign(const int alignment);
|
||||
|
||||
|
||||
virtual inline bool isPicPainted(){return pic_painted;};
|
||||
virtual void paint(bool do_save_bg = CC_SAVE_SCREEN_YES);
|
||||
virtual void hide(bool no_restore = false);
|
||||
@@ -101,10 +109,14 @@ class CComponentsChannelLogo : public CComponentsPicture, CPictureViewer
|
||||
bool has_logo;
|
||||
|
||||
public:
|
||||
CComponentsChannelLogo( const int x_pos, const int y_pos, const int w, const int h,
|
||||
const uint64_t& channelId =0, const std::string& channelName = "",
|
||||
const int alignment = CC_ALIGN_HOR_CENTER | CC_ALIGN_VER_CENTER, bool has_shadow = CC_SHADOW_OFF,
|
||||
fb_pixel_t color_frame = COL_MENUCONTENT_PLUS_6, fb_pixel_t color_background = 0, fb_pixel_t color_shadow = COL_MENUCONTENTDARK_PLUS_0);
|
||||
CComponentsChannelLogo( const int &x_pos, const int &y_pos, const int &w, const int &h,
|
||||
const uint64_t& channelId =0,
|
||||
const std::string& channelName = "",
|
||||
const int &alignment = CC_ALIGN_HOR_CENTER | CC_ALIGN_VER_CENTER,
|
||||
bool has_shadow = CC_SHADOW_OFF,
|
||||
fb_pixel_t color_frame = COL_MENUCONTENT_PLUS_6,
|
||||
fb_pixel_t color_background = 0,
|
||||
fb_pixel_t color_shadow = COL_MENUCONTENTDARK_PLUS_0);
|
||||
|
||||
void setChannel(const uint64_t& channelId, const std::string& channelName);
|
||||
void setPicture(const std::string& picture_name);
|
||||
|
Reference in New Issue
Block a user