Cleanup ...
This commit is contained in:
@@ -1,156 +0,0 @@
|
||||
///////////////////////////////////////////////////////
|
||||
//
|
||||
// SaherElm IT Center MQL5 Class Library
|
||||
// --------------------------------------
|
||||
// Name: XCButton
|
||||
// Description: provides all based classes for use ...
|
||||
//
|
||||
//
|
||||
// Maintainer:
|
||||
// ------------
|
||||
// Hadi Khazaee Asl (hadi_khazaee_asl@yahoo.com)
|
||||
//
|
||||
//////////////////////////////////////////////////////
|
||||
//
|
||||
// Global Properties ...
|
||||
#property library
|
||||
#property copyright "Copyright 2023, SaherElm IT Center"
|
||||
#property link "https://www.saherelm.ir"
|
||||
#property version "1.00"
|
||||
#property strict
|
||||
|
||||
//
|
||||
#include "../XCObjects/x-saherelm.xcobject.class.mq5"
|
||||
|
||||
//
|
||||
// Definitions ...
|
||||
|
||||
//
|
||||
// Implementation ...
|
||||
|
||||
//
|
||||
// a Button Creation Class ...
|
||||
class XCButton : public XCObject
|
||||
{
|
||||
//
|
||||
// Public ...
|
||||
public:
|
||||
//
|
||||
// Constructor(s) ...
|
||||
void XCButton()
|
||||
{
|
||||
}
|
||||
|
||||
//
|
||||
// Deconstructor ...
|
||||
void ~XCButton()
|
||||
{
|
||||
}
|
||||
|
||||
//
|
||||
// Actions ...
|
||||
|
||||
/**
|
||||
* Create an Instance of Class Object ...
|
||||
*
|
||||
* @param name: Object Name
|
||||
* @param xDis: X Distance
|
||||
* @param yDis: Y Distance
|
||||
* @param xSize: X Size
|
||||
* @param ySize: Y Size
|
||||
*/
|
||||
bool Create(
|
||||
string name,
|
||||
int xDis,
|
||||
int yDis,
|
||||
int xSize,
|
||||
int ySize,
|
||||
long chartID = 0 //
|
||||
)
|
||||
{
|
||||
//
|
||||
// Object creation and property settings
|
||||
bool result = false;
|
||||
|
||||
//
|
||||
result = ObjectCreate(chartID, name, OBJ_BUTTON, 0, 0, 0);
|
||||
if (!result)
|
||||
{
|
||||
return result;
|
||||
}
|
||||
|
||||
//
|
||||
ObjectSetInteger(chartID, name, OBJPROP_XDISTANCE, xDis);
|
||||
ObjectSetInteger(chartID, name, OBJPROP_YDISTANCE, yDis);
|
||||
ObjectSetInteger(chartID, name, OBJPROP_XSIZE, xSize);
|
||||
ObjectSetInteger(chartID, name, OBJPROP_YSIZE, ySize);
|
||||
|
||||
//
|
||||
mName = name;
|
||||
mChartID = chartID;
|
||||
|
||||
//
|
||||
return result;
|
||||
}
|
||||
|
||||
//
|
||||
// Getter(s) / Setter(s) ...
|
||||
|
||||
/**
|
||||
* Set Object Border Color ...
|
||||
*
|
||||
* @param value: color
|
||||
*/
|
||||
void BorderColor(color value)
|
||||
{
|
||||
ObjectSetInteger(mChartID, mName, OBJPROP_BORDER_COLOR, value);
|
||||
}
|
||||
|
||||
/**
|
||||
* Set Object Background Color ...
|
||||
*
|
||||
* @param value: color
|
||||
*/
|
||||
void BGColor(color value)
|
||||
{
|
||||
ObjectSetInteger(mChartID, mName, OBJPROP_BGCOLOR, value);
|
||||
}
|
||||
|
||||
/**
|
||||
* Set Object Text Color ...
|
||||
*
|
||||
* @param value: Color
|
||||
*/
|
||||
void Color(color value)
|
||||
{
|
||||
ObjectSetInteger(mChartID, mName, OBJPROP_COLOR, value);
|
||||
}
|
||||
|
||||
/**
|
||||
* Set Object Text ...
|
||||
*
|
||||
* @param value: text
|
||||
*/
|
||||
void Text(string value)
|
||||
{
|
||||
ObjectSetString(mChartID, mName, OBJPROP_TEXT, value);
|
||||
}
|
||||
|
||||
/**
|
||||
* Set Button Click State ...
|
||||
*
|
||||
* @param value: state
|
||||
*/
|
||||
void State(bool value)
|
||||
{
|
||||
ObjectSetInteger(mChartID, mName, OBJPROP_STATE, value);
|
||||
}
|
||||
|
||||
//
|
||||
// Protected ...
|
||||
protected:
|
||||
//
|
||||
// Private ...
|
||||
private:
|
||||
//
|
||||
};
|
||||
@@ -1,186 +0,0 @@
|
||||
///////////////////////////////////////////////////////
|
||||
//
|
||||
// SaherElm IT Center MQL5 Class Library
|
||||
// --------------------------------------
|
||||
// Name: XCEdit
|
||||
// Description: provides all based classes for use ...
|
||||
//
|
||||
//
|
||||
// Maintainer:
|
||||
// ------------
|
||||
// Hadi Khazaee Asl (hadi_khazaee_asl@yahoo.com)
|
||||
//
|
||||
//////////////////////////////////////////////////////
|
||||
//
|
||||
// Global Properties ...
|
||||
#property library
|
||||
#property copyright "Copyright 2023, SaherElm IT Center"
|
||||
#property link "https://www.saherelm.ir"
|
||||
#property version "1.00"
|
||||
#property strict
|
||||
|
||||
//
|
||||
#include "../XCObjects/x-saherelm.xcobject.class.mq5"
|
||||
|
||||
//
|
||||
// Definitions ...
|
||||
|
||||
//
|
||||
// Implementation ...
|
||||
|
||||
//
|
||||
// a Label Creation Class ...
|
||||
class XCEdit : public XCObject
|
||||
{
|
||||
//
|
||||
// Public ...
|
||||
public:
|
||||
//
|
||||
// Constructor(s) ...
|
||||
void XCEdit()
|
||||
{
|
||||
}
|
||||
|
||||
//
|
||||
// Deconstructor ...
|
||||
void ~XCEdit()
|
||||
{
|
||||
}
|
||||
|
||||
//
|
||||
// Actions ...
|
||||
|
||||
/**
|
||||
* Create an Instance of Class Object ...
|
||||
*
|
||||
* @param name: Object Name
|
||||
* @param xDis: X Distance
|
||||
* @param yDis: Y Distance
|
||||
* @param xSize: X Size
|
||||
* @param ySize: Y Size
|
||||
*/
|
||||
bool Create(
|
||||
string name,
|
||||
int xDis,
|
||||
int yDis,
|
||||
int xSize,
|
||||
int ySize,
|
||||
long chartID = 0 //
|
||||
)
|
||||
{
|
||||
//
|
||||
// Object creation and property settings
|
||||
bool result = false;
|
||||
|
||||
//
|
||||
result = ObjectCreate(chartID, name, OBJ_EDIT, 0, 0, 0);
|
||||
if (!result)
|
||||
{
|
||||
return result;
|
||||
}
|
||||
|
||||
//
|
||||
ObjectSetInteger(chartID, name, OBJPROP_XDISTANCE, xDis);
|
||||
ObjectSetInteger(chartID, name, OBJPROP_YDISTANCE, yDis);
|
||||
ObjectSetInteger(chartID, name, OBJPROP_XSIZE, xSize);
|
||||
ObjectSetInteger(chartID, name, OBJPROP_YSIZE, ySize);
|
||||
|
||||
//
|
||||
mName = name;
|
||||
mChartID = chartID;
|
||||
|
||||
//
|
||||
return result;
|
||||
}
|
||||
|
||||
//
|
||||
// Getter(s) / Setter(s) ...
|
||||
|
||||
/**
|
||||
* Set Object Border Color ...
|
||||
*
|
||||
* @param value: color
|
||||
*/
|
||||
void BorderColor(color value)
|
||||
{
|
||||
ObjectSetInteger(mChartID, mName, OBJPROP_BORDER_COLOR, value);
|
||||
}
|
||||
|
||||
/**
|
||||
* Set Background Color of Object ...
|
||||
*
|
||||
* @param value: color
|
||||
*/
|
||||
void BGColor(color value)
|
||||
{
|
||||
ObjectSetInteger(mChartID, mName, OBJPROP_BGCOLOR, value);
|
||||
}
|
||||
|
||||
/**
|
||||
* Set Object Text Color ...
|
||||
*
|
||||
* @param value: color
|
||||
*/
|
||||
void Color(color value)
|
||||
{
|
||||
ObjectSetInteger(mChartID, mName, OBJPROP_COLOR, value);
|
||||
}
|
||||
|
||||
/**
|
||||
* Set Text of Object ...
|
||||
*
|
||||
* @param value: text
|
||||
*/
|
||||
void Text(string value)
|
||||
{
|
||||
ObjectSetString(mChartID, mName, OBJPROP_TEXT, value);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get Current Text of Object ...
|
||||
*
|
||||
* @return ( string )
|
||||
*/
|
||||
string Text()
|
||||
{
|
||||
return ObjectGetString(mChartID, mName, OBJPROP_TEXT);
|
||||
}
|
||||
|
||||
/**
|
||||
* Set Font Size of Object ...
|
||||
*
|
||||
* @param value: size
|
||||
*/
|
||||
void FontSize(int value)
|
||||
{
|
||||
ObjectSetInteger(mChartID, mName, OBJPROP_FONTSIZE, value);
|
||||
}
|
||||
|
||||
/**
|
||||
* Set Font Name Of Object ...
|
||||
*
|
||||
* @param value: font name
|
||||
*/
|
||||
void Font(string value)
|
||||
{
|
||||
ObjectSetString(mChartID, mName, OBJPROP_FONT, value);
|
||||
}
|
||||
|
||||
/**
|
||||
* Set ReadOnly State of Object ...
|
||||
*
|
||||
* @param value: boolean value
|
||||
*/
|
||||
void ReadOnly(bool value)
|
||||
{
|
||||
ObjectSetInteger(mChartID, mName, OBJPROP_READONLY, value);
|
||||
}
|
||||
|
||||
//
|
||||
// Protected ...
|
||||
protected:
|
||||
//
|
||||
// Private ...
|
||||
private:
|
||||
//
|
||||
};
|
||||
@@ -1,160 +0,0 @@
|
||||
///////////////////////////////////////////////////////
|
||||
//
|
||||
// SaherElm IT Center MQL5 Class Library
|
||||
// --------------------------------------
|
||||
// Name: XCLabel
|
||||
// Description: provides all based classes for use ...
|
||||
//
|
||||
//
|
||||
// Maintainer:
|
||||
// ------------
|
||||
// Hadi Khazaee Asl (hadi_khazaee_asl@yahoo.com)
|
||||
//
|
||||
//////////////////////////////////////////////////////
|
||||
//
|
||||
// Global Properties ...
|
||||
#property library
|
||||
#property copyright "Copyright 2023, SaherElm IT Center"
|
||||
#property link "https://www.saherelm.ir"
|
||||
#property version "1.00"
|
||||
#property strict
|
||||
|
||||
//
|
||||
#include "../XCObjects/x-saherelm.xcobject.class.mq5"
|
||||
|
||||
//
|
||||
// Definitions ...
|
||||
|
||||
//
|
||||
// Implementation ...
|
||||
|
||||
//
|
||||
// a Label Creation Class ...
|
||||
class XCLabel : public XCObject
|
||||
{
|
||||
//
|
||||
// Public ...
|
||||
public:
|
||||
//
|
||||
// Constructor(s) ...
|
||||
void XCLabel()
|
||||
{
|
||||
}
|
||||
|
||||
//
|
||||
// Deconstructor ...
|
||||
void ~XCLabel()
|
||||
{
|
||||
}
|
||||
|
||||
//
|
||||
// Actions ...
|
||||
|
||||
/**
|
||||
* Create an Instance of Class Object ...
|
||||
*
|
||||
* @param name: Object Name
|
||||
* @param xDis: X Distance
|
||||
* @param yDis: Y Distance
|
||||
*/
|
||||
bool Create(
|
||||
string name,
|
||||
int xDis,
|
||||
int yDis,
|
||||
long chartID = 0 //
|
||||
)
|
||||
{
|
||||
//
|
||||
// Object creation and property settings
|
||||
bool result = false;
|
||||
|
||||
//
|
||||
result = ObjectCreate(chartID, name, OBJ_LABEL, 0, 0, 0);
|
||||
if (!result)
|
||||
{
|
||||
return result;
|
||||
}
|
||||
|
||||
//
|
||||
ObjectSetInteger(chartID, name, OBJPROP_XDISTANCE, xDis);
|
||||
ObjectSetInteger(chartID, name, OBJPROP_YDISTANCE, yDis);
|
||||
|
||||
//
|
||||
mName = name;
|
||||
mChartID = chartID;
|
||||
|
||||
//
|
||||
return result;
|
||||
}
|
||||
|
||||
//
|
||||
// Getter(s) / Setter(s) ...
|
||||
|
||||
/**
|
||||
* Set Text Color ...
|
||||
*
|
||||
* @param value: color
|
||||
*/
|
||||
void Color(color value)
|
||||
{
|
||||
ObjectSetInteger(mChartID, mName, OBJPROP_COLOR, value);
|
||||
}
|
||||
|
||||
/**
|
||||
* Set Text of Object ...
|
||||
*
|
||||
* @param value: text
|
||||
*/
|
||||
void Text(string value)
|
||||
{
|
||||
ObjectSetString(mChartID, mName, OBJPROP_TEXT, value);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get Text Of Object ...
|
||||
*
|
||||
* @return ( string )
|
||||
*/
|
||||
string Text()
|
||||
{
|
||||
return ObjectGetString(mChartID, mName, OBJPROP_TEXT);
|
||||
}
|
||||
|
||||
/**
|
||||
* Set Font Size of Object ...
|
||||
*
|
||||
* @param value: size
|
||||
*/
|
||||
void FontSize(int value)
|
||||
{
|
||||
ObjectSetInteger(mChartID, mName, OBJPROP_FONTSIZE, value);
|
||||
}
|
||||
|
||||
/**
|
||||
* Set Font Name Of Object ...
|
||||
*
|
||||
* @param value: font name
|
||||
*/
|
||||
void Font(string value)
|
||||
{
|
||||
ObjectSetString(mChartID, mName, OBJPROP_FONT, value);
|
||||
}
|
||||
|
||||
/**
|
||||
* Set Object Anchor ...
|
||||
*
|
||||
* @param value: anchor
|
||||
*/
|
||||
void Anchor(ENUM_ANCHOR_POINT value)
|
||||
{
|
||||
ObjectSetInteger(mChartID, mName, OBJPROP_ANCHOR, value);
|
||||
}
|
||||
|
||||
//
|
||||
// Protected ...
|
||||
protected:
|
||||
//
|
||||
// Private ...
|
||||
private:
|
||||
//
|
||||
};
|
||||
@@ -1,299 +0,0 @@
|
||||
///////////////////////////////////////////////////////
|
||||
//
|
||||
// SaherElm IT Center MQL5 Class Library
|
||||
// --------------------------------------
|
||||
// Name: XCPanel
|
||||
// Description: provides all based classes for use ...
|
||||
//
|
||||
//
|
||||
// Maintainer:
|
||||
// ------------
|
||||
// Hadi Khazaee Asl (hadi_khazaee_asl@yahoo.com)
|
||||
//
|
||||
//////////////////////////////////////////////////////
|
||||
//
|
||||
// Global Properties ...
|
||||
#property library
|
||||
#property copyright "Copyright 2023, SaherElm IT Center"
|
||||
#property link "https://www.saherelm.ir"
|
||||
#property version "1.00"
|
||||
#property strict
|
||||
|
||||
//
|
||||
// Imports ...
|
||||
#include "../XCObjects/x-saherelm.x-button.class.mq5"
|
||||
#include "../XCObjects/x-saherelm.x-edit.class.mq5"
|
||||
#include "../XCObjects/x-saherelm.x-label.class.mq5"
|
||||
#include "../XCObjects/x-saherelm.x-rectangle.label.class.mq5"
|
||||
|
||||
//
|
||||
// Implementation ...
|
||||
|
||||
//
|
||||
class XCPanel : XCObject
|
||||
{
|
||||
public:
|
||||
//
|
||||
// Constructor(s) ...
|
||||
void XCPanel()
|
||||
{
|
||||
}
|
||||
|
||||
//
|
||||
// Deconstructor ...
|
||||
void ~XCPanel()
|
||||
{
|
||||
Destroy();
|
||||
}
|
||||
|
||||
//
|
||||
// Action ...
|
||||
|
||||
/**
|
||||
* Create an instance of Panel Object ...
|
||||
*
|
||||
* @param name: Object name
|
||||
* @param xDis: X Distance
|
||||
* @param yDis: Y Distance
|
||||
* @param xSize: X Size
|
||||
* @param ySize: Y Size
|
||||
* @param titleBarBorderType: Border Type of Panel TitleBar
|
||||
* @param titleBarBGColor: Background Color of Panel TitleBar
|
||||
* @param caption: Caption Text of Panel TitleBar
|
||||
* @param captionontSize: Font Size of Panel Caption
|
||||
* @param captionColor: Text Color of Panel Caption
|
||||
* @param captionAnchor: Anchor Point of Panel Caption
|
||||
* @param bodyBorderType: Border Type of Panel Body
|
||||
* @param bodyBGColor: Background Color of Panel Body
|
||||
*
|
||||
* @return ( bool )
|
||||
*/
|
||||
bool Create(
|
||||
string name,
|
||||
int xDis,
|
||||
int yDis,
|
||||
int xSize,
|
||||
int ySize,
|
||||
//
|
||||
long chartID = 0,
|
||||
//
|
||||
// Title Bar ...
|
||||
ENUM_BORDER_TYPE titleBarBorderType = BORDER_FLAT,
|
||||
color titleBarBGColor = clrBlueViolet,
|
||||
//
|
||||
// Caption ...
|
||||
string caption = "",
|
||||
int captionontSize = 9,
|
||||
color captionColor = clrWhite,
|
||||
ENUM_ANCHOR_POINT captionAnchor = ANCHOR_LEFT_UPPER,
|
||||
//
|
||||
// Body ...
|
||||
ENUM_BORDER_TYPE bodyBorderType = BORDER_FLAT,
|
||||
color bodyBGColor = clrMediumSlateBlue //
|
||||
)
|
||||
{
|
||||
//
|
||||
bool result = false;
|
||||
|
||||
//
|
||||
// Enables mouse move events on the chart
|
||||
ChartSetInteger(chartID, CHART_EVENT_MOUSE_MOVE, true);
|
||||
|
||||
//
|
||||
result = IsValid(name);
|
||||
if (!result)
|
||||
{
|
||||
//
|
||||
Destroy();
|
||||
return result;
|
||||
}
|
||||
|
||||
//
|
||||
mTitleBarName = name + "_TITLE_BAR";
|
||||
mCaptionLblName = name + "_CAPTION";
|
||||
mBodyName = name + "_BODY";
|
||||
|
||||
//
|
||||
if (!IsValid(caption))
|
||||
{
|
||||
caption = name;
|
||||
}
|
||||
|
||||
//
|
||||
// Title Bar ...
|
||||
int titleBarHeight = 20;
|
||||
result = mTitleBar.Create(
|
||||
mTitleBarName,
|
||||
xDis,
|
||||
yDis,
|
||||
xSize,
|
||||
titleBarHeight //
|
||||
);
|
||||
if (!result)
|
||||
{
|
||||
//
|
||||
Destroy();
|
||||
return result;
|
||||
}
|
||||
mTitleBar.BorderType(titleBarBorderType);
|
||||
mTitleBar.BGColor(titleBarBGColor);
|
||||
|
||||
//
|
||||
// Body ...
|
||||
result = mBody.Create(
|
||||
mBodyName,
|
||||
xDis,
|
||||
yDis + titleBarHeight - 1,
|
||||
xSize,
|
||||
ySize //
|
||||
);
|
||||
if (!result)
|
||||
{
|
||||
//
|
||||
Destroy();
|
||||
return result;
|
||||
}
|
||||
mBody.BorderType(bodyBorderType);
|
||||
mBody.BGColor(bodyBGColor);
|
||||
mBody.AsBackGround(true);
|
||||
|
||||
//
|
||||
// Caption ...
|
||||
result = mCaptionLbl.Create(mCaptionLblName, xDis, yDis);
|
||||
if (!result)
|
||||
{
|
||||
//
|
||||
Destroy();
|
||||
return result;
|
||||
}
|
||||
mCaptionLbl.Text(caption);
|
||||
mCaptionLbl.Color(captionColor);
|
||||
mCaptionLbl.Anchor(captionAnchor);
|
||||
mCaptionLbl.FontSize(captionontSize);
|
||||
|
||||
//
|
||||
// Adding Child Objects ...
|
||||
mTitleBar.Add(mBodyName);
|
||||
mTitleBar.Add(mCaptionLblName);
|
||||
|
||||
//
|
||||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
* Destroy Panel Object and all of it's Child
|
||||
*/
|
||||
void Destroy()
|
||||
{
|
||||
//
|
||||
mBodyName = NULL;
|
||||
mTitleBarName = NULL;
|
||||
mCaptionLblName = NULL;
|
||||
|
||||
//
|
||||
mBody.Destroy();
|
||||
mTitleBar.Destroy();
|
||||
mCaptionLbl.Destroy();
|
||||
}
|
||||
|
||||
/**
|
||||
* Event Handling for Mouse Movement ...
|
||||
* @param id: Event ID
|
||||
* @param lparam: Event parameter of long type
|
||||
* @param dparam: Event parameter of double type
|
||||
* @param sparam: Event parameter of string type
|
||||
*/
|
||||
void OnEvent(
|
||||
int id,
|
||||
long lparam,
|
||||
double dparam,
|
||||
string sparam //
|
||||
)
|
||||
{
|
||||
//
|
||||
mTitleBar.OnEvent(
|
||||
id,
|
||||
lparam,
|
||||
dparam,
|
||||
sparam //
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Add Specific Child Object ...
|
||||
*
|
||||
* @param name: object name
|
||||
*/
|
||||
void Add(string name)
|
||||
{
|
||||
mTitleBar.Add(name);
|
||||
}
|
||||
|
||||
/**
|
||||
* Retrieve Panel Caption ...
|
||||
*
|
||||
* @return ( string )
|
||||
*/
|
||||
string Caption()
|
||||
{
|
||||
return mCaptionLbl.Text();
|
||||
}
|
||||
|
||||
/**
|
||||
* Set Panel Caption ...
|
||||
*
|
||||
* @param value: Caption
|
||||
*/
|
||||
void Caption(string value)
|
||||
{
|
||||
mCaptionLbl.Text(value);
|
||||
}
|
||||
|
||||
/**
|
||||
* Set Caption Color ...
|
||||
*
|
||||
* @param value: Color
|
||||
*/
|
||||
void CptionColor(color value)
|
||||
{
|
||||
mCaptionLbl.Color(value);
|
||||
}
|
||||
|
||||
/**
|
||||
* Set Panel Body BG Color ...
|
||||
*
|
||||
* @param value: Color
|
||||
*/
|
||||
void BodyColor(color value)
|
||||
{
|
||||
mBody.BGColor(value);
|
||||
}
|
||||
|
||||
/**
|
||||
* Set Panel Titlebar BG Color ...
|
||||
*
|
||||
* @param value: Color
|
||||
*/
|
||||
void TitleBarBGColor(color value)
|
||||
{
|
||||
mTitleBar.BGColor(value);
|
||||
}
|
||||
|
||||
//
|
||||
protected:
|
||||
private:
|
||||
//
|
||||
// Props ...
|
||||
|
||||
//
|
||||
string mBodyName;
|
||||
string mTitleBarName;
|
||||
string mCaptionLblName;
|
||||
|
||||
//
|
||||
XCLabel mCaptionLbl;
|
||||
XCRectangleLabel mBody;
|
||||
XCRectangleLabel mTitleBar;
|
||||
|
||||
//
|
||||
};
|
||||
@@ -1,259 +0,0 @@
|
||||
///////////////////////////////////////////////////////
|
||||
//
|
||||
// SaherElm IT Center MQL5 Class Library
|
||||
// --------------------------------------
|
||||
// Name: XCRectangleLabel
|
||||
// Description: provides all based classes for use ...
|
||||
//
|
||||
//
|
||||
// Maintainer:
|
||||
// ------------
|
||||
// Hadi Khazaee Asl (hadi_khazaee_asl@yahoo.com)
|
||||
//
|
||||
//////////////////////////////////////////////////////
|
||||
//
|
||||
// Global Properties ...
|
||||
#property library
|
||||
#property copyright "Copyright 2023, SaherElm IT Center"
|
||||
#property link "https://www.saherelm.ir"
|
||||
#property version "1.00"
|
||||
#property strict
|
||||
|
||||
//
|
||||
#include "../XCObjects/x-saherelm.xcobject.class.mq5"
|
||||
|
||||
//
|
||||
// Definitions ...
|
||||
|
||||
//
|
||||
// Implementation ...
|
||||
|
||||
//
|
||||
// a Rectangle Label Creation Class ...
|
||||
class XCRectangleLabel : public XCObject
|
||||
{
|
||||
//
|
||||
// Public ...
|
||||
public:
|
||||
//
|
||||
// Constructor(s) ...
|
||||
void XCRectangleLabel()
|
||||
{
|
||||
}
|
||||
|
||||
//
|
||||
// Deconstructor ...
|
||||
void ~XCRectangleLabel()
|
||||
{
|
||||
}
|
||||
|
||||
//
|
||||
// Actions ...
|
||||
|
||||
/**
|
||||
* Create an Instance of Class Object ...
|
||||
*
|
||||
* @param name: Object Name
|
||||
* @param xDis: X Distance
|
||||
* @param yDis: Y Distance
|
||||
* @param xSize: X Size
|
||||
* @param ySize: Y Size
|
||||
*/
|
||||
bool Create(
|
||||
string name,
|
||||
int xDis,
|
||||
int yDis,
|
||||
int xSize,
|
||||
int ySize,
|
||||
long chartID = 0 //
|
||||
)
|
||||
{
|
||||
//
|
||||
// Object creation and property settings
|
||||
bool result = false;
|
||||
|
||||
//
|
||||
result = ObjectCreate(chartID, name, OBJ_RECTANGLE_LABEL, 0, 0, 0);
|
||||
if (!result)
|
||||
{
|
||||
return result;
|
||||
}
|
||||
|
||||
//
|
||||
ObjectSetInteger(chartID, name, OBJPROP_XDISTANCE, xDis);
|
||||
ObjectSetInteger(chartID, name, OBJPROP_YDISTANCE, yDis);
|
||||
ObjectSetInteger(chartID, name, OBJPROP_XSIZE, xSize);
|
||||
ObjectSetInteger(chartID, name, OBJPROP_YSIZE, ySize);
|
||||
|
||||
//
|
||||
mName = name;
|
||||
mChartID = chartID;
|
||||
|
||||
//
|
||||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
* Add a Name to Object
|
||||
* @param name: name
|
||||
*/
|
||||
void Add(string name)
|
||||
{
|
||||
//
|
||||
// Add a new object by name to the rectangle label and track distances
|
||||
ArrayResize(mAddedNames, ArraySize(mAddedNames) + 1);
|
||||
ArrayResize(mAddedXDisDiffrence, ArraySize(mAddedXDisDiffrence) + 1);
|
||||
ArrayResize(mAddedYDisDiffrence, ArraySize(mAddedYDisDiffrence) + 1);
|
||||
|
||||
//
|
||||
mAddedNames[ArraySize(mAddedNames) - 1] = name;
|
||||
mAddedXDisDiffrence[ArraySize(mAddedXDisDiffrence) - 1] = ObjectGetInteger(0, mName, OBJPROP_XDISTANCE) - ObjectGetInteger(0, name, OBJPROP_XDISTANCE);
|
||||
mAddedYDisDiffrence[ArraySize(mAddedYDisDiffrence) - 1] = ObjectGetInteger(0, mName, OBJPROP_YDISTANCE) - ObjectGetInteger(0, name, OBJPROP_YDISTANCE);
|
||||
}
|
||||
|
||||
//
|
||||
// Handlers ...
|
||||
|
||||
/**
|
||||
* Event Handling for Mouse Movement ...
|
||||
* @param id: Event ID
|
||||
* @param lparam: Event parameter of long type
|
||||
* @param dparam: Event parameter of double type
|
||||
* @param sparam: Event parameter of string type
|
||||
*/
|
||||
void OnEvent(
|
||||
int id,
|
||||
long lparam,
|
||||
double dparam,
|
||||
string sparam //
|
||||
)
|
||||
{
|
||||
//
|
||||
// Handle mouse movement events for dragging the rectangle label
|
||||
if (id == CHARTEVENT_MOUSE_MOVE)
|
||||
{
|
||||
//
|
||||
int X = (int)lparam;
|
||||
int Y = (int)dparam;
|
||||
int MouseState = (int)sparam;
|
||||
|
||||
//
|
||||
string name = mName;
|
||||
int XSize = (int)ObjectGetInteger(0, name, OBJPROP_XSIZE);
|
||||
int YSize = (int)ObjectGetInteger(0, name, OBJPROP_YSIZE);
|
||||
int XDistance = (int)ObjectGetInteger(0, name, OBJPROP_XDISTANCE);
|
||||
int YDistance = (int)ObjectGetInteger(0, name, OBJPROP_YDISTANCE);
|
||||
|
||||
//
|
||||
if (MouseState == 1 &&
|
||||
mPreviousMouseState == 0)
|
||||
{
|
||||
//
|
||||
mlbDownX = X;
|
||||
mlbDownY = Y;
|
||||
mlbDownXDistance = XDistance;
|
||||
mlbDownYDistance = YDistance;
|
||||
|
||||
//
|
||||
if (X >= XDistance &&
|
||||
Y >= YDistance &&
|
||||
X <= XDistance + XSize &&
|
||||
Y <= YDistance + YSize)
|
||||
{
|
||||
mMovingState = true;
|
||||
}
|
||||
}
|
||||
|
||||
//
|
||||
if (mMovingState)
|
||||
{
|
||||
//
|
||||
ChartSetInteger(0, CHART_MOUSE_SCROLL, false);
|
||||
ObjectSetInteger(0, name, OBJPROP_XDISTANCE, mlbDownXDistance + X - mlbDownX);
|
||||
ObjectSetInteger(0, name, OBJPROP_YDISTANCE, mlbDownYDistance + Y - mlbDownY);
|
||||
|
||||
//
|
||||
for (int i = 0; i < ArraySize(mAddedNames); i++)
|
||||
{
|
||||
//
|
||||
ObjectSetInteger(0, mAddedNames[i], OBJPROP_XDISTANCE, mlbDownXDistance + X - mlbDownX - mAddedXDisDiffrence[i]);
|
||||
ObjectSetInteger(0, mAddedNames[i], OBJPROP_YDISTANCE, mlbDownYDistance + Y - mlbDownY - mAddedYDisDiffrence[i]);
|
||||
}
|
||||
|
||||
//
|
||||
ChartRedraw(0);
|
||||
}
|
||||
|
||||
//
|
||||
if (MouseState == 0)
|
||||
{
|
||||
//
|
||||
mMovingState = false;
|
||||
ChartSetInteger(0, CHART_MOUSE_SCROLL, true);
|
||||
}
|
||||
|
||||
//
|
||||
mPreviousMouseState = MouseState;
|
||||
}
|
||||
}
|
||||
|
||||
//
|
||||
// Getter(s) / Setter(s) ...
|
||||
|
||||
/**
|
||||
* Set Object Border Type ...
|
||||
*
|
||||
* @param borderType: Specified border type
|
||||
*/
|
||||
void BorderType(ENUM_BORDER_TYPE borderType)
|
||||
{
|
||||
//
|
||||
ObjectSetInteger(
|
||||
mChartID,
|
||||
mName,
|
||||
OBJPROP_BORDER_TYPE,
|
||||
borderType //
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Set Object Background Color
|
||||
*
|
||||
* @param value: color
|
||||
*/
|
||||
void BGColor(color value)
|
||||
{
|
||||
//
|
||||
ObjectSetInteger(
|
||||
mChartID,
|
||||
mName,
|
||||
OBJPROP_BGCOLOR,
|
||||
value //
|
||||
);
|
||||
}
|
||||
|
||||
//
|
||||
// Protected ...
|
||||
protected:
|
||||
//
|
||||
// Private ...
|
||||
private:
|
||||
//
|
||||
// Props ...
|
||||
|
||||
//
|
||||
// Mouse state tracking variables ...
|
||||
int mlbDownX;
|
||||
int mlbDownY;
|
||||
int mlbDownXDistance;
|
||||
int mlbDownYDistance;
|
||||
int mPreviousMouseState;
|
||||
|
||||
//
|
||||
bool mMovingState; // State for whether the object is moving
|
||||
|
||||
//
|
||||
string mAddedNames[]; // Array of added names
|
||||
long mAddedXDisDiffrence[]; // Arrays to store added distance differences
|
||||
long mAddedYDisDiffrence[]; // Arrays to store added distance differences
|
||||
};
|
||||
@@ -1,116 +0,0 @@
|
||||
///////////////////////////////////////////////////////
|
||||
//
|
||||
// SaherElm IT Center MQL5 Class Library
|
||||
// --------------------------------------
|
||||
// Name: XCObject
|
||||
// Description: Base Class Of Chart Object Class
|
||||
//
|
||||
//
|
||||
// Maintainer:
|
||||
// ------------
|
||||
// Hadi Khazaee Asl (hadi_khazaee_asl@yahoo.com)
|
||||
//
|
||||
//////////////////////////////////////////////////////
|
||||
//
|
||||
// Global Properties ...
|
||||
#property library
|
||||
#property copyright "Copyright 2023, SaherElm IT Center"
|
||||
#property link "https://www.saherelm.ir"
|
||||
#property version "1.00"
|
||||
#property strict
|
||||
|
||||
//
|
||||
#include "../x-saherelm.base.class.mq5"
|
||||
|
||||
//
|
||||
// Definitions ...
|
||||
|
||||
//
|
||||
// Implementation ...
|
||||
|
||||
//
|
||||
// a Button Creation Class ...
|
||||
class XCObject : XSCBase
|
||||
{
|
||||
//
|
||||
// Public ...
|
||||
public:
|
||||
//
|
||||
// Constructor(s) ...
|
||||
void XCObject()
|
||||
{
|
||||
mChartID = 0;
|
||||
}
|
||||
|
||||
//
|
||||
// Deconstructor ...
|
||||
void ~XCObject()
|
||||
{
|
||||
Destroy();
|
||||
}
|
||||
|
||||
/**
|
||||
* Destroy Class Instance ...
|
||||
*/
|
||||
void Destroy()
|
||||
{
|
||||
//
|
||||
mName = NULL;
|
||||
ObjectDelete(0, mName);
|
||||
}
|
||||
|
||||
//
|
||||
// Getter(s) / Setter(s) ...
|
||||
|
||||
/**
|
||||
* Retrieve Object Name ...
|
||||
*
|
||||
* @return ( string )
|
||||
*/
|
||||
string Name()
|
||||
{
|
||||
return mName;
|
||||
}
|
||||
|
||||
/**
|
||||
* Retrieve Registered Chart ID ...
|
||||
*
|
||||
* @return ( long )
|
||||
*/
|
||||
long ChartID()
|
||||
{
|
||||
return mChartID;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set Object ZOrder ...
|
||||
*
|
||||
* @param value: z order
|
||||
*/
|
||||
void ZOrder(int value)
|
||||
{
|
||||
ObjectSetInteger(0, mName, OBJPROP_ZORDER, value);
|
||||
}
|
||||
|
||||
/**
|
||||
* Set Object as Background ...
|
||||
*
|
||||
* @param value: boolean value
|
||||
*/
|
||||
void AsBackGround(bool value)
|
||||
{
|
||||
ObjectSetInteger(0, mName, OBJPROP_BACK, value);
|
||||
}
|
||||
|
||||
//
|
||||
// Protected ...
|
||||
protected:
|
||||
//
|
||||
string mName; // Name of Object ...
|
||||
long mChartID; // Chart ID ...
|
||||
|
||||
//
|
||||
// Private ...
|
||||
private:
|
||||
//
|
||||
};
|
||||
Binary file not shown.
File diff suppressed because it is too large
Load Diff
@@ -1,79 +0,0 @@
|
||||
///////////////////////////////////////////////////////
|
||||
//
|
||||
// SaherElm IT Center MQL5 Class Library
|
||||
// ----------------------------------------------
|
||||
// Name: XSCZone
|
||||
// Description: provides all Zone requirements ...
|
||||
//
|
||||
//
|
||||
// Maintainer:
|
||||
// ------------
|
||||
// Hadi Khazaee Asl (hadi_khazaee_asl@yahoo.com)
|
||||
//
|
||||
//////////////////////////////////////////////////////
|
||||
//
|
||||
// Global Properties ...
|
||||
#property library
|
||||
#property copyright "Copyright 2023, SaherElm IT Center"
|
||||
#property link "https://www.saherelm.ir"
|
||||
#property version "1.00"
|
||||
#property strict
|
||||
|
||||
//
|
||||
// Imports ...
|
||||
#include <Arrays/ArrayObj.mqh>
|
||||
#include "../Libraries/x-saherelm.common.lib.mq5"
|
||||
|
||||
//
|
||||
// Specific Zone ...
|
||||
class XSCZone : public CObject
|
||||
{
|
||||
//
|
||||
// Public ...
|
||||
public:
|
||||
//
|
||||
// Props ...
|
||||
double high;
|
||||
double low;
|
||||
int ticks;
|
||||
double percent;
|
||||
|
||||
//
|
||||
ENUM_TIMEFRAMES period;
|
||||
datetime start;
|
||||
datetime end;
|
||||
|
||||
//
|
||||
// Compare Two Zone With Each Other ...
|
||||
virtual int Compare(
|
||||
const CObject *node,
|
||||
const int mode = 0 //
|
||||
) const
|
||||
{
|
||||
//
|
||||
const XSCZone *other = (XSCZone *)node;
|
||||
|
||||
//
|
||||
return other.ticks - ticks;
|
||||
}
|
||||
|
||||
//
|
||||
// Props ...
|
||||
string GetTag() {
|
||||
//
|
||||
string result = "";
|
||||
|
||||
//
|
||||
result = "XZ_" + ToString(period) + "_" + ToString(start);
|
||||
|
||||
//
|
||||
return result;
|
||||
}
|
||||
|
||||
//
|
||||
// Protected ...
|
||||
protected:
|
||||
//
|
||||
// Private ...
|
||||
private:
|
||||
};
|
||||
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user