EasyAndFastMod/Controls/Picture.mqh

96 lines
7.4 KiB
MQL5
Raw Permalink Normal View History

2026-01-15 07:23:17 -05:00
<EFBFBD><EFBFBD>//+------------------------------------------------------------------+
//| Picture.mqh |
//| Copyright 2016, MetaQuotes Software Corp. |
//| http://www.mql5.com |
//+------------------------------------------------------------------+
#include "..\Element.mqh"
//+------------------------------------------------------------------+
//| ;0AA 4;O A>740=8O :0@B8=:8 |
//+------------------------------------------------------------------+
class CPicture : public CElement
{
public:
CPicture(void);
~CPicture(void);
//--- 5B>4K 4;O A>740=8O :0@B8=:8
bool CreatePicture(const int x_gap,const int y_gap);
//---
private:
void InitializeProperties(const int x_gap,const int y_gap);
bool CreateCanvas(void);
//---
public:
//--- 8AC5B M;5<5=B
virtual void Draw(void);
};
//+------------------------------------------------------------------+
//| Constructor |
//+------------------------------------------------------------------+
CPicture::CPicture(void)
{
//--- !>E@0=8< 8<O :;0AA0 M;5<5=B0 2 107>2>< :;0AA5
CElementBase::ClassName(CLASS_NAME);
}
//+------------------------------------------------------------------+
//| Destructor |
//+------------------------------------------------------------------+
CPicture::~CPicture(void)
{
}
//+------------------------------------------------------------------+
//| !>740QB M;5<5=B "0@B8=:0" |
//+------------------------------------------------------------------+
bool CPicture::CreatePicture(const int x_gap,const int y_gap)
{
//--- K9B8, 5A;8 =5B C:070B5;O =0 3;02=K9 M;5<5=B
if(!CElement::CheckMainPointer())
return(false);
//--- =8F80;870F8O A2>9AB2
InitializeProperties(x_gap,y_gap);
//--- !>740=85 M;5<5=B0
if(!CreateCanvas())
return(false);
//---
return(true);
}
//+------------------------------------------------------------------+
//| =8F80;870F8O A2>9AB2 |
//+------------------------------------------------------------------+
void CPicture::InitializeProperties(const int x_gap,const int y_gap)
{
m_x =CElement::CalculateX(x_gap);
m_y =CElement::CalculateY(y_gap);
m_x_size =(m_x_size<1)? 16 : m_x_size;
m_y_size =(m_y_size<1)? 16 : m_y_size;
//--- !2>9AB20 ?> C<>;G0=8N
m_back_color =(m_back_color!=clrNONE)? m_back_color : m_main.BackColor();
//--- BABC?K >B :@09=59 B>G:8
CElementBase::XGap(x_gap);
CElementBase::YGap(y_gap);
}
//+------------------------------------------------------------------+
//| !>740QB >1J5:B 4;O @8A>20=8O |
//+------------------------------------------------------------------+
bool CPicture::CreateCanvas(void)
{
//--- $>@<8@>20=85 8<5=8 >1J5:B0
string name=CElementBase::ElementName("icon");
//--- !>740=85 >1J5:B0
if(!CElement::CreateCanvas(name,m_x,m_y,m_x_size,m_y_size))
return(false);
//---
return(true);
}
//+------------------------------------------------------------------+
//| 8AC5B M;5<5=B |
//+------------------------------------------------------------------+
void CPicture::Draw(void)
{
//--- 0@8A>20BL D>=
CElement::DrawBackground();
//--- 0@8A>20BL :0@B8=:C
CElement::DrawImage();
}
//+------------------------------------------------------------------+