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 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
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user