mirror of
https://github.com/tuxbox-fork-migrations/recycled-ni-neutrino.git
synced 2025-08-28 16:01:10 +02:00
cc_*_picture: add own file for cc_frm_picture.
Re-adding compatibility with old background behavior.
Should mainly fix behavior with lua plugins whose are using
background paint as default and without explicit enabled background.
Origin commit data
------------------
Branch: ni/coolstream
Commit: dda1574930
Author: Thilo Graf <dbt@novatux.de>
Date: 2021-12-02 (Thu, 02 Dec 2021)
------------------
This commit was generated by Migit
This commit is contained in:
@@ -31,6 +31,7 @@ libneutrino_gui_components_a_SOURCES = \
|
|||||||
cc_frm_header.cpp \
|
cc_frm_header.cpp \
|
||||||
cc_frm_ext_text.cpp \
|
cc_frm_ext_text.cpp \
|
||||||
cc_frm_icons.cpp \
|
cc_frm_icons.cpp \
|
||||||
|
cc_frm_picture.cpp \
|
||||||
cc_frm_scrollbar.cpp \
|
cc_frm_scrollbar.cpp \
|
||||||
cc_frm_signalbars.cpp \
|
cc_frm_signalbars.cpp \
|
||||||
cc_frm_slider.cpp \
|
cc_frm_slider.cpp \
|
||||||
|
74
src/gui/components/cc_frm_picture.cpp
Normal file
74
src/gui/components/cc_frm_picture.cpp
Normal file
@@ -0,0 +1,74 @@
|
|||||||
|
/*
|
||||||
|
Based up Neutrino-GUI - Tuxbox-Project
|
||||||
|
Copyright (C) 2001 by Steffen Hehn 'McClean'
|
||||||
|
|
||||||
|
Classes for generic GUI-related components.
|
||||||
|
Copyright (C) 2021, 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
|
||||||
|
Library 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/>.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifdef HAVE_CONFIG_H
|
||||||
|
#include <config.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#include <global.h>
|
||||||
|
#include <neutrino.h>
|
||||||
|
#include "cc_item_picture.h"
|
||||||
|
|
||||||
|
|
||||||
|
void CComponentsPicture::getRealSize(int *dx, int *dy)
|
||||||
|
{
|
||||||
|
ccp->getRealSize(dx, dy);
|
||||||
|
}
|
||||||
|
|
||||||
|
void CComponentsPicture::setPicture(const std::string &name, const int &w, const int &h)
|
||||||
|
{
|
||||||
|
ccp->setPicture(name, w, h);
|
||||||
|
init(x, y, name, ccp->getBodyBGImageTranparencyMode());
|
||||||
|
}
|
||||||
|
|
||||||
|
void CComponentsPicture::setPicture(const char *name, const int &w, const int &h)
|
||||||
|
{
|
||||||
|
setPicture(name, w, h);
|
||||||
|
}
|
||||||
|
|
||||||
|
std::string CComponentsPicture::getPictureName()
|
||||||
|
{
|
||||||
|
return ccp->getPictureName();
|
||||||
|
}
|
||||||
|
|
||||||
|
void CComponentsPicture::SetTransparent(const int &mode)
|
||||||
|
{
|
||||||
|
init(x, y, ccp->getBodyBGImage(), mode);
|
||||||
|
}
|
||||||
|
|
||||||
|
void CComponentsPicture::setWidth(const int &w, bool keep_aspect)
|
||||||
|
{
|
||||||
|
ccp->setWidth(w, keep_aspect);
|
||||||
|
init(x, y, ccp->getBodyBGImage(), ccp->getBodyBGImageTranparencyMode());
|
||||||
|
}
|
||||||
|
|
||||||
|
void CComponentsPicture::setHeight(const int &h, bool keep_aspect)
|
||||||
|
{
|
||||||
|
ccp->setHeight(h, keep_aspect);
|
||||||
|
init(x, y, ccp->getBodyBGImage(), ccp->getBodyBGImageTranparencyMode());
|
||||||
|
}
|
||||||
|
|
||||||
|
void CComponentsPicture::paint(const bool &do_save_bg)
|
||||||
|
{
|
||||||
|
CComponentsForm::paint(do_save_bg);
|
||||||
|
};
|
@@ -35,28 +35,33 @@
|
|||||||
|
|
||||||
extern CPictureViewer *g_PicViewer;
|
extern CPictureViewer *g_PicViewer;
|
||||||
|
|
||||||
CCPictureBase::CCPictureBase(const int &x_pos,
|
// CCPicture
|
||||||
const int &y_pos,
|
|
||||||
const int &w,
|
CCPicture::CCPicture(const int &x_pos,
|
||||||
const int &h,
|
const int &y_pos,
|
||||||
const std::string &image,
|
const int &w,
|
||||||
CComponentsForm *parent,
|
const int &h,
|
||||||
int shadow_mode,
|
const std::string &image,
|
||||||
fb_pixel_t color_frame,
|
CComponentsForm *parent,
|
||||||
fb_pixel_t color_background,
|
int shadow_mode,
|
||||||
fb_pixel_t color_shadow,
|
fb_pixel_t color_frame,
|
||||||
const int &transparency_mode)
|
fb_pixel_t color_background,
|
||||||
: CComponentsShapeSquare(x_pos, y_pos, w, h, NULL, shadow_mode, color_frame, color_background, color_shadow)
|
fb_pixel_t color_shadow,
|
||||||
|
const int &transparency_mode)
|
||||||
|
: CComponentsShapeSquare(x_pos, y_pos, w, h, NULL, shadow_mode, color_frame, color_background, color_shadow)
|
||||||
{
|
{
|
||||||
cc_item_type.id = CC_ITEMTYPE_PICTURE;
|
cc_item_type.id = CC_ITEMTYPE_PICTURE;
|
||||||
cc_item_type.name = image.empty() ? "cc_image_box" : image;
|
cc_item_type.name = image.empty() ? "cc_image_box" : image;
|
||||||
cc_bg_image_tr_mode = transparency_mode;
|
cc_bg_image_tr_mode = transparency_mode;
|
||||||
|
|
||||||
|
// image and background are the same things in this object! Must be always enabled.
|
||||||
|
paint_bg = true;
|
||||||
|
|
||||||
setPicture(image, w, h);
|
setPicture(image, w, h);
|
||||||
initParent(parent);
|
initParent(parent);
|
||||||
}
|
}
|
||||||
|
|
||||||
void CCPictureBase::setPicture(const std::string &name, const int &w, const int &h)
|
void CCPicture::setPicture(const std::string &name, const int &w, const int &h)
|
||||||
{
|
{
|
||||||
setBodyBGImageName(name, "", "");
|
setBodyBGImageName(name, "", "");
|
||||||
|
|
||||||
@@ -67,7 +72,7 @@ void CCPictureBase::setPicture(const std::string &name, const int &w, const int
|
|||||||
|
|
||||||
if (getBodyBGImage().empty())
|
if (getBodyBGImage().empty())
|
||||||
{
|
{
|
||||||
dprintf(DEBUG_INFO, "[CCPictureBase] [%s - %d] no image defined or doesn't exists %s\n", __func__, __LINE__, name.c_str());
|
dprintf(DEBUG_INFO, "[CCPicture] [%s - %d] no image defined or doesn't exists %s\n", __func__, __LINE__, name.c_str());
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -96,7 +101,7 @@ void CCPictureBase::setPicture(const std::string &name, const int &w, const int
|
|||||||
CCDraw::setHeight(dy_tmp);
|
CCDraw::setHeight(dy_tmp);
|
||||||
}
|
}
|
||||||
|
|
||||||
void CCPictureBase::setPicture(const char *name, const int &w, const int &h)
|
void CCPicture::setPicture(const char *name, const int &w, const int &h)
|
||||||
{
|
{
|
||||||
std::string s_tmp = "";
|
std::string s_tmp = "";
|
||||||
if (name)
|
if (name)
|
||||||
@@ -104,35 +109,38 @@ void CCPictureBase::setPicture(const char *name, const int &w, const int &h)
|
|||||||
setPicture(s_tmp, w, h);
|
setPicture(s_tmp, w, h);
|
||||||
}
|
}
|
||||||
|
|
||||||
void CCPictureBase::setWidth(const int &w, bool keep_aspect)
|
void CCPicture::setWidth(const int &w, bool keep_aspect)
|
||||||
{
|
{
|
||||||
setPicture(cc_bg_std_image, w, keep_aspect ? 0 : height);
|
setPicture(cc_bg_std_image, w, keep_aspect ? 0 : height);
|
||||||
}
|
}
|
||||||
|
|
||||||
void CCPictureBase::setHeight(const int &h, bool keep_aspect)
|
void CCPicture::setHeight(const int &h, bool keep_aspect)
|
||||||
{
|
{
|
||||||
setPicture(cc_bg_std_image, keep_aspect ? 0 : width, h);
|
setPicture(cc_bg_std_image, keep_aspect ? 0 : width, h);
|
||||||
}
|
}
|
||||||
|
|
||||||
void CCPictureBase::getRealSize(int *dx, int *dy)
|
void CCPicture::getRealSize(int *dx, int *dy)
|
||||||
{
|
{
|
||||||
*dx = dx_orig;
|
*dx = dx_orig;
|
||||||
*dy = dy_orig;
|
*dy = dy_orig;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// CComponentsChannelLogo
|
||||||
|
|
||||||
CComponentsChannelLogo::CComponentsChannelLogo(const int &x_pos,
|
CComponentsChannelLogo::CComponentsChannelLogo(const int &x_pos,
|
||||||
const int &y_pos,
|
const int &y_pos,
|
||||||
const int &w,
|
const int &w,
|
||||||
const int &h,
|
const int &h,
|
||||||
const std::string &channelName,
|
const std::string &channelName,
|
||||||
const uint64_t &channelId,
|
const uint64_t &channelId,
|
||||||
CComponentsForm *parent,
|
CComponentsForm *parent,
|
||||||
int shadow_mode,
|
int shadow_mode,
|
||||||
fb_pixel_t color_frame,
|
fb_pixel_t color_frame,
|
||||||
fb_pixel_t color_background,
|
fb_pixel_t color_background,
|
||||||
fb_pixel_t color_shadow,
|
fb_pixel_t color_shadow,
|
||||||
const int &transparency_mode)
|
const int &transparency_mode)
|
||||||
: CCPictureBase(x_pos, y_pos, w, h, "", parent, shadow_mode, color_frame, color_background, color_shadow, transparency_mode)
|
: CCPicture(x_pos, y_pos, w, h, "", parent, shadow_mode, color_frame, color_background, color_shadow, transparency_mode)
|
||||||
{
|
{
|
||||||
cc_item_type.id = CC_ITEMTYPE_CHANNEL_LOGO;
|
cc_item_type.id = CC_ITEMTYPE_CHANNEL_LOGO;
|
||||||
cc_item_type.name = "cc_channel_logo_box";
|
cc_item_type.name = "cc_channel_logo_box";
|
||||||
|
@@ -30,21 +30,22 @@
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
#include "cc_base.h"
|
#include "cc_base.h"
|
||||||
|
#include "cc_frm.h"
|
||||||
#include "cc_item_shapes.h"
|
#include "cc_item_shapes.h"
|
||||||
#include <string>
|
#include <string>
|
||||||
|
|
||||||
//! Sub class of CComponentsShapeSquare. Shows box with image with assigned attributes.
|
//! Shows box with image with assigned attributes.
|
||||||
/*!
|
/*!
|
||||||
Picture is usable as an object like each other CCItems.
|
Usable as an object like each other CCItems.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
class CCPictureBase : public CComponentsShapeSquare
|
class CCPicture : public CComponentsShapeSquare
|
||||||
{
|
{
|
||||||
private:
|
private:
|
||||||
int dx_orig, dy_orig;
|
int dx_orig, dy_orig;
|
||||||
public:
|
public:
|
||||||
|
|
||||||
CCPictureBase(const int &x_pos,
|
CCPicture(const int &x_pos,
|
||||||
const int &y_pos,
|
const int &y_pos,
|
||||||
const int &w,
|
const int &w,
|
||||||
const int &h,
|
const int &h,
|
||||||
@@ -56,7 +57,7 @@ class CCPictureBase : public CComponentsShapeSquare
|
|||||||
fb_pixel_t color_shadow = COL_SHADOW_PLUS_0,
|
fb_pixel_t color_shadow = COL_SHADOW_PLUS_0,
|
||||||
const int &transparency_mode = CFrameBuffer::TM_EMPTY);
|
const int &transparency_mode = CFrameBuffer::TM_EMPTY);
|
||||||
|
|
||||||
virtual~CCPictureBase() {};
|
virtual~CCPicture() {};
|
||||||
|
|
||||||
///sets an image name, full image path or url to an image file
|
///sets an image name, full image path or url to an image file
|
||||||
void setPicture(const std::string &name, const int &w = 0, const int &h = 0);
|
void setPicture(const std::string &name, const int &w = 0, const int &h = 0);
|
||||||
@@ -77,51 +78,12 @@ class CCPictureBase : public CComponentsShapeSquare
|
|||||||
void getRealSize(int *dx, int *dy);
|
void getRealSize(int *dx, int *dy);
|
||||||
};
|
};
|
||||||
|
|
||||||
class CComponentsPicture : public CCPictureBase
|
//! Shows box with channel logo with assigned attributes.
|
||||||
{
|
/*!
|
||||||
public:
|
Usable as an object like each other CCItems.
|
||||||
/*!
|
*/
|
||||||
Use this for non scaled images.
|
|
||||||
Dimensions are defined by image itself.
|
|
||||||
If scaling is required, you should use class CComponentsPicture with dimension parameters see next.
|
|
||||||
width and height are defined by give image dimensions itself and are retrievable e.g. with getWidth() or getHeight().
|
|
||||||
*/
|
|
||||||
CComponentsPicture(const int &x_pos,
|
|
||||||
const int &y_pos,
|
|
||||||
const std::string &image,
|
|
||||||
CComponentsForm *parent = NULL,
|
|
||||||
int shadow_mode = CC_SHADOW_OFF,
|
|
||||||
fb_pixel_t color_frame = COL_FRAME_PLUS_0,
|
|
||||||
fb_pixel_t color_background = 0,
|
|
||||||
fb_pixel_t color_shadow = COL_SHADOW_PLUS_0,
|
|
||||||
int transparency_mode = CFrameBuffer::TM_EMPTY)
|
|
||||||
: CCPictureBase(x_pos, y_pos, 0, 0, image, parent, shadow_mode, color_frame, color_background, color_shadow, transparency_mode) {};
|
|
||||||
|
|
||||||
/*!
|
class CComponentsChannelLogo : public CCPicture
|
||||||
Use this for scaled images.
|
|
||||||
Dimensions are defined with parameters w (width) and h (height).
|
|
||||||
Only dimension values > 0 have a scale effect!
|
|
||||||
If one of the dimension parameters = 0, the ratio of image will be kept.
|
|
||||||
If scaling is not required, you should use overloaded class CComponentsPicture without dimension parameters or set values of w and h = 0.
|
|
||||||
width and height are retrievable e.g. with getWidth() or getHeight().
|
|
||||||
*/
|
|
||||||
CComponentsPicture(const int &x_pos,
|
|
||||||
const int &y_pos,
|
|
||||||
const int &w,
|
|
||||||
const int &h,
|
|
||||||
const std::string &image,
|
|
||||||
CComponentsForm *parent = NULL,
|
|
||||||
int shadow_mode = CC_SHADOW_OFF,
|
|
||||||
fb_pixel_t color_frame = COL_FRAME_PLUS_0,
|
|
||||||
fb_pixel_t color_background = 0,
|
|
||||||
fb_pixel_t color_shadow = COL_SHADOW_PLUS_0,
|
|
||||||
int transparency_mode = CFrameBuffer::TM_EMPTY)
|
|
||||||
: CCPictureBase(x_pos, y_pos, w, h, image, parent, shadow_mode, color_frame, color_background, color_shadow, transparency_mode) {};
|
|
||||||
|
|
||||||
virtual~CComponentsPicture() {};
|
|
||||||
};
|
|
||||||
|
|
||||||
class CComponentsChannelLogo : public CCPictureBase
|
|
||||||
{
|
{
|
||||||
private:
|
private:
|
||||||
///channel id
|
///channel id
|
||||||
@@ -138,15 +100,13 @@ class CComponentsChannelLogo : public CCPictureBase
|
|||||||
///indicates that logo is available, after paint or new instance, value = false
|
///indicates that logo is available, after paint or new instance, value = false
|
||||||
bool has_logo;
|
bool has_logo;
|
||||||
|
|
||||||
// void init(const uint64_t& channelId, const std::string &channelName, bool allow_scale);
|
|
||||||
|
|
||||||
public:
|
public:
|
||||||
/*!
|
/*!
|
||||||
Constructor for channel image objects: use this for scaled channel logos.
|
Constructor for channel image objects: use this for scaled channel logos.
|
||||||
Does the same like class CComponentsPicture() with parameters w (width) and h (height), see above!
|
Does the same like class CComponentsPicture() with parameters w (width) and h (height), see above!
|
||||||
Requires parameter channel_name or channelId instead image filename
|
Requires parameter channel_name or channelId instead image filename
|
||||||
NOTE: channel name string is prefered!
|
NOTE: channel name string is prefered!
|
||||||
*/
|
*/
|
||||||
CComponentsChannelLogo(const int &x_pos,
|
CComponentsChannelLogo(const int &x_pos,
|
||||||
const int &y_pos,
|
const int &y_pos,
|
||||||
const int &w,
|
const int &w,
|
||||||
@@ -160,6 +120,24 @@ class CComponentsChannelLogo : public CCPictureBase
|
|||||||
fb_pixel_t color_shadow = COL_SHADOW_PLUS_0,
|
fb_pixel_t color_shadow = COL_SHADOW_PLUS_0,
|
||||||
const int &transparency_mode = CFrameBuffer::TM_EMPTY);
|
const int &transparency_mode = CFrameBuffer::TM_EMPTY);
|
||||||
|
|
||||||
|
/*!
|
||||||
|
Constructor for channel image objects: use this for non scaled channel logos.
|
||||||
|
Does the same like class CComponentsPicture() without parameters w (width) and h (height), see above!
|
||||||
|
Requires parameter channel_name or channelId instead image filename
|
||||||
|
NOTE: channel name string is prefered!
|
||||||
|
*/
|
||||||
|
CComponentsChannelLogo(const int &x_pos,
|
||||||
|
const int &y_pos,
|
||||||
|
const std::string &channelName = "",
|
||||||
|
const uint64_t &channelId = 0,
|
||||||
|
CComponentsForm *parent = NULL,
|
||||||
|
int shadow_mode = CC_SHADOW_OFF,
|
||||||
|
fb_pixel_t color_frame = COL_FRAME_PLUS_0,
|
||||||
|
fb_pixel_t color_background = 0,
|
||||||
|
fb_pixel_t color_shadow = COL_SHADOW_PLUS_0,
|
||||||
|
const int &transparency_mode = CFrameBuffer::TM_EMPTY)
|
||||||
|
: CComponentsChannelLogo(x_pos, y_pos, 0, 0, channelName, channelId, parent, shadow_mode, color_frame, color_background, color_shadow, transparency_mode) {};
|
||||||
|
|
||||||
virtual~CComponentsChannelLogo() {};
|
virtual~CComponentsChannelLogo() {};
|
||||||
|
|
||||||
///set channel id and/or channel name, NOTE: channel name is prefered
|
///set channel id and/or channel name, NOTE: channel name is prefered
|
||||||
@@ -179,23 +157,157 @@ class CComponentsChannelLogo : public CCPictureBase
|
|||||||
///returns true, if any logo is available, also if an alternate logo was defined
|
///returns true, if any logo is available, also if an alternate logo was defined
|
||||||
bool hasLogo() {return has_logo;}
|
bool hasLogo() {return has_logo;}
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
|
class CComponentsPicture : public CComponentsForm
|
||||||
|
{
|
||||||
|
private:
|
||||||
|
CCPicture *ccp;
|
||||||
|
|
||||||
|
void init(const int &x_pos, const int &y_pos, const std::string &image, const int &transparency_mode)
|
||||||
|
{
|
||||||
|
setPos(x_pos, y_pos);
|
||||||
|
|
||||||
|
if (ccp == NULL)
|
||||||
|
{
|
||||||
|
ccp = new CCPicture(0, 0, width, height, image, this, CC_SHADOW_OFF, COL_FRAME_PLUS_0, 0, COL_SHADOW_PLUS_0, transparency_mode);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
ccp->setPicture(image, width, height);
|
||||||
|
ccp->SetTransparent(transparency_mode);
|
||||||
|
}
|
||||||
|
|
||||||
|
CComponentsForm::setWidth(ccp->getWidth());
|
||||||
|
CComponentsForm::setHeight(ccp->getHeight());
|
||||||
|
};
|
||||||
|
|
||||||
|
public:
|
||||||
/*!
|
/*!
|
||||||
Constructor for channel image objects: use this for non scaled channel logos.
|
Use this for scaled images.
|
||||||
Does the same like class CComponentsPicture() without parameters w (width) and h (height), see above!
|
Dimensions are defined with parameters w (width) and h (height).
|
||||||
Requires parameter channel_name or channelId instead image filename
|
Only dimension values > 0 have a scale effect!
|
||||||
NOTE: channel name string is prefered!
|
If one of the dimension parameters = 0, the ratio of image will be kept.
|
||||||
|
If scaling is not required, you should use overloaded class CComponentsPicture without dimension parameters or set values of w and h = 0.
|
||||||
|
width and height are retrievable e.g. with getWidth() or getHeight().
|
||||||
|
|
||||||
|
* @param[in] int x_pos, item position
|
||||||
|
* @param[in] int y_pos, item position
|
||||||
|
* @param[in] int w, item width
|
||||||
|
* @param[in] int h, item height
|
||||||
|
* @param[in] std::string image, image name, path or url
|
||||||
|
* @param[in] CComponentsForm *parent, parent form in which this item is embedded, optional, default NULL
|
||||||
|
* @param[in] int shadow_mode, mode of shadow, optional, default OFF
|
||||||
|
* @param[in] fb_pixel_t color_frame, color of frame, optional, default COL_FRAME_PLUS_0
|
||||||
|
* @param[in] fb_pixel_t color_background, color of background, optional, default 0
|
||||||
|
* @param[in] fb_pixel_t color_shadow, color of shadow, optional, default COL_SHADOW_PLUS_0
|
||||||
|
* @param[in] int transparency_mode, mode of image, optional, default CFrameBuffer::TM_EMPTY
|
||||||
*/
|
*/
|
||||||
CComponentsChannelLogo(const int &x_pos,
|
CComponentsPicture(const int &x_pos,
|
||||||
const int &y_pos,
|
const int &y_pos,
|
||||||
const std::string &channelName = "",
|
const int &w,
|
||||||
const uint64_t &channelId = 0,
|
const int &h,
|
||||||
|
const std::string &image,
|
||||||
CComponentsForm *parent = NULL,
|
CComponentsForm *parent = NULL,
|
||||||
int shadow_mode = CC_SHADOW_OFF,
|
int shadow_mode = CC_SHADOW_OFF,
|
||||||
fb_pixel_t color_frame = COL_FRAME_PLUS_0,
|
fb_pixel_t color_frame = COL_FRAME_PLUS_0,
|
||||||
fb_pixel_t color_background = 0,
|
fb_pixel_t color_background = 0,
|
||||||
fb_pixel_t color_shadow = COL_SHADOW_PLUS_0,
|
fb_pixel_t color_shadow = COL_SHADOW_PLUS_0,
|
||||||
const int &transparency_mode = CFrameBuffer::TM_EMPTY)
|
int transparency_mode = CFrameBuffer::TM_EMPTY)
|
||||||
: CComponentsChannelLogo(x_pos, y_pos, 0, 0, channelName, channelId, parent, shadow_mode, color_frame, color_background, color_shadow, transparency_mode) {};
|
: CComponentsForm(x_pos, y_pos, w, h, parent, shadow_mode, color_frame, color_background, color_shadow)
|
||||||
|
{
|
||||||
|
cc_item_type.name = image.empty() ? "cc_image_frm" : image;
|
||||||
|
ccp = NULL;
|
||||||
|
paint_bg = false;
|
||||||
|
init(x_pos, y_pos, image, transparency_mode);
|
||||||
|
};
|
||||||
|
|
||||||
|
/*!
|
||||||
|
Use this for non scaled images.
|
||||||
|
Dimensions are defined by image itself.
|
||||||
|
If scaling is required, you should use class CComponentsPicture with dimension parameters see above.
|
||||||
|
width and height are defined by given image dimensions itself and are retrievable e.g. with getWidth() or getHeight().
|
||||||
|
* @param[in] int x_pos, item position
|
||||||
|
* @param[in] int y_pos, item position
|
||||||
|
* @param[in] std::string image, image name, path or url
|
||||||
|
* @param[in] CComponentsForm *parent, parent form in which this item is embedded, optional, default NULL
|
||||||
|
* @param[in] int shadow_mode, mode of shadow, optional, default OFF
|
||||||
|
* @param[in] fb_pixel_t color_frame, color of frame, optional, default COL_FRAME_PLUS_0
|
||||||
|
* @param[in] fb_pixel_t color_background, color of background, optional, default 0
|
||||||
|
* @param[in] fb_pixel_t color_shadow, color of shadow, optional, default COL_SHADOW_PLUS_0
|
||||||
|
* @param[in] int transparency_mode, mode of image, optional, default CFrameBuffer::TM_EMPTY
|
||||||
|
*/
|
||||||
|
CComponentsPicture(const int &x_pos,
|
||||||
|
const int &y_pos,
|
||||||
|
const std::string &image,
|
||||||
|
CComponentsForm *parent = NULL,
|
||||||
|
int shadow_mode = CC_SHADOW_OFF,
|
||||||
|
fb_pixel_t color_frame = COL_FRAME_PLUS_0,
|
||||||
|
fb_pixel_t color_background = 0,
|
||||||
|
fb_pixel_t color_shadow = COL_SHADOW_PLUS_0,
|
||||||
|
int transparency_mode = CFrameBuffer::TM_EMPTY)
|
||||||
|
: CComponentsPicture(x_pos, y_pos, 0, 0, image, parent, shadow_mode, color_frame, color_background, color_shadow, transparency_mode)
|
||||||
|
{};
|
||||||
|
|
||||||
|
virtual~CComponentsPicture() {};
|
||||||
|
|
||||||
|
/*!
|
||||||
|
Passing original image size, use this to get origin dimensions of embedded image.
|
||||||
|
* @param[in] *int pointer to image width
|
||||||
|
* @param[in] *int pointer to image height
|
||||||
|
*/
|
||||||
|
void getRealSize(int *dx, int *dy);
|
||||||
|
|
||||||
|
/*!
|
||||||
|
Sets an image name, full image path or url to an image file.
|
||||||
|
Different dimension values > 0 will scale images, if is only one dimension value != 0, ratio will be kept.
|
||||||
|
* @param[in] std::string or const *char for image
|
||||||
|
* @param[in] int w image width, optional, default 0
|
||||||
|
* @param[in] int h image height, optional, default 0
|
||||||
|
*/
|
||||||
|
void setPicture(const std::string &name, const int &w = 0, const int &h = 0);
|
||||||
|
void setPicture(const char *name, const int &w = 0, const int &h = 0);
|
||||||
|
|
||||||
|
/*!
|
||||||
|
* This will return the current image with full path
|
||||||
|
*
|
||||||
|
* @return std::string returns image path
|
||||||
|
*/
|
||||||
|
std::string getPictureName();
|
||||||
|
|
||||||
|
/*!
|
||||||
|
Sets image transparency mode
|
||||||
|
* @param[in] int mode
|
||||||
|
*/
|
||||||
|
void SetTransparent(const int &mode);
|
||||||
|
|
||||||
|
/*!
|
||||||
|
Sets width of object, keep_aspect = true keeps ratio related to height
|
||||||
|
* @param[in] int w image width
|
||||||
|
* @param[in] bool keep_aspect, optional default = true
|
||||||
|
*/
|
||||||
|
void setWidth(const int &w, bool keep_aspect = true);
|
||||||
|
|
||||||
|
/*!
|
||||||
|
Sets height of object, keep_aspect = true keeps ratio related to width
|
||||||
|
* @param[in] int h image width
|
||||||
|
* @param[in] bool keep_aspect, optional default = true
|
||||||
|
*/
|
||||||
|
void setHeight(const int &h, bool keep_aspect = true);
|
||||||
|
|
||||||
|
/*!
|
||||||
|
Paints item
|
||||||
|
* @param[in] bool do_save_bg, optional default = true. True allows using hide() to restore background
|
||||||
|
*
|
||||||
|
* @see paintInit()
|
||||||
|
*/
|
||||||
|
void paint(const bool &do_save_bg = true);
|
||||||
|
|
||||||
|
/**Enable/Disable paint caching for body and shadow
|
||||||
|
* @see CCDraw::enablePaintCache(), CCDraw::disablePaintCache()
|
||||||
|
*/
|
||||||
|
void enablePaintCache(const bool &enable = true) {ccp->enablePaintCache(enable); enablePaintCache(enable);}
|
||||||
|
void disablePaintCache(){enablePaintCache(false);}
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif //__CC_ITEM_PICTURE_V2_H__
|
#endif //__CC_ITEM_PICTURE_V2_H__
|
||||||
|
Reference in New Issue
Block a user