/// <summary> /// Initializes a new instance of the <see cref="ToggleLinkElementCommand"/> class. /// </summary> /// <param name="sequenceModel">The timeline model.</param> /// <param name="layer">The layer of the element.</param> /// <param name="element">The element being linked/unliked.</param> /// <param name="linkPosition">The <see cref="LinkPosition"/> of the link.</param> public ToggleLinkElementCommand(ISequenceModel sequenceModel, Track layer, TimelineElement element, LinkPosition linkPosition) { this.sequenceModel = sequenceModel; this.layer = layer; this.element = element; this.linkPosition = linkPosition; }
/// <summary> /// Initializes a new instance of the <see cref="ToggleLinkElementCommand"/> class. /// </summary> /// <param name="timelineModel">The timeline model.</param> /// <param name="layer">The layer of the element.</param> /// <param name="element">The element being linked/unliked.</param> /// <param name="linkPosition">The <see cref="LinkPosition"/> of the link.</param> public ToggleLinkElementCommand(ITimelineModel timelineModel, Track layer, TimelineElement element, LinkPosition linkPosition) { this.timelineModel = timelineModel; this.layer = layer; this.element = element; this.linkPosition = linkPosition; }
public Point GetPosition(Field field, LinkPosition lp) { int pos = checkedListBox1.FindString(field.ToString()); Rectangle rec = checkedListBox1.GetItemRectangle(pos); Point pnt = new Point(); pnt.Y = rec.Top + rec.Height / 2; if (pnt.Y < 0) { pnt.Y = 0; } else if (pnt.Y > checkedListBox1.Height) { pnt.Y = checkedListBox1.Height; } if (lp == LinkPosition.Left) { pnt.X = -10; } else { pnt.X = checkedListBox1.Width + 10; } return(checkedListBox1.PointToScreen(pnt)); }
/// <summary> /// Raises the LinkClicked event. /// </summary> /// <param name="linkPosition">The link position used to raise the event.</param> private void OnLinkClicked(LinkPosition linkPosition) { EventHandler <LinkElementEventArgs> linkClickedHandler = this.LinkClicked; if (linkClickedHandler != null) { linkClickedHandler(this, new LinkElementEventArgs(this.Model, linkPosition)); } }
/// <summary> /// Hides the link of the given position. /// </summary> /// <param name="position">The position of the link to hide.</param> public void HideLink(LinkPosition position) { if (position == LinkPosition.In) { this.InUnlinkIcon.Visibility = Visibility.Collapsed; this.InLinkIcon.Visibility = Visibility.Collapsed; } if (position == LinkPosition.Out) { this.OutUnlinkIcon.Visibility = Visibility.Collapsed; this.OutLinkIcon.Visibility = Visibility.Collapsed; } }
/// <summary> /// Shows the link of the given position. /// </summary> /// <param name="position">The position of the link to show.</param> /// <param name="linked">If the link is linked or not.</param> public void ShowLink(LinkPosition position, bool linked) { if (position == LinkPosition.In) { this.InUnlinkIcon.Visibility = linked ? Visibility.Collapsed : Visibility.Visible; this.InLinkIcon.Visibility = linked ? Visibility.Visible : Visibility.Collapsed; } if (position == LinkPosition.Out) { this.OutUnlinkIcon.Visibility = linked ? Visibility.Collapsed : Visibility.Visible; this.OutLinkIcon.Visibility = linked ? Visibility.Visible : Visibility.Collapsed; } }
/// <summary> /// Initializes a new instance of the <see cref="LinkElementEventArgs"/> class. /// </summary> /// <param name="element">The timeline element.</param> /// <param name="linkPosition">The link position.</param> public LinkElementEventArgs(TimelineElement element, LinkPosition linkPosition) { this.Element = element; this.LinkPosition = linkPosition; }
private string Strip(SkinControl skin, int offset, string text) { string result = ""; bool linkStarted = false; foreach (string word in text.Split(' ')) { if (_iconDict.ContainsKey(word)) { Vector2 tmp = skin.Layers[0].Text.Font.Resource.MeasureString(result); IconPosition pos = new IconPosition(); pos.Location = new Vector2(13 + tmp.X, offset); pos.IconName = word; Icons.Add(pos); result += "--- "; } else if (linkStarted && word != "[/link]") { Links.Last().Link += word + " "; result += word + " "; } else if(word.StartsWith("[link=")) { Vector2 tmp = skin.Layers[0].Text.Font.Resource.MeasureString(result); LinkPosition link = new LinkPosition(); link.Link = ""; link.Target = word.Replace("[link=", "").Replace("]", ""); link.Location = new Vector2(13 + tmp.X, offset); Links.Add(link); linkStarted = true; } else if (word == "[/link]") { // do nothing linkStarted = false; // update link width } else result += word + " "; } return result.Trim(); }
public void HideLink(LinkPosition position, TimelineElement element) { this.HideLinkCalled = true; }
public void ShowLink(LinkPosition position, bool linked, TimelineElement element) { this.ShowLinkLinkPositionArgument = position; this.ShowLinkCalled = true; }