AiDataTaskRuner/UI/Main.mqh
Nique_372 48907b78e0
2026-02-25 11:10:09 -05:00

167 líneas
5,4 KiB
MQL5

//+------------------------------------------------------------------+
//| Main.mqh |
//| Copyright 2025, Niquel Mendoza. |
//| https://www.mql5.com/es/users/nique_372 |
//+------------------------------------------------------------------+
#property copyright "Copyright 2025, Niquel Mendoza."
#property link "https://www.mql5.com/es/users/nique_372"
#property strict
#ifndef AIDATATASKRUNER_UI_MAIN_MQH
#define AIDATATASKRUNER_UI_MAIN_MQH
//+------------------------------------------------------------------+
//| |
//+------------------------------------------------------------------+
#include "AllTabs.mqh"
//---
string g_taskruner_main_tab_tabs[2]
{
"Data Gen",
"Acerda de"
};
//---
#define TASKRUNERAIMAINTAB_TAB_DGEN (0)
#define TASKRUNERAIMAINTAB_TAB_ABOUT (1)
//+------------------------------------------------------------------+
//| |
//+------------------------------------------------------------------+
class CTaskRunerMainTab : public CLoggerBase
{
private:
//--- Tabb principal
CTabs m_tabs;
//--- Secciones
CTaskRunerAiTabDGenMain m_sec_generation_data;
CTaskRunerAiTabAbout m_sec_about;
public:
CTaskRunerMainTab(void) {}
~CTaskRunerMainTab(void) {}
//---
CTaskRunerAiTabDGenMain* GetSecTaskRunerAiDGenPtr() { return &m_sec_generation_data; }
CTaskRunerAiTabAbout* GetSecAbout() { return &m_sec_about; }
//--- Funcion principal de creacion
// Se supone que top_gatp ya viene con el offset del tab
bool Create(CWndCreate* p, CWindow& main_window, CTabs& general_tabs, int tab_index, int top_gap, int left_gap, int right_gap, int bottom_gap);
//--- Eventos
bool OnClickBottom(const long lparam);
bool OnChangeDate(const long lparam, const double dparam); //dparm = date
bool OnTextEdit(const long lparam);
bool OnChangeComBox(const long lparam);
};
//+------------------------------------------------------------------+
bool CTaskRunerMainTab::Create(CWndCreate *p, CWindow &main_window, CTabs &general_tabs, int tab_index, int top_gap, int left_gap, int right_gap, int bottom_gap)
{
int x = left_gap + 1;
int y = top_gap + 1;
//--- Creacion del control tabs
// Propiedades
int widts[2];
widts[TASKRUNERAIMAINTAB_TAB_DGEN] = 65;
widts[TASKRUNERAIMAINTAB_TAB_ABOUT] = 65;
x += 65;
m_tabs.BackColor(C'191,191,191');
m_tabs.BackColorPressed(AIDATATASKRUNER_COLOR_FONDO);
// Offset
right_gap += 2;
bottom_gap += 2;
// Creacion
if(!p.CreateTabs(m_tabs, main_window, 0, general_tabs, tab_index, x, y, 0, 0, g_taskruner_main_tab_tabs, widts, TABS_LEFT, true, true, right_gap, bottom_gap))
{
AIDATATASKRUNER_ERROR_CREATION(m_tabs);
return false;
}
//---
left_gap += m_tabs.SumWidthTabs() + 1;
top_gap += 1;
//--- Seccion generacino de datos
if(!m_sec_generation_data.Create(p, main_window, m_tabs, TASKRUNERAIMAINTAB_TAB_DGEN, top_gap, left_gap, right_gap, bottom_gap))
{
AIDATATASKRUNER_ERROR_CREATION(m_sec_generation_data);
return false;
}
else
{
m_sec_generation_data.AddLogFlags(LogFlags());
}
//--- Seccion About
if(!m_sec_about.Create(p, main_window, m_tabs, TASKRUNERAIMAINTAB_TAB_ABOUT, top_gap, left_gap, right_gap, bottom_gap))
{
AIDATATASKRUNER_ERROR_CREATION(m_sec_about);
return false;
}
else
{
m_sec_about.AddLogFlags(LogFlags());
}
//---
return true;
}
//+------------------------------------------------------------------+
//| |
//+------------------------------------------------------------------+
bool CTaskRunerMainTab::OnChangeComBox(const long lparam)
{
if(m_tabs.SelectedTab() == TASKRUNERAIMAINTAB_TAB_DGEN)
return m_sec_generation_data.OnChangeComBox(lparam);
else
return false;
return true;
}
//+------------------------------------------------------------------+
//| |
//+------------------------------------------------------------------+
bool CTaskRunerMainTab::OnClickBottom(const long lparam)
{
if(m_tabs.SelectedTab() == TASKRUNERAIMAINTAB_TAB_DGEN)
return m_sec_generation_data.OnClickBottom(lparam);
else
return false;
return true;
}
//+------------------------------------------------------------------+
//| |
//+------------------------------------------------------------------+
bool CTaskRunerMainTab::OnChangeDate(const long lparam, const double dparam)
{
if(m_tabs.SelectedTab() == TASKRUNERAIMAINTAB_TAB_DGEN)
return m_sec_generation_data.OnChangeDate(lparam, dparam);
else
return false;
return true;
}
//+------------------------------------------------------------------+
//| |
//+------------------------------------------------------------------+
bool CTaskRunerMainTab::OnTextEdit(const long lparam)
{
if(m_tabs.SelectedTab() == TASKRUNERAIMAINTAB_TAB_DGEN)
return m_sec_generation_data.OnTextEdit(lparam);
else
return false;
return true;
}
//---
#endif // AIDATATASKRUNER_UI_MAIN_MQH