Files
MQL5Data/Classes/XObjects/x-saherelm.x-label.class.mq5
T
2024-09-22 22:26:19 +03:30

177 lines
3.2 KiB
Plaintext

///////////////////////////////////////////////////////
//
// 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 "../x-saherelm.base.class.mq5"
//
// Definitions ...
//
// Implementation ...
//
// a Label Creation Class ...
class XCLabel : XSCBase
{
//
// 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 //
)
{
//
// Object creation and property settings
bool result = false;
//
result = ObjectCreate(0, name, OBJ_LABEL, 0, 0, 0);
if (!result)
{
return result;
}
//
ObjectSetInteger(0, name, OBJPROP_XDISTANCE, xDis);
ObjectSetInteger(0, name, OBJPROP_YDISTANCE, yDis);
//
mName = name;
//
return result;
}
/**
* Destroy Class Instance ...
*/
void Destroy()
{
ObjectDelete(0, mName);
}
//
// Getter(s) / Setter(s) ...
/**
* Set Text Color ...
*
* @param value: color
*/
void SetTextColor(color value)
{
ObjectSetInteger(0, mName, OBJPROP_COLOR, value);
}
/**
* Set Text of Object ...
*
* @param value: text
*/
void SetText(string value)
{
ObjectSetString(0, mName, OBJPROP_TEXT, value);
}
/**
* Get Text Of Object ...
*
* @return ( string )
*/
string GetText()
{
return ObjectGetString(0, mName, OBJPROP_TEXT);
}
/**
* Set Font Size of Object ...
*
* @param value: size
*/
void SetFontSize(int value)
{
ObjectSetInteger(0, mName, OBJPROP_FONTSIZE, value);
}
/**
* Set Font Name Of Object ...
*
* @param value: font name
*/
void SetFont(string value)
{
ObjectSetString(0, mName, OBJPROP_FONT, value);
}
//
// Protected ...
protected:
//
// 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
};