mirror of
https://github.com/tuxbox-neutrino/neutrino.git
synced 2025-08-29 16:31:11 +02:00
CComponentsPicture: add member initPosition()
This commit is contained in:
@@ -142,31 +142,40 @@ void CComponentsPicture::initVarPicture()
|
|||||||
printf("[CComponentsPicture] %s file: %s, no icon dimensions found! width = %d, height = %d\n", __FUNCTION__, pic_name.c_str(), pic_width, pic_height);
|
printf("[CComponentsPicture] %s file: %s, no icon dimensions found! width = %d, height = %d\n", __FUNCTION__, pic_name.c_str(), pic_width, pic_height);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
pic_x += fr_thickness;
|
initPosition();
|
||||||
pic_y += fr_thickness;
|
|
||||||
|
|
||||||
if (pic_height>0 && pic_width>0){
|
|
||||||
if (pic_align & CC_ALIGN_LEFT)
|
|
||||||
pic_x = x+fr_thickness;
|
|
||||||
if (pic_align & CC_ALIGN_RIGHT)
|
|
||||||
pic_x = x+width-pic_width-fr_thickness;
|
|
||||||
if (pic_align & CC_ALIGN_TOP)
|
|
||||||
pic_y = y+fr_thickness;
|
|
||||||
if (pic_align & CC_ALIGN_BOTTOM)
|
|
||||||
pic_y = y+height-pic_height-fr_thickness;
|
|
||||||
if (pic_align & CC_ALIGN_HOR_CENTER)
|
|
||||||
pic_x = x+width/2-pic_width/2;
|
|
||||||
if (pic_align & CC_ALIGN_VER_CENTER)
|
|
||||||
pic_y = y+height/2-pic_height/2;
|
|
||||||
|
|
||||||
do_paint = true;
|
|
||||||
}
|
|
||||||
|
|
||||||
int sw = (shadow ? shadow_w :0);
|
int sw = (shadow ? shadow_w :0);
|
||||||
width = max(max(pic_width, pic_max_w), width) + sw ;
|
width = max(max(pic_width, pic_max_w), width) + sw ;
|
||||||
height = max(max(pic_height, pic_max_h), height) + sw ;
|
height = max(max(pic_height, pic_max_h), height) + sw ;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void CComponentsPicture::initPosition()
|
||||||
|
{
|
||||||
|
//using of real x/y values to paint images if this picture object is bound in a parent form
|
||||||
|
int px = x, py = y;
|
||||||
|
if (cc_parent){
|
||||||
|
px = cc_xr;
|
||||||
|
py = cc_yr;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (pic_height>0 && pic_width>0){
|
||||||
|
if (pic_align & CC_ALIGN_LEFT)
|
||||||
|
pic_x = px+fr_thickness;
|
||||||
|
if (pic_align & CC_ALIGN_RIGHT)
|
||||||
|
pic_x = px+width-pic_width-fr_thickness;
|
||||||
|
if (pic_align & CC_ALIGN_TOP)
|
||||||
|
pic_y = py+fr_thickness;
|
||||||
|
if (pic_align & CC_ALIGN_BOTTOM)
|
||||||
|
pic_y = py+height-pic_height-fr_thickness;
|
||||||
|
if (pic_align & CC_ALIGN_HOR_CENTER)
|
||||||
|
pic_x = px+width/2-pic_width/2;
|
||||||
|
if (pic_align & CC_ALIGN_VER_CENTER)
|
||||||
|
pic_y = py+height/2-pic_height/2;
|
||||||
|
|
||||||
|
do_paint = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void CComponentsPicture::paintPicture()
|
void CComponentsPicture::paintPicture()
|
||||||
{
|
{
|
||||||
pic_painted = false;
|
pic_painted = false;
|
||||||
|
@@ -65,6 +65,9 @@ class CComponentsPicture : public CComponentsItem
|
|||||||
|
|
||||||
void init( const int x_pos, const int y_pos, const std::string& image_name, const int alignment, bool has_shadow,
|
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);
|
fb_pixel_t color_frame, fb_pixel_t color_background, fb_pixel_t color_shadow);
|
||||||
|
|
||||||
|
///initialize position of picture object dependendly from settings
|
||||||
|
void initPosition();
|
||||||
void paintPicture();
|
void paintPicture();
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
Reference in New Issue
Block a user