Merge remote-tracking branch 'check/next-cc'

This commit is contained in:
Stefan Seyfried
2014-01-12 14:41:44 +01:00
29 changed files with 620 additions and 520 deletions

View File

@@ -46,9 +46,12 @@ Basic attributes and member functions for component sub classes
#include "cc_frm_button.h"
#include "cc_frm_chain.h"
#include "cc_frm_clock.h"
#include "cc_frm_ext_text.h"
#include "cc_frm_header.h"
#include "cc_frm_icons.h"
#include "cc_frm_signalbars.h"
#include "cc_frm_slider.h"
#include "cc_frm_window.h"
#endif /*__N_COMPONENTS__*/

View File

@@ -44,7 +44,7 @@ CComponents::~CComponents()
{
hide();
clearSavedScreen();
clear();
clearFbData();
}
void CComponents::clearSavedScreen()
@@ -196,7 +196,7 @@ inline void CComponents::hide()
}
}
clear();
clearFbData();
is_painted = false;
}
@@ -205,13 +205,13 @@ void CComponents::kill()
{
for(size_t i =0; i< v_fbdata.size() ;i++)
frameBuffer->paintBackgroundBoxRel(v_fbdata[i].x, v_fbdata[i].y, v_fbdata[i].dx, v_fbdata[i].dy);
clear();
clearFbData();
firstPaint = true;
is_painted = false;
}
//clean old screen buffer
inline void CComponents::clear()
inline void CComponents::clearFbData()
{
for(size_t i =0; i< v_fbdata.size() ;i++)
if (v_fbdata[i].pixbuf)

View File

@@ -105,7 +105,7 @@ class CComponents
void paintFbItems(bool do_save_bg = true);
///clean up old screen buffer saved in v_fbdata
virtual void clear();
virtual void clearFbData();
///container: contains saved pixel buffer with position and dimensions
comp_screen_data_t saved_screen;
@@ -166,6 +166,8 @@ class CComponents
///set frame color
inline virtual void setColorFrame(fb_pixel_t color){col_frame = color;};
///set selected frame color
inline virtual void setColorFrameSel(fb_pixel_t color){col_frame_sel = color;};
///set body color
inline virtual void setColorBody(fb_pixel_t color){col_body = color;};
///set shadow color

View File

@@ -85,7 +85,7 @@ CComponentsDetailLine::~CComponentsDetailLine()
//paint details line with current parameters
void CComponentsDetailLine::paint(bool do_save_bg)
{
clear();
clearFbData();
int y_mark_top = y-h_mark_top/2+thickness/2;
int y_mark_down = y_down-h_mark_down/2+thickness/2;

View File

@@ -3,7 +3,7 @@
Copyright (C) 2001 by Steffen Hehn 'McClean'
Classes for generic GUI-related components.
Copyright (C) 2012, 2013, Thilo Graf 'dbt'
Copyright (C) 2012, 2013, 2014 Thilo Graf 'dbt'
Copyright (C) 2012, Michael Liebmann 'micha-bbg'
License: GPL
@@ -18,10 +18,8 @@
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, write to the
Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
Boston, MA 02110-1301, USA.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#ifdef HAVE_CONFIG_H
@@ -66,21 +64,11 @@ CComponentsForm::CComponentsForm(const int x_pos, const int y_pos, const int w,
CComponentsForm::~CComponentsForm()
{
cleanCCForm();
}
void CComponentsForm::cleanCCForm()
{
#ifdef DEBUG_CC
printf("[CComponentsForm] [%s - %d] clean up...\n", __func__, __LINE__);
#endif
clearCCItems();
clear();
}
void CComponentsForm::clearCCItems()
void CComponentsForm::clear()
{
if (v_cc_items.empty())
return;
@@ -355,6 +343,9 @@ void CComponentsForm::paintCCItems()
int right_item = cc_item->getRealXPos() + w_item;
int w_diff = right_item - right_frm;
int new_w = w_item - w_diff;
//avoid of width error due to odd values (1 line only)
right_item -= (new_w%2);
w_item -= (new_w%2);
if (right_item > right_frm){
printf("[CComponentsForm] %s: [form: %d] [item-index %d] [type=%d] width is too large, definied width=%d, possible width=%d \n",
__func__, cc_item_index, cc_item->getIndex(), cc_item->getItemType(), w_item, new_w);
@@ -366,6 +357,9 @@ void CComponentsForm::paintCCItems()
int bottom_item = cc_item->getRealYPos() + h_item;
int h_diff = bottom_item - bottom_frm;
int new_h = h_item - h_diff;
//avoid of height error due to odd values (1 line only)
bottom_item -= (new_h%2);
h_item -= (new_h%2);
if (bottom_item > bottom_frm){
printf("[CComponentsForm] %s: [form: %d] [item-index %d] [type=%d] height is too large, definied height=%d, possible height=%d \n",
__func__, cc_item_index, cc_item->getIndex(), cc_item->getItemType(), h_item, new_h);

View File

@@ -3,7 +3,7 @@
Copyright (C) 2001 by Steffen Hehn 'McClean'
Classes for generic GUI-related components.
Copyright (C) 2012, 2013, Thilo Graf 'dbt'
Copyright (C) 2012, 2013, 2014, Thilo Graf 'dbt'
License: GPL
@@ -17,10 +17,8 @@
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, write to the
Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
Boston, MA 02110-1301, USA.
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_H__
@@ -29,10 +27,6 @@
#include "config.h"
#include <gui/components/cc_base.h>
#include <gui/components/cc_item_text.h>
#include <gui/components/cc_item_picture.h>
#include <vector>
#include <string>
class CComponentsForm : public CComponentsItem
@@ -40,7 +34,7 @@ class CComponentsForm : public CComponentsItem
private:
void initVarForm();
protected:
std::vector<CComponentsItem*> v_cc_items;
std::vector<CComponentsItem*> v_cc_items;
void paintForm(bool do_save_bg);
///generates next possible index for an item, see also cc_item_index, getIndex(), setIndex()
int genIndex();
@@ -68,357 +62,15 @@ class CComponentsForm : public CComponentsItem
virtual int getCCItemId(CComponentsItem* cc_Item);
virtual CComponentsItem* getCCItem(const uint& cc_item_id);
virtual void paintCCItems();
virtual void clearCCItems();
virtual void cleanCCForm();
///clean up and deallocate existant items from v_cc_items at once
virtual void clear();
///return true, if no items available
virtual bool empty(){return v_cc_items.empty();};
///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;};
};
class CComponentsIconForm : public CComponentsForm
{
private:
std::vector<std::string> v_icons;
int ccif_offset, ccif_icon_align;
void initMaxHeight(int *pheight);
protected:
void initVarIconForm();
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(); //inherited from CComponentsForm
void paint(bool do_save_bg = CC_SAVE_SCREEN_YES);
void initCCIcons();
void addIcon(const std::string& icon_name);
void addIcon(std::vector<std::string> icon_name);
void removeIcons(){v_icons.clear();};
void insertIcon(const uint& icon_id, const std::string& icon_name);
void removeIcon(const uint& icon_id);
void removeIcon(const std::string& icon_name);
void removeAllIcons();
void setIconOffset(const int offset){ccif_offset = offset;};
enum //alignements
{
CC_ICONS_FRM_ALIGN_RIGHT ,
CC_ICONS_FRM_ALIGN_LEFT
};
void setIconAlign(int alignment){ccif_icon_align = alignment;};
int getIconId(const std::string& icon_name);
};
class CComponentsHeader : public CComponentsForm
{
private:
void initVarHeader();
protected:
CComponentsPicture * cch_icon_obj;
CComponentsText * cch_text_obj;
CComponentsIconForm * cch_btn_obj;
std::string cch_text;
const char* cch_icon_name;
fb_pixel_t cch_col_text;
Font* cch_font;
int cch_items_y, cch_icon_x, cch_icon_w, cch_text_x, cch_buttons, cch_buttons_w, cch_buttons_h, cch_buttons_space, cch_offset;
std::vector<std::string> v_cch_btn;
int cch_size_mode;
int cch_caption_align;
bool userHeight;
void initIcon();
void initCaption();
void initButtons();
void initDefaultButtons();
void initButtonFormSize();
public:
enum
{
CC_BTN_HELP = 0x02,
CC_BTN_INFO = 0x04,
CC_BTN_MENU = 0x40,
CC_BTN_EXIT = 0x80
};
enum
{
CC_HEADER_ITEM_ICON = 0,
CC_HEADER_ITEM_TEXT = 1,
CC_HEADER_ITEM_BUTTONS = 2
};
enum
{
CC_HEADER_SIZE_LARGE = 0,
CC_HEADER_SIZE_SMALL = 1
};
CComponentsHeader();
CComponentsHeader(const int x_pos, const int y_pos, const int w, const int h = 0, const std::string& caption = "header", const char* icon_name = NULL, 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_MENUHEAD_PLUS_0, fb_pixel_t color_shadow = COL_MENUCONTENTDARK_PLUS_0);
CComponentsHeader(const int x_pos, const int y_pos, const int w, const int h = 0, neutrino_locale_t caption_locale = NONEXISTANT_LOCALE, const char* icon_name = NULL, 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_MENUHEAD_PLUS_0, fb_pixel_t color_shadow = COL_MENUCONTENTDARK_PLUS_0);
virtual ~CComponentsHeader();
virtual void setCaption(const std::string& caption, const int& align_mode = CTextBox::NO_AUTO_LINEBREAK);
virtual void setCaption(neutrino_locale_t caption_locale, const int& align_mode = CTextBox::NO_AUTO_LINEBREAK);
virtual void setCaptionAlignment(const int& align_mode){cch_caption_align = align_mode;};
virtual void setCaptionFont(Font* font_name);
virtual void setCaptionColor(fb_pixel_t text_color){cch_col_text = text_color;};
virtual void setOffset(const int offset){cch_offset = offset;};
virtual void setIcon(const char* icon_name);
virtual void addButtonIcon(const std::string& button_name);
virtual void removeButtonIcons();
virtual void setDefaultButtons(const int buttons);
virtual void setButtonsSpace(const int buttons_space){cch_buttons_space = buttons_space;};
virtual void initCCItems();
virtual void setSizeMode(const int& size_mode){cch_size_mode = size_mode;};
virtual CComponentsText* getTextObject(){return cch_text_obj;};
virtual void paint(bool do_save_bg = CC_SAVE_SCREEN_YES);
};
class CComponentsFooter : public CComponentsHeader
{
protected:
void initVarFooter();
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);
};
//! Sub class of CComponentsForm. Shows a window with prepared items.
/*!
CComponentsWindow provides prepared items like header, footer and a container for
items like text, labels, pictures ...
*/
/*
x
y+-------------------------------------------------------+
|icon caption buttons |header (ccw_head)
+-x-----------------------------------------------------+
|cc_item0 |
|cc_item1 |body (ccw_body)
| add items here directly with |
| addWindowItem() or |
y with ccw_body->addCCItem() |
| Note: x/y related to body object |
| |
+-------------------------------------------------------+
| add cc_items with ccw_footer->addCCItem() |footer(ccw_footer)
+-------------------------------------------------------+
*/
class CComponentsWindow : public CComponentsForm
{
protected:
///object: header object, to get access to header properties see also getHeaderObject()
CComponentsHeader * ccw_head;
///object: body object, this is the container for all needed items, to add with addWindowItem()
CComponentsForm * ccw_body;
///object: footer object, to get access to header properties see also getFooterObject(
CComponentsFooter * ccw_footer;
///property: caption in header, see also getHeaderObject()
std::string ccw_caption;
///property: alignment mode for header caption
int ccw_align_mode;
///property: icon name in header, see also getHeaderObject()
const char* ccw_icon_name;
///property: assigned default icon buttons in header, see also getHeaderObject()
int ccw_buttons;
///property: value = true, let show footer, see showFooter()
bool ccw_show_footer;
///property: value = true, let show header, see showHeader()
bool ccw_show_header;
///initialze header object
void initHeader();
///initialze body object
void initBody();
///initialze footer object
void initFooter();
///initialze all window objects at once
void initCCWItems();
///initialize all attributes
void initVarWindow();
public:
enum
{
CC_WINDOW_ITEM_HEADER = 0
};
///simple constructor for CComponentsWindow
CComponentsWindow();
///advanced constructor for CComponentsWindow, provides parameters for the most required properties, and caption as string
CComponentsWindow( const int x_pos, const int y_pos, const int w, const int h,
const std::string& caption,
const char* iconname = NULL,
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);
///advanced constructor for CComponentsWindow, provides parameters for the most required properties, and caption from locales
CComponentsWindow( const int x_pos, const int y_pos, const int w, const int h,
neutrino_locale_t locale_caption,
const char* iconname = NULL,
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 as string and icon, position of window is general centered and bound
///to current screen settings, this shows a window over full screen
CComponentsWindow(const std::string& caption, const char* iconname = NULL);
///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
CComponentsWindow(neutrino_locale_t locale_caption, const char* iconname = NULL);
~CComponentsWindow();
///add item to body object, also usable is addCCItem() to add items to the windo object
void addWindowItem(CComponentsItem* cc_Item);
///allow/disallow paint a footer, default true, see also ccw_show_footer, showHeader()
void showFooter(bool show = true){ccw_show_footer = show; initCCWItems();};
///allow/disallow paint a header, default true, see also ccw_show_header, showFooter()
void showHeader(bool show = true){ccw_show_header = show; initCCWItems();};
///set caption in header with string, see also getHeaderObject()
void setWindowCaption(const std::string& text, const int& align_mode = CTextBox::NO_AUTO_LINEBREAK){ccw_caption = text; ccw_align_mode = align_mode;};
///set caption in header from locales, see also getHeaderObject()
void setWindowCaption(neutrino_locale_t locale_text, const int& align_mode = CTextBox::NO_AUTO_LINEBREAK);
///set caption alignment
void setWindowCaptionAlignment(const int& align_mode){ccw_align_mode = align_mode;};
///set icon name in header, see also getHeaderObject()
void setWindowIcon(const char* iconname){ccw_icon_name = iconname;};
///set default header icon buttons, see also getHeaderObject()
void setWindowHeaderButtons(const int& buttons){ccw_buttons = buttons;};
///returns a pointer to the internal header object, use this to get access to header properities
CComponentsHeader* getHeaderObject(){return ccw_head;};
///returns a pointer to the internal body object, use this to get access to body properities
CComponentsForm* getBodyObject(){return ccw_body;};
///returns a pointer to the internal footer object, use this to get access to footer properities
CComponentsFooter* getFooterObject(){return ccw_footer;};
///refresh position and dimension and reinitialize elemenatary properties
void Refresh(){initCCWItems();};
///paint all window items, this overwriting paint() from CComponentsForm
virtual void paint(bool do_save_bg = CC_SAVE_SCREEN_YES);
};
class CComponentsExtTextForm : public CComponentsForm
{
private:
///property: content of label, see also setLabelAndText()
std::string ccx_label_text;
///property: content of text, see also setLabelAndText()
std::string ccx_text;
///property: color of label text, see also setLabelAndTextColor()
fb_pixel_t ccx_label_color;
///property: color of text, see also setLabelAndTextColor()
fb_pixel_t ccx_text_color;
///property: mode of label text, see also setTextModes()
int ccx_label_align;
///property: mode of text, see also setTextModes()
int ccx_text_align;
///property: width of label, see also setLabelWidthPercent()
int ccx_label_width;
///property: width of text, see also setLabelWidthPercent()
int ccx_text_width;
///property: font type of both items (label and text), see also setLabelAndText()
Font* ccx_font;
///property: percentage val of label width related to full width, causes fit of text automatically into the available remaining size of item, see also setLabelWidthPercent()
uint8_t ccx_percent_label_w;
///object: label object
CComponentsLabel *ccx_label_obj;
///object: text object
CComponentsText *ccx_text_obj;
///initialize of properties for all objects
void initCCTextItems();
///initialize the label object
void initLabel();
///initialize the text object
void initText();
protected:
///initialize basic variables
void initVarExtTextForm(const int x_pos = 1, const int y_pos = 1, const int w = 300, const int h = 27,
bool has_shadow = CC_SHADOW_OFF,
fb_pixel_t label_color = COL_MENUCONTENTINACTIVE_TEXT,
fb_pixel_t text_color = COL_MENUCONTENT_TEXT,
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);
public:
///simple constructor for CComponentsExtTextForm
CComponentsExtTextForm();
///advanced constructor for CComponentsExtTextForm, provides parameters for the most required properties, and caption as string
CComponentsExtTextForm( const int x_pos, const int y_pos, const int w, const int h,
const std::string& label_text, const std::string& text,
bool has_shadow = CC_SHADOW_OFF,
fb_pixel_t label_color = COL_MENUCONTENTINACTIVE_TEXT,
fb_pixel_t text_color = COL_MENUCONTENT_TEXT,
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);
///advanced constructor for CComponentsExtTextForm, provides parameters for the most required properties, and caption as locales
CComponentsExtTextForm( const int x_pos, const int y_pos, const int w, const int h,
const neutrino_locale_t& locale_label_text, const neutrino_locale_t& locale_text,
bool has_shadow = CC_SHADOW_OFF,
fb_pixel_t label_color = COL_MENUCONTENTINACTIVE_TEXT,
fb_pixel_t text_color = COL_MENUCONTENT_TEXT,
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);
// ~CComponentsExtTextForm(); //inherited from CComponentsForm
///assigns texts for label and text, parameter as string, parameter Font is optional for required font type, default font is dependently from defined item height
void setLabelAndText(const std::string& label_text, const std::string& text, Font* font_text = NULL);
///assigns texts for label and text, parameter as neutrino_locale_t, parameter Font is optional for required font type, default font is dependently from defined item height
void setLabelAndText(const neutrino_locale_t& locale_label_text, const neutrino_locale_t& locale_text, Font* font_text = NULL);
///assigns text Font type
void setLabelAndTextFont(Font* font);
///assigns texts for label and text, parameter as struct (locale_ext_txt_t), parameters provide the same properties like setLabelAndText()
void setLabelAndTexts(const locale_ext_txt_t& texts);
///assigns texts for label and text, parameter as struct (string_ext_txt_t), parameters provide the same properties like setLabelAndText()
void setLabelAndTexts(const string_ext_txt_t& locale_texts);
///assigns colors for text for label text, parameter as fb_pixel_t
void setLabelAndTextColor(const fb_pixel_t label_color , const fb_pixel_t text_color);
///assigns width of label and text related to width, parameter as uint8_t in percent of width, fits text automatically into the available remaining size of item
void setLabelWidthPercent(const uint8_t& percent_val);
///returns a pointer to the internal label object, use this to get access to its most properties
CComponentsLabel*getLabelObject(){return ccx_label_obj;};
///returns a pointer to the internal text object, use this to get access to its most properties
CComponentsText*getTextObject(){return ccx_text_obj;};
///sets the text modes (mainly text alignment) to the label and text object, see /gui/widget/textbox.h for possible modes
void setTextModes(const int& label_mode, const int& text_mode);
///paint this item/form
void paint(bool do_save_bg = CC_SAVE_SCREEN_YES);
};
#endif

View File

@@ -3,7 +3,7 @@
Copyright (C) 2001 by Steffen Hehn 'McClean'
Generic GUI-related component.
Copyright (C) 2013, Thilo Graf 'dbt'
Copyright (C) 2013, 2014 Thilo Graf 'dbt'
License: GPL
@@ -17,10 +17,8 @@
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, write to the
Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
Boston, MA 02110-1301, USA.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#ifdef HAVE_CONFIG_H
@@ -135,7 +133,7 @@ void CComponentsFrmClock::initCCLockItems()
if (v_cc_items.size() != s_time.size()){
//clean up possible old items before add new items
clearCCItems();
clear();
//create new empty label objects, set some general properties and add to container
for (size_t i = 0; i < s_time.size(); i++){
@@ -355,10 +353,10 @@ void CComponentsFrmClock::paint(bool do_save_bg)
paintForm(do_save_bg);
}
void CComponentsFrmClock::setClockFontSize(int size)
void CComponentsFrmClock::setClockFontSize(int font_size)
{
int tmp_w = 0;
dyn_font_size = size;
dyn_font_size = font_size;
cl_font = CNeutrinoFonts::getInstance()->getDynFont(tmp_w, dyn_font_size, "", CNeutrinoFonts::FONT_STYLE_BOLD, CNeutrinoFonts::FONT_ID_INFOCLOCK);
}

View File

@@ -100,7 +100,7 @@ class CComponentsFrmClock : public CComponentsForm
///set font type or font size for segments
virtual void setClockFont(int font);
virtual void setClockFontSize(int size);
virtual void setClockFontSize(int font_size);
///set text color
virtual void setTextColor(fb_pixel_t color_text){ cl_col_text = color_text;};

View File

@@ -3,7 +3,7 @@
Copyright (C) 2001 by Steffen Hehn 'McClean'
Classes for generic GUI-related components.
Copyright (C) 2013, Thilo Graf 'dbt'
Copyright (C) 2013, 2014 Thilo Graf 'dbt'
License: GPL
@@ -17,10 +17,8 @@
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, write to the
Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
Boston, MA 02110-1301, USA.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#ifdef HAVE_CONFIG_H
@@ -29,49 +27,37 @@
#include <global.h>
#include <neutrino.h>
#include "cc_frm.h"
#include "cc_frm_ext_text.h"
#define DEF_HEIGHT 27
#define DEF_LABEL_WIDTH_PERCENT 30
#define DEF_WIDTH 300
using namespace std;
CComponentsExtTextForm::CComponentsExtTextForm()
{
initVarExtTextForm();
initCCTextItems();
}
CComponentsExtTextForm::CComponentsExtTextForm( const int x_pos, const int y_pos, const int w, const int h,
CComponentsExtTextForm::CComponentsExtTextForm( const int& x_pos, const int& y_pos, const int& w, const int& h,
const std::string& label_text, const std::string& text,
bool has_shadow,
fb_pixel_t label_color,
fb_pixel_t text_color,
fb_pixel_t color_frame, fb_pixel_t color_body, fb_pixel_t color_shadow)
{
initVarExtTextForm(x_pos, y_pos, w, h, has_shadow, label_color, text_color, color_frame, color_body, color_shadow);
ccx_label_text = label_text;
ccx_text = text;
initVarExtTextForm(x_pos, y_pos, w, h, label_text, text, has_shadow, label_color, text_color, color_frame, color_body, color_shadow);
initCCTextItems();
}
CComponentsExtTextForm::CComponentsExtTextForm( const int x_pos, const int y_pos, const int w, const int h,
const neutrino_locale_t& locale_label_text, const neutrino_locale_t& locale_text,
bool has_shadow,
fb_pixel_t label_color,
fb_pixel_t text_color,
fb_pixel_t color_frame, fb_pixel_t color_body, fb_pixel_t color_shadow)
{
initVarExtTextForm(x_pos, y_pos, w, h, has_shadow, label_color, text_color, color_frame, color_body, color_shadow);
ccx_label_text = g_Locale->getText(locale_label_text);
ccx_text = g_Locale->getText(locale_text);
CComponentsExtTextFormLocalized::CComponentsExtTextFormLocalized(const int& x_pos, const int& y_pos, const int& w, const int& h,
const neutrino_locale_t& locale_label_text, const neutrino_locale_t& locale_text,
bool has_shadow,
fb_pixel_t label_color,
fb_pixel_t text_color,
fb_pixel_t color_frame, fb_pixel_t color_body, fb_pixel_t color_shadow)
: CComponentsExtTextForm( x_pos, y_pos, w, h,
g_Locale->getText(locale_label_text), g_Locale->getText(locale_text),
has_shadow,
label_color, text_color, color_frame, color_body, color_shadow){};
initCCTextItems();
}
void CComponentsExtTextForm::initVarExtTextForm(const int x_pos, const int y_pos, const int w, const int h,
void CComponentsExtTextForm::initVarExtTextForm(const int& x_pos, const int& y_pos, const int& w, const int& h,
const std::string& label_text, const std::string& text,
bool has_shadow,
fb_pixel_t label_color,
fb_pixel_t text_color,
@@ -90,8 +76,8 @@ void CComponentsExtTextForm::initVarExtTextForm(const int x_pos, const int y_pos
height = h;
ccx_label_text = "";
ccx_text = "";
ccx_label_text = label_text;
ccx_text = text;
shadow = has_shadow;
ccx_label_color = label_color;
ccx_text_color = text_color;

View File

@@ -0,0 +1,128 @@
/*
Based up Neutrino-GUI - Tuxbox-Project
Copyright (C) 2001 by Steffen Hehn 'McClean'
Classes for generic GUI-related components.
Copyright (C) 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_EXT_TEXT_H__
#define __CC_FORM_EXT_TEXT_H__
#include "cc_frm.h"
#include "cc_item_text.h"
class CComponentsExtTextForm : public CComponentsForm
{
private:
///property: content of label, see also setLabelAndText()
std::string ccx_label_text;
///property: content of text, see also setLabelAndText()
std::string ccx_text;
///property: color of label text, see also setLabelAndTextColor()
fb_pixel_t ccx_label_color;
///property: color of text, see also setLabelAndTextColor()
fb_pixel_t ccx_text_color;
///property: mode of label text, see also setTextModes()
int ccx_label_align;
///property: mode of text, see also setTextModes()
int ccx_text_align;
///property: width of label, see also setLabelWidthPercent()
int ccx_label_width;
///property: width of text, see also setLabelWidthPercent()
int ccx_text_width;
///property: font type of both items (label and text), see also setLabelAndText()
Font* ccx_font;
///property: percentage val of label width related to full width, causes fit of text automatically into the available remaining size of item, see also setLabelWidthPercent()
uint8_t ccx_percent_label_w;
///object: label object
CComponentsLabel *ccx_label_obj;
///object: text object
CComponentsText *ccx_text_obj;
///initialize of properties for all objects
void initCCTextItems();
///initialize the label object
void initLabel();
///initialize the text object
void initText();
protected:
///initialize basic variables
void initVarExtTextForm(const int& x_pos, const int& y_pos, const int& w, const int& h,
const std::string& label_text, const std::string& text,
bool has_shadow,
fb_pixel_t label_color,
fb_pixel_t text_color,
fb_pixel_t color_frame, fb_pixel_t color_body, fb_pixel_t color_shadow);
public:
///advanced constructor for CComponentsExtTextForm, provides parameters for the most required properties, and caption as string
CComponentsExtTextForm( const int& x_pos = 1, const int& y_pos = 1, const int& w = 300, const int& h = 48,
const std::string& label_text = "", const std::string& text = "",
bool has_shadow = CC_SHADOW_OFF,
fb_pixel_t label_color = COL_MENUCONTENTINACTIVE_TEXT,
fb_pixel_t text_color = COL_MENUCONTENT_TEXT,
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);
// ~CComponentsExtTextForm(); //inherited from CComponentsForm
///assigns texts for label and text, parameter as string, parameter Font is optional for required font type, default font is dependently from defined item height
void setLabelAndText(const std::string& label_text, const std::string& text, Font* font_text = NULL);
///assigns texts for label and text, parameter as neutrino_locale_t, parameter Font is optional for required font type, default font is dependently from defined item height
void setLabelAndText(const neutrino_locale_t& locale_label_text, const neutrino_locale_t& locale_text, Font* font_text = NULL);
///assigns text Font type
void setLabelAndTextFont(Font* font);
///assigns texts for label and text, parameter as struct (locale_ext_txt_t), parameters provide the same properties like setLabelAndText()
void setLabelAndTexts(const locale_ext_txt_t& texts);
///assigns texts for label and text, parameter as struct (string_ext_txt_t), parameters provide the same properties like setLabelAndText()
void setLabelAndTexts(const string_ext_txt_t& locale_texts);
///assigns colors for text for label text, parameter as fb_pixel_t
void setLabelAndTextColor(const fb_pixel_t label_color , const fb_pixel_t text_color);
///assigns width of label and text related to width, parameter as uint8_t in percent of width, fits text automatically into the available remaining size of item
void setLabelWidthPercent(const uint8_t& percent_val);
///returns a pointer to the internal label object, use this to get access to its most properties
CComponentsLabel*getLabelObject(){return ccx_label_obj;};
///returns a pointer to the internal text object, use this to get access to its most properties
CComponentsText*getTextObject(){return ccx_text_obj;};
///sets the text modes (mainly text alignment) to the label and text object, see /gui/widget/textbox.h for possible modes
void setTextModes(const int& label_mode, const int& text_mode);
///paint this item/form
void paint(bool do_save_bg = CC_SAVE_SCREEN_YES);
};
class CComponentsExtTextFormLocalized : public CComponentsExtTextForm
{
public:
///advanced constructor for CComponentsExtTextForm, provides parameters for the most required properties, and caption as locales
CComponentsExtTextFormLocalized(const int& x_pos = 1, const int& y_pos = 1, const int& w = 300, const int& h = 48,
const neutrino_locale_t& locale_label_text = NONEXISTANT_LOCALE, const neutrino_locale_t& locale_text = NONEXISTANT_LOCALE,
bool has_shadow = CC_SHADOW_OFF,
fb_pixel_t label_color = COL_MENUCONTENTINACTIVE_TEXT,
fb_pixel_t text_color = COL_MENUCONTENT_TEXT,
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

View File

@@ -1,9 +1,9 @@
/*
Based up Neutrino-GUI - Tuxbox-Project
Based up Neutrino-GUI - Tuxbox-Project
Copyright (C) 2001 by Steffen Hehn 'McClean'
Classes for generic GUI-related components.
Copyright (C) 2012, 2013, Thilo Graf 'dbt'
Copyright (C) 2012, 2013, 2014 Thilo Graf 'dbt'
Copyright (C) 2012, Michael Liebmann 'micha-bbg'
License: GPL
@@ -18,10 +18,8 @@
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, write to the
Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
Boston, MA 02110-1301, USA.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#ifdef HAVE_CONFIG_H
@@ -30,7 +28,7 @@
#include <global.h>
#include <neutrino.h>
#include "cc_frm.h"
#include "cc_frm_header.h"
using namespace std;

View File

@@ -0,0 +1,117 @@
/*
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_HEADER_H__
#define __CC_FORM_HEADER_H__
#include "cc_frm.h"
#include "cc_item_picture.h"
#include "cc_item_text.h"
#include "cc_frm_icons.h"
class CComponentsHeader : public CComponentsForm
{
private:
void initVarHeader();
protected:
CComponentsPicture * cch_icon_obj;
CComponentsText * cch_text_obj;
CComponentsIconForm * cch_btn_obj;
std::string cch_text;
const char* cch_icon_name;
fb_pixel_t cch_col_text;
Font* cch_font;
int cch_items_y, cch_icon_x, cch_icon_w, cch_text_x, cch_buttons, cch_buttons_w, cch_buttons_h, cch_buttons_space, cch_offset;
std::vector<std::string> v_cch_btn;
int cch_size_mode;
int cch_caption_align;
bool userHeight;
void initIcon();
void initCaption();
void initButtons();
void initDefaultButtons();
void initButtonFormSize();
public:
enum
{
CC_BTN_HELP = 0x02,
CC_BTN_INFO = 0x04,
CC_BTN_MENU = 0x40,
CC_BTN_EXIT = 0x80
};
enum
{
CC_HEADER_ITEM_ICON = 0,
CC_HEADER_ITEM_TEXT = 1,
CC_HEADER_ITEM_BUTTONS = 2
};
enum
{
CC_HEADER_SIZE_LARGE = 0,
CC_HEADER_SIZE_SMALL = 1
};
CComponentsHeader();
CComponentsHeader(const int x_pos, const int y_pos, const int w, const int h = 0, const std::string& caption = "header", const char* icon_name = NULL, 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_MENUHEAD_PLUS_0, fb_pixel_t color_shadow = COL_MENUCONTENTDARK_PLUS_0);
CComponentsHeader(const int x_pos, const int y_pos, const int w, const int h = 0, neutrino_locale_t caption_locale = NONEXISTANT_LOCALE, const char* icon_name = NULL, 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_MENUHEAD_PLUS_0, fb_pixel_t color_shadow = COL_MENUCONTENTDARK_PLUS_0);
virtual ~CComponentsHeader();
virtual void setCaption(const std::string& caption, const int& align_mode = CTextBox::NO_AUTO_LINEBREAK);
virtual void setCaption(neutrino_locale_t caption_locale, const int& align_mode = CTextBox::NO_AUTO_LINEBREAK);
virtual void setCaptionAlignment(const int& align_mode){cch_caption_align = align_mode;};
virtual void setCaptionFont(Font* font_name);
virtual void setCaptionColor(fb_pixel_t text_color){cch_col_text = text_color;};
virtual void setOffset(const int offset){cch_offset = offset;};
virtual void setIcon(const char* icon_name);
virtual void addButtonIcon(const std::string& button_name);
virtual void removeButtonIcons();
virtual void setDefaultButtons(const int buttons);
virtual void setButtonsSpace(const int buttons_space){cch_buttons_space = buttons_space;};
virtual void initCCItems();
virtual void setSizeMode(const int& size_mode){cch_size_mode = size_mode;};
virtual CComponentsText* getTextObject(){return cch_text_obj;};
virtual void paint(bool do_save_bg = CC_SAVE_SCREEN_YES);
};
class CComponentsFooter : public CComponentsHeader
{
protected:
void initVarFooter();
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

View File

@@ -3,7 +3,7 @@
Copyright (C) 2001 by Steffen Hehn 'McClean'
Classes for generic GUI-related components.
Copyright (C) 2012, 2013, Thilo Graf 'dbt'
Copyright (C) 2012, 2013, 2014 Thilo Graf 'dbt'
Copyright (C) 2012, Michael Liebmann 'micha-bbg'
License: GPL
@@ -18,10 +18,8 @@
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, write to the
Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
Boston, MA 02110-1301, USA.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#ifdef HAVE_CONFIG_H
@@ -30,7 +28,7 @@
#include <global.h>
#include <neutrino.h>
#include "cc_frm.h"
#include "cc_frm_icons.h"
using namespace std;
@@ -110,7 +108,7 @@ int CComponentsIconForm::getIconId(const std::string& icon_name)
//to remove old items before add new icons, otherwise icons will be appended.
void CComponentsIconForm::removeAllIcons()
{
clearCCItems();
clear();
v_icons.clear();
}

View File

@@ -0,0 +1,67 @@
/*
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_ICONS_H__
#define __CC_FORM_ICONS_H__
#include "cc_frm.h"
#include "cc_frm_icons.h"
class CComponentsIconForm : public CComponentsForm
{
private:
std::vector<std::string> v_icons;
int ccif_offset, ccif_icon_align;
void initMaxHeight(int *pheight);
protected:
void initVarIconForm();
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(); //inherited from CComponentsForm
void paint(bool do_save_bg = CC_SAVE_SCREEN_YES);
void initCCIcons();
void addIcon(const std::string& icon_name);
void addIcon(std::vector<std::string> icon_name);
void removeIcons(){v_icons.clear();};
void insertIcon(const uint& icon_id, const std::string& icon_name);
void removeIcon(const uint& icon_id);
void removeIcon(const std::string& icon_name);
void removeAllIcons();
void setIconOffset(const int offset){ccif_offset = offset;};
enum //alignements
{
CC_ICONS_FRM_ALIGN_RIGHT ,
CC_ICONS_FRM_ALIGN_LEFT
};
void setIconAlign(int alignment){ccif_icon_align = alignment;};
int getIconId(const std::string& icon_name);
};
#endif

View File

@@ -97,17 +97,18 @@ void CComponentsSlider::setValueScale(const int& min_value, const int& max_value
void CComponentsSlider::initCCSlBody()
{
if (!csl_body_icon.empty()){
printf("[CComponentsSlider] [%s] missing or undefinied slider body icon %s\n", __func__, csl_body_icon.c_str());
if (csl_body_obj == NULL){
csl_body_obj = new CComponentsPicture(0, 0, 0, height, csl_body_icon);
csl_body_obj = new CComponentsPicture(0, 0, 0, 0, csl_body_icon);
csl_body_obj->doPaintBg(false);
addCCItem(csl_body_obj);
}
else
csl_body_obj->setPicture(csl_body_icon);
}
else
else{
printf("[CComponentsSlider] [%s] missing or undefinied slider body icon %s\n", __func__, csl_body_icon.c_str());
return;
}
//get first icon dimensions
int icon_w = csl_body_obj->getWidth();
@@ -127,7 +128,6 @@ void CComponentsSlider::initCCSlBody()
void CComponentsSlider::initCCSlSlider()
{
if (!csl_slider_icon.empty()){
printf("[CComponentsSlider] [%s] missing or undefinied slider icon %s\n", __func__, csl_slider_icon.c_str());
if (csl_slider_obj == NULL){
csl_slider_obj = new CComponentsPicture(0, 0, 0, 0, csl_slider_icon);
csl_slider_obj->doPaintBg(false);
@@ -136,8 +136,10 @@ void CComponentsSlider::initCCSlSlider()
else
csl_slider_obj->setPicture(csl_slider_icon);
}
else
else{
printf("[CComponentsSlider] [%s] missing or undefinied slider icon %s\n", __func__, csl_slider_icon.c_str());
return;
}
//get first icon dimensions
int slider_w = csl_slider_obj->getWidth();
@@ -157,6 +159,12 @@ void CComponentsSlider::initCCSlItems()
initCCSlSlider();
}
void CComponentsSlider::setSliderIcon(const std::string &icon_name)
{
csl_slider_icon = icon_name;
initCCSlSlider();
}
// void CComponentsSlider::paint(bool do_save_bg)
// {
// //prepare items before paint

View File

@@ -85,6 +85,7 @@ class CComponentsSlider : public CComponentsForm
void setValuePos(const int& current_value);
void setValueScale(const int& min_value, const int& max_value);
void setSliderIcon(const std::string &icon_name);
// void paint(bool do_save_bg = CC_SAVE_SCREEN_YES);
};

View File

@@ -1,9 +1,9 @@
/*
Based up Neutrino-GUI - Tuxbox-Project
Based up Neutrino-GUI - Tuxbox-Project
Copyright (C) 2001 by Steffen Hehn 'McClean'
Classes for generic GUI-related components.
Copyright (C) 2012, 2013, Thilo Graf 'dbt'
Copyright (C) 2012, 2013, 2014 Thilo Graf 'dbt'
Copyright (C) 2012, Michael Liebmann 'micha-bbg'
License: GPL
@@ -18,10 +18,8 @@
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, write to the
Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
Boston, MA 02110-1301, USA.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#ifdef HAVE_CONFIG_H
@@ -30,7 +28,7 @@
#include <global.h>
#include <neutrino.h>
#include "cc_frm.h"
#include "cc_frm_window.h"
#include <driver/screen_max.h>
using namespace std;
@@ -47,7 +45,7 @@ CComponentsWindow::CComponentsWindow()
CComponentsWindow::CComponentsWindow(const std::string& caption, const char* iconname)
{
initVarWindow();
ccw_caption = caption;
ccw_icon_name = iconname;
@@ -57,7 +55,7 @@ CComponentsWindow::CComponentsWindow(const std::string& caption, const char* ico
CComponentsWindow::CComponentsWindow(neutrino_locale_t locale_caption, const char* iconname)
{
initVarWindow();
ccw_caption = g_Locale->getText(locale_caption);
ccw_icon_name = iconname;

View File

@@ -0,0 +1,160 @@
/*
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_WINDOW_H__
#define __CC_FORM_WINDOW_H__
#include "cc_frm.h"
#include "cc_frm_icons.h"
#include "cc_frm_header.h"
//! Sub class of CComponentsForm. Shows a window with prepared items.
/*!
CComponentsWindow provides prepared items like header, footer and a container for
items like text, labels, pictures ...
*/
/*
x
y+-------------------------------------------------------+
|icon caption buttons |header (ccw_head)
+-x-----------------------------------------------------+
|cc_item0 |
|cc_item1 |body (ccw_body)
| add items here directly with |
| addWindowItem() or |
y with ccw_body->addCCItem() |
| Note: x/y related to body object |
| |
+-------------------------------------------------------+
| add cc_items with ccw_footer->addCCItem() |footer(ccw_footer)
+-------------------------------------------------------+
*/
class CComponentsWindow : public CComponentsForm
{
protected:
///object: header object, to get access to header properties see also getHeaderObject()
CComponentsHeader * ccw_head;
///object: body object, this is the container for all needed items, to add with addWindowItem()
CComponentsForm * ccw_body;
///object: footer object, to get access to header properties see also getFooterObject(
CComponentsFooter * ccw_footer;
///property: caption in header, see also getHeaderObject()
std::string ccw_caption;
///property: alignment mode for header caption
int ccw_align_mode;
///property: icon name in header, see also getHeaderObject()
const char* ccw_icon_name;
///property: assigned default icon buttons in header, see also getHeaderObject()
int ccw_buttons;
///property: value = true, let show footer, see showFooter()
bool ccw_show_footer;
///property: value = true, let show header, see showHeader()
bool ccw_show_header;
///initialze header object
void initHeader();
///initialze body object
void initBody();
///initialze footer object
void initFooter();
///initialze all window objects at once
void initCCWItems();
///initialize all attributes
void initVarWindow();
public:
enum
{
CC_WINDOW_ITEM_HEADER = 0
};
///simple constructor for CComponentsWindow
CComponentsWindow();
///advanced constructor for CComponentsWindow, provides parameters for the most required properties, and caption as string
CComponentsWindow( const int x_pos, const int y_pos, const int w, const int h,
const std::string& caption,
const char* iconname = NULL,
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);
///advanced constructor for CComponentsWindow, provides parameters for the most required properties, and caption from locales
CComponentsWindow( const int x_pos, const int y_pos, const int w, const int h,
neutrino_locale_t locale_caption,
const char* iconname = NULL,
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 as string and icon, position of window is general centered and bound
///to current screen settings, this shows a window over full screen
CComponentsWindow(const std::string& caption, const char* iconname = NULL);
///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
CComponentsWindow(neutrino_locale_t locale_caption, const char* iconname = NULL);
~CComponentsWindow();
///add item to body object, also usable is addCCItem() to add items to the windo object
void addWindowItem(CComponentsItem* cc_Item);
///allow/disallow paint a footer, default true, see also ccw_show_footer, showHeader()
void showFooter(bool show = true){ccw_show_footer = show; initCCWItems();};
///allow/disallow paint a header, default true, see also ccw_show_header, showFooter()
void showHeader(bool show = true){ccw_show_header = show; initCCWItems();};
///set caption in header with string, see also getHeaderObject()
void setWindowCaption(const std::string& text, const int& align_mode = CTextBox::NO_AUTO_LINEBREAK){ccw_caption = text; ccw_align_mode = align_mode;};
///set caption in header from locales, see also getHeaderObject()
void setWindowCaption(neutrino_locale_t locale_text, const int& align_mode = CTextBox::NO_AUTO_LINEBREAK);
///set caption alignment
void setWindowCaptionAlignment(const int& align_mode){ccw_align_mode = align_mode;};
///set icon name in header, see also getHeaderObject()
void setWindowIcon(const char* iconname){ccw_icon_name = iconname;};
///set default header icon buttons, see also getHeaderObject()
void setWindowHeaderButtons(const int& buttons){ccw_buttons = buttons;};
///returns a pointer to the internal header object, use this to get access to header properities
CComponentsHeader* getHeaderObject(){return ccw_head;};
///returns a pointer to the internal body object, use this to get access to body properities
CComponentsForm* getBodyObject(){return ccw_body;};
///returns a pointer to the internal footer object, use this to get access to footer properities
CComponentsFooter* getFooterObject(){return ccw_footer;};
///refresh position and dimension and reinitialize elemenatary properties
void Refresh(){initCCWItems();};
///paint all window items, this overwriting paint() from CComponentsForm
virtual void paint(bool do_save_bg = CC_SAVE_SCREEN_YES);
};
#endif

View File

@@ -63,7 +63,7 @@ void CComponentsItem::initVarItem()
// If backround is not required, it's possible to override this with variable paint_bg=false, use doPaintBg(true/false) to set this!
void CComponentsItem::paintInit(bool do_save_bg)
{
clear();
clearFbData();
int th = fr_thickness;
fb_pixel_t col_frame_cur = col_frame;