Files
xMQL5/BKPS/14030823/BKPs/14030802-X121/Classes/XCObjects/x-saherelm.x-button.class.mq5
T
2024-11-15 10:50:11 +03:30

157 lines
2.9 KiB
Plaintext

///////////////////////////////////////////////////////
//
// 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:
//
};