public MActionDialog(Node node) { this.container = null; this.success = false; this.node = null; if (node != null) { this.node = node; this.attributes = AttributeBuilder.ActionAttributes(node); if (this.attributes == null) { this.attributes = new ActionAttributes(); } } this.InitializeComponent(); if (this.attributes.actionType == ActionType.StatusLine) { this.statusline.Checked = true; this.spinner.Enabled = false; this.spinner.Maximum = new decimal(1); this.statline.Enabled = true; } else if (this.attributes.actionType == ActionType.ToolTip) { this.tooltip.Checked = true; this.spinner.Enabled = false; this.spinner.Maximum = new decimal(1); this.statline.Enabled = true; } else if (this.attributes.actionType == ActionType.Highlight) { this.highlight.Checked = true; this.spinner.Enabled = false; this.spinner.Maximum = new decimal(1); this.statusline.Enabled = false; this.tooltip.Enabled = false; this.statline.Enabled = false; this.statline.Text = ""; } else if (this.attributes.actionType == ActionType.Toggle) { this.toggle.Checked = true; this.statusline.Enabled = false; this.tooltip.Enabled = false; this.spinner.Enabled = true; this.spinner.Maximum = (decimal)node.numChildren; this.spinner.Value = (decimal)this.attributes.selection; this.statline.Enabled = false; this.statline.Text = ""; } else { this.statusline.Checked = false; this.tooltip.Checked = false; this.toggle.Checked = false; this.highlight.Checked = false; this.spinner.Enabled = false; this.spinner.Maximum = new decimal(1); this.statline.Enabled = false; this.statline.Text = ""; } if ((this.attributes.actionType == ActionType.StatusLine) || (this.attributes.actionType == ActionType.ToolTip)) { string s = ""; try { if (node.HasChildren()) { Node n = node.firstChild; if ((n != null) && (n.nextSibling != null)) { n = n.nextSibling; if (n.type_.type == ElementType.Mtext) { s = n.literalText; } } } } catch { } this.statline.Text = s; } }
public override void setChildSize(Node childNode) { bool foundTarget = false; if (childNode.childIndex == 0) { this.actionAttrs = AttributeBuilder.ActionAttributes(childNode.parent_); } if (this.actionAttrs != null) { switch (this.actionAttrs.actionType) { case ActionType.StatusLine: case ActionType.ToolTip: { if (childNode.childIndex == 0) { this.target = childNode; foundTarget = true; } break; } case ActionType.Toggle: { if ((childNode.childIndex + 1) == this.actionAttrs.selection) { this.target = childNode; foundTarget = true; } break; } case ActionType.Highlight: { if (childNode.childIndex == 0) { this.target = childNode; foundTarget = true; } break; } case ActionType.Unknown: { if (childNode.childIndex == 0) { this.target = childNode; foundTarget = true; } break; } } } if ((foundTarget && (this.target != null)) && (childNode == this.target)) { base.rect.width = this.target.box.Width; base.rect.baseline = this.target.box.Baseline; base.rect.accent = this.target.box.Height - this.target.box.Baseline; base.Skip(childNode, false); base.rect.height = base.rect.baseline + base.rect.accent; this.target.skip = false; this.target.isVisible = true; this.target.isGlyph = false; } else { childNode.box.Width = 0; childNode.box.Height = 0; childNode.box.X = 0; childNode.box.Y = 0; childNode.skip = true; childNode.isVisible = false; childNode.isGlyph = true; } if (childNode.type_.type == ElementType.Mrow) { base.Skip(childNode, true); } }