예제 #1
0
                public object GetStyleValue(EditStyling.Style style)
                {
                    switch (style)
                    {
                    case EditStyling.Style.BoldParagraph:
                    {
                        return(true);
                    }

                    case EditStyling.Style.BoldItalicizeParagraph:
                    {
                        return(true);
                    }

                    case EditStyling.Style.ItalicizeParagraph:
                    {
                        return(true);
                    }

                    case EditStyling.Style.UnderlineParagraph:
                    {
                        return(true);
                    }

                    case EditStyling.Style.BulletParagraph:
                    {
                        return(true);
                    }
                    }

                    return(null);
                }
예제 #2
0
                public object GetStyleValue(EditStyling.Style style)
                {
                    switch (style)
                    {
                    case EditStyling.Style.FontName:
                    {
                        return(PlatformLabel.Editable_GetFontName( ));
                    }

                    case EditStyling.Style.FontSize:
                    {
                        return(PlatformLabel.Editable_GetFontSize( ));
                    }

                    //case EditStyling.Style.Underline:
                    //{
                    //    return PlatformLabel.Editable_HasUnderline( );
                    //}

                    case EditStyling.Style.RevealBox:
                    {
                        // here, we're basically saying "YES, we ARE a reveal box" so the system
                        // knows to downgrade us.
                        return(true);
                    }

                    case EditStyling.Style.BoldParagraph:
                    {
                        // for bolding the paragraph, forward this to the parent to see if it supports it
                        return(ParentControl.GetStyleValue(style));
                    }

                    case EditStyling.Style.UnderlineParagraph:
                    {
                        // for underlining the paragraph, forward this to the parent to see if it supports it
                        return(ParentControl.GetStyleValue(style));
                    }

                    case EditStyling.Style.BulletParagraph:
                    {
                        return(ParentControl.GetStyleValue(style));
                    }

                    case EditStyling.Style.BoldItalicizeParagraph:
                    {
                        return(ParentControl.GetStyleValue(style));
                    }

                    case EditStyling.Style.ItalicizeParagraph:
                    {
                        return(ParentControl.GetStyleValue(style));
                    }
                    }

                    return(null);
                }
예제 #3
0
 public void SetStyleValue(EditStyling.Style style, object value)
 {
 }
예제 #4
0
 public object GetStyleValue(EditStyling.Style style)
 {
     return(null);
 }
예제 #5
0
 public void HandleChildStyleChanged(EditStyling.Style style, IEditableUIControl childControl)
 {
     // for now, lets just redo our layout.
     SetPosition(TextView.Frame.Left, TextView.Frame.Top);
 }
예제 #6
0
 public void HandleChildStyleChanged(EditStyling.Style style, IEditableUIControl childControl)
 {
     // nothing this will need to do, since this control can't have children
 }
예제 #7
0
                public void SetStyleValue(EditStyling.Style style, object value)
                {
                    switch (style)
                    {
                    case EditStyling.Style.FontName:
                    {
                        string fontName = value as string;
                        PlatformLabel.Editable_SetFontName(fontName);

                        break;
                    }

                    case EditStyling.Style.FontSize:
                    {
                        float fontSize = (float)value;
                        PlatformLabel.Editable_SetFontSize(fontSize);

                        break;
                    }

                    case EditStyling.Style.Underline:
                    {
                        bool enableUnderline = (bool)value;

                        if (enableUnderline)
                        {
                            PlatformLabel.Editable_AddUnderline( );
                        }
                        else
                        {
                            PlatformLabel.Editable_RemoveUnderline( );
                        }

                        break;
                    }

                    case EditStyling.Style.BoldParagraph:
                    {
                        // for bolding the paragraph, forward this to the parent
                        ParentControl.SetStyleValue(style, value);
                        break;
                    }

                    case EditStyling.Style.UnderlineParagraph:
                    {
                        // for underlining the paragraph, forward this to the parent
                        ParentControl.SetStyleValue(style, value);
                        break;
                    }

                    case EditStyling.Style.BulletParagraph:
                    {
                        ParentControl.SetStyleValue(style, value);
                        break;
                    }

                    case EditStyling.Style.BoldItalicizeParagraph:
                    {
                        ParentControl.SetStyleValue(style, value);
                        break;
                    }

                    case EditStyling.Style.ItalicizeParagraph:
                    {
                        ParentControl.SetStyleValue(style, value);
                        break;
                    }
                    }

                    // first, reset our dimensions and call sizeToFit, which will
                    // fully recalculate our bounds (since our font name / size may have changed.)
                    PlatformLabel.Bounds = new RectangleF(0, 0, 0, 0);
                    PlatformLabel.SizeToFit( );

                    // now notify our parent so it can update its layout with our new size
                    ParentControl.HandleChildStyleChanged(style, this);
                }
