void openSwatch() { m_isSwatchOpen = true; if (m_openColorPicker != null) { m_openColorPicker.Dispose(); m_openColorPicker = null; } m_openColorPicker = new ColorPicker(m_owner, Page, m_openArea, m_hueSize.X, m_hueSize.Y, m_hues); m_openColorPicker.OnMouseClick = onOpenSwatchClick; ((Gump)m_owner).AddControl(m_openColorPicker); }
protected override void OnMouseClick(int x, int y, MouseButton button) { if (IsChild) // is a child { ParentColorPicker.Index = this.Index; ParentColorPicker.CloseChildPicker(); } else { if (m_ChildColorPicker == null) { m_ChildColorPicker = new ColorPicker(this.Parent, m_openArea, m_hueWidth, m_hueHeight, m_hues); m_ChildColorPicker.IsChild = true; m_ChildColorPicker.ParentColorPicker = this; Parent.AddControl(m_ChildColorPicker, this.Page); } else { m_ChildColorPicker.Dispose(); m_ChildColorPicker = null; } } }