Control CreateFlowPanel(GuiLayout gl)
        {
            FlowLayoutPanel flp = new FlowLayoutPanel();

            flp.SuspendLayout();
            flp.AutoScroll       = true;
            flp.AutoScrollMargin = new System.Drawing.Size(100, 1000);
            flp.WrapContents     = false;
            flp.FlowDirection    = FlowDirection.LeftToRight;
            if (gl.direction.IsExplicit())
            {
                switch (((string)gl.direction).ToUpper())
                {
                case "L2R": flp.FlowDirection = FlowDirection.LeftToRight; break;

                case "T2B": flp.FlowDirection = FlowDirection.TopDown; break;

                case "R2L": flp.FlowDirection = FlowDirection.RightToLeft; break;

                case "B2T": flp.FlowDirection = FlowDirection.BottomUp; break;
                }
            }
            FillCommonLayoutParameters(gl, flp);
            return(WrapInCollapsible(gl, flp));
        }
Example #2
0
        Panel CreateTabPanel(GuiLayout gl)
        {
            Panel pnl = new Panel();

            pnl.SuspendLayout();
            pnl.Dock = DockStyle.Fill;
            FlowLayoutPanel flp = new FlowLayoutPanel();

            flp.SuspendLayout();
            flp.Dock          = DockStyle.Top;
            flp.FlowDirection = FlowDirection.LeftToRight;
            flp.Size          = new Size(50, 50);
            flp.BackColor     = Color.Aqua;
            foreach (GuiLayout subgl in gl.subLayouts)
            {
                Control ctl = null;
                if (subgl.type == GuiLayout.LayoutType.TabItem)
                {
                    ctl = CreateTabItem(subgl, flp);
                }
                if (ctl != null)
                {
                    pnl.Controls.Add(ctl);
                }
            }
            FillCommonLayoutParameters(gl, pnl);
            pnl.Controls.Add(flp);
            AddLayoutControl(gl.name + "-Title", flp);
            flp.ResumeLayout();
            pnl.BackColor = Color.Bisque;
            return(pnl);
        }
Example #3
0
        public void SizeControl(AubitDesktop.Xml.XMLForm.Matrix ma, int index, Control c)
        {
            // int coffset = 0;
            c.Height = GuiLayout.get_gui_h(_rows);
            if (_columns > 2 || true)
            {
                c.Width = GuiLayout.get_gui_w(_columns + 1);
                //  coffset = 1;
            }
            else
            {
                c.Width = GuiLayout.get_gui_w(3);
            }

            if (configSettings.ContainsKey("HEIGHT"))
            {
                c.Height = GuiLayout.get_gui_h(Convert.ToInt32((string)configSettings["HEIGHT"]));
            }
            if (configSettings.ContainsKey("WIDTH"))
            {
                c.Width = GuiLayout.get_gui_w(Convert.ToInt32((string)configSettings["WIDTH"]));
            }


            c.Visible = true;

            c.Location = GuiLayout.getPoint(ma, index, _column, _row);
        }
Example #4
0
        /*
         * public void doInput(INPUT i)
         * {
         *  this.CurrentForm.DoInput(i);
         * }
         * */



        public void setForm(FGLForm f, bool KeepFormOpenWhenWindowCloses)
        {
            if (this.CurrentForm != null)
            {
                if (WindowWidget != null)
                {
                    if (WindowWidget.Controls.Contains(CurrentForm.thisFormsPanel))
                    {
                        WindowWidget.Controls.Remove(CurrentForm.thisFormsPanel);
                    }
                }
            }

            this.CurrentForm = f;
            if (this.LineHeight == 0)
            {
                this.LineHeight = f.maxline;
            }
            if (this.CharWidth == 0)
            {
                this.CharWidth = f.maxcol;
            }

            if (this.WindowWidget.BackColor != System.Drawing.SystemColors.Control)
            {
                f.thisFormsPanel.BackColor = this.WindowWidget.BackColor;
            }

            if (this.form_line == 255) // Its the default - use the OPTIONS FORM LINE...
            {
                //f.thisFormsPanel.Top = 0;
            }
            else
            {
                Padding p;
                p     = f.thisFormsPanel.Padding;
                p.Top = GuiLayout.get_gui_y(form_line);
                f.thisFormsPanel.Padding = p;
            }

            WindowWidget.Controls.Add(f.thisFormsPanel);



            //WindowWidget.BackColor = Color.Aqua;

            //for (int a = 1; a < 1000; a++)
            //{
            //   f.thisFormsPanel.Top = a;
            //  f.thisFormsPanel.Left = a;
            // Application.DoEvents();
            //System.Threading.Thread.Sleep(10);
            // }
            //  f.thisFormsPanel.BorderStyle = BorderStyle.Fixed3D;
            this.KeepFormOpenWhenWindowCloses = KeepFormOpenWhenWindowCloses;
        }
        Control CreateLayoutRecurse(GuiLayout gl)
        {
            Control ctl = null;

            switch (gl.type)
            {
            case GuiLayout.LayoutType.Control:
                ctl = GetControlOrButton(gl.name, false);
                if (guiConf.PreviewMode)
                {
                    ctl = CreatePreviewControl(gl.name, ctl);
                }
                FillCommonLayoutParameters(gl, ctl);
                break;

            case GuiLayout.LayoutType.FlowPanel:
                ctl = CreateFlowPanel(gl);
                break;

            case GuiLayout.LayoutType.Layout:
            case GuiLayout.LayoutType.Panel:
                ctl = new Panel();
                ctl.SuspendLayout();
                if (gl.type == GuiLayout.LayoutType.Layout)
                {
                    ctl.Dock = DockStyle.Fill;
                }
                FillCommonLayoutParameters(gl, ctl);
                break;

            case GuiLayout.LayoutType.SplitPanel:
                ctl = CreateSplitPanel(gl);
                break;

            case GuiLayout.LayoutType.TabPanel:
                ctl = CreateTabPanel(gl);
                break;
            }

            if (ctl == null)
            {
                return(null);
            }

            if (guiConf.PreviewMode || (gl.type != GuiLayout.LayoutType.Control))
            {
                AddLayoutControl(gl.name, ctl);
            }
            CreateSublayouts(gl, ctl);
            if (ctl is ctlCollapse)
            {
                ((ctlCollapse)ctl).InnerControl.ResumeLayout();
            }
            ctl.ResumeLayout();
            return(ctl);
        }
