private bool m_IsMouseOverClickableBox = false; // indicates mouse is over a clickable region. // #endregion// members #region Constructors // ***************************************************************** // **** Constructors **** // ***************************************************************** // // public Cluster(GuiTemplates.EngineContainerGui guiTemplate) { InitializeComponent(); m_Name = guiTemplate.DisplayName; m_EngineContainerID = guiTemplate.EngineContainerID; this.Name = string.Format("Cluster{0}", m_EngineContainerID.ToString()); m_Configuration = new ClusterConfiguration(); //clusterConfig.Clone(); m_Header = new Header(this, guiTemplate); // creates PopUp controls for engines. m_LowerControl = new Huds.MultiPanel(this, guiTemplate); InitializeBoxRowControl(guiTemplate); // creates BoxRows InitializeLayout(); // does layout for all controls. RegisterMouseEvents(); }
private System.Drawing.Point m_NextMenuButtonLoc = new System.Drawing.Point(228, 0); // location of first button #endregion // members #region Constructors // ***************************************************************** // **** Constructors **** // ***************************************************************** // /// <summary> /// Constructor for the Header in a Cluster object. This is called from /// a Cluster constructor and therefore by a GUI thread. /// The Cluster constructor is called using reflection but uses an invoke on the /// GUI thread. /// </summary> /// <param name="parent"></param> /// <param name="container">The container (think Strategy) associated with this Cluster.</param> public Header(IEngineContainer parent, GuiTemplates.EngineContainerGui container) { m_ParentCluster = parent; // Cluster in which I belong. if (m_ParentCluster is Cluster) { this.ContextMenuStrip = ((Cluster)m_ParentCluster).ClusterContextMenuStrip; } InitializeComponent(); // Initialize Header - unique in each Cluster, 1-to-1 with EngineContainer. this.txtName.Text = parent.EngineContainerName; m_EngineContainerID = parent.EngineContainerID; // Create controls (per engine) for this EngineContainer. this.SuspendLayout(); List <GuiTemplates.EngineGui> engineList = container.m_Engines; foreach (GuiTemplates.EngineGui engineGui in engineList) { // Create Popup displays. Control newControl = null; Type guiType = typeof(EngineControl); if (UV.Lib.IO.Xml.Stringifiable.TryGetType(engineGui.HeaderControlFullName, out guiType)) { // We have found the desired control to create. //if (Utilities.GuiCreator.TryCreateControl(out newControl, guiType, engineGui.EngineID, engineGui.ParameterList)) if (Utilities.GuiCreator.TryCreateControl(out newControl, guiType, engineGui)) { // We have successfully created the desired control. m_EngineControlList.Add((IEngine)newControl); // Create unique name for popup. string uniqueName = string.Format("{0}", engineGui.DisplayName); // starting name. if (m_PopupList.ContainsKey(uniqueName)) { int n = 0; while (m_PopupList.ContainsKey(uniqueName)) { uniqueName = string.Format("{0} {1}", engineGui.DisplayName, n++);// new name with additional index. } } // Create a popup window to contain control. PopUp1 popup = new PopUps.PopUp1(this); // load any IPopUp object here! //popup.Title = uniqueName; popup.Title = engineGui.DisplayName; popup.Text = m_ParentCluster.EngineContainerName; // Text on the top of Window. popup.AddControl((IEngineControl)newControl); // Add this new popup to my lists. m_PopupList.Add(uniqueName, popup); // unique popupname to popup form. if (!m_EngineIDToPopups.ContainsKey(engineGui.EngineID)) { m_EngineIDToPopups.Add(engineGui.EngineID, new List <string>()); // create mapping for engineID -> popup names. } m_EngineIDToPopups[engineGui.EngineID].Add(uniqueName); // store each popup name. // Create a new buttons to open/close this new popup. this.comboBoxEngines.Items.Add(uniqueName); } } } //next engine this.ResumeLayout(false); } //constructor
// // // // // // ********************************************************* // **** Initialize BoxRow Control() **** // ********************************************************* /// <summary> /// Initializes the BoxRowControl object, which right now is hard-coding inside /// this object. /// </summary> private void InitializeBoxRowControl(GuiTemplates.EngineContainerGui guiTemplate) { // // Identify the types of engines we have. // List <GuiTemplates.EngineGui> engineList = guiTemplate.m_Engines; foreach (GuiTemplates.EngineGui engine in engineList) { int engineID = engine.EngineID; Type engineType; if (UV.Lib.IO.Xml.Stringifiable.TryGetType(engine.EngineFullName, out engineType)) { List <Type> interfaces = new List <Type>(engineType.GetInterfaces()); if (interfaces.Contains(typeof(IPricingEngine))) { m_PricingEngineID = engineID; //m_MinTickSize = 1; } // test for order engines, fill engines, etc, too. } /* * Type baseType = engine.GetType(); * while (baseType != null && baseType.BaseType != typeof(Engine)) * { // if next next level down is NOT an Engine, then we need to dig deeper. * baseType = baseType.BaseType; * } * if (baseType.Name.Contains("Pricing")) * { // the main pricing engine is assumed to be listed first! * // TODO: In future, allow multiple pricing engines, or some other way to * // indicate the "boss" pricing engine whose market is shown in the Cluster. * if (m_PricingEngineID < 0) * { * m_PricingEngineID = engine.EngineID; * } * else if (Log != null) * { * Log.NewEntry(LogLevel.Major, "{0} cluster won't display mkt depth of pricing engine {1}." * , container.EngineContainerName, engine.EngineName); * } * } * else if (baseType.Name.Contains("Fill")) * m_FillEngineID = engine.EngineID; * else if (baseType.Name.Contains("Order")) * m_OrderEngineID = engine.EngineID; */ }//next engine // // Initialize the cluster's internal workings. // m_BoxRowIsRegenerationNeeded = new bool[m_BoxRowRows]; m_Memory = new int[m_BoxRowRows][]; m_HiLiteMemory = new int[m_BoxRowRows][]; m_RawDataQ = new int[m_BoxRowRows][]; m_RawDataP = new double[m_BoxRowRows][]; for (int i = 0; i < m_Memory.Length; i++) { m_Memory[i] = new int[m_Configuration.BoxRowColumns]; m_HiLiteMemory[i] = new int[m_Configuration.BoxRowColumns]; } // Initialize the clusters controls. m_LeftBaseLoc = (int)(m_Configuration.BoxRowColumns / 2 - 1); // index offset for left-most (first) box. // // Create the rows // int nCols = m_Configuration.BoxRowColumns; if (nCols == 0) { m_Row = new BoxRow[0]; return; } int xLocOffset = 0; // optional extra space for over-flow columns. m_Row = new BoxRow[m_BoxRowRows]; for (int row = 0; row < m_Row.Length; ++row) { // design each row property switch (row) { case PriceRowID: // price row m_Row[row] = new BoxRow(nCols, m_MinTickSize, xLocOffset, false, ColorPalette.TextNormal); m_Row[row].RowType = ClusterEventArgs.BoxRowType.PriceRow; break; case BidRowID: m_Row[row] = new BoxRow(nCols, 1, xLocOffset, false, ColorPalette.BackSigned); m_Row[row].RowType = ClusterEventArgs.BoxRowType.BidQtyRow; break; case AskRowID: m_Row[row] = new BoxRow(nCols, 1, xLocOffset, false, ColorPalette.BackSigned); m_Row[row].RowType = ClusterEventArgs.BoxRowType.AskQtyRow; break; case FillsRowID: m_Row[row] = new BoxRow(nCols, 1, xLocOffset, false, ColorPalette.BackSigned); m_Row[row].RowType = ClusterEventArgs.BoxRowType.FillsRow; break; case OrderRowID: //m_Row[row] = new BoxRow(nCols, 1, xLocOffset, false, ColorPalette.ForeSigned); m_Row[row] = new BoxRow(nCols, 1, xLocOffset, false, ColorPalette.TextSigned); m_Row[row].RowType = ClusterEventArgs.BoxRowType.OrderRow; break; default: m_Row[row] = new BoxRow(nCols, 1, xLocOffset, false, ColorPalette.BackSigned); break; } //row switch } // row } //InitializeBoxRowControl().