/////////////////////////////////////////////////////// // // SaherElm IT Center MQL5 Class Library // -------------------------------------- // Name: XCPanel // 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 // // Imports ... #include "../XCObjects/x-saherelm.x-button.class.mq5" #include "../XCObjects/x-saherelm.x-edit.class.mq5" #include "../XCObjects/x-saherelm.x-label.class.mq5" #include "../XCObjects/x-saherelm.x-rectangle.label.class.mq5" // // Implementation ... // class XCPanel : XSCBase { public: // // Constructor(s) ... void XCPanel() { // // Enables mouse move events on the chart ChartSetInteger(0, CHART_EVENT_MOUSE_MOVE, true); } // // Deconstructor ... void ~XCPanel() { Destroy(); } // // Action ... /** * Create an instance of Panel Object ... * * @param name: Object name * @param xDis: X Distance * @param yDis: Y Distance * @param xSize: X Size * @param ySize: Y Size * @param titleBarBorderType: Border Type of Panel TitleBar * @param titleBarBGColor: Background Color of Panel TitleBar * @param caption: Caption Text of Panel TitleBar * @param captionontSize: Font Size of Panel Caption * @param captionColor: Text Color of Panel Caption * @param captionAnchor: Anchor Point of Panel Caption * @param bodyBorderType: Border Type of Panel Body * @param bodyBGColor: Background Color of Panel Body * * @return ( bool ) */ bool Create( string name, int xDis, int yDis, int xSize, int ySize, // // Title Bar ... ENUM_BORDER_TYPE titleBarBorderType = BORDER_FLAT, color titleBarBGColor = clrBlueViolet, // // Caption ... string caption = "", int captionontSize = 9, color captionColor = clrWhite, ENUM_ANCHOR_POINT captionAnchor = ANCHOR_LEFT_UPPER, // // Body ... ENUM_BORDER_TYPE bodyBorderType = BORDER_FLAT, color bodyBGColor = clrMediumSlateBlue // ) { // bool result = false; // result = IsValid(name); if (!result) { // Destroy(); return result; } // mTitleBarName = name + "_TITLE_BAR"; mTitleTextName = name + "_CAPTION"; mBodyName = name + "_BODY"; // if (!IsValid(caption)) { caption = name; } // // Title Bar ... int titleBarHeight = 20; result = mTitleBar.Create( mTitleBarName, xDis, yDis, xSize, titleBarHeight // ); if (!result) { // Destroy(); return result; } mTitleBar.SetBorderType(titleBarBorderType); mTitleBar.SetBGColor(titleBarBGColor); // // Body ... result = mBody.Create( mBodyName, xDis, yDis + titleBarHeight - 1, xSize, ySize // ); if (!result) { // Destroy(); return result; } mBody.SetBorderType(bodyBorderType); mBody.SetBGColor(bodyBGColor); // // Caption ... result = mTitleText.Create(mTitleTextName, xDis, yDis); if (!result) { // Destroy(); return result; } mTitleText.SetText(caption); mTitleText.SetAnchor(captionAnchor); mTitleText.SetTextColor(captionColor); mTitleText.SetFontSize(captionontSize); // // Adding Child Objects ... mTitleBar.Add(mBodyName); mTitleBar.Add(mTitleTextName); // return result; } /** * Destroy Panel Object and all of it's Child */ void Destroy() { // mBodyName = NULL; mTitleBarName = NULL; mTitleTextName = NULL; // mBody.Destroy(); mTitleBar.Destroy(); mTitleText.Destroy(); } /** * Event Handling for Mouse Movement ... * @param id: Event ID * @param lparam: Event parameter of long type * @param dparam: Event parameter of double type * @param sparam: Event parameter of string type */ void OnEvent( int id, long lparam, double dparam, string sparam // ) { // mTitleBar.OnEvent( id, lparam, dparam, sparam // ); } /** * Add Specific Child Object ... * * @param name: object name */ void Add(string name) { mTitleBar.Add(name); } // protected: private: // // Props ... // string mBodyName; string mTitleBarName; string mTitleTextName; // XCLabel mTitleText; XCRectangleLabel mBody; XCRectangleLabel mTitleBar; // };