Example #6
0
 void CreateSublayouts(GuiLayout gl, Control parent)
 {
     foreach (GuiLayout subgl in gl.subLayouts)
     {
         Control subctl = CreateLayoutRecurse(subgl);
         if (subctl != null)
         {
             AddControlToParent(subctl, parent);
         }
     }
 }
Example #7
0
 public void sizeWindow(int x, int y, bool border)
 {
     LineHeight = y;
     CharWidth  = x;
     if (border)
     {
         WindowWidget.Height = GuiLayout.get_gui_y(y + 1);
         WindowWidget.Width  = GuiLayout.get_gui_x(x + 1);
     }
     else
     {
         WindowWidget.Height = GuiLayout.get_gui_y(y);
         WindowWidget.Width  = GuiLayout.get_gui_x(x);
     }
 }
Example #8
0
        void FillCommonLayoutParameters(GuiLayout gl, Control ctl)
        {
            if (ctl == null)
            {
                return;
            }
            ctl.Name    = gl.name;
            ctl.Visible = true;
            if (gl.w.IsExplicit())
            {
                ctl.Width = gl.w;
            }
            if (gl.h.IsExplicit())
            {
                ctl.Height = gl.h;
            }
            if (gl.dock.IsExplicit())
            {
                switch (((string)gl.dock).ToLower())
                {
                case "top": ctl.Dock = DockStyle.Top; break;

                case "bottom": ctl.Dock = DockStyle.Bottom; break;

                case "left": ctl.Dock = DockStyle.Left; break;

                case "right": ctl.Dock = DockStyle.Right; break;

                case "fill": ctl.Dock = DockStyle.Fill; break;
                }
            }
            int px = ctl.Location.X;
            int py = ctl.Location.Y;

            if (gl.px.IsExplicit())
            {
                px = gl.px;
            }
            if (gl.py.IsExplicit())
            {
                py = gl.py;
            }
            if ((px != ctl.Location.X) || (py != ctl.Location.Y))
            {
                ctl.Location = new Point(px, py);
            }
        }
        /*
         * override internal void setKeyList(List<ONKEY_EVENT> keyList, List<ON_ACTION_EVENT> actionList, UIContext currContext)
         * {
         *
         *  foreach (ONKEY_EVENT a in keyList)
         *  {
         *      if (Convert.ToInt32(a.KEY) == FGLUtils.getKeyCodeFromKeyName(Action))
         *      {
         *          // The action is really a fake keypress...
         *          onActionID = a.ID;
         *
         *
         *
         *          break;
         *      }
         *  }
         *
         * }
         */



        private void createWidget(ATTRIB thisAttribute, AubitDesktop.Xml.XMLForm.Matrix ma, int row, int index, int column, int rows, int columns, string widget, string config, int id, string tabcol, string action, int attributeNo, string incl)
        {
            this.SetWidget(thisAttribute, ma, row, index, column, rows, columns, widget, config, id, tabcol, action, attributeNo, incl);
            pb = new PictureBox();

            #region SetImageFromFile
            if (configSettings.ContainsKey("FILENAME"))
            {
                string dir;
                Image  obj; // NOTWEBGUI
                //WEBGUI Gizmox.WebGUI.Common.Resources.ResourceHandle obj;

                obj = FGLUtils.getImageFromName((string)configSettings["FILENAME"]);
                //pb.BackColor = Color.AliceBlue;


                if (obj != null)
                {
                    pb.Image = obj;
                }
                else
                {
                    dir = "c:/images"; //Properties.  Resources.ImageDirectory;
                    if (!dir.EndsWith("/") && !dir.EndsWith("\\"))
                    {
                        dir = dir + "/";
                    }
                    try
                    {
                        pb.Load(dir + "/" + (string)configSettings["FILENAME"]);
                    }
                    catch (Exception)
                    {
                        ;
                    }
                }
                ContextTypeChanged();
            }
            #endregion

            SizeControl(ma, index, pb);
            pb.SizeMode = PictureBoxSizeMode.StretchImage;
            pb.Visible  = true;
            pb.Location = GuiLayout.getPoint(ma, index, column - 1, row);
        }
        private void createWidget(ATTRIB thisAttribute, AubitDesktop.Xml.XMLForm.Matrix ma, int row, int index, int column, int rows, int columns, string widget, string config, int id, string tabcol, string action, int attributeNo, string incl)
        {
            this.SetWidget(thisAttribute, ma, row, index, column, rows, columns, widget, config, id, tabcol, action, attributeNo, incl);
            pb = new WebBrowser();

            #region SetImageFromFile
            if (configSettings.ContainsKey("URL"))
            {
                pb.Url = new Uri((string)configSettings["URL"]);
            }
            #endregion
            pb.ScrollBarsEnabled = true;
            SizeControl(ma, index, pb);


            pb.Visible  = true;
            pb.Location = GuiLayout.getPoint(ma, index, column, row);
        }
Example #11
0
        Control WrapInCollapsible(GuiLayout gl, Control ctl)
        {
            Control retCtl = ctl;

            if (gl.collapsible.IsExplicit() && gl.collapsible)
            {
                ctlCollapse colCtl = new ctlCollapse();
                colCtl.SuspendLayout();
                colCtl.Name         = ctl.Name + "Parent";
                colCtl.Dock         = ctl.Dock;
                colCtl.InnerControl = ctl;
                if (gl.isCollapsed.IsExplicit())
                {
                    colCtl.Collapsed = gl.isCollapsed;
                }
                retCtl = colCtl;
            }
            return(retCtl);
        }
