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:
2013-10-11 22:11:15 +02:00
parent 81e14a3291
commit acf753f584
3 changed files with 22 additions and 5 deletions

View File

@@ -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);