Inheritance: RenderElement
Example #1
0
        public override RenderElement GetPrimaryRenderElement(RootGraphic rootgfx)
        {
            if (!this.HasReadyRenderElement)
            {
                //first time
                RenderElement baseRenderElement = base.GetPrimaryRenderElement(rootgfx);

                //1. add place holder first
                placeHolder      = new CustomTextRun(rootgfx, this.Width - 4, this.Height - 4);
                placeHolder.Text = placeHolderText;
                placeHolder.SetLocation(1, 1);
                placeHolder.TextColor = Color.FromArgb(180, Color.LightGray);

                baseRenderElement.AddChild(placeHolder);

                //2. textbox
                myTextBox = new TextBox(this.Width - 4, this.Height - 4, multiline);
                myTextBox.BackgroundColor = Color.Transparent;
                myTextBox.SetLocation(2, 2);

                textEvListener = new Text.TextSurfaceEventListener();

                myTextBox.TextEventListener = textEvListener;
                textEvListener.KeyDown     += new EventHandler <Text.TextDomEventArgs>(textEvListener_KeyDown);
                baseRenderElement.AddChild(myTextBox);

                return(baseRenderElement);
            }
            else
            {
                return(base.GetPrimaryRenderElement(rootgfx));
            }
        }
Example #2
0
        public override RenderElement GetPrimaryRenderElement()
        {
            if (_myTextRun == null)
            {
                var t_run = new CustomTextRun(this.Width, this.Height);
                t_run.TextDrawingTech = _textDrawingTech;

                t_run.TextColor   = _textColor;
                t_run.BackColor   = _backColor;
                t_run.Text        = this.Text;
                t_run.PaddingLeft = this.PaddingLeft;
                t_run.PaddingTop  = this.PaddingTop;
                t_run.SetVisible(this.Visible);
                t_run.SetLocation(this.Left, this.Top);
                t_run.SetController(this);
                t_run.TransparentForMouseEvents = this.TransparentForMouseEvents;

                //
                if (_font != null)
                {
                    t_run.RequestFont = _font;
                }
                _myTextRun = t_run;
            }
            //-----------
            return(_myTextRun);
        }
Example #3
0
        public override RenderElement GetPrimaryRenderElement(RootGraphic rootgfx)
        {
            if (_myTextRun == null)
            {
                var trun = new CustomTextRun(rootgfx, this.Width, this.Height);

#if DEBUG
                trun.dbugBreak = this.dbugBreakOnRenderElement;
#endif
                trun.SetLocation(this.Left, this.Top);
                trun.TextColor   = _textColor;
                trun.Text        = this.Text;
                trun.PaddingLeft = this.PaddingLeft;
                trun.PaddingTop  = this.PaddingTop;
                trun.SetVisible(this.Visible);
                trun.SetController(this);
                //
                if (_font != null)
                {
                    trun.RequestFont = _font;
                }
                _myTextRun = trun;
            }
            //-----------
            return(_myTextRun);
        }
Example #4
0
        public override RenderElement GetPrimaryRenderElement(RootGraphic rootgfx)
        {
            if (primElement == null)
            {
                //first time
                var element = new CustomRenderBox(rootgfx, this.Width, this.Height);
                element.SetLocation(this.Left, this.Top);
                element.BackColor       = this.backColor;
                element.HasSpecificSize = true;
                //-----------------------------
                // create default layer for node content


                //-----------------------------
                uiNodeIcon = new ImageBox(16, 16);//create with default size
                SetupNodeIconBehaviour(uiNodeIcon);
                element.AddChild(uiNodeIcon);
                //-----------------------------
                myTextRun = new CustomTextRun(rootgfx, 10, 17);
                myTextRun.SetLocation(16, 0);
                myTextRun.Text = "Test01";
                element.AddChild(myTextRun);
                //-----------------------------
                this.primElement = element;
            }
            return(primElement);
        }
 public override RenderElement GetPrimaryRenderElement(RootGraphic rootgfx)
 {
     if (!this.HasReadyRenderElement)
     {
         //first time
         RenderElement baseRenderElement = base.GetPrimaryRenderElement(rootgfx);
         //1. add place holder first
         placeHolder = new CustomTextRun(rootgfx, this.Width - 4, this.Height - 4);
         placeHolder.Text = placeHolderText;
         placeHolder.SetLocation(1, 1);
         placeHolder.TextColor = Color.FromArgb(180, Color.LightGray);
         baseRenderElement.AddChild(placeHolder);
         //2. textbox 
         myTextBox = new TextBox(this.Width - 4, this.Height - 4, multiline);
         myTextBox.BackgroundColor = Color.Transparent;
         myTextBox.SetLocation(2, 2);
         textEvListener = new Text.TextSurfaceEventListener();
         myTextBox.TextEventListener = textEvListener;
         textEvListener.KeyDown += new EventHandler<Text.TextDomEventArgs>(textEvListener_KeyDown);
         baseRenderElement.AddChild(myTextBox);
         return baseRenderElement;
     }
     else
     {
         return base.GetPrimaryRenderElement(rootgfx);
     }
 }