Example #12
0
        public void sizeWindow(FGLForm f, bool border)
        {
            if (form_line != 255)
            {
                LineHeight = f.maxline + form_line - 1; /* form line is 1 based */
            }
            else
            {
                LineHeight = f.maxline;
            }
            CharWidth = f.maxcol;

            if (isContainable)
            {
                if (f.pixelWidth > 0 && f.pixelHeight > 0)
                {
                    WindowWidget.Height = f.pixelHeight + 5 + f.thisFormsPanel.Top;
                    WindowWidget.Width  = f.pixelWidth + 5 + f.thisFormsPanel.Left;
                }
                else
                {
                    if (f.maxcol >= 0 && f.maxline >= 0)
                    {
                        if (border)
                        {
                            WindowWidget.Height = GuiLayout.get_gui_y(f.maxline + form_line);
                            WindowWidget.Width  = GuiLayout.get_gui_x(f.maxcol + 1);
                        }
                        else
                        {
                            WindowWidget.Height = GuiLayout.get_gui_y(f.maxline + form_line - 1) + 20;
                            WindowWidget.Width  = GuiLayout.get_gui_x(f.maxcol) + 20;
                        }
                    }
                    else
                    {
                        WindowWidget.AutoSize = true;
                    }
                }
            }
        }
        Control WrapInCollapsible(GuiLayout gl, Control ctl)
        {
            Control retCtl = ctl;

            if (gl.collapsible.IsExplicit() && gl.collapsible)
            {
                ctlCollapse colCtl = new ctlCollapse();
                colCtl.SuspendLayout();
                colCtl.Name         = ctl.Name + "-CollapsePanel";
                colCtl.Dock         = ctl.Dock;
                colCtl.InnerControl = ctl;
                AddLayoutControl(gl.name, ctl);
                colCtl.Button.Name = ctl.Name + "-CollapseButton";
                AddButton(colCtl.Button);
                if (gl.isCollapsed.IsExplicit())
                {
                    colCtl.Collapsed = gl.isCollapsed;
                }
                retCtl = colCtl;
            }
            return(retCtl);
        }
Example #14
0
        SplitContainer CreateSplitPanel(GuiLayout gl)
        {
            SplitContainer sc = new SplitContainer();

            sc.SuspendLayout();
            sc.Panel1.SuspendLayout();
            sc.Panel2.SuspendLayout();
            sc.Orientation = Orientation.Horizontal;
            if (gl.orientation.IsExplicit() && (((string)gl.orientation).ToLower()[0] == 'v'))
            {
                sc.Orientation = Orientation.Vertical;
            }
            if (gl.splitPos.IsExplicit())
            {
                sc.SplitterDistance = gl.splitPos;
            }
            foreach (GuiLayout subgl in gl.subLayouts)
            {
                SplitterPanel sp;
                if (subgl.type == GuiLayout.LayoutType.SplitPanel1)
                {
                    sp = sc.Panel1;
                }
                else if (subgl.type == GuiLayout.LayoutType.SplitPanel2)
                {
                    sp = sc.Panel2;
                }
                else
                {
                    continue;
                }
                CreateSublayouts(subgl, sp);
            }
            FillCommonLayoutParameters(gl, sc);
            sc.Panel1.ResumeLayout();
            sc.Panel2.ResumeLayout();
            return(sc);
        }
Example #15
0
 void CreateSublayouts(GuiLayout gl, Control parent)
 {
     foreach (GuiLayout subgl in gl.subLayouts)
     {
         Control subctl = CreateLayoutRecurse(subgl);
         if (subctl != null)
         {
             AddControlToParent(subctl, parent);
         }
     }
 }
Example #16
0
 SplitContainer CreateSplitPanel(GuiLayout gl)
 {
     SplitContainer sc = new SplitContainer();
     sc.SuspendLayout();
     sc.Panel1.SuspendLayout();
     sc.Panel2.SuspendLayout();
     sc.Orientation = Orientation.Horizontal;
     if (gl.orientation.IsExplicit() && (((string)gl.orientation).ToLower()[0] == 'v'))
         sc.Orientation = Orientation.Vertical;
     if (gl.splitPos.IsExplicit())
         sc.SplitterDistance = gl.splitPos;
     foreach (GuiLayout subgl in gl.subLayouts)
     {
         SplitterPanel sp;
         if (subgl.type == GuiLayout.LayoutType.SplitPanel1)
             sp = sc.Panel1;
         else if (subgl.type == GuiLayout.LayoutType.SplitPanel2)
             sp = sc.Panel2;
         else
             continue;
         CreateSublayouts(subgl, sp);
     }
     FillCommonLayoutParameters(gl, sc);
     sc.Panel1.ResumeLayout();
     sc.Panel2.ResumeLayout();
     return sc;
 }
Example #17
0
        Control CreateLayoutRecurse(GuiLayout gl)
        {
            Control ctl = null;
            switch (gl.type)
            {
                case GuiLayout.LayoutType.Control:
                    ctl = GetControlOrButton(gl.name, false);
                    if (guiConf.PreviewMode)
                        ctl = CreatePreviewControl(gl.name, ctl);
                    FillCommonLayoutParameters(gl, ctl);
                    break;

                case GuiLayout.LayoutType.FlowPanel:
                    ctl = CreateFlowPanel(gl);
                    break;

                case GuiLayout.LayoutType.Layout:
                case GuiLayout.LayoutType.Panel:
                    ctl = new Panel();
                    ctl.SuspendLayout();
                    if (gl.type == GuiLayout.LayoutType.Layout)
                        ctl.Dock = DockStyle.Fill;
                    FillCommonLayoutParameters(gl, ctl);
                    break;

                case GuiLayout.LayoutType.SplitPanel:
                    ctl = CreateSplitPanel(gl);
                    break;

                case GuiLayout.LayoutType.TabPanel:
                    ctl = CreateTabPanel(gl);
                    break;
            }

            if (ctl == null)
                return null;

            if (guiConf.PreviewMode || (gl.type != GuiLayout.LayoutType.Control))
                AddLayoutControl(gl.name, ctl);
            CreateSublayouts(gl, ctl);
            if (ctl is ctlCollapse)
                ((ctlCollapse)ctl).InnerControl.ResumeLayout();
            ctl.ResumeLayout();
            return ctl;
        }
