From d39eaa22fc543aef2da5a66e16ec78d2bc78809a Mon Sep 17 00:00:00 2001 From: Thilo Graf Date: Sun, 26 May 2013 18:11:06 +0200 Subject: [PATCH] CComponents: split some header files CComponentsInfoBox CComponentsShapeCircle/Square CComponentsDetailLine CComponentsPIP CComponentsText/CComponentsLabel CComponentsPicture --- src/gui/audiomute.h | 2 +- src/gui/bedit/bouqueteditor_channels.h | 3 +- src/gui/bedit/bouqueteditor_chanselect.h | 3 +- src/gui/components/cc.h | 211 ----------------------- src/gui/components/cc_detailsline.cpp | 2 +- src/gui/components/cc_detailsline.h | 77 +++++++++ src/gui/components/cc_frm.h | 2 + src/gui/components/cc_item_infobox.cpp | 2 +- src/gui/components/cc_item_infobox.h | 85 +++++++++ src/gui/components/cc_item_picture.cpp | 2 +- src/gui/components/cc_item_picture.h | 88 ++++++++++ src/gui/components/cc_item_shapes.cpp | 2 +- src/gui/components/cc_item_shapes.h | 67 +++++++ src/gui/components/cc_item_text.cpp | 2 +- src/gui/components/cc_item_text.h | 156 +++++++++++++++++ src/gui/components/cc_item_tvpic.cpp | 2 +- src/gui/components/cc_item_tvpic.h | 69 ++++++++ src/gui/eventlist.h | 2 +- src/gui/imageinfo.h | 5 + src/gui/streaminfo2.h | 1 + src/gui/test_menu.h | 1 + src/gui/volumebar.h | 1 + src/gui/widget/menue.h | 3 +- 23 files changed, 566 insertions(+), 222 deletions(-) create mode 100644 src/gui/components/cc_detailsline.h create mode 100644 src/gui/components/cc_item_infobox.h create mode 100644 src/gui/components/cc_item_picture.h create mode 100644 src/gui/components/cc_item_shapes.h create mode 100644 src/gui/components/cc_item_text.h create mode 100644 src/gui/components/cc_item_tvpic.h diff --git a/src/gui/audiomute.h b/src/gui/audiomute.h index 406483f18..2c2310c0e 100644 --- a/src/gui/audiomute.h +++ b/src/gui/audiomute.h @@ -27,7 +27,7 @@ #ifndef __CAUDIOMUTE__ #define __CAUDIOMUTE__ -#include +#include class CAudioMute : public CComponentsPicture { diff --git a/src/gui/bedit/bouqueteditor_channels.h b/src/gui/bedit/bouqueteditor_channels.h index 90d4d03d4..afc74a4b1 100644 --- a/src/gui/bedit/bouqueteditor_channels.h +++ b/src/gui/bedit/bouqueteditor_channels.h @@ -35,7 +35,8 @@ #include #include -#include +#include +#include #include #include diff --git a/src/gui/bedit/bouqueteditor_chanselect.h b/src/gui/bedit/bouqueteditor_chanselect.h index 729c3d7af..6ae293c87 100644 --- a/src/gui/bedit/bouqueteditor_chanselect.h +++ b/src/gui/bedit/bouqueteditor_chanselect.h @@ -34,7 +34,8 @@ #include #include -#include +#include +#include #include #include diff --git a/src/gui/components/cc.h b/src/gui/components/cc.h index 3443c8df2..19c283263 100644 --- a/src/gui/components/cc.h +++ b/src/gui/components/cc.h @@ -230,215 +230,4 @@ class CComponentsItem : public CComponents virtual bool isEnabled(){return cc_item_enabled;}; }; -class CComponentsPicture : public CComponentsItem -{ - protected: - void initVarPicture(); - - enum - { - CC_PIC_IMAGE_MODE_OFF = 0, //paint pictures in icon mode, mainly not scaled - CC_PIC_IMAGE_MODE_ON = 1, //paint pictures in image mode, paint scaled if required - CC_PIC_IMAGE_MODE_AUTO = 2 - }; - - std::string pic_name; - unsigned char pic_offset; - 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); - - 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); - - 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); - virtual inline void getPictureSize(int *pwidth, int *pheight){*pwidth=pic_width; *pheight=pic_height;}; - virtual void setMaxWidth(const int w_max){pic_max_w = w_max;}; - virtual void setMaxHeight(const int h_max){pic_max_h = h_max;}; -}; - -class CComponentsText : public CComponentsItem -{ - protected: - CTextBox * ct_textbox; - CBox * ct_box; - Font * ct_font; - - fb_pixel_t ct_col_text; - int ct_text_mode; //see textbox.h for possible modes - std::string ct_text, ct_old_text; - bool ct_text_sent, ct_paint_textbg, ct_force_text_paint; - - static std::string iToString(int int_val); //helper to convert int to string - - void initVarText(); - void clearCCText(); - void initCCText(); - void paintText(bool do_save_bg = CC_SAVE_SCREEN_YES); - public: - CComponentsText(); - CComponentsText( const int x_pos, const int y_pos, const int w, const int h, - std::string text = "", const int mode = CTextBox::AUTO_WIDTH, Font* font_text = NULL, - bool has_shadow = CC_SHADOW_OFF, - fb_pixel_t color_text = COL_MENUCONTENT, 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); - virtual ~CComponentsText(); - - //default members to paint a text box and hide painted text - //hide textbox - void hide(bool no_restore = false); - //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); - - //send options for text font (size and type), color and mode (allignment) - virtual inline void setTextFont(Font* font_text){ct_font = font_text;}; - virtual inline void setTextColor(fb_pixel_t color_text){ ct_col_text = color_text;}; - //see textbox.h for possible allignment modes - virtual inline void setTextMode(const int mode){ct_text_mode = mode;}; - - //send option to CTextBox object to paint background box behind text or not - virtual inline void doPaintTextBoxBg(bool do_paintbox_bg){ ct_paint_textbg = do_paintbox_bg;}; - - //sets text mainly with string also possible with overloades members for loacales, const char and text file - virtual void setText(const std::string& stext, const int mode = ~CTextBox::AUTO_WIDTH, Font* font_text = NULL); - - virtual void setText(const char* ctext, const int mode = ~CTextBox::AUTO_WIDTH, Font* font_text = NULL); - virtual void setText(neutrino_locale_t locale_text, const int mode = ~CTextBox::AUTO_WIDTH, Font* font_text = NULL); - virtual void setText(const int digit, const int mode = ~CTextBox::AUTO_WIDTH, Font* font_text = NULL); - virtual bool setTextFromFile(const std::string& path_to_textfile, const int mode = ~CTextBox::AUTO_WIDTH, Font* font_text = NULL); - - //helper to remove linebreak chars from a string if needed - virtual void removeLineBreaks(std::string& str); - - //returns true, if text was changed - virtual bool textChanged(){return ct_old_text != ct_text;}; - //force paint of text even if text was changed or not - virtual void forceTextPaint(bool force_text_paint = true){ct_force_text_paint = force_text_paint;}; - - //gets the embedded CTextBox object, so it's possible to get access directly to its methods and properties - virtual CTextBox* getCTextBoxObject() { return ct_textbox; }; -}; - -class CComponentsLabel : public CComponentsText -{ - public: - CComponentsLabel( const int x_pos, const int y_pos, const int w, const int h, - std::string text = "", const int mode = CTextBox::AUTO_WIDTH, Font* font_text = NULL, - bool has_shadow = CC_SHADOW_OFF, - fb_pixel_t color_text = COL_MENUCONTENTINACTIVE, 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) - :CComponentsText(x_pos, y_pos, w, h, text, mode, font_text, has_shadow, color_text, color_frame, color_body, color_shadow) - { - cc_item_type = CC_ITEMTYPE_LABEL; - }; - CComponentsLabel():CComponentsText() - { - initVarText(); - cc_item_type = CC_ITEMTYPE_LABEL; - ct_col_text = COL_MENUCONTENTINACTIVE; - }; -}; - -#define INFO_BOX_Y_OFFSET 2 -class CComponentsInfoBox : public CComponentsText -{ - private: - int x_text, x_offset; - CComponentsPicture * pic; - std::string pic_default_name; - - void paintPicture(); - void initVarInfobox(); - std::string pic_name; - - public: - CComponentsText * cctext; - - CComponentsInfoBox(); - CComponentsInfoBox( const int x_pos, const int y_pos, const int w, const int h, - std::string info_text = "", const int mode = CTextBox::AUTO_WIDTH, Font* font_text = NULL, - bool has_shadow = CC_SHADOW_OFF, - fb_pixel_t color_text = COL_MENUCONTENT, 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); - - ~CComponentsInfoBox(); - - inline void setSpaceOffset(const int offset){x_offset = offset;}; - inline void setPicture(const std::string& picture_name){pic_name = picture_name;}; - - void paint(bool do_save_bg = CC_SAVE_SCREEN_YES); -}; - - -class CComponentsShapeCircle : public CComponentsItem -{ - private: - int d; - public: - CComponentsShapeCircle( const int x_pos, const int y_pos, const int diam, bool has_shadow = CC_SHADOW_ON, - 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); - - inline void setDiam(const int& diam){d=width=height=diam, corner_rad=d/2;}; - inline int getDiam(){return d;}; - void paint(bool do_save_bg = CC_SAVE_SCREEN_YES); -}; - -class CComponentsShapeSquare : public CComponentsItem -{ - public: - CComponentsShapeSquare( const int x_pos, const int y_pos, const int w, const int h, bool has_shadow = CC_SHADOW_ON, - 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); - - void paint(bool do_save_bg = CC_SAVE_SCREEN_YES); -}; - -class CComponentsPIP : public CComponentsItem -{ - private: - int screen_w, screen_h; - std::string pic_name; //alternate picture if is no tv picture available - public: - CComponentsPIP( const int x_pos, const int y_pos, const int percent = 30, bool has_shadow = CC_SHADOW_OFF); - ~CComponentsPIP(); - - void paint(bool do_save_bg = CC_SAVE_SCREEN_YES); - void hide(bool no_restore = false); - void setScreenWidth(int screen_width){screen_w = screen_width;}; - void setScreenHeight(int screen_heigth){screen_h = screen_heigth;}; - void setPicture(const std::string& image){pic_name = image;}; -}; - - -class CComponentsDetailLine : public CComponents -{ - private: - int thickness, y_down, h_mark_top, h_mark_down; - - void initVarDline(); - - public: - CComponentsDetailLine(); - CComponentsDetailLine( const int x_pos,const int y_pos_top, const int y_pos_down, - const int h_mark_up = CC_HEIGHT_MIN , const int h_mark_down = CC_HEIGHT_MIN, - fb_pixel_t color_line = COL_MENUCONTENT_PLUS_6, fb_pixel_t color_shadow = COL_MENUCONTENTDARK_PLUS_0); - ~CComponentsDetailLine(); - - void paint(bool do_save_bg = CC_SAVE_SCREEN_YES); - inline void setColors(fb_pixel_t color_line, fb_pixel_t color_shadow){col_body = color_line; col_shadow = color_shadow;}; - void syncSysColors(); - inline void setYPosDown(const int& y_pos_down){y_down = y_pos_down;}; - inline void setHMarkTop(const int& h_mark_top_){h_mark_top = h_mark_top_;}; - inline void setHMarkDown(const int& h_mark_down_){h_mark_down = h_mark_down_;}; -}; - #endif diff --git a/src/gui/components/cc_detailsline.cpp b/src/gui/components/cc_detailsline.cpp index 10f6f96a3..646b0292e 100644 --- a/src/gui/components/cc_detailsline.cpp +++ b/src/gui/components/cc_detailsline.cpp @@ -30,7 +30,7 @@ #include #include -#include "cc.h" +#include "cc_detailsline.h" using namespace std; diff --git a/src/gui/components/cc_detailsline.h b/src/gui/components/cc_detailsline.h new file mode 100644 index 000000000..f35cbf745 --- /dev/null +++ b/src/gui/components/cc_detailsline.h @@ -0,0 +1,77 @@ +/* + 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' + + 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, write to the + Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, + Boston, MA 02110-1301, USA. +*/ + +#ifndef __CC_DETAIL_LINE_H__ +#define __CC_DETAIL_LINE_H__ + +#ifdef HAVE_CONFIG_H +#include +#endif + +#include "cc.h" + +//! Sub class of CComponents. Shows a connectline with given dimensions and color on screen. +/*! +Not usable as CCItem! +*/ + +class CComponentsDetailLine : public CComponents +{ + private: + ///property: line thickness + int thickness; + ///property: lowest y position + int y_down; + ///property: height of top marker + int h_mark_top; + ///property: height of bottom marker + int h_mark_down; + + ///initialize all internal attributes + void initVarDline(); + + public: + CComponentsDetailLine(); + CComponentsDetailLine( const int x_pos,const int y_pos_top, const int y_pos_down, + const int h_mark_up = CC_HEIGHT_MIN , const int h_mark_down = CC_HEIGHT_MIN, + fb_pixel_t color_line = COL_MENUCONTENT_PLUS_6, fb_pixel_t color_shadow = COL_MENUCONTENTDARK_PLUS_0); + ~CComponentsDetailLine(); + + ///set colors + inline void setColors(fb_pixel_t color_line, fb_pixel_t color_shadow){col_body = color_line; col_shadow = color_shadow;}; + ///set colors with system settings + void syncSysColors(); + ///set property: lowest y position + inline void setYPosDown(const int& y_pos_down){y_down = y_pos_down;}; + ///set property: height of top marker + inline void setHMarkTop(const int& h_mark_top_){h_mark_top = h_mark_top_;}; + ///property: height of bottom marker + inline void setHMarkDown(const int& h_mark_down_){h_mark_down = h_mark_down_;}; + + ///paint all to screen + void paint(bool do_save_bg = CC_SAVE_SCREEN_YES); +}; + +#endif diff --git a/src/gui/components/cc_frm.h b/src/gui/components/cc_frm.h index 5cff48683..367638618 100644 --- a/src/gui/components/cc_frm.h +++ b/src/gui/components/cc_frm.h @@ -29,6 +29,8 @@ #include "config.h" #include +#include +#include #include #include diff --git a/src/gui/components/cc_item_infobox.cpp b/src/gui/components/cc_item_infobox.cpp index 2cf17427d..a5a46cd76 100644 --- a/src/gui/components/cc_item_infobox.cpp +++ b/src/gui/components/cc_item_infobox.cpp @@ -30,7 +30,7 @@ #include #include -#include "cc.h" +#include "cc_item_infobox.h" using namespace std; diff --git a/src/gui/components/cc_item_infobox.h b/src/gui/components/cc_item_infobox.h new file mode 100644 index 000000000..c1882e74d --- /dev/null +++ b/src/gui/components/cc_item_infobox.h @@ -0,0 +1,85 @@ +/* + 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' + + 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, write to the + Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, + Boston, MA 02110-1301, USA. +*/ + +#ifndef __CC_ITEM_INFOBOX__ +#define __CC_ITEM_INFOBOX__ + +#ifdef HAVE_CONFIG_H +#include +#endif + +#include "cc_item_text.h" +#include "cc_item_picture.h" +#include + +//! Sub class of CComponentsItem. Shows box with text and optional icon on screen. +/*! +InfoBox has been originally intended for displaying text information or menue hints, +but is also usable like each other CCItems. +*/ + +#define INFO_BOX_Y_OFFSET 2 +class CComponentsInfoBox : public CComponentsText +{ + private: + ///property: start position of textbox within infobox + int x_text; + ///property: space between picture and textbox + int x_offset; + + ///object: picture object + CComponentsPicture * pic; + ///property: path or default name of displayed image + std::string pic_default_name; + + ///initialize all needed default attributes + void initVarInfobox(); + ///paint picture, used in initVarInfobox() + void paintPicture(); + ///property: path or name of displayed image + std::string pic_name; + + public: + ///object: internal used CTextBox object + CComponentsText * cctext; + + CComponentsInfoBox(); + CComponentsInfoBox( const int x_pos, const int y_pos, const int w, const int h, + std::string info_text = "", const int mode = CTextBox::AUTO_WIDTH, Font* font_text = NULL, + bool has_shadow = CC_SHADOW_OFF, + fb_pixel_t color_text = COL_MENUCONTENT, 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); + + ~CComponentsInfoBox(); + + ///set property: space between picture and textbox + inline void setSpaceOffset(const int offset){x_offset = offset;}; + ///set property: path or name of displayed image + inline void setPicture(const std::string& picture_name){pic_name = picture_name;}; + + ///paint item + void paint(bool do_save_bg = CC_SAVE_SCREEN_YES); +}; + +#endif diff --git a/src/gui/components/cc_item_picture.cpp b/src/gui/components/cc_item_picture.cpp index 215039324..b02c25f81 100644 --- a/src/gui/components/cc_item_picture.cpp +++ b/src/gui/components/cc_item_picture.cpp @@ -30,7 +30,7 @@ #include #include -#include "cc.h" +#include "cc_item_picture.h" #include extern CPictureViewer * g_PicViewer; diff --git a/src/gui/components/cc_item_picture.h b/src/gui/components/cc_item_picture.h new file mode 100644 index 000000000..fc404039f --- /dev/null +++ b/src/gui/components/cc_item_picture.h @@ -0,0 +1,88 @@ +/* + 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, Michael Liebmann 'micha-bbg' + + 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, write to the + Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, + Boston, MA 02110-1301, USA. +*/ + +#ifndef __CC_ITEM_PICTURE_H__ +#define __CC_ITEM_PICTURE_H__ + +#ifdef HAVE_CONFIG_H +#include +#endif + +#include "cc.h" +#include +#include + +//! Sub class of CComponentsItem. Shows box with image with assigned attributes. +/*! +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 + { + CC_PIC_IMAGE_MODE_OFF = 0, //paint pictures in icon mode, mainly not scaled + CC_PIC_IMAGE_MODE_ON = 1, //paint pictures in image mode, paint scaled if required + CC_PIC_IMAGE_MODE_AUTO = 2 + }; + + ///property: path or name of image, icon names to find in /widget/icons.h, icons will paint never scaled + std::string pic_name; + ///property: interface to CFrameBuffer::paintIcon() arg 5 + unsigned char pic_offset; + + 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); + + 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); + + 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); + virtual inline void getPictureSize(int *pwidth, int *pheight){*pwidth=pic_width; *pheight=pic_height;}; + virtual void setMaxWidth(const int w_max){pic_max_w = w_max;}; + virtual void setMaxHeight(const int h_max){pic_max_h = h_max;}; +}; + +#endif diff --git a/src/gui/components/cc_item_shapes.cpp b/src/gui/components/cc_item_shapes.cpp index abe5826d2..758622401 100644 --- a/src/gui/components/cc_item_shapes.cpp +++ b/src/gui/components/cc_item_shapes.cpp @@ -30,7 +30,7 @@ #include #include -#include "cc.h" +#include "cc_item_shapes.h" using namespace std; diff --git a/src/gui/components/cc_item_shapes.h b/src/gui/components/cc_item_shapes.h new file mode 100644 index 000000000..ffde992f4 --- /dev/null +++ b/src/gui/components/cc_item_shapes.h @@ -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, 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, write to the + Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, + Boston, MA 02110-1301, USA. +*/ + +#ifndef __CC_ITEM_SHAPES_H__ +#define __CC_ITEM_SHAPES_H__ + +#ifdef HAVE_CONFIG_H +#include +#endif + +#include "cc.h" + +//! Sub class of CComponentsItem. Shows a shape with given dimensions and color on screen. +/*! +Paint of simple shapes on screen. +*/ + +class CComponentsShapeCircle : public CComponentsItem +{ + private: + ///property: diam + int d; + public: + CComponentsShapeCircle( const int x_pos, const int y_pos, const int diam, bool has_shadow = CC_SHADOW_ON, + 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); + + ///set property: diam + inline void setDiam(const int& diam){d=width=height=diam, corner_rad=d/2;}; + ///get property: diam + inline int getDiam(){return d;}; + + ///paint item + void paint(bool do_save_bg = CC_SAVE_SCREEN_YES); +}; + +class CComponentsShapeSquare : public CComponentsItem +{ + public: + CComponentsShapeSquare( const int x_pos, const int y_pos, const int w, const int h, bool has_shadow = CC_SHADOW_ON, + 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); + + void paint(bool do_save_bg = CC_SAVE_SCREEN_YES); +}; + +#endif diff --git a/src/gui/components/cc_item_text.cpp b/src/gui/components/cc_item_text.cpp index 38d5e8d90..d2f563d08 100644 --- a/src/gui/components/cc_item_text.cpp +++ b/src/gui/components/cc_item_text.cpp @@ -30,7 +30,7 @@ #include #include -#include "cc.h" +#include "cc_item_text.h" #include #include #include diff --git a/src/gui/components/cc_item_text.h b/src/gui/components/cc_item_text.h new file mode 100644 index 000000000..2e11ceef8 --- /dev/null +++ b/src/gui/components/cc_item_text.h @@ -0,0 +1,156 @@ +/* + 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' + + 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, write to the + Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, + Boston, MA 02110-1301, USA. +*/ + +#ifndef __CC_ITEM_TEXT_H__ +#define __CC_ITEM_TEXT_H__ + +#include "cc.h" +#include +#include + +//! Sub class of CComponentsItem. Shows a text box. +/*! +Usable like all other CCItems and provides paint of text with different properties for format, alignment, color, fonts etc. +The basic background of textboxes based on frame, body and shadow, known from othe CCItems. +Handling of text parts based up CTextBox attributes and methodes. +CComponentsText provides a interface to the embedded CTextBox object. +*/ + +class CComponentsText : public CComponentsItem +{ + protected: + ///object: CTextBox object + CTextBox * ct_textbox; + ///object: CBox object + CBox * ct_box; + ///object: Fontrenderer object + Font * ct_font; + + ///property: CTextBox object + fb_pixel_t ct_col_text; + ///property: text display modes, see textbox.h for possible modes + int ct_text_mode; + ///property: current text string + std::string ct_text; + ///status: cached text string, mainly required to compare with current text + std::string ct_old_text; + + ///status: current text string is sent to CTextBox object + bool ct_text_sent; + ///property: send to CTextBox object enableBackgroundPaint(true) + bool ct_paint_textbg; + + ///property: force sending text to the CTextBox object, false= text only sended, if text was changed, see also textChanged() + bool ct_force_text_paint; + + ///helper: convert int to string + static std::string iToString(int int_val); //helper to convert int to string + + ///initialize all required default attributes + void initVarText(); + + ///destroy current CTextBox and CBox objects + void clearCCText(); + + ///initialize all required attributes for text and send to the CTextBox object + void initCCText(); + ///paint CCItem backckrond (if paint_bg=true), apply initCCText() and send paint() to the CTextBox object + void paintText(bool do_save_bg = CC_SAVE_SCREEN_YES); + public: + CComponentsText(); + CComponentsText( const int x_pos, const int y_pos, const int w, const int h, + std::string text = "", const int mode = CTextBox::AUTO_WIDTH, Font* font_text = NULL, + bool has_shadow = CC_SHADOW_OFF, + fb_pixel_t color_text = COL_MENUCONTENT, 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); + virtual ~CComponentsText(); + + ///default members to paint a text box and hide painted text + ///hide textbox + void hide(bool no_restore = false); + ///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); + + ///send options for text font (size and type), color and mode (allignment) + virtual inline void setTextFont(Font* font_text){ct_font = font_text;}; + ///set text color + virtual inline void setTextColor(fb_pixel_t color_text){ ct_col_text = color_text;}; + ///set text alignment, also see textbox.h for possible alignment modes + virtual inline void setTextMode(const int mode){ct_text_mode = mode;}; + + ///send option to CTextBox object to paint background box behind text or not + virtual inline void doPaintTextBoxBg(bool do_paintbox_bg){ ct_paint_textbg = do_paintbox_bg;}; + + ///set text as string also possible with overloades members for loacales, const char and text file + virtual void setText(const std::string& stext, const int mode = ~CTextBox::AUTO_WIDTH, Font* font_text = NULL); + ///set text with const char* + virtual void setText(const char* ctext, const int mode = ~CTextBox::AUTO_WIDTH, Font* font_text = NULL); + ///set text from locale + virtual void setText(neutrino_locale_t locale_text, const int mode = ~CTextBox::AUTO_WIDTH, Font* font_text = NULL); + ///set text from digit, digit is integer + virtual void setText(const int digit, const int mode = ~CTextBox::AUTO_WIDTH, Font* font_text = NULL); + ///set text directly from a textfile, path as string is required + virtual bool setTextFromFile(const std::string& path_to_textfile, const int mode = ~CTextBox::AUTO_WIDTH, Font* font_text = NULL); + + ///helper to remove linebreak chars from a string if needed + virtual void removeLineBreaks(std::string& str); + + ///returns true, if text was changed + virtual bool textChanged(){return ct_old_text != ct_text;}; + ///force paint of text even if text was changed or not + virtual void forceTextPaint(bool force_text_paint = true){ct_force_text_paint = force_text_paint;}; + + ///gets the embedded CTextBox object, so it's possible to get access directly to its methods and properties + virtual CTextBox* getCTextBoxObject() { return ct_textbox; }; +}; + + +//! Sub class of CComponentsText. Shows text as label, text color=inactive mode, depending from color settings. +/*! +Usable like all other CCItems and provides paint of text with different properties for format, alignment, color, fonts etc. +The basic background of textboxes based on frame, body and shadow, known from othe CCItems. +Handling of text parts based up CTextBox attributes and methodes. +CComponentsLbel provides a interface to the embedded CTextBox object. +*/ + +class CComponentsLabel : public CComponentsText +{ + public: + CComponentsLabel( const int x_pos, const int y_pos, const int w, const int h, + std::string text = "", const int mode = CTextBox::AUTO_WIDTH, Font* font_text = NULL, + bool has_shadow = CC_SHADOW_OFF, + fb_pixel_t color_text = COL_MENUCONTENTINACTIVE, 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) + :CComponentsText(x_pos, y_pos, w, h, text, mode, font_text, has_shadow, color_text, color_frame, color_body, color_shadow) + { + cc_item_type = CC_ITEMTYPE_LABEL; + }; + CComponentsLabel():CComponentsText() + { + initVarText(); + cc_item_type = CC_ITEMTYPE_LABEL; + ct_col_text = COL_MENUCONTENTINACTIVE; + }; +}; + +#endif diff --git a/src/gui/components/cc_item_tvpic.cpp b/src/gui/components/cc_item_tvpic.cpp index eedc4e65e..2646ddf15 100644 --- a/src/gui/components/cc_item_tvpic.cpp +++ b/src/gui/components/cc_item_tvpic.cpp @@ -30,7 +30,7 @@ #include #include -#include "cc.h" +#include "cc_item_tvpic.h" #include diff --git a/src/gui/components/cc_item_tvpic.h b/src/gui/components/cc_item_tvpic.h new file mode 100644 index 000000000..6634b15b2 --- /dev/null +++ b/src/gui/components/cc_item_tvpic.h @@ -0,0 +1,69 @@ +/* + 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' + + 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, write to the + Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, + Boston, MA 02110-1301, USA. +*/ + +#ifndef __CC_ITEM_TVPIC_H__ +#define __CC_ITEM_TVPIC_H__ + +#ifdef HAVE_CONFIG_H +#include +#endif + +#include "cc.h" +#include + +//! Sub class of CComponentsItem. Shows a mini tv box, similar to a PIP-Feature with current tv-channel. +/*! +Usable like all other CCItems and provides a simple display of a mini tv box on screen. +A real PIP-Feature is only provided with correct hardware support and in soon in newer versions. +*/ + +class CComponentsPIP : public CComponentsItem +{ + private: + ///property: width of tv box + int screen_w; + ///property: height of tv box + int screen_h; + ///property: path to image that displayed, if no tv-mode is active, default: start.jpg + std::string pic_name; + public: + ///constructor: initialize of position like all other items with x and y values, but dimensions in percent + CComponentsPIP( const int x_pos, const int y_pos, const int percent = 30, bool has_shadow = CC_SHADOW_OFF); + ~CComponentsPIP(); + + ///set property: width of tv box in pixel + void setScreenWidth(int screen_width){screen_w = screen_width;}; + ///set property: height of tv box in pixel + void setScreenHeight(int screen_heigth){screen_h = screen_heigth;}; + ///property: path to image that displayed, if no tv-mode is active + void setPicture(const std::string& image){pic_name = image;}; + + ///show tv box + void paint(bool do_save_bg = CC_SAVE_SCREEN_YES); + ///remove tv box from screen + void hide(bool no_restore = false); +}; + +#endif diff --git a/src/gui/eventlist.h b/src/gui/eventlist.h index 8eff085db..621581fbc 100644 --- a/src/gui/eventlist.h +++ b/src/gui/eventlist.h @@ -34,7 +34,7 @@ #include #include #include -#include +#include #include "color.h" #include "infoviewer.h" diff --git a/src/gui/imageinfo.h b/src/gui/imageinfo.h index a26399fbf..15fcc7aa1 100644 --- a/src/gui/imageinfo.h +++ b/src/gui/imageinfo.h @@ -27,8 +27,13 @@ #ifndef __imageinfo__ #define __imageinfo__ +#ifdef HAVE_CONFIG_H +#include +#endif + #include #include +#include #include typedef struct image_info_t diff --git a/src/gui/streaminfo2.h b/src/gui/streaminfo2.h index 2a3757ce9..8ecf4d171 100644 --- a/src/gui/streaminfo2.h +++ b/src/gui/streaminfo2.h @@ -28,6 +28,7 @@ #include #include #include +#include #include diff --git a/src/gui/test_menu.h b/src/gui/test_menu.h index 57bc63d1b..390106038 100644 --- a/src/gui/test_menu.h +++ b/src/gui/test_menu.h @@ -35,6 +35,7 @@ #include #include #include +#include #define TEST_MENU #include diff --git a/src/gui/volumebar.h b/src/gui/volumebar.h index e44b2d881..280ba7716 100644 --- a/src/gui/volumebar.h +++ b/src/gui/volumebar.h @@ -29,6 +29,7 @@ #include //CComponentsForm #include //CProgressBar +#include //CComponentsLabel class CVolumeBar : public CComponentsForm { diff --git a/src/gui/widget/menue.h b/src/gui/widget/menue.h index 6f78bea21..1e27ec6fd 100644 --- a/src/gui/widget/menue.h +++ b/src/gui/widget/menue.h @@ -41,7 +41,8 @@ #include #include #include -#include +#include +#include #include #include