Example #6
0
        public override RenderElement GetPrimaryRenderElement(RootGraphic rootgfx)
        {
            if (primElement == null)
            {
                //1.
                var element = new CustomContainerRenderBox(rootgfx, this.Width, this.Height);
                element.SetLocation(this.Left, this.Top);
                element.BackColor = this.backColor;
                element.SetController(this);
                //
                listItemText = new CustomTextRun(rootgfx, 200, this.Height);
                if (font != null)
                {
                    listItemText.RequestFont = font;
                    //TODO: review how to find
                    int blankLineHeight = (int)rootgfx.TextServices.MeasureBlankLineHeight(font);
                    listItemText.SetHeight(blankLineHeight);
                    element.SetHeight(blankLineHeight);
                }


                element.AddChild(listItemText);
                listItemText.TransparentForAllEvents = true;
                if (this.itemText != null)
                {
                    listItemText.NeedClipArea = true;
                    listItemText.Text         = this.itemText;
                }

                element.NeedClipArea = true;
                this.primElement     = element;
            }
            return(primElement);
        }
Example #7
0
 public override RenderElement GetPrimaryRenderElement(RootGraphic rootgfx)
 {
     if (this.myTextRun == null)
     {
         var trun = new CustomTextRun(rootgfx, this.Width, this.Height);
         trun.SetLocation(this.Left, this.Top);
         trun.TextColor = this.textColor;
         trun.Text      = this.Text;
         this.myTextRun = trun;
     }
     //-----------
     return(myTextRun);
 }
Example #8
0
 public override RenderElement GetPrimaryRenderElement(RootGraphic rootgfx)
 {
     if (this.myTextRun == null)
     {
         var trun = new CustomTextRun(rootgfx, this.Width, this.Height);
         trun.SetLocation(this.Left, this.Top);
         trun.TextColor = this.textColor;
         trun.Text = this.Text;
         this.myTextRun = trun;
     }
     //-----------
     return myTextRun;
 }
Example #9
0
        public override RenderElement GetPrimaryRenderElement(RootGraphic rootgfx)
        {
            if (primElement == null)
            {
                //1.
                var element = new CustomContainerRenderBox(rootgfx, this.Width, this.Height);
                element.SetLocation(this.Left, this.Top);
                element.BackColor = this.backColor;
                element.SetController(this);

                listItemText = new CustomTextRun(rootgfx, 200, this.Height);
                element.AddChild(listItemText);
                listItemText.TransparentForAllEvents = true;
                if (this.itemText != null)
                {
                    listItemText.Text = this.itemText;
                }

                this.primElement = element;
            }
            return(primElement);
        }
Example #10
0
        public override RenderElement GetPrimaryRenderElement(RootGraphic rootgfx)
        {
            if (primElement == null)
            {
                //first time
                var element = new CustomRenderBox(rootgfx, this.Width, this.Height);
                element.SetLocation(this.Left, this.Top);
                element.BackColor = this.backColor;
                element.HasSpecificSize = true;
                //-----------------------------
                // create default layer for node content


                //-----------------------------
                uiNodeIcon = new ImageBox(16, 16);//create with default size 
                SetupNodeIconBehaviour(uiNodeIcon);
                element.AddChild(uiNodeIcon);
                //-----------------------------
                myTextRun = new CustomTextRun(rootgfx, 10, 17);
                myTextRun.SetLocation(16, 0);
                myTextRun.Text = "Test01";
                element.AddChild(myTextRun);
                //-----------------------------
                this.primElement = element;
            }
            return primElement;
        }
Example #11
0
        public override RenderElement GetPrimaryRenderElement(RootGraphic rootgfx)
        {
            if (primElement == null)
            {
                //1.
                var element = new CustomContainerRenderBox(rootgfx, this.Width, this.Height);
                element.SetLocation(this.Left, this.Top);
                element.BackColor = this.backColor;
                element.SetController(this);

                listItemText = new CustomTextRun(rootgfx, 200, this.Height);
                element.AddChild(listItemText);
                listItemText.TransparentForAllEvents = true;
                if (this.itemText != null)
                {
                    listItemText.Text = this.itemText;
                }

                this.primElement = element;
            }
            return primElement;
        }