-
Notifications
You must be signed in to change notification settings - Fork 6
/
Copy pathLediaPanel.mqh
122 lines (119 loc) · 5.51 KB
/
LediaPanel.mqh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
#include "Dialog.mqh"
#include <Controls\Label.mqh>
#include <Controls\Button.mqh>
#include <Controls\Edit.mqh>
class LediaEAPanel : public CAppDialog {
public:
LediaEAPanel(void){};
~LediaEAPanel(void){};
//--- create
virtual bool CreatePanel(const long chart,const string name,const int subwin,const int x1,const int y1,const int x2,const int y2);
bool createInput(CEdit &inp, const string name, const int x, const int y, const int x2,const int y2, const color c1, const color c2, const color c3, const bool center);
bool createLabel(CLabel &lab, string text,const string name,const int font_size,const int x,const int y,const int x2, const int y2,const color clr,const string font);
bool createButton(CButton &btn, const string name,const int x,const int y,const int x1,const int y2, const string text,const string font,const int font_size,const color clr,const color back_clr,const color brdclr);
};
//+
//+------------------------------------------------------------------+
//| Create |
//+------------------------------------------------------------------+
bool LediaEAPanel::CreatePanel(const long chart,const string name,const int subwin,const int x1,const int y1,const int x2,const int y2)
{
if(!Create(chart,name,subwin,x1,y1,x2,y2))
return(false);
//--- create background
//---
if (DARK_MODE) {
//color border, color bg, color clientarea, color cborder, color cap, color capborder
if(!setBackColor(clrBlack, clrBlack, C'160,160,160', C'40,40,40', clrBlack, clrBlack, clrBlack, C'40,40,40')) return(false);
}
else if(!setBackColor(C'164,30,38', C'164,30,38', clrSnow, C'245,245,245', C'164,30,38', C'164,30,38', C'164,30,38', C'164,30,38')) return(false);
//--- succeed
return(true);
}
//+------------------------------------------------------------------+
//| createInput |
//+------------------------------------------------------------------+
bool LediaEAPanel::createInput(
CEdit &inp,
const string name="LediaEA_Input",
const int x=0,
const int y=0,
const int x2=50,
const int y2=20,
const color clr=clrBlack, // text color
const color bgclr=clrWhite, // background color
const color brdclr=clrGray, // in the background
const bool center=true
)
{
if (!inp.Create(0, name, 0, x,y,x2,y2))
return(false);
if(!inp.Color(clr))
return(false);
if(!inp.ColorBackground(bgclr))
return(false);
if(!inp.ColorBorder(brdclr))
return(false);
if(center)
if (!inp.TextAlign(ALIGN_CENTER))
return(false);
if (!Add(inp)) return(false);
return(true);
}
//+------------------------------------------------------------------+
//| createButton |
//+------------------------------------------------------------------+
bool LediaEAPanel::createButton(
CButton &btn,
const string name="LediaEA_Button", // button name
const int x=0, // X coordinate
const int y=20,// Y coordinate
const int x2=60, // button width
const int y2=20, // button height
const string text="LediaEA", // text
const string font="Courier New", // font
const int font_size=10, // font size
const color clr=clrBlack, // text color
const color bgclr=clrGray, // background color
const color brdclr=clrGray // in the background
)
{
btn.Create(0, name, 0, x, y, x2, y2);
btn.Font(font);
btn.FontSize(font_size);
btn.Text(text);
btn.Color(clr);
btn.ColorBackground(bgclr);
btn.ColorBorder(brdclr);
if(!Add(btn)) return(false);;
return(true);
}
//+------------------------------------------------------------------+
//| createLabel |
//+------------------------------------------------------------------+
bool LediaEAPanel::createLabel(
CLabel &lab,
string text="", // text
const string name="LediaEA Label", // label name
const int font_size=17, // font size
const int x=0, // X coordinate
const int y=0, // Y coordinate
const int x2=0, // X coordinate
const int y2=0, // Y coordinate
const color clr=clrGold, // color
const string font="Arial" // font,
)
{
if (!lab.Create(0, name, 0, x,y,x2,y2))
return(false);
if(!lab.Font(font))
return(false);
if(!lab.FontSize(font_size))
return(false);
if(!lab.Color(clr))
return(false);
if(!lab.Text(text))
return(false);
if(!Add(lab)) return(false);
return(true);
}