Example #18
0
 Control CreateFlowPanel(GuiLayout gl)
 {
     FlowLayoutPanel flp = new FlowLayoutPanel();
     flp.SuspendLayout();
     flp.AutoScroll = true;
     flp.AutoScrollMargin = new System.Drawing.Size(100, 1000);
     flp.WrapContents = false;
     flp.FlowDirection = FlowDirection.LeftToRight;
     if (gl.direction.IsExplicit())
     {
         switch (((string)gl.direction).ToUpper())
         {
             case "L2R": flp.FlowDirection = FlowDirection.LeftToRight; break;
             case "T2B": flp.FlowDirection = FlowDirection.TopDown; break;
             case "R2L": flp.FlowDirection = FlowDirection.RightToLeft; break;
             case "B2T": flp.FlowDirection = FlowDirection.BottomUp; break;
         }
     }
     FillCommonLayoutParameters(gl, flp);
     return WrapInCollapsible(gl,flp);
 }
        Control CreateLayoutRecurse(GuiLayout gl)
        {
            Control ctl = null;

            switch (gl.type)
            {
            case GuiLayout.LayoutType.Control:
                ctl = GetControlOrButton(gl.name, false);
                if (guiConf.PreviewMode)
                {
                    ctl = CreatePreviewControl(gl.name, ctl);
                }
                FillCommonLayoutParameters(gl, ctl);
                break;

            case GuiLayout.LayoutType.FlowPanel:
                ctl = CreateFlowPanel(gl);
                break;

            case GuiLayout.LayoutType.Layout:
            case GuiLayout.LayoutType.Panel:
                ctl = new Panel();
                ctl.SuspendLayout();
                if (gl.type == GuiLayout.LayoutType.Layout)
                {
                    ctl.Dock = DockStyle.Fill;
                }
                FillCommonLayoutParameters(gl, ctl);
                break;

            case GuiLayout.LayoutType.SplitPanel:
                ctl = CreateSplitPanel(gl);
                break;

            case GuiLayout.LayoutType.TabPanel:
                ctl = CreateTabPanel(gl);
                break;
            }

            if (ctl == null)
            {
                return(null);
            }

            if (guiConf.PreviewMode || (gl.type != GuiLayout.LayoutType.Control))
            {
                AddLayoutControl(gl.name, ctl);
            }
            CreateSublayouts(gl, ctl);

            /*if (gl.type == GuiLayout.LayoutType.FlowPanel)
             * {
             *  Control flowCtl = ctl;
             *  if (ctl is ctlCollapse)
             *      flowCtl = ((ctlCollapse)ctl).InnerControl;
             *  if (flowCtl
             * }*/
            if (ctl is ctlCollapse)
            {
                ((ctlCollapse)ctl).InnerControl.ResumeLayout();
            }
            ctl.ResumeLayout();
            if ((gl.type != GuiLayout.LayoutType.Control) && gl.style.IsValid())
            {
                GuiControlStyle stl = GetControlStyle(gl.style);
                if (stl != null)
                {
                    ApplyStyleRecurse(ctl, stl, stl.MaxDepth);
                }
            }
            return(ctl);
        }
