mirror of
https://github.com/tuxbox-fork-migrations/recycled-ni-neutrino.git
synced 2025-08-29 08:21:07 +02:00
CComponentsForm: add predefine CC_CENTERED for auto positions
This saves explicit position calculations to arrange items centered
Origin commit data
------------------
Branch: ni/coolstream
Commit: 3ff09c88bd
Author: Thilo Graf <dbt@novatux.de>
Date: 2013-10-11 (Fri, 11 Oct 2013)
------------------
This commit was generated by Migit
This commit is contained in:
@@ -51,17 +51,17 @@ class CComponents
|
||||
///container: for frambuffer properties and pixel buffer
|
||||
std::vector<comp_fbdata_t> v_fbdata;
|
||||
|
||||
///property: x-position on screen
|
||||
///property: x-position on screen, to alter with setPos() or setDimensionsAll(), see also defines CC_APPEND, CC_CENTERED
|
||||
int x;
|
||||
///property: y-position on screen
|
||||
///property: y-position on screen, to alter setPos() or setDimensionsAll(), see also defines CC_APPEND, CC_CENTERED
|
||||
int y;
|
||||
///property: contains real x-position on screen
|
||||
int cc_xr;
|
||||
///property: contains real y-position on screen
|
||||
int cc_yr;
|
||||
///property: height-dimension on screen
|
||||
///property: height-dimension on screen, to alter with setHeight() or setDimensionsAll()
|
||||
int height;
|
||||
///property: width-dimension on screen
|
||||
///property: width-dimension on screen, to alter with setWidth() or setDimensionsAll()
|
||||
int width;
|
||||
///property: has corners with definied type, types are defined in /driver/frambuffer.h, without effect, if corner_radius=0
|
||||
int corner_type;
|
||||
|
@@ -309,23 +309,35 @@ void CComponentsForm::paintCCItems()
|
||||
int xpos = cc_item->getXPos();
|
||||
int ypos = cc_item->getYPos();
|
||||
|
||||
//set required x-position to item
|
||||
//set required x-position to item:
|
||||
//append vertical
|
||||
if (xpos == CC_APPEND){
|
||||
auto_x += append_h_offset;
|
||||
cc_item->setRealXPos(auto_x + xpos + 1);
|
||||
auto_x += w_item;
|
||||
}
|
||||
//positionize vertical centered
|
||||
else if (xpos == CC_CENTERED){
|
||||
auto_x = width/2 - cc_item->getWidth()/2;
|
||||
cc_item->setRealXPos(this_x + auto_x);
|
||||
}
|
||||
else{
|
||||
cc_item->setRealXPos(this_x + xpos);
|
||||
auto_x = (cc_item->getRealXPos() + w_item);
|
||||
}
|
||||
|
||||
//set required y-position to item
|
||||
//append hor
|
||||
if (ypos == CC_APPEND){
|
||||
auto_y += append_v_offset;
|
||||
cc_item->setRealYPos(auto_y + ypos + 1);
|
||||
auto_y += h_item;
|
||||
}
|
||||
//positionize hor centered
|
||||
else if (ypos == CC_CENTERED){
|
||||
auto_y = height/2 - cc_item->getHeight()/2;
|
||||
cc_item->setRealYPos(this_y + auto_y);
|
||||
}
|
||||
else{
|
||||
cc_item->setRealYPos(this_y + ypos);
|
||||
auto_y = (cc_item->getRealYPos() + h_item);
|
||||
|
@@ -134,7 +134,12 @@ typedef struct comp_element_data_t
|
||||
#define CC_SAVE_SCREEN_NO false
|
||||
|
||||
#define CC_NO_INDEX -1
|
||||
|
||||
///predefined parameters for auto positionizing of embedded items inside a parent form
|
||||
///CC_APPEND used for x or y position or booth. An item with this parameter will paint automatically arranged side by side
|
||||
#define CC_APPEND -1
|
||||
///CC CENTERED used for x or y position or booth. An item with this parameter will paint automatically centered
|
||||
#define CC_CENTERED -2
|
||||
|
||||
|
||||
|
||||
|
Reference in New Issue
Block a user