Exemplo n.º 1
0
 public static void ApplyAttrs(Node node, ActionAttributes actionAttributes)
 {
     if (((node != null) && (node.type_ != null)) && ((node.type_.type == ElementType.Maction) && (actionAttributes != null)))
     {
         if (node.attrs == null)
         {
             node.attrs = new AttributeList();
         }
         if (actionAttributes.actionType == ActionType.StatusLine)
         {
             node.attrs.Add("actiontype", "statusline");
         }
         else if (actionAttributes.actionType == ActionType.Toggle)
         {
             node.attrs.Add("actiontype", "toggle");
         }
         else if (actionAttributes.actionType == ActionType.Highlight)
         {
             node.attrs.Add("actiontype", "highlight");
         }
         else if (actionAttributes.actionType == ActionType.ToolTip)
         {
             node.attrs.Add("actiontype", "tooltip");
         }
         else if ((actionAttributes.actionType == ActionType.Unknown) && (actionAttributes.actionString.Length > 0))
         {
             node.attrs.Add("actiontype", actionAttributes.actionString);
         }
         string s = actionAttributes.selection.ToString();
         if (s.Length > 0)
         {
             node.attrs.Add("selection", s);
         }
     }
 }
Exemplo n.º 2
0
 public static ActionAttributes ActionAttributes(Node node)
 {
     Nodes.Attribute attribute = null;
     ActionAttributes attributes = null;
     try
     {
         if (node.attrs == null)
         {
             return attributes;
         }
         node.attrs.Reset();
         for (attribute = node.attrs.Next(); attribute != null; attribute = node.attrs.Next())
         {
             string s = attribute.val.Trim();
             if (attribute.name == "actiontype")
             {
                 if (s.Length > 0)
                 {
                     ActionType actionType = ActionType.StatusLine;
                     if (s.ToUpper() == "STATUSLINE")
                     {
                         actionType = ActionType.StatusLine;
                     }
                     else if (s.ToUpper() == "TOOLTIP")
                     {
                         actionType = ActionType.ToolTip;
                     }
                     else if (s.ToUpper() == "HIGHLIGHT")
                     {
                         actionType = ActionType.Highlight;
                     }
                     else if (s.ToUpper() == "TOGGLE")
                     {
                         actionType = ActionType.Toggle;
                     }
                     else
                     {
                         actionType = ActionType.Unknown;
                     }
                     if (attributes == null)
                     {
                         attributes = new ActionAttributes();
                     }
                     attributes.actionType = actionType;
                     attributes.actionString = s;
                 }
             }
             else if ((attribute.name == "selection") && (s.Length > 0))
             {
                 if (attributes == null)
                 {
                     attributes = new ActionAttributes();
                 }
                 attributes.selection = Convert.ToInt32(s.Trim());
             }
         }
         node.attrs.Reset();
     }
     catch
     {
     }
     return attributes;
 }
Exemplo n.º 3
0
 //
 public bool ApplyActionAttrs (Node node, ActionAttributes ActionAttributes, string statusLine)
 {
     try
     {
         this.OnInsert (false);
         if ((ActionAttributes.actionType == ActionType.StatusLine) ||
             (ActionAttributes.actionType == ActionType.ToolTip))
         {
             try
             {
                 if (node.HasChildren ())
                 {
                     Node first = node.firstChild;
                     if ((first != null) && (first.nextSibling != null))
                     {
                         first = first.nextSibling;
                         if (first.type_.type == ElementType.Mtext)
                         {
                             first.literalText = statusLine;
                         }
                     }
                 }
             }
             catch
             {
             }
         }
         if ((node != null) && (ActionAttributes != null))
         {
             AttributeBuilder.ApplyAttrs (node, ActionAttributes);
         }
     }
     catch
     {
     }
     return true;
 }