109 lines
8.3 KiB
MQL5
109 lines
8.3 KiB
MQL5
//+------------------------------------------------------------------+
|
|
//| Program.mqh |
|
|
//| Copyright 2015, MetaQuotes Software Corp. |
|
|
//| http://www.mql5.com |
|
|
//+------------------------------------------------------------------+
|
|
#include <EasyAndFastGUI\Controls\WndEvents.mqh>
|
|
//+------------------------------------------------------------------+
|
|
//| Class for creating an application |
|
|
//+------------------------------------------------------------------+
|
|
class CProgram : public CWndEvents
|
|
{
|
|
private:
|
|
//--- Window
|
|
CWindow m_window;
|
|
//---
|
|
public:
|
|
CProgram(void);
|
|
~CProgram(void);
|
|
//--- Initialization/uninitialization
|
|
void OnInitEvent(void);
|
|
void OnDeinitEvent(const int reason);
|
|
//--- Timer
|
|
void OnTimerEvent(void);
|
|
//---
|
|
protected:
|
|
//--- Chart event handler
|
|
virtual void OnEvent(const int id,const long &lparam,const double &dparam,const string &sparam);
|
|
//---
|
|
public:
|
|
//--- Creates a trading panel
|
|
bool CreateTradePanel(void);
|
|
//---
|
|
private:
|
|
bool CreateWindow(const string text);
|
|
};
|
|
//+------------------------------------------------------------------+
|
|
//| Constructor |
|
|
//+------------------------------------------------------------------+
|
|
CProgram::CProgram(void)
|
|
{
|
|
}
|
|
//+------------------------------------------------------------------+
|
|
//| Destructor |
|
|
//+------------------------------------------------------------------+
|
|
CProgram::~CProgram(void)
|
|
{
|
|
}
|
|
//+------------------------------------------------------------------+
|
|
//| Initialization |
|
|
//+------------------------------------------------------------------+
|
|
void CProgram::OnInitEvent(void)
|
|
{
|
|
}
|
|
//+------------------------------------------------------------------+
|
|
//| Uninitialization |
|
|
//+------------------------------------------------------------------+
|
|
void CProgram::OnDeinitEvent(const int reason)
|
|
{
|
|
//--- Deleting an interface
|
|
CWndEvents::Destroy();
|
|
}
|
|
//+------------------------------------------------------------------+
|
|
//| Timer |
|
|
//+------------------------------------------------------------------+
|
|
void CProgram::OnTimerEvent(void)
|
|
{
|
|
CWndEvents::OnTimerEvent();
|
|
}
|
|
//+------------------------------------------------------------------+
|
|
//| Event handler |
|
|
//+------------------------------------------------------------------+
|
|
void CProgram::OnEvent(const int id,const long &lparam,const double &dparam,const string &sparam)
|
|
{
|
|
}
|
|
//+------------------------------------------------------------------+
|
|
//| Creates a trading panel |
|
|
//+------------------------------------------------------------------+
|
|
bool CProgram::CreateTradePanel(void)
|
|
{
|
|
//--- Creating a form for controls
|
|
if(!CreateWindow("EXPERT PANEL"))
|
|
return(false);
|
|
//--- Creating controls
|
|
// ...
|
|
//---
|
|
m_chart.Redraw();
|
|
return(true);
|
|
}
|
|
//+------------------------------------------------------------------+
|
|
//| Creates a form for controls |
|
|
//+------------------------------------------------------------------+
|
|
bool CProgram::CreateWindow(const string caption_text)
|
|
{
|
|
//--- Add a window pointer to the window array
|
|
CWndContainer::AddWindow(m_window);
|
|
//--- Coordinates
|
|
int x=1;
|
|
int y=1;
|
|
//--- Properties
|
|
m_window.Movable(true);
|
|
m_window.XSize(200);
|
|
m_window.YSize(200);
|
|
//--- Creating a form
|
|
if(!m_window.CreateWindow(m_chart_id,m_subwin,caption_text,x,y))
|
|
return(false);
|
|
//---
|
|
return(true);
|
|
}
|
|
//+------------------------------------------------------------------+
|