mirror of
https://github.com/tuxbox-fork-migrations/recycled-ni-neutrino.git
synced 2025-08-27 23:42:51 +02:00
CComponentsItem: add members to set item position via percent value
Origin commit data
------------------
Branch: ni/coolstream
Commit: 38dffb8456
Author: Thilo Graf <dbt@novatux.de>
Date: 2014-02-26 (Wed, 26 Feb 2014)
------------------
No further description and justification available within origin commit message!
------------------
This commit was generated by Migit
This commit is contained in:
@@ -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-2014, Thilo Graf 'dbt'
|
||||
Copyright (C) 2012, Michael Liebmann 'micha-bbg'
|
||||
|
||||
License: GPL
|
||||
@@ -235,10 +235,20 @@ void CComponents::kill()
|
||||
}
|
||||
|
||||
//clean old screen buffer
|
||||
inline void CComponents::clearFbData()
|
||||
void CComponents::clearFbData()
|
||||
{
|
||||
for(size_t i =0; i< v_fbdata.size() ;i++)
|
||||
if (v_fbdata[i].pixbuf)
|
||||
delete[] v_fbdata[i].pixbuf;
|
||||
v_fbdata.clear();
|
||||
}
|
||||
|
||||
inline void CComponents::setXPos(const int& xpos)
|
||||
{
|
||||
x = xpos;
|
||||
}
|
||||
|
||||
inline void CComponents::setYPos(const int& ypos)
|
||||
{
|
||||
y = ypos;
|
||||
}
|
||||
|
@@ -120,11 +120,11 @@ class CComponents
|
||||
CComponents();
|
||||
virtual~CComponents();
|
||||
|
||||
///set screen x-position
|
||||
inline virtual void setXPos(const int& xpos){x = xpos;};
|
||||
///set screen y-position,
|
||||
inline virtual void setYPos(const int& ypos){y = ypos;};
|
||||
///set x and y position
|
||||
///set screen x-position, parameter as int
|
||||
virtual void setXPos(const int& xpos);
|
||||
///set screen y-position, parameter as int
|
||||
virtual void setYPos(const int& ypos);
|
||||
///set x and y position at once
|
||||
///Note: position of bound components (items) means position related within parent form, not for screen!
|
||||
///to set the real screen position, look at setRealPos()
|
||||
inline virtual void setPos(const int& xpos, const int& ypos){x = xpos; y = ypos;};
|
||||
@@ -286,6 +286,14 @@ class CComponentsItem : public CComponents
|
||||
///set an index to item, see also attribut cc_item_index.
|
||||
///To generate an index, use genIndex()
|
||||
virtual void setIndex(const int& index){cc_item_index = index;};
|
||||
|
||||
///set screen x-position, parameter as uint8_t, percent value of screen x
|
||||
virtual void setXPosP(const uint8_t& xpos_percent);
|
||||
///set screen y-position, parameter as uint8_t, percent value of screen y
|
||||
virtual void setYPosP(const uint8_t& ypos_percent);
|
||||
///set x and y position as percent value from current parent or screen dimensions at once
|
||||
///Note: position of bound components (items) means position related within parent form, not for screen!
|
||||
virtual void setPosP(const uint8_t& xpos_percent, const uint8_t& ypos_percent);
|
||||
};
|
||||
|
||||
#endif
|
||||
|
@@ -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-2014, Thilo Graf 'dbt'
|
||||
Copyright (C) 2012, Michael Liebmann 'micha-bbg'
|
||||
|
||||
License: GPL
|
||||
@@ -31,6 +31,7 @@
|
||||
#include <global.h>
|
||||
#include <neutrino.h>
|
||||
#include "cc_base.h"
|
||||
#include <driver/screen_max.h>
|
||||
|
||||
using namespace std;
|
||||
|
||||
@@ -163,3 +164,21 @@ bool CComponentsItem::isAdded()
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
void CComponentsItem::setXPosP(const uint8_t& xpos_percent)
|
||||
{
|
||||
int x_tmp = cc_parent ? xpos_percent*cc_parent->getWidth() : xpos_percent*frameBuffer->getScreenWidth();
|
||||
x = x_tmp/100;
|
||||
}
|
||||
|
||||
void CComponentsItem::setYPosP(const uint8_t& ypos_percent)
|
||||
{
|
||||
int y_tmp = cc_parent ? ypos_percent*cc_parent->getHeight() : ypos_percent*frameBuffer->getScreenHeight();
|
||||
x = y_tmp/100;
|
||||
}
|
||||
|
||||
void CComponentsItem::setPosP(const uint8_t& xpos_percent, const uint8_t& ypos_percent)
|
||||
{
|
||||
setXPosP(xpos_percent);
|
||||
setYPosP(ypos_percent);
|
||||
}
|
||||
|
Reference in New Issue
Block a user