Example #20
0
        Control CreateTabItem(GuiLayout gl, FlowLayoutPanel flp)
        {
            Control shownControl = null;

            if (gl.subLayouts.Count == 1)
            {
                shownControl = CreateLayoutRecurse(gl.subLayouts[0]);
            }
            else
            {
                shownControl      = new Panel();
                shownControl.Name = gl.name + "Content";
                //AddControl(shownControl);
                Controls[shownControl.Name] = shownControl;
                CreateSublayouts(gl, shownControl);
            }
            if (shownControl == null)
            {
                return(null);
            }

            shownControl.Dock    = DockStyle.Fill;
            shownControl.Visible = gl.isSelected.IsExplicit() && gl.isSelected;

            Control tabctl = null;

            if (gl.control.IsExplicit())
            {
                tabctl = GetControlOrButton(gl.control);
            }
            if (tabctl == null)
            {
                string cmd = String.Format("GMActivateTab {0} {1}", gl.name, shownControl.Name);
                if (!gl.text.IsExplicit())
                {
                    // if no text, create image button
                    AddButton(gl.name, new ctlImageButton());
                    ctlImageButton butt = Buttons[gl.name];
                    butt.BringToFront();
                    if (gl.image.IsExplicit())
                    {
                        butt.GLImage = gl.image;
                        butt.Image   = guiConf.GetImage(gl.image, null);
                    }
                    butt.OnClickCallback = cmd;
                    tabctl = butt;
                }
                else
                {
                    // text valid, create title control
                    ctlTitle ttl = new ctlTitle();
                    ttl.Image           = guiConf.GetImage(gl.image, null);
                    ttl.Text            = gl.text;
                    ttl.Name            = gl.name;
                    ttl.OnClickCallback = cmd;
                    ttl.CheckImage      = guiConf.GetImage("buttChecked", null);
                    ttl.Size            = new Size(180, 40);
                    Controls[gl.name]   = ttl;
                    tabctl = ttl;
                }
                CheckTab(tabctl, gl.isSelected.IsExplicit() && gl.isSelected);
            }
            flp.Controls.Add(tabctl);
            return(shownControl);
        }
        private void createTextWidget(ATTRIB thisAttribute, AubitDesktop.Xml.XMLForm.Matrix ma, int row, int index, int column, int rows, int columns, string widget, string config, int id, string tabcol, string action, int attributeNo, string incl, bool buttonEdit, string buttonImage)
        {
            int bcol = 0;

            this.SetWidget(thisAttribute, ma, row, index, column, rows, columns, widget, config, id, tabcol, action, attributeNo, incl);

            p = new Panel();

            p.BorderStyle = BorderStyle.Fixed3D;

            tNullable              = new NullableDateTimePicker();
            tNullable.Format       = DateTimePickerFormat.Custom;
            tNullable.CustomFormat = FGLUtils.DBDATEFormat_dotnet;
            tNullable.Visible      = true;
            tNullable.Enabled      = true;


            p.Margin  = new Padding(0, 0, 0, 0);
            p.Padding = new Padding(0, 0, 0, 0);

            tNullable.Margin  = new Padding(0, 0, 0, 0);
            tNullable.Padding = new Padding(0, 0, 0, 0);


            tNullable.Visible = true;
            tNullable.Enabled = true;
            tNullable.Value   = null;
            SizeControl(ma, index, p);
            //p.Location = new System.Drawing.Point(GuiLayout.get_gui_x(column), GuiLayout.get_gui_y(row));
            p.AutoSize     = true;
            p.Name         = "DTPP_" + tabcol;
            tNullable.Name = "DTPT_" + tabcol;

            //t.BackColor = Color.Red;
            //l.BackColor = Color.Blue;



            // Any columns used for the button must be subtracted from the length of the
            // textbox..

            tNullable.Size = new Size(GuiLayout.get_gui_w(columns - bcol), GuiLayout.get_gui_h(rows));

            p.Size = new Size(GuiLayout.get_gui_w(columns), GuiLayout.get_gui_h(rows));



            if (columns > 2)
            {
                tNullable.Width = GuiLayout.get_gui_w(columns + 1);
            }
            else
            {
                tNullable.Width = GuiLayout.get_gui_w(3);
            }


            //t.KeyDown += new KeyEventHandler(t_KeyDown);
            //t.KeyPress += new KeyPressEventHandler(t_KeyPress);



            if (buttonEdit)
            {
                b         = new Button();
                b.TabStop = false;
                if (configSettings["TEXT"] != null)
                {
                    b.Text = (string)configSettings["TEXT"];
                }
                else
                {
                    b.Text = "!";
                }

                b.Size = new Size(GuiLayout.get_gui_w(bcol), GuiLayout.get_gui_h(rows) - 4);
                b.Top  = 0;
                if (configSettings["IMAGE"] == null)
                {
                    b.Image = FGLUtils.getImageFromName("zoom");
                }
                else
                {
                    b.Image = FGLUtils.getImageFromName((string)configSettings["IMAGE"]);
                }

                b.Left = tNullable.Width + 1;
                //b.Left = GuiLayout.get_gui_x(column) ;     /* thats 2 pixels - not 2 characters */
                b.Visible = true;
            }
            else
            {
                b = null;
            }

            p.Controls.Add(tNullable);

            if (b != null)
            {
                p.Controls.Add(b);
            }

            // p.Size = l.Size;

            tNullable.CausesValidation = true;
            tNullable.KeyDown         += new KeyEventHandler(t_KeyDown);
            tNullable.KeyPress        += new KeyPressEventHandler(t_KeyPress);
            tNullable.Validating      += new System.ComponentModel.CancelEventHandler(t_Validating);
            tNullable.Enter           += new EventHandler(t_GotFocus);
            tNullable.TextChanged     += new EventHandler(t_TextChanged);
            //t.Validating += new System.ComponentModel.CancelEventHandler(t_Validating);
            if (b != null)
            {
                b.Click += new EventHandler(t_Click);
            }
            else
            {
                tNullable.Click += new EventHandler(t_Click);
            }
            tNullable.Visible = true;

            this.id          = id;
            this.ContextType = FGLContextType.ContextNone;

            adjustDisplayPropertiesForContext();
        }
        private void createTextWidget(ATTRIB thisAttribute, AubitDesktop.Xml.XMLForm.Matrix ma, int row, int index, int column, int rows, int columns, string widget, string config, int id, string tabcol, string action, int attributeNo, string incl, bool buttonEdit, string buttonImage)
        {
            int bcol       = 0;
            int totalWidth = 0;

            this.SetWidget(thisAttribute, ma, row, index, column, rows, columns, widget, config, id, tabcol, action, attributeNo, incl);

            p = new Panel();
            //lblInsteadOfTxtBox = new Label();
            p.BorderStyle = BorderStyle.None;

            /*
             * if (rows > 1)
             * {
             *  lblInsteadOfTxtBox.TextAlign = ContentAlignment.TopLeft;
             * }
             * else
             * {
             *  lblInsteadOfTxtBox.TextAlign = ContentAlignment.MiddleLeft;
             * } */

            t = new System.Windows.Forms.TextBox();
            if (thisAttribute.ATTRIB_INVISIBLE != null)
            {
                t.PasswordChar = '*';
            }

            p.Margin  = new Padding(0, 0, 0, 0);
            p.Padding = new Padding(0, 0, 0, 0);
            // lblInsteadOfTxtBox.Margin = new Padding(0, 0, 0, 0);
            //lblInsteadOfTxtBox.Padding = new Padding(0, 0, 0, 0);
            t.Margin  = new Padding(0, 0, 0, 0);
            t.Padding = new Padding(0, 0, 0, 0);

            p.Name = "TWP_" + tabcol;
            t.Name = "TWT_" + tabcol;
            // lblInsteadOfTxtBox.Name = "TWL_" + tabcol;

            if (buttonEdit)
            {
                if (configSettings["BUTTONWIDTH"] != null)
                {
                    bcol = Convert.ToInt32((string)configSettings["BUTTONWIDTH"]);
                }
                else
                {
                    bcol = 1;
                }
            }



            t.Visible = true;
            t.Enabled = true;
            SizeControl(ma, index, p);
            if (bcol > 0)
            {
                p.Size = new Size(GuiLayout.get_gui_w(columns + bcol + 1) + 5, GuiLayout.get_gui_h(rows));
            }


            if (rows > 1)
            {
                t.Multiline = true;
            }
            else
            {
                t.Multiline = false;
            }



            // Any columns used for the button must be subtracted from the length of the
            // textbox..

            // t.Size = new Size(GuiLayout.get_gui_w(columns), GuiLayout.get_gui_h(rows));
            //l.Size = new Size(GuiLayout.get_gui_w(columns), GuiLayout.get_gui_h(rows));

            t.Height = GuiLayout.get_gui_h(rows);


            if (columns > 2 || true)
            {
                totalWidth = GuiLayout.get_gui_w(columns + 1);
            }
            else
            {
                totalWidth = GuiLayout.get_gui_w(4);
            }

            if (rows == 1)
            {
                this.MaxLength = columns;
            }
            else
            {
                this.MaxLength = columns * rows;
            }


            if (Upshift)
            {
                t.CharacterCasing = CharacterCasing.Upper;
            }

            if (Downshift)
            {
                t.CharacterCasing = CharacterCasing.Lower;
            }


            if (false)
            {
                // lblInsteadOfTxtBox.Visible = true;
                // lblInsteadOfTxtBox.BorderStyle = BorderStyle.Fixed3D;
            }

            if (buttonEdit)
            {
                b         = new Button();
                b.TabStop = false;
                if (configSettings["TEXT"] != null)
                {
                    b.Text = (string)configSettings["TEXT"];
                }
                else
                {
                    b.Text = "!";
                }

                //b.Size = new Size(GuiLayout.get_gui_w(bcol), GuiLayout.get_gui_h(rows)-4);
                b.Top = 0;

                if (bcol > 0)
                {
                    //reservedButtonWidth = bcol;
                    b.Width = GuiLayout.get_gui_w(bcol);     //NOTWEBGUI
                    //WEBGUI b.Size = new System.Drawing.Size( GuiLayout.get_gui_w(bcol+1),  GuiLayout.get_gui_h(1));
                }
                else
                {
                    //reservedButtonWidth = 1;
                    b.Width = GuiLayout.get_gui_w(1); //NOTWEBGUI
                    //WEBGUI b.Size = new System.Drawing.Size( GuiLayout.get_gui_w(2),  GuiLayout.get_gui_h(1));
                }

                if (configSettings["IMAGE"] == null)
                {
                    //WEBGUI b.Image = FGLUtils.getImageFromName("zoom.png");
                    b.Image = FGLUtils.getImageFromName("zoom"); //NOTWEBGUI
                }
                else
                {
                    b.Image = FGLUtils.getImageFromName((string)configSettings["IMAGE"]);
                }


                b.Height = b.Image.Height + 4;  // NOTWEBGUI
                b.Width  = b.Image.Width + 4;   // NOTWEBGUI
                if (b.Image.Height > t.Height)  // NOTWEBGUI
                {                               // NOTWEBGUI
                    b.Height = t.Height;        // NOTWEBGUI
                }                               // NOTWEBGUI


                if (bcol > 0)
                {
                    t.Width = totalWidth; // -(GuiLayout.get_gui_w(bcol) + 5);
                    b.Left  = totalWidth; // -b.Width;
                }
                else
                {
                    t.Width = totalWidth; //-(b.Width +5);
                    b.Left  = totalWidth; // -b.Width;
                }

                //b.Left = GuiLayout.get_gui_x(column) ;     /* thats 2 pixels - not 2 characters */
                b.Visible = true;
            }
            else
            {
                b       = null;
                t.Width = totalWidth;
            }
            p.Height = GuiLayout.get_gui_h(rows);
            // lblInsteadOfTxtBox.Left = 0;
            //lblInsteadOfTxtBox.Top = 0;
            //lblInsteadOfTxtBox.Size = t.Size;
            p.Controls.Add(t);
            // p.Controls.Add(lblInsteadOfTxtBox);
            p.AutoSize = true; //NOTWEBGUI
            if (b != null)
            {
                p.Controls.Add(b);
            }

            // p.Size = l.Size;

            t.CausesValidation = true;
            //t.KeyDown += new KeyEventHandler(t_KeyDown);
            t.KeyPress    += new KeyPressEventHandler(t_KeyPress);
            t.Validating  += new System.ComponentModel.CancelEventHandler(t_Validating);
            t.Enter       += new EventHandler(t_GotFocus);
            t.TextChanged += new EventHandler(t_TextChanged);

            // EventHandler moveNext = new EventHandler(TheMethod);

            //t.Validating += new System.ComponentModel.CancelEventHandler(t_Validating);
            if (b != null)
            {
                b.Click += new EventHandler(t_Click);
            }
            else
            {
                t.Click += new EventHandler(t_Click);
            }
            t.ReadOnly = true;
            t.Visible  = true;

            this.id          = id;
            this.ContextType = FGLContextType.ContextNone;
            adjustDisplayPropertiesForContext();
        }
