Refactor XCObjects and Extends them from Base XCObject Class and also Implement GUI Features on EA Class and Refactor Inputs ...
This commit is contained in:
@@ -20,7 +20,7 @@
|
||||
#property strict
|
||||
|
||||
//
|
||||
#include "../x-saherelm.base.class.mq5"
|
||||
#include "../XCObjects/x-saherelm.xcobject.class.mq5"
|
||||
|
||||
//
|
||||
// Definitions ...
|
||||
@@ -30,7 +30,7 @@
|
||||
|
||||
//
|
||||
// a Button Creation Class ...
|
||||
class XCButton : XSCBase
|
||||
class XCButton : public XCObject
|
||||
{
|
||||
//
|
||||
// Public ...
|
||||
@@ -64,7 +64,8 @@ class XCButton : XSCBase
|
||||
int xDis,
|
||||
int yDis,
|
||||
int xSize,
|
||||
int ySize //
|
||||
int ySize,
|
||||
long chartID = 0 //
|
||||
)
|
||||
{
|
||||
//
|
||||
@@ -72,33 +73,26 @@ class XCButton : XSCBase
|
||||
bool result = false;
|
||||
|
||||
//
|
||||
result = ObjectCreate(0, name, OBJ_BUTTON, 0, 0, 0);
|
||||
result = ObjectCreate(chartID, name, OBJ_BUTTON, 0, 0, 0);
|
||||
if (!result)
|
||||
{
|
||||
return result;
|
||||
}
|
||||
|
||||
//
|
||||
ObjectSetInteger(0, name, OBJPROP_XDISTANCE, xDis);
|
||||
ObjectSetInteger(0, name, OBJPROP_YDISTANCE, yDis);
|
||||
ObjectSetInteger(0, name, OBJPROP_XSIZE, xSize);
|
||||
ObjectSetInteger(0, name, OBJPROP_YSIZE, ySize);
|
||||
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;
|
||||
}
|
||||
|
||||
/**
|
||||
* Destroy Class Instance ...
|
||||
*/
|
||||
void Destroy()
|
||||
{
|
||||
ObjectDelete(0, mName);
|
||||
}
|
||||
|
||||
//
|
||||
// Getter(s) / Setter(s) ...
|
||||
|
||||
@@ -107,9 +101,9 @@ class XCButton : XSCBase
|
||||
*
|
||||
* @param value: color
|
||||
*/
|
||||
void SetBorderColor(color value)
|
||||
void BorderColor(color value)
|
||||
{
|
||||
ObjectSetInteger(0, mName, OBJPROP_BORDER_COLOR, value);
|
||||
ObjectSetInteger(mChartID, mName, OBJPROP_BORDER_COLOR, value);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -117,9 +111,9 @@ class XCButton : XSCBase
|
||||
*
|
||||
* @param value: color
|
||||
*/
|
||||
void SetBGColor(color value)
|
||||
void BGColor(color value)
|
||||
{
|
||||
ObjectSetInteger(0, mName, OBJPROP_BGCOLOR, value);
|
||||
ObjectSetInteger(mChartID, mName, OBJPROP_BGCOLOR, value);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -127,9 +121,9 @@ class XCButton : XSCBase
|
||||
*
|
||||
* @param value: Color
|
||||
*/
|
||||
void SetColor(color value)
|
||||
void Color(color value)
|
||||
{
|
||||
ObjectSetInteger(0, mName, OBJPROP_COLOR, value);
|
||||
ObjectSetInteger(mChartID, mName, OBJPROP_COLOR, value);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -137,29 +131,9 @@ class XCButton : XSCBase
|
||||
*
|
||||
* @param value: text
|
||||
*/
|
||||
void SetText(string value)
|
||||
void Text(string value)
|
||||
{
|
||||
ObjectSetString(0, mName, OBJPROP_TEXT, value);
|
||||
}
|
||||
|
||||
/**
|
||||
* Set Object ZOrder ...
|
||||
*
|
||||
* @param value: z order
|
||||
*/
|
||||
void SetZOrder(int value)
|
||||
{
|
||||
ObjectSetInteger(0, mName, OBJPROP_ZORDER, value);
|
||||
}
|
||||
|
||||
/**
|
||||
* Set Object as Background ...
|
||||
*
|
||||
* @param value: boolean value
|
||||
*/
|
||||
void SetAsBackGround(bool value)
|
||||
{
|
||||
ObjectSetInteger(0, mName, OBJPROP_BACK, value);
|
||||
ObjectSetString(mChartID, mName, OBJPROP_TEXT, value);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -167,9 +141,9 @@ class XCButton : XSCBase
|
||||
*
|
||||
* @param value: state
|
||||
*/
|
||||
void SetState(bool value)
|
||||
void State(bool value)
|
||||
{
|
||||
ObjectSetInteger(0, mName, OBJPROP_STATE, value);
|
||||
ObjectSetInteger(mChartID, mName, OBJPROP_STATE, value);
|
||||
}
|
||||
|
||||
//
|
||||
@@ -179,24 +153,4 @@ class XCButton : XSCBase
|
||||
// Private ...
|
||||
private:
|
||||
//
|
||||
// Props ...
|
||||
|
||||
//
|
||||
string mName; // Name of Object
|
||||
|
||||
//
|
||||
// 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
|
||||
};
|
||||
|
||||
@@ -20,7 +20,7 @@
|
||||
#property strict
|
||||
|
||||
//
|
||||
#include "../x-saherelm.base.class.mq5"
|
||||
#include "../XCObjects/x-saherelm.xcobject.class.mq5"
|
||||
|
||||
//
|
||||
// Definitions ...
|
||||
@@ -30,7 +30,7 @@
|
||||
|
||||
//
|
||||
// a Label Creation Class ...
|
||||
class XCEdit : XSCBase
|
||||
class XCEdit : public XCObject
|
||||
{
|
||||
//
|
||||
// Public ...
|
||||
@@ -64,7 +64,8 @@ class XCEdit : XSCBase
|
||||
int xDis,
|
||||
int yDis,
|
||||
int xSize,
|
||||
int ySize //
|
||||
int ySize,
|
||||
long chartID = 0 //
|
||||
)
|
||||
{
|
||||
//
|
||||
@@ -72,33 +73,26 @@ class XCEdit : XSCBase
|
||||
bool result = false;
|
||||
|
||||
//
|
||||
result = ObjectCreate(0, name, OBJ_EDIT, 0, 0, 0);
|
||||
result = ObjectCreate(chartID, name, OBJ_EDIT, 0, 0, 0);
|
||||
if (!result)
|
||||
{
|
||||
return result;
|
||||
}
|
||||
|
||||
//
|
||||
ObjectSetInteger(0, name, OBJPROP_XDISTANCE, xDis);
|
||||
ObjectSetInteger(0, name, OBJPROP_YDISTANCE, yDis);
|
||||
ObjectSetInteger(0, name, OBJPROP_XSIZE, xSize);
|
||||
ObjectSetInteger(0, name, OBJPROP_YSIZE, ySize);
|
||||
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;
|
||||
}
|
||||
|
||||
/**
|
||||
* Destroy Class Instance ...
|
||||
*/
|
||||
void Destroy()
|
||||
{
|
||||
ObjectDelete(0, mName);
|
||||
}
|
||||
|
||||
//
|
||||
// Getter(s) / Setter(s) ...
|
||||
|
||||
@@ -107,9 +101,9 @@ class XCEdit : XSCBase
|
||||
*
|
||||
* @param value: color
|
||||
*/
|
||||
void SetBorderColor(color value)
|
||||
void BorderColor(color value)
|
||||
{
|
||||
ObjectSetInteger(0, mName, OBJPROP_BORDER_COLOR, value);
|
||||
ObjectSetInteger(mChartID, mName, OBJPROP_BORDER_COLOR, value);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -117,9 +111,9 @@ class XCEdit : XSCBase
|
||||
*
|
||||
* @param value: color
|
||||
*/
|
||||
void SetBGColor(color value)
|
||||
void BGColor(color value)
|
||||
{
|
||||
ObjectSetInteger(0, mName, OBJPROP_BGCOLOR, value);
|
||||
ObjectSetInteger(mChartID, mName, OBJPROP_BGCOLOR, value);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -127,9 +121,9 @@ class XCEdit : XSCBase
|
||||
*
|
||||
* @param value: color
|
||||
*/
|
||||
void SetTextColor(color value)
|
||||
void Color(color value)
|
||||
{
|
||||
ObjectSetInteger(0, mName, OBJPROP_COLOR, value);
|
||||
ObjectSetInteger(mChartID, mName, OBJPROP_COLOR, value);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -137,9 +131,9 @@ class XCEdit : XSCBase
|
||||
*
|
||||
* @param value: text
|
||||
*/
|
||||
void SetText(string value)
|
||||
void Text(string value)
|
||||
{
|
||||
ObjectSetString(0, mName, OBJPROP_TEXT, value);
|
||||
ObjectSetString(mChartID, mName, OBJPROP_TEXT, value);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -147,29 +141,9 @@ class XCEdit : XSCBase
|
||||
*
|
||||
* @return ( string )
|
||||
*/
|
||||
string GetText()
|
||||
string Text()
|
||||
{
|
||||
return ObjectGetString(0, mName, OBJPROP_TEXT);
|
||||
}
|
||||
|
||||
/**
|
||||
* Set Object ZOrder ...
|
||||
*
|
||||
* @param value: z order
|
||||
*/
|
||||
void SetZOrder(int value)
|
||||
{
|
||||
ObjectSetInteger(0, mName, OBJPROP_ZORDER, value);
|
||||
}
|
||||
|
||||
/**
|
||||
* Set Object as Background ...
|
||||
*
|
||||
* @param value: boolean value
|
||||
*/
|
||||
void SetAsBackGround(bool value)
|
||||
{
|
||||
ObjectSetInteger(0, mName, OBJPROP_BACK, value);
|
||||
return ObjectGetString(mChartID, mName, OBJPROP_TEXT);
|
||||
}
|
||||
|
||||
//
|
||||
@@ -179,24 +153,4 @@ class XCEdit : XSCBase
|
||||
// Private ...
|
||||
private:
|
||||
//
|
||||
// Props ...
|
||||
|
||||
//
|
||||
string mName; // Name of Object
|
||||
|
||||
//
|
||||
// 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
|
||||
};
|
||||
|
||||
@@ -20,7 +20,7 @@
|
||||
#property strict
|
||||
|
||||
//
|
||||
#include "../x-saherelm.base.class.mq5"
|
||||
#include "../XCObjects/x-saherelm.xcobject.class.mq5"
|
||||
|
||||
//
|
||||
// Definitions ...
|
||||
@@ -30,7 +30,7 @@
|
||||
|
||||
//
|
||||
// a Label Creation Class ...
|
||||
class XCLabel : XSCBase
|
||||
class XCLabel : public XCObject
|
||||
{
|
||||
//
|
||||
// Public ...
|
||||
@@ -60,7 +60,8 @@ class XCLabel : XSCBase
|
||||
bool Create(
|
||||
string name,
|
||||
int xDis,
|
||||
int yDis //
|
||||
int yDis,
|
||||
long chartID = 0 //
|
||||
)
|
||||
{
|
||||
//
|
||||
@@ -68,31 +69,24 @@ class XCLabel : XSCBase
|
||||
bool result = false;
|
||||
|
||||
//
|
||||
result = ObjectCreate(0, name, OBJ_LABEL, 0, 0, 0);
|
||||
result = ObjectCreate(chartID, name, OBJ_LABEL, 0, 0, 0);
|
||||
if (!result)
|
||||
{
|
||||
return result;
|
||||
}
|
||||
|
||||
//
|
||||
ObjectSetInteger(0, name, OBJPROP_XDISTANCE, xDis);
|
||||
ObjectSetInteger(0, name, OBJPROP_YDISTANCE, yDis);
|
||||
ObjectSetInteger(chartID, name, OBJPROP_XDISTANCE, xDis);
|
||||
ObjectSetInteger(chartID, name, OBJPROP_YDISTANCE, yDis);
|
||||
|
||||
//
|
||||
mName = name;
|
||||
mChartID = chartID;
|
||||
|
||||
//
|
||||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
* Destroy Class Instance ...
|
||||
*/
|
||||
void Destroy()
|
||||
{
|
||||
ObjectDelete(0, mName);
|
||||
}
|
||||
|
||||
//
|
||||
// Getter(s) / Setter(s) ...
|
||||
|
||||
@@ -101,9 +95,9 @@ class XCLabel : XSCBase
|
||||
*
|
||||
* @param value: color
|
||||
*/
|
||||
void SetTextColor(color value)
|
||||
void Color(color value)
|
||||
{
|
||||
ObjectSetInteger(0, mName, OBJPROP_COLOR, value);
|
||||
ObjectSetInteger(mChartID, mName, OBJPROP_COLOR, value);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -111,9 +105,9 @@ class XCLabel : XSCBase
|
||||
*
|
||||
* @param value: text
|
||||
*/
|
||||
void SetText(string value)
|
||||
void Text(string value)
|
||||
{
|
||||
ObjectSetString(0, mName, OBJPROP_TEXT, value);
|
||||
ObjectSetString(mChartID, mName, OBJPROP_TEXT, value);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -121,9 +115,9 @@ class XCLabel : XSCBase
|
||||
*
|
||||
* @return ( string )
|
||||
*/
|
||||
string GetText()
|
||||
string Text()
|
||||
{
|
||||
return ObjectGetString(0, mName, OBJPROP_TEXT);
|
||||
return ObjectGetString(mChartID, mName, OBJPROP_TEXT);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -131,9 +125,9 @@ class XCLabel : XSCBase
|
||||
*
|
||||
* @param value: size
|
||||
*/
|
||||
void SetFontSize(int value)
|
||||
void FontSize(int value)
|
||||
{
|
||||
ObjectSetInteger(0, mName, OBJPROP_FONTSIZE, value);
|
||||
ObjectSetInteger(mChartID, mName, OBJPROP_FONTSIZE, value);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -141,9 +135,9 @@ class XCLabel : XSCBase
|
||||
*
|
||||
* @param value: font name
|
||||
*/
|
||||
void SetFont(string value)
|
||||
void Font(string value)
|
||||
{
|
||||
ObjectSetString(0, mName, OBJPROP_FONT, value);
|
||||
ObjectSetString(mChartID, mName, OBJPROP_FONT, value);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -151,29 +145,9 @@ class XCLabel : XSCBase
|
||||
*
|
||||
* @param value: anchor
|
||||
*/
|
||||
void SetAnchor(ENUM_ANCHOR_POINT value)
|
||||
void Anchor(ENUM_ANCHOR_POINT value)
|
||||
{
|
||||
ObjectSetInteger(0, mName, OBJPROP_ANCHOR, value);
|
||||
}
|
||||
|
||||
/**
|
||||
* Set Object ZOrder ...
|
||||
*
|
||||
* @param value: z order
|
||||
*/
|
||||
void SetZOrder(int value)
|
||||
{
|
||||
ObjectSetInteger(0, mName, OBJPROP_ZORDER, value);
|
||||
}
|
||||
|
||||
/**
|
||||
* Set Object as Background ...
|
||||
*
|
||||
* @param value: boolean value
|
||||
*/
|
||||
void SetAsBackGround(bool value)
|
||||
{
|
||||
ObjectSetInteger(0, mName, OBJPROP_BACK, value);
|
||||
ObjectSetInteger(mChartID, mName, OBJPROP_ANCHOR, value);
|
||||
}
|
||||
|
||||
//
|
||||
@@ -183,24 +157,4 @@ class XCLabel : XSCBase
|
||||
// Private ...
|
||||
private:
|
||||
//
|
||||
// Props ...
|
||||
|
||||
//
|
||||
string mName; // Name of Object
|
||||
|
||||
//
|
||||
// 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
|
||||
};
|
||||
|
||||
@@ -30,16 +30,13 @@
|
||||
// Implementation ...
|
||||
|
||||
//
|
||||
class XCPanel : XSCBase
|
||||
class XCPanel : XCObject
|
||||
{
|
||||
public:
|
||||
//
|
||||
// Constructor(s) ...
|
||||
void XCPanel()
|
||||
{
|
||||
//
|
||||
// Enables mouse move events on the chart
|
||||
ChartSetInteger(0, CHART_EVENT_MOUSE_MOVE, true);
|
||||
}
|
||||
|
||||
//
|
||||
@@ -78,6 +75,8 @@ class XCPanel : XSCBase
|
||||
int xSize,
|
||||
int ySize,
|
||||
//
|
||||
long chartID = 0,
|
||||
//
|
||||
// Title Bar ...
|
||||
ENUM_BORDER_TYPE titleBarBorderType = BORDER_FLAT,
|
||||
color titleBarBGColor = clrBlueViolet,
|
||||
@@ -96,6 +95,10 @@ class XCPanel : XSCBase
|
||||
//
|
||||
bool result = false;
|
||||
|
||||
//
|
||||
// Enables mouse move events on the chart
|
||||
ChartSetInteger(chartID, CHART_EVENT_MOUSE_MOVE, true);
|
||||
|
||||
//
|
||||
result = IsValid(name);
|
||||
if (!result)
|
||||
@@ -132,8 +135,8 @@ class XCPanel : XSCBase
|
||||
Destroy();
|
||||
return result;
|
||||
}
|
||||
mTitleBar.SetBorderType(titleBarBorderType);
|
||||
mTitleBar.SetBGColor(titleBarBGColor);
|
||||
mTitleBar.BorderType(titleBarBorderType);
|
||||
mTitleBar.BGColor(titleBarBGColor);
|
||||
|
||||
//
|
||||
// Body ...
|
||||
@@ -150,9 +153,9 @@ class XCPanel : XSCBase
|
||||
Destroy();
|
||||
return result;
|
||||
}
|
||||
mBody.SetBorderType(bodyBorderType);
|
||||
mBody.SetBGColor(bodyBGColor);
|
||||
mBody.SetAsBackGround(true);
|
||||
mBody.BorderType(bodyBorderType);
|
||||
mBody.BGColor(bodyBGColor);
|
||||
mBody.AsBackGround(true);
|
||||
|
||||
//
|
||||
// Caption ...
|
||||
@@ -163,10 +166,10 @@ class XCPanel : XSCBase
|
||||
Destroy();
|
||||
return result;
|
||||
}
|
||||
mCaptionLbl.SetText(caption);
|
||||
mCaptionLbl.SetAnchor(captionAnchor);
|
||||
mCaptionLbl.SetTextColor(captionColor);
|
||||
mCaptionLbl.SetFontSize(captionontSize);
|
||||
mCaptionLbl.Text(caption);
|
||||
mCaptionLbl.Color(captionColor);
|
||||
mCaptionLbl.Anchor(captionAnchor);
|
||||
mCaptionLbl.FontSize(captionontSize);
|
||||
|
||||
//
|
||||
// Adding Child Objects ...
|
||||
@@ -233,7 +236,7 @@ class XCPanel : XSCBase
|
||||
*/
|
||||
string Caption()
|
||||
{
|
||||
return mCaptionLbl.GetText();
|
||||
return mCaptionLbl.Text();
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -243,7 +246,37 @@ class XCPanel : XSCBase
|
||||
*/
|
||||
void Caption(string value)
|
||||
{
|
||||
mCaptionLbl.SetText(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);
|
||||
}
|
||||
|
||||
//
|
||||
|
||||
@@ -20,7 +20,7 @@
|
||||
#property strict
|
||||
|
||||
//
|
||||
#include "../x-saherelm.base.class.mq5"
|
||||
#include "../XCObjects/x-saherelm.xcobject.class.mq5"
|
||||
|
||||
//
|
||||
// Definitions ...
|
||||
@@ -30,7 +30,7 @@
|
||||
|
||||
//
|
||||
// a Rectangle Label Creation Class ...
|
||||
class XCRectangleLabel : XSCBase
|
||||
class XCRectangleLabel : public XCObject
|
||||
{
|
||||
//
|
||||
// Public ...
|
||||
@@ -48,7 +48,68 @@ class XCRectangleLabel : XSCBase
|
||||
}
|
||||
|
||||
//
|
||||
// Getter(s) / Setter(s) ...
|
||||
// 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 ...
|
||||
@@ -137,67 +198,18 @@ class XCRectangleLabel : XSCBase
|
||||
}
|
||||
|
||||
//
|
||||
// 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 //
|
||||
)
|
||||
{
|
||||
//
|
||||
// Object creation and property settings
|
||||
bool result = false;
|
||||
|
||||
//
|
||||
result = ObjectCreate(0, name, OBJ_RECTANGLE_LABEL, 0, 0, 0);
|
||||
if (!result)
|
||||
{
|
||||
return result;
|
||||
}
|
||||
|
||||
//
|
||||
ObjectSetInteger(0, name, OBJPROP_XDISTANCE, xDis);
|
||||
ObjectSetInteger(0, name, OBJPROP_YDISTANCE, yDis);
|
||||
ObjectSetInteger(0, name, OBJPROP_XSIZE, xSize);
|
||||
ObjectSetInteger(0, name, OBJPROP_YSIZE, ySize);
|
||||
|
||||
//
|
||||
mName = name;
|
||||
|
||||
//
|
||||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
* Destroy Class Instance ...
|
||||
*/
|
||||
void Destroy()
|
||||
{
|
||||
ObjectDelete(0, mName);
|
||||
}
|
||||
// Getter(s) / Setter(s) ...
|
||||
|
||||
/**
|
||||
* Set Object Border Type ...
|
||||
*
|
||||
* @param borderType: Specified border type
|
||||
*/
|
||||
void SetBorderType(ENUM_BORDER_TYPE borderType)
|
||||
void BorderType(ENUM_BORDER_TYPE borderType)
|
||||
{
|
||||
//
|
||||
ObjectSetInteger(
|
||||
0,
|
||||
mChartID,
|
||||
mName,
|
||||
OBJPROP_BORDER_TYPE,
|
||||
borderType //
|
||||
@@ -209,55 +221,17 @@ class XCRectangleLabel : XSCBase
|
||||
*
|
||||
* @param value: color
|
||||
*/
|
||||
void SetBGColor(color value)
|
||||
void BGColor(color value)
|
||||
{
|
||||
//
|
||||
ObjectSetInteger(
|
||||
0,
|
||||
mChartID,
|
||||
mName,
|
||||
OBJPROP_BGCOLOR,
|
||||
value //
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Set Object ZOrder ...
|
||||
*
|
||||
* @param value: z order
|
||||
*/
|
||||
void SetZOrder(int value)
|
||||
{
|
||||
ObjectSetInteger(0, mName, OBJPROP_ZORDER, value);
|
||||
}
|
||||
|
||||
/**
|
||||
* Set Object as Background ...
|
||||
*
|
||||
* @param value: boolean value
|
||||
*/
|
||||
void SetAsBackGround(bool value)
|
||||
{
|
||||
ObjectSetInteger(0, mName, OBJPROP_BACK, value);
|
||||
}
|
||||
|
||||
/**
|
||||
* 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);
|
||||
}
|
||||
|
||||
//
|
||||
// Protected ...
|
||||
protected:
|
||||
@@ -267,9 +241,6 @@ class XCRectangleLabel : XSCBase
|
||||
//
|
||||
// Props ...
|
||||
|
||||
//
|
||||
string mName; // Name of Object
|
||||
|
||||
//
|
||||
// Mouse state tracking variables ...
|
||||
int mlbDownX;
|
||||
|
||||
@@ -0,0 +1,116 @@
|
||||
///////////////////////////////////////////////////////
|
||||
//
|
||||
// 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:
|
||||
//
|
||||
};
|
||||
Reference in New Issue
Block a user