mirror of
https://github.com/tuxbox-fork-migrations/recycled-ni-neutrino.git
synced 2025-08-30 08:51:04 +02:00
CCTypes: outsource type variables and methods into own inheritable class
Origin commit data
------------------
Branch: ni/coolstream
Commit: d188811d7c
Author: Thilo Graf <dbt@novatux.de>
Date: 2018-04-05 (Thu, 05 Apr 2018)
------------------
No further description and justification available within origin commit message!
------------------
This commit was generated by Migit
This commit is contained in:
@@ -42,4 +42,5 @@ libneutrino_gui_components_a_SOURCES = \
|
|||||||
cc_item_shapes.cpp \
|
cc_item_shapes.cpp \
|
||||||
cc_item_text.cpp \
|
cc_item_text.cpp \
|
||||||
cc_item_tvpic.cpp \
|
cc_item_tvpic.cpp \
|
||||||
cc_timer.cpp
|
cc_timer.cpp\
|
||||||
|
cc_types.cpp
|
||||||
|
@@ -38,7 +38,7 @@ Basic paint attributes and member functions for component classes
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
class CComponentsTimer;
|
class CComponentsTimer;
|
||||||
class CCDraw : public COSDFader, public CComponentsSignals
|
class CCDraw : public COSDFader, public CComponentsSignals, public CCTypes
|
||||||
{
|
{
|
||||||
protected:
|
protected:
|
||||||
///pixel buffer handling, returns pixel buffer depends of given parameters
|
///pixel buffer handling, returns pixel buffer depends of given parameters
|
||||||
|
@@ -44,8 +44,6 @@ using namespace std;
|
|||||||
//abstract sub class CComponentsItem from CComponents
|
//abstract sub class CComponentsItem from CComponents
|
||||||
CComponentsItem::CComponentsItem(CComponentsForm* parent)
|
CComponentsItem::CComponentsItem(CComponentsForm* parent)
|
||||||
{
|
{
|
||||||
cc_item_type.id = CC_ITEMTYPE_GENERIC;
|
|
||||||
cc_item_type.name = "cc_base_item";
|
|
||||||
cc_item_index = CC_NO_INDEX;
|
cc_item_index = CC_NO_INDEX;
|
||||||
cc_item_enabled = true;
|
cc_item_enabled = true;
|
||||||
cc_item_selected = false;
|
cc_item_selected = false;
|
||||||
@@ -241,19 +239,6 @@ void CComponentsItem::syncSysColors()
|
|||||||
col_frame = COL_FRAME_PLUS_0;
|
col_frame = COL_FRAME_PLUS_0;
|
||||||
}
|
}
|
||||||
|
|
||||||
//returns current item element type, if no available, return -1 as unknown type
|
|
||||||
int CComponentsItem::getItemType()
|
|
||||||
{
|
|
||||||
for(int i =0; i< (CC_ITEMTYPES) ;i++){
|
|
||||||
if (i == cc_item_type.id)
|
|
||||||
return i;
|
|
||||||
}
|
|
||||||
|
|
||||||
dprintf(DEBUG_DEBUG, "[CComponentsItem] %s: unknown item type requested...\n", __func__);
|
|
||||||
|
|
||||||
return -1;
|
|
||||||
}
|
|
||||||
|
|
||||||
//returns true if current item is added to a form
|
//returns true if current item is added to a form
|
||||||
bool CComponentsItem::isAdded()
|
bool CComponentsItem::isAdded()
|
||||||
{
|
{
|
||||||
@@ -332,12 +317,4 @@ void CComponentsItem::setSelected(bool selected, const fb_pixel_t& sel_frame_col
|
|||||||
col_frame = cc_item_selected ? sel_frame_col : frame_col;
|
col_frame = cc_item_selected ? sel_frame_col : frame_col;
|
||||||
}
|
}
|
||||||
|
|
||||||
void CComponentsItem::setItemName(const std::string& name)
|
|
||||||
{
|
|
||||||
cc_item_type.name = name;
|
|
||||||
}
|
|
||||||
|
|
||||||
std::string CComponentsItem::getItemName()
|
|
||||||
{
|
|
||||||
return cc_item_type.name;
|
|
||||||
}
|
|
||||||
|
@@ -40,8 +40,6 @@ class CComponentsItem : public CComponents
|
|||||||
///default: CC_NO_INDEX as identifer for not embedded item and default index=0 for form as main parent
|
///default: CC_NO_INDEX as identifer for not embedded item and default index=0 for form as main parent
|
||||||
///see also getIndex(), setIndex()
|
///see also getIndex(), setIndex()
|
||||||
int cc_item_index;
|
int cc_item_index;
|
||||||
///property: define of item type, see cc_types.h for possible types
|
|
||||||
cc_type_t cc_item_type;
|
|
||||||
///property: default enabled
|
///property: default enabled
|
||||||
bool cc_item_enabled;
|
bool cc_item_enabled;
|
||||||
///property: default not selected
|
///property: default not selected
|
||||||
@@ -102,13 +100,6 @@ class CComponentsItem : public CComponents
|
|||||||
*/
|
*/
|
||||||
virtual void kill(const fb_pixel_t& bg_color = COL_BACKGROUND_PLUS_0, bool ignore_parent = false, const int& fblayer_type = ~CC_FBDATA_TYPES);
|
virtual void kill(const fb_pixel_t& bg_color = COL_BACKGROUND_PLUS_0, bool ignore_parent = false, const int& fblayer_type = ~CC_FBDATA_TYPES);
|
||||||
|
|
||||||
///get the current item type, see attribute cc_item_type above
|
|
||||||
int getItemType();
|
|
||||||
//sets item name
|
|
||||||
void setItemName(const std::string& name);
|
|
||||||
//gets item name
|
|
||||||
std::string getItemName();
|
|
||||||
|
|
||||||
///syncronizes item colors with current color settings if required, NOTE: overwrites internal values!
|
///syncronizes item colors with current color settings if required, NOTE: overwrites internal values!
|
||||||
virtual void syncSysColors();
|
virtual void syncSysColors();
|
||||||
|
|
||||||
|
59
src/gui/components/cc_types.cpp
Normal file
59
src/gui/components/cc_types.cpp
Normal file
@@ -0,0 +1,59 @@
|
|||||||
|
/*
|
||||||
|
Based up Neutrino-GUI - Tuxbox-Project
|
||||||
|
Copyright (C) 2001 by Steffen Hehn 'McClean'
|
||||||
|
|
||||||
|
Types and base type class for generic GUI-related components.
|
||||||
|
Copyright (C) 2012-2018, 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/>.
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
#include "cc_types.h"
|
||||||
|
#include <system/debug.h>
|
||||||
|
|
||||||
|
|
||||||
|
CCTypes::CCTypes()
|
||||||
|
{
|
||||||
|
cc_item_type.id = CC_ITEMTYPE_GENERIC;
|
||||||
|
cc_item_type.name = "cc_generic_type";
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
//returns current item element type, if no available, return -1 as unknown type
|
||||||
|
int CCTypes::CCTypes::getItemType()
|
||||||
|
{
|
||||||
|
for(int i =0; i< (CC_ITEMTYPES) ;i++){
|
||||||
|
if (i == cc_item_type.id)
|
||||||
|
return i;
|
||||||
|
}
|
||||||
|
|
||||||
|
dprintf(DEBUG_DEBUG, "[CCTypes] %s: unknown item type requested...\n", __func__);
|
||||||
|
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
|
//sets item name
|
||||||
|
void CCTypes::CCTypes::setItemName(const std::string& name)
|
||||||
|
{
|
||||||
|
cc_item_type.name = name;
|
||||||
|
}
|
||||||
|
|
||||||
|
//gets item name
|
||||||
|
std::string CCTypes::CCTypes::getItemName()
|
||||||
|
{
|
||||||
|
return cc_item_type.name;
|
||||||
|
}
|
@@ -2,8 +2,8 @@
|
|||||||
Based up Neutrino-GUI - Tuxbox-Project
|
Based up Neutrino-GUI - Tuxbox-Project
|
||||||
Copyright (C) 2001 by Steffen Hehn 'McClean'
|
Copyright (C) 2001 by Steffen Hehn 'McClean'
|
||||||
|
|
||||||
Classes for generic GUI-related components.
|
Types and base type class for generic GUI-related components.
|
||||||
Copyright (C) 2012-2014, Thilo Graf 'dbt'
|
Copyright (C) 2012-2018, Thilo Graf 'dbt'
|
||||||
|
|
||||||
License: GPL
|
License: GPL
|
||||||
|
|
||||||
@@ -17,10 +17,8 @@
|
|||||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||||
General Public License for more details.
|
General Public License for more details.
|
||||||
|
|
||||||
You should have received a copy of the GNU General Public
|
You should have received a copy of the GNU General Public License
|
||||||
License along with this program; if not, write to the
|
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
|
|
||||||
Boston, MA 02110-1301, USA.
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#ifndef __CC_TYPES__
|
#ifndef __CC_TYPES__
|
||||||
@@ -236,5 +234,24 @@ typedef struct button_label_cc
|
|||||||
#define CC_CENTERED -2
|
#define CC_CENTERED -2
|
||||||
|
|
||||||
|
|
||||||
|
//abstract basic type class
|
||||||
|
class CCTypes
|
||||||
|
{
|
||||||
|
protected:
|
||||||
|
///property: define of item type, see cc_types.h for possible types
|
||||||
|
cc_type_t cc_item_type;
|
||||||
|
|
||||||
|
public:
|
||||||
|
CCTypes();
|
||||||
|
virtual ~CCTypes(){};
|
||||||
|
|
||||||
|
///get the current item type, see attribute cc_item_type above
|
||||||
|
int getItemType();
|
||||||
|
//sets item name
|
||||||
|
void setItemName(const std::string& name);
|
||||||
|
//gets item name
|
||||||
|
std::string getItemName();
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
Reference in New Issue
Block a user