Example #23
0
        private void createComboBoxWidget(ATTRIB thisAttribute, AubitDesktop.Xml.XMLForm.Matrix ma, int row, int index, int column, int rows, int columns, string widget, string config, int id, string tabcol, string action, int attributeNo, string incl, AubitDesktop.Xml.XMLForm.Item[] items)
        {
            this.SetWidget(thisAttribute, ma, row, index, column, rows, columns, widget, config, id, tabcol, action, attributeNo, incl);

            p           = new Panel();
            l           = new Label();
            l.TextAlign = ContentAlignment.MiddleLeft;
            t           = new Gizmox.WebGUI.Forms.ComboBox();

            p.Margin  = new Padding(0, 0, 0, 0);
            p.Padding = new Padding(0, 0, 0, 0);
            l.Margin  = new Padding(0, 0, 0, 0);
            l.Padding = new Padding(0, 0, 0, 0);
            t.Margin  = new Padding(0, 0, 0, 0);
            t.Padding = new Padding(0, 0, 0, 0);


            t.Visible = true;
            t.Enabled = true;
            SizeControl(ma, index, p);

            t.Size = p.Size;


            t.TextChanged += new EventHandler(t_TextChanged);

            // Any columns used for the button must be subtracted from the length of the
            // textbox..


            if (columns > 2)
            {
                t.Width = GuiLayout.get_gui_w(columns + 1);
            }
            else
            {
                t.Width = GuiLayout.get_gui_w(3);
            }

            _maxLength = columns;


            l.Size = t.Size;

            /*
             * if (Upshift)
             * {
             *
             *  t.CharacterCasing = CharacterCasing.Upper;
             * }
             *
             * if (Downshift)
             * {
             *  t.CharacterCasing = CharacterCasing.Lower;
             * }
             */


            l.Visible     = true;
            l.BorderStyle = BorderStyle.Fixed3D;

            t.DropDownStyle = ComboBoxStyle.DropDownList;

            p.Controls.Add(t);
            p.Controls.Add(l);


            FGLComboEntry[] cbItems = FGLComboEntry.createItems(items);

            setItems(cbItems);

            // p.Size = l.Size;


            t.CausesValidation = true;
            t.Validating      += new System.ComponentModel.CancelEventHandler(t_Validating);
            t.Enter           += new EventHandler(t_GotFocus);
            t.Click           += new EventHandler(t_Click);
            t.Visible          = true;
            t.Enabled          = true;

            this.id = id;
        }