예제 #8
0
                public void HandleChildStyleChanged(EditStyling.Style style, IEditableUIControl childControl)
                {
                    switch (style)
                    {
                    case EditStyling.Style.RevealBox:
                    {
                        // first, find the target in our list
                        int targetIndex = 0;
                        foreach (IUIControl child in ChildControls)
                        {
                            // when we find it
                            if (child.Equals(childControl) == true)
                            {
                                // take its index, and remove it from the renderer and our list of children
                                targetIndex = ChildControls.IndexOf(child);

                                child.RemoveFromView(ParentEditingCanvas);
                                ChildControls.RemoveAt(targetIndex);
                                break;
                            }
                        }

                        // if we received RevealBox, we're either upgrading a NoteText to BE a RevealBox,
                        // or downgrading a RevealBox to be a normal NoteText.
                        EditableNoteText editableNoteText = childControl as EditableNoteText;
                        if (editableNoteText != null)
                        {
                            // create a new revealBox, but force the text to uppper-case and add the bold font (since this is typically what the Mobile App does)
                            Style controlStyle = childControl.GetControlStyle( );
                            controlStyle.mFont       = new FontParams( );
                            controlStyle.mFont.mName = sDefaultBoldFontName;

                            RevealBox newRevealBox = Parser.CreateRevealBox(new CreateParams(this, Frame.Width, Frame.Height, ref controlStyle), editableNoteText.GetText( ).ToUpper( ).Trim( ));
                            newRevealBox.AddToView(ParentEditingCanvas);

                            // add the new revealBox into the same spot as what it's replacing
                            ChildControls.Insert(targetIndex, newRevealBox);

                            // make sure we add a space after the reveal box, as that's required.
                            NoteText textLabel = Parser.CreateNoteText(new CreateParams(this, Frame.Width, Frame.Height, ref mStyle), " ");
                            textLabel.AddToView(ParentEditingCanvas);
                            ChildControls.Insert(targetIndex + 1, textLabel);
                        }

                        EditableRevealBox editableRevealBox = childControl as EditableRevealBox;
                        if (editableRevealBox != null)
                        {
                            // create a new revealBox that has the styling and text of the noteText it's replacing.
                            Style    controlStyle = childControl.GetControlStyle( );
                            NoteText newNoteText  = Parser.CreateNoteText(new CreateParams(this, Frame.Width, Frame.Height, ref controlStyle), editableRevealBox.GetText( ).Trim( ));
                            newNoteText.AddToView(ParentEditingCanvas);

                            // add the new revealBox into the same spot as what it's replacing
                            ChildControls.Insert(targetIndex, newNoteText);
                        }

                        break;
                    }
                    }

                    // for now, lets just redo our layout.
                    SetPosition(Frame.Left, Frame.Top);
                }
예제 #9
0
                public void SetStyleValue(EditStyling.Style style, object value)
                {
                    switch (style)
                    {
                    case EditStyling.Style.BoldParagraph:
                    {
                        // force all children to bold
                        foreach (IUIControl child in ChildControls)
                        {
                            IEditableUIControl editableChild = child as IEditableUIControl;
                            if (editableChild != null)
                            {
                                editableChild.SetStyleValue(EditStyling.Style.FontName, EditableParagraph.sDefaultBoldFontName);
                            }
                        }
                        break;
                    }

                    case EditStyling.Style.BoldItalicizeParagraph:
                    {
                        // force all children to bold
                        foreach (IUIControl child in ChildControls)
                        {
                            IEditableUIControl editableChild = child as IEditableUIControl;
                            if (editableChild != null)
                            {
                                editableChild.SetStyleValue(EditStyling.Style.FontName, EditableParagraph.sDefaultBoldItalicFontName);
                            }
                        }
                        break;
                    }

                    case EditStyling.Style.ItalicizeParagraph:
                    {
                        // force all children to bold
                        foreach (IUIControl child in ChildControls)
                        {
                            IEditableUIControl editableChild = child as IEditableUIControl;
                            if (editableChild != null)
                            {
                                editableChild.SetStyleValue(EditStyling.Style.FontName, EditableParagraph.sDefaultItalicFontName);
                            }
                        }
                        break;
                    }

                    case EditStyling.Style.BulletParagraph:
                    {
                        // create a noteText with the bullet, and then insert it
                        XmlTextReader reader = new XmlTextReader(new StringReader("<NT>" + sBulletChar + "</NT>"));
                        reader.Read( );

                        IUIControl bulletText = Parser.TryParseControl(new CreateParams(this, ParentSize.Width, ParentSize.Height, ref mStyle), reader);

                        ChildControls.Insert(0, bulletText);

                        SetPosition(Frame.Left, Frame.Top);

                        bulletText.AddToView(ParentEditingCanvas);

                        break;
                    }

                    case EditStyling.Style.UnderlineParagraph:
                    {
                        // to underline the whole thing, we need to make it one big NoteText.
                        // we'll gather all the text, convert it to a single NoteText with Underlined Attribute,
                        // remove the existing children, and replace them with the new single underlined one.

                        // get the full text. we can use the build HTML stream code to do this.
                        string htmlStream = string.Empty;
                        string textStream = string.Empty;
                        BuildHTMLContent(ref htmlStream, ref textStream, new List <IUIControl>( ));

                        // if the last character is a URL glyph, remove it
                        textStream = textStream.Trim(new char[] { ' ', PrivateNoteConfig.CitationUrl_Icon[0] });

                        XmlTextReader reader = new XmlTextReader(new StringReader("<NT Underlined=\"True\">" + textStream + "</NT>"));
                        reader.Read( );

                        IUIControl noteText = Parser.TryParseControl(new CreateParams(this, ParentSize.Width, ParentSize.Height, ref mStyle), reader);

                        foreach (IUIControl control in ChildControls)
                        {
                            control.RemoveFromView(ParentEditingCanvas);
                        }
                        ChildControls.Clear( );


                        ChildControls.Add(noteText);

                        SetPosition(Frame.Left, Frame.Top);

                        noteText.AddToView(ParentEditingCanvas);

                        break;
                    }
                    }
                }