Example #24
0
 void FillCommonLayoutParameters(GuiLayout gl, Control ctl)
 {
     if (ctl == null)
         return;
     ctl.Name = gl.name;
     ctl.Visible = true;
     if (gl.w.IsExplicit()) ctl.Width = gl.w;
     if (gl.h.IsExplicit()) ctl.Height = gl.h;
     if (gl.dock.IsExplicit())
     {
         switch (((string)gl.dock).ToLower())
         {
             case "top": ctl.Dock = DockStyle.Top; break;
             case "bottom": ctl.Dock = DockStyle.Bottom; break;
             case "left": ctl.Dock = DockStyle.Left; break;
             case "right": ctl.Dock = DockStyle.Right; break;
             case "fill": ctl.Dock = DockStyle.Fill; break;
         }
     }
     int px = ctl.Location.X;
     int py = ctl.Location.Y;
     if (gl.px.IsExplicit()) px = gl.px;
     if (gl.py.IsExplicit()) py = gl.py;
     if ((px != ctl.Location.X) || (py != ctl.Location.Y))
     {
         ctl.Location = new Point(px,py);
     }
 }
Example #25
0
        Control CreateTabItem(GuiLayout gl, FlowLayoutPanel flp)
        {
            Control shownControl = null;
            if (gl.subLayouts.Count == 1)
            {
                shownControl = CreateLayoutRecurse(gl.subLayouts[0]);
            }
            else
            {
                shownControl = new Panel();
                //shownControl.Name = gl.name + "-Content";
                //AddControl(shownControl);
                //Controls[shownControl.Name] = shownControl;
                CreateSublayouts(gl, shownControl);
                AddLayoutControl(gl.name + "-Content", shownControl);
            }
            if (shownControl == null)
                return null;

            shownControl.Dock = DockStyle.Fill;
            shownControl.Visible = gl.isSelected.IsExplicit() && gl.isSelected;

            Control tabctl = null;
            if (gl.control.IsExplicit() && !guiConf.PreviewMode)
                tabctl = GetControlOrButton(gl.control);
            if (tabctl == null)
            {
                string cmd = String.Format("GMActivateTab {0} {1}", gl.name, shownControl.Name);
                if (!gl.text.IsExplicit())
                {
                    // if no text, create image button
                    AddButton(gl.name, new ctlImageButton());
                    ctlImageButton butt = Buttons[gl.name];
                    butt.BringToFront();
                    if (gl.image.IsExplicit())
                    {
                        butt.GLImage = gl.image;
                        butt.Image = guiConf.GetImage(gl.image, null);
                    }
                    butt.OnClickCallback = cmd;
                    tabctl = butt;
                }
                else
                {
                    // text valid, create title control
                    ctlTitle ttl = new ctlTitle();
                    ttl.Image = guiConf.GetImage(gl.image, null);
                    ttl.Text = gl.text;
                    ttl.Name = gl.name;
                    ttl.OnClickCallback = cmd;
                    ttl.CheckImage = guiConf.GetImage("buttChecked", null);
                    ttl.Size = new Size(180, 40);
                    Controls[gl.name] = ttl;
                    tabctl = ttl;

                }
                CheckTab(tabctl, gl.isSelected.IsExplicit() && gl.isSelected);

            }
            AddLayoutControl(gl.name, tabctl);
            flp.Controls.Add(tabctl);
            return shownControl;
        }
Example #26
0
 Panel CreateTabPanel(GuiLayout gl)
 {
     Panel pnl = new Panel();
     pnl.SuspendLayout();
     pnl.Dock = DockStyle.Fill;
     FlowLayoutPanel flp = new FlowLayoutPanel();
     flp.SuspendLayout();
     flp.Dock = DockStyle.Top;
     flp.FlowDirection = FlowDirection.LeftToRight;
     flp.Size = new Size(50, 50);
     flp.BackColor = Color.Aqua;
     foreach (GuiLayout subgl in gl.subLayouts)
     {
         Control ctl = null;
         if (subgl.type == GuiLayout.LayoutType.TabItem)
             ctl = CreateTabItem(subgl, flp);
         if (ctl != null)
             pnl.Controls.Add(ctl);
     }
     FillCommonLayoutParameters(gl, pnl);
     pnl.Controls.Add(flp);
     AddLayoutControl(gl.name + "-Title", flp);
     flp.ResumeLayout();
     pnl.BackColor = Color.Bisque;
     return pnl;
 }
Example #27
0
        /// <summary>
        /// Display a single character at an x/y location (1 based)
        /// create a label if required to do it.
        ///
        /// </summary>
        /// <param name="x">X position (1 based)</param>
        /// <param name="y">Y position (1 based)</param>
        /// <param name="s">String to display (or null to remove any existsing label)</param>
        /// <param name="attr">Numeric attribute (eg. 4096 for reverse video) </param>
        private void displayAtLabel(int x, int y, string s, int attr)
        {
            Label l;

            if (s == null)
            {
                if (backgroundLabels[x - 1, y - 1] != null)
                {
                    backgroundLabels[x - 1, y - 1].Visible = false;
                    backgroundLabels[x - 1, y - 1]         = null;
                }
                return;
            }

            if (backgroundLabels[x - 1, y - 1] == null)
            {
                l           = new Label();
                l.AutoSize  = false;
                l.Width     = GuiLayout.get_gui_w(1);
                l.Height    = GuiLayout.get_gui_h(1);
                l.Left      = GuiLayout.get_gui_x(x);
                l.Top       = GuiLayout.get_gui_y(y);
                l.TextAlign = ContentAlignment.MiddleCenter;
                l.Font      = fixedWidthFont;
                backgroundLabels[x - 1, y - 1] = l;
                this.WindowWidget.Controls.Add(backgroundLabels[x - 1, y - 1]);
                l.BringToFront();
            }
            else
            {
                l = backgroundLabels[x - 1, y - 1];
            }

            backgroundLabels[x - 1, y - 1].Text = s;
            if (this.CurrentForm != null)
            {
                l.Left = GuiLayout.get_gui_x(x);
                l.Top  = GuiLayout.get_gui_y(y);
                if (l.Left > this.CurrentForm.thisFormsPanel.Left && l.Left < this.CurrentForm.thisFormsPanel.Right)
                {
                    if (l.Top > this.CurrentForm.thisFormsPanel.Top && l.Top < this.CurrentForm.thisFormsPanel.Bottom)
                    {
                        // Its actually in the 'current' form - not the background window...
                        l.Parent = this.CurrentForm.thisFormsPanel;
                        l.Top   -= this.CurrentForm.thisFormsPanel.Top;
                        l.Left  -= this.CurrentForm.thisFormsPanel.Left;
                    }
                }
            }
            else
            {
                l.Left = GuiLayout.get_gui_x(x);
                l.Top  = GuiLayout.get_gui_y(y);
            }
            if ((attr & 4096) > 0)
            {
                backgroundLabels[x - 1, y - 1].BackColor = Color.Bisque;
            }
            else
            {
                backgroundLabels[x - 1, y - 1].BackColor = this.WindowWidget.BackColor;
            }
            backgroundLabels[x - 1, y - 1].BringToFront();
        }
Example #28
0
 Control WrapInCollapsible(GuiLayout gl, Control ctl)
 {
     Control retCtl = ctl;
     if (gl.collapsible.IsExplicit() && gl.collapsible)
     {
         ctlCollapse colCtl = new ctlCollapse();
         colCtl.SuspendLayout();
         colCtl.Name = ctl.Name + "Parent";
         colCtl.Dock = ctl.Dock;
         colCtl.InnerControl = ctl;
         AddLayoutControl(gl.name, ctl);
         if (gl.isCollapsed.IsExplicit())
             colCtl.Collapsed = gl.isCollapsed;
         retCtl = colCtl;
     }
     return retCtl;
 }
Example #29
0
        public FGLWindow(string windowName, int x, int y, int attribute, string text, string style, int error_line, int prompt_line, int menu_line, int comment_line, int message_line, int form_line, bool border)
        {
            int colourCode;

            this.windowName    = windowName;
            this.x             = x;
            this.y             = y;
            this.LineHeight    = 0;
            this.CharWidth     = 0;
            this.attribute     = attribute;
            this.text          = text;
            this.style         = style;
            this.error_line    = error_line;
            this.prompt_line   = prompt_line;
            this.menu_line     = menu_line;
            this.comment_line  = comment_line;
            this.message_line  = message_line;
            this.form_line     = form_line;
            this.border        = border;
            this.isContainable = true;
            this.isModal       = false;
            this.CurrentForm   = null;

            colourCode = (attribute & 0xf00) >> 8;

            switch (style)
            {
            case "":
            case "NORMAL":
            {
                Panel p;
                p                = new Panel();
                WindowWidget     = p;
                p.Name           = "PanNormal" + windowName;
                WindowFormWidget = null;
                if (border)
                {
                    p.BorderStyle = BorderStyle.Fixed3D;
                }
                p.Font = new System.Drawing.Font("Microsoft Sans Serif", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
                WindowWidget.Visible = true;
                switch (colourCode)
                {
                case 1:
                    p.BackColor = System.Drawing.Color.LightCoral;
                    break;

                case 2:
                    p.BackColor = System.Drawing.Color.LightGreen;
                    break;

                case 3:
                    p.BackColor = System.Drawing.Color.LightGoldenrodYellow;
                    break;

                case 4:
                    p.BackColor = System.Drawing.Color.LightBlue;
                    break;

                case 5:
                    p.BackColor = System.Drawing.Color.Magenta;
                    break;

                case 6:
                    p.BackColor = System.Drawing.Color.LightCyan;
                    break;
                }
            }
            break;

            case "GROUPBOX":
            {
                GroupBox g;         // Group boxes are always bordered....
                g                    = new GroupBox();
                g.Text               = text;
                WindowWidget         = g;
                WindowFormWidget     = null;
                WindowWidget.Visible = true;
                g.Font               = new System.Drawing.Font("Microsoft Sans Serif", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
            }
            break;


            case "WINDOW":
            {
                Form frm;
                frm               = new Form();
                frm.Text          = text;
                WindowWidget      = frm;
                WindowFormWidget  = frm;
                frm.AutoSize      = true;
                frm.Width         = 10;
                frm.Height        = 10;
                frm.StartPosition = FormStartPosition.CenterParent;
                frm.Font          = new System.Drawing.Font("Microsoft Sans Serif", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
                sizeWindowToFill();
            }

                WindowWidget.Visible = true;
                isContainable        = false;
                break;


            case "MODALWINDOW":
            {
                Form frm;

                frm              = new Form();
                frm.Visible      = false;
                frm.Text         = text;
                WindowWidget     = frm;
                WindowFormWidget = frm;
                frm.AutoSize     = true;
                frm.Width        = 10;
                frm.Height       = 10;
                frm.Font         = new System.Drawing.Font("Microsoft Sans Serif", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
                sizeWindowToFill();
            }

                isContainable = false;
                isModal       = true;
                break;



            default:
                Program.Show("Unhandled window style");
                break;
            }
            WindowWidget.BackColor = System.Drawing.Color.FromArgb(240, 240, 240);


            WindowWidget.Top  = GuiLayout.get_gui_y(y);
            WindowWidget.Left = GuiLayout.get_gui_x(x);
            WindowWidget.Name = "WindowFor" + windowName;

            clrFormlabels();
        }