Пример #1
0
        public void Load(IPanel parent)
        {
            _parent = parent;
            var factory = _game.Factory;

            _searchBox             = factory.UI.GetTextBox("GameDebugInspectorSearchBox", 0f, parent.Height, parent, "Search...", width: parent.Width, height: 30f);
            _searchBox.RenderLayer = _layer;
            _searchBox.Border      = AGSBorders.SolidColor(Colors.Green, 2f);
            _searchBox.Tint        = Colors.Transparent;
            _searchBox.Pivot       = new PointF(0f, 1f);
            _searchBox.GetComponent <ITextComponent>().PropertyChanged += onSearchPropertyChanged;

            var height = parent.Height - _searchBox.Height;

            _scrollingPanel             = factory.UI.GetPanel("GameDebugInspectorScrollingPanel", parent.Width, height, 0f, height, parent);
            _scrollingPanel.RenderLayer = _layer;
            _scrollingPanel.Pivot       = new PointF(0f, 1f);
            _scrollingPanel.Tint        = Colors.Transparent;
            _scrollingPanel.Border      = AGSBorders.SolidColor(Colors.Green, 2f);

            _panel             = factory.UI.GetPanel("GameDebugInspectorPanel", parent.Width, _padding, 0f, height - _padding, _scrollingPanel);
            _panel.Tint        = Colors.Transparent;
            _panel.RenderLayer = _layer;
            var treeView = _panel.AddComponent <ITreeViewComponent>();

            treeView.SkipRenderingRoot = true;
            treeView.NodeViewProvider  = new InspectorTreeNodeProvider(treeView.NodeViewProvider, _game.Factory);

            Inspector = new AGSInspector(_game.Factory, _game.Settings);
            _panel.AddComponent <IInspectorComponent>(Inspector);
            factory.UI.CreateScrollingPanel(_scrollingPanel);
            _parent.Bind <IScaleComponent>(c => c.PropertyChanged += onParentPanelScaleChanged,
                                           c => c.PropertyChanged -= onParentPanelScaleChanged);
        }
Пример #2
0
        public void AddEditorUI(string id, ITreeNodeView view, IProperty property)
        {
            _property = property;
            var label = view.TreeItem;
            var panel = _factory.UI.GetPanel(id, 0f, 0f, 0f, 0f, label.TreeNode.Parent);

            _combobox = SelectEditor.GetCombobox($"{id}_Combobox", _factory, panel, 200f);
            _text     = _combobox.TextBox;
            _combobox.DropDownPanelList.MinWidth = 200f;
            _combobox.DropDownPanelList.Items.AddRange(_colorList);
            _combobox.Z = label.Z;

            _colorLabel             = _factory.UI.GetLabel($"{id}_ColorLabel", "", 50f, 25f, 250f, 0f, panel);
            _colorLabel.TextVisible = false;

            var layout = view.HorizontalPanel.GetComponent <ITreeTableRowLayoutComponent>();

            if (layout != null)
            {
                layout.RestrictionList.RestrictionList.AddRange(new List <string> {
                    panel.ID
                });
            }

            RefreshUI();
            _text.OnPressingKey.Subscribe(onTextboxPressingKey);
            _combobox.SuggestMode = ComboSuggest.Suggest;
            _combobox.DropDownPanelList.OnSelectedItemChanged.Subscribe(args =>
            {
                setColor(Color.FromHexa(NamedColorsMap.NamedColors[args.Item.Text]));
            });
        }
Пример #3
0
 public LoginPage(RoboBrowser browser) : base(browser)
 {
     Name     = "LoginPage";
     Username = ControlFactory.Create <ITextBox>("Login1_UserName");
     Password = ControlFactory.Create <ITextBox>("Login1_Password");
     Submit   = ControlFactory.Create <IButton>("Login1_Login");
 }
Пример #4
0
 public void LoadOptions()
 {
     if (_activeStory.CanContinue)
     {
         LoadDialogBox();
     }
     else if (_activeStory.Choices.Count > 0)
     {
         var optionBoxes = new List <OptionTextBox>();
         var choices     = _activeStory.Choices;
         for (var i = 0; i < choices.Count; i++)
         {
             var option = new OptionTextBox(ScreenSize, _font, i, choices[i]);
             optionBoxes.Add(option);
             option.Show();
             option.InteractEvent += (sender, args) => ChooseOption(option);
         }
         OptionTextBoxFactory.LineTextBoxes(optionBoxes, ScreenSize);
         _currentTextBox = new OptionTextBoxList(optionBoxes, _gamePad);
         StoryState      = StoryState.Option;
     }
     else
     {
         EndDialog();
     }
 }
Пример #5
0
        public MyDialog_StringQuery(Decal.Adapter.Wrappers.PluginHost H, string[] pbuttons, string ptitle, string plabel, int picon, delInputVerify pVerify, string pdefaultinput, string dialogkey, IView pOrigin)
            : base(dialogkey, pOrigin)
        {
            iButtons      = pbuttons;
            iTitle        = ptitle;
            iLabel        = plabel;
            iIcon         = picon;
            iVerify       = pVerify;
            iDefaultInput = pdefaultinput;

            if (!base.ShowView(H))
            {
                return;
            }

            ResultButtons = new IButton[iButtons.Length];
            for (int i = 0; i < iButtons.Length; ++i)
            {
                ResultButtons[i]      = (IButton)View["btn" + i.ToString()];
                ResultButtons[i].Hit += new EventHandler(MyDialog_StringQuery_Hit);
            }
            Text       = (ITextBox)View["Textbox1"];
            Text.Text  = iDefaultInput;
            Label      = (IStaticText)View["Label1"];
            Label.Text = iLabel;

#if VVS_REFERENCED
            if (View.ViewType == ViewSystemSelector.eViewSystem.VirindiViewService)
            {
                SetStrVVSProps();
            }
#endif
        }
Пример #6
0
        static void Main(string[] args)
        {
            Console.WriteLine("Choose OS:");
            Console.WriteLine("1. Win");
            Console.WriteLine("2. OS X");

            string   result = Console.ReadLine();
            IFactory factory;

            switch (result)
            {
            case "1":
                factory = new WinFactory();
                break;

            case "2":
                factory = new OSXFactory();
                break;

            default:
                throw new NotImplementedException();
            }

            IButton button = factory.CreateButton();

            ITextBox textBox = factory.CreateTextBox();
        }
Пример #7
0
        public static void AddHoverEffect(ITextBox textbox)
        {
            var uiEvents = textbox.GetComponent <IUIEvents>();

            uiEvents.MouseEnter.Subscribe(_ => textbox.TextConfig = HoverTextConfig);
            uiEvents.MouseLeave.Subscribe(_ => textbox.TextConfig = TextConfig);
        }
Пример #8
0
        private static void IMEControl_GetCompExtEvent(refRECT rect)
        {
            ITextBox textBox_ = Game1.keyboardDispatcher.Subscriber as ITextBox;
            TextBox  textBox  = Game1.keyboardDispatcher.Subscriber as TextBox;

            if (textBox == null)
            {
                return;
            }

            Vector2 vector2 = textBox.Font.MeasureString(comp.text);

            if (textBox_ != null)
            {
                Acp  acp     = textBox_.GetSelection();
                RECT CompExt = textBox_.GetTextExt(new Acp(0, acp.Start));
                rect.left = CompExt.right;
                rect.top  = CompExt.top;
            }
            else if (textBox != null)//without ITextBox interface
            {
                int strLen  = textBox is ChatTextBox ? (int)(textBox as ChatTextBox).currentWidth : (int)textBox.Font.MeasureString(textBox.Text).X;
                int xOffset = textBox.X + strLen + (textBox is ChatTextBox ? 12 : 16);
                //if without textbox, we can only insert at end
                rect.left = xOffset;
                rect.top  = textBox.Y + (textBox is ChatTextBox ? 12 : 8);
            }
            rect.right  = rect.left + (int)vector2.X;
            rect.bottom = rect.top + 32;
        }
Пример #9
0
 public ec(PluginHost A_0, string[] A_1, string A_2, string A_3, int A_4, ec.a A_5, string A_6, string A_7, IView A_8) : base(A_7, A_8)
 {
     this.a = A_1;
     this.b = A_2;
     this.c = A_3;
     this.d = A_4;
     this.e = A_5;
     this.f = A_6;
     if (base.a(A_0))
     {
         this.g = new IButton[this.a.Length];
         for (int i = 0; i < this.a.Length; i++)
         {
             this.g[i]      = (IButton)base.a["btn" + i.ToString()];
             this.g[i].Hit += new EventHandler(this.a);
         }
         this.h      = (ITextBox)base.a["Textbox1"];
         this.h.Text = this.f;
         this.i      = (IStaticText)base.a["Label1"];
         this.i.Text = this.c;
         if (base.a is View)
         {
             this.b();
         }
     }
 }
Пример #10
0
        public override void Start()
        {
            base.Start();

            IStack stack = Platform.Current.Create <IStack>();

            ILabel lblLabel = Platform.Current.Create <ILabel>();

            lblLabel.Text   = "Enter your name";
            lblLabel.Height = 30;
            stack.Children.Add(lblLabel);

            ITextBox txtText = Platform.Current.Create <ITextBox>();

            txtText.Value = "";
            stack.Children.Add(txtText);

            IButton cmdPrint = Platform.Current.Create <IButton>();

            IButton cmdClose = Platform.Current.Create <IButton>();

            cmdClose.Text   = "Close";
            cmdClose.Click += CmdClose_Click;
            stack.Children.Add(cmdClose);

            Platform.Current.Page.Title   = "Test label";
            Platform.Current.Page.Content = stack;
        }
Пример #11
0
        public void Text_GetterReturnsShapeTextWhichIsParagraphTextsAggregate()
        {
            // Arrange
            ITextBox textBoxCase1  = ((IAutoShape)_fixture.Pre009.Slides[3].Shapes.First(sp => sp.Id == 2)).TextBox;
            ITextBox textBoxCase2  = ((IAutoShape)_fixture.Pre001.Slides[0].Shapes.First(sp => sp.Id == 5)).TextBox;
            ITextBox textBoxCase3  = ((IAutoShape)_fixture.Pre001.Slides[0].Shapes.First(sp => sp.Id == 6)).TextBox;
            ITextBox textBoxCase5  = ((IAutoShape)_fixture.Pre019.Slides[0].Shapes.First(sp => sp.Id == 2)).TextBox;
            ITextBox textBoxCase6  = ((IAutoShape)_fixture.Pre014.Slides[0].Shapes.First(sp => sp.Id == 61)).TextBox;
            ITextBox textBoxCase7  = ((IAutoShape)_fixture.Pre014.Slides[1].Shapes.First(sp => sp.Id == 5)).TextBox;
            ITextBox textBoxCase8  = ((IAutoShape)_fixture.Pre011.Slides[0].Shapes.First(sp => sp.Id == 54275)).TextBox;
            ITextBox textBoxCase9  = ((IAutoShape)_fixture.Pre008.Slides[0].Shapes.First(sp => sp.Id == 3)).TextBox;
            ITextBox textBoxCase10 = ((IAutoShape)_fixture.Pre021.Slides[3].Shapes.First(sp => sp.Id == 2)).TextBox;
            ITextBox textBoxCase11 = ((IAutoShape)_fixture.Pre012.Slides[0].Shapes.First(sp => sp.Id == 2)).TextBox;
            ITextBox textBoxCase12 = ((IAutoShape)_fixture.Pre012.Slides[0].Shapes.First(sp => sp.Id == 3)).TextBox;
            ITextBox textBoxCase13 = ((IAutoShape)_fixture.Pre011.Slides[0].Shapes.First(sp => sp.Id == 2)).TextBox;
            ITextBox textBoxCase14 = ((ITable)_fixture.Pre001.Slides[1].Shapes.First(sp => sp.Id == 3)).Rows[0].Cells[0].TextBox;
            ITextBox textBoxCase4  = ((ITable)_fixture.Pre009.Slides[2].Shapes.First(sp => sp.Id == 3)).Rows[0].Cells[0].TextBox;

            // Act-Assert
            textBoxCase1.Text.Should().BeEquivalentTo("Title text");
            textBoxCase2.Text.Should().BeEquivalentTo(" id5-Text1");
            textBoxCase3.Text.Should().BeEquivalentTo($"id6-Text1{Environment.NewLine}Text2");
            textBoxCase4.Text.Should().BeEquivalentTo($"0:0_p1_lvl1{Environment.NewLine}0:0_p2_lvl2");
            textBoxCase5.Text.Should().BeEquivalentTo("1");
            textBoxCase6.Text.Should().BeEquivalentTo($"test1{Environment.NewLine}test2{Environment.NewLine}" +
                                                      $"test3{Environment.NewLine}test4{Environment.NewLine}test5");
            textBoxCase7.Text.Should().BeEquivalentTo("Test subtitle");
            textBoxCase8.Text.Should().BeEquivalentTo("Jan 2018");
            textBoxCase9.Text.Should().BeEquivalentTo("25.01.2020");
            textBoxCase10.Text.Should().BeEquivalentTo("test footer");
            textBoxCase11.Text.Should().BeEquivalentTo("Test title text");
            textBoxCase12.Text.Should().BeEquivalentTo("P1 P2");
            textBoxCase13.Text.Should().BeEquivalentTo($"P1{Environment.NewLine}");
            textBoxCase14.Text.Should().BeEquivalentTo("id3");
        }
        public void TestTwoStringTextBoxFilter()
        {
            //---------------Set up test pack-------------------
            IFilterClauseFactory itsFilterClauseFactory = new DataViewFilterClauseFactory();
            IFilterControl       filterControl          = GetControlFactory().CreateFilterControl();
            ITextBox             tb = filterControl.AddStringFilterTextBox("Test:", "TestColumn");

            tb.Text = "testvalue";
            ITextBox tb2 = filterControl.AddStringFilterTextBox("Test:", "TestColumn2");

            tb2.Text = "testvalue2";

            //---------------Execute Test ----------------------
            string filterClauseString = filterControl.GetFilterClause().GetFilterClauseString();

            //---------------Test Result -----------------------
            IFilterClause clause1 =
                itsFilterClauseFactory.CreateStringFilterClause("TestColumn", FilterClauseOperator.OpLike, "testvalue");
            IFilterClause clause2 =
                itsFilterClauseFactory.CreateStringFilterClause("TestColumn2", FilterClauseOperator.OpLike, "testvalue2");
            IFilterClause fullClause =
                itsFilterClauseFactory.CreateCompositeFilterClause(clause1, FilterClauseCompositeOperator.OpAnd, clause2);

            Assert.AreEqual(fullClause.GetFilterClauseString(), filterClauseString);

            //---------------Tear Down -------------------------
        }
Пример #13
0
        public void Load(IPanel parent)
        {
            _parent  = parent;
            _panelId = parent.TreeNode.GetRoot().ID;
            var factory = _editor.Editor.Factory;

            _searchBox             = factory.UI.GetTextBox("GameDebugTreeSearchBox", 0f, parent.Height, parent, "Search...", width: parent.Width, height: 30f);
            _searchBox.RenderLayer = _layer;
            _searchBox.Border      = factory.Graphics.Borders.SolidColor(GameViewColors.Border, 2f);
            _searchBox.Tint        = GameViewColors.Textbox;
            _searchBox.Pivot       = new PointF(0f, 1f);
            _searchBox.GetComponent <ITextComponent>().PropertyChanged += onSearchPropertyChanged;

            _scrollingPanel             = factory.UI.GetPanel("GameDebugTreeScrollingPanel", parent.Width - _gutterSize, parent.Height - _searchBox.Height - _gutterSize, 0f, 0f, parent);
            _scrollingPanel.RenderLayer = _layer;
            _scrollingPanel.Pivot       = new PointF(0f, 0f);
            _scrollingPanel.Tint        = Colors.Transparent;
            _scrollingPanel.Border      = factory.Graphics.Borders.SolidColor(GameViewColors.Border, 2f);
            _contentsPanel = factory.UI.CreateScrollingPanel(_scrollingPanel);
            _treeView      = _contentsPanel.AddComponent <ITreeViewComponent>();
            _treeView.OnNodeSelected.Subscribe(onTreeNodeSelected);
            _treeView.TopPadding  = 30f;
            _treeView.LeftPadding = 5f;
            parent.GetComponent <IScaleComponent>().PropertyChanged += (_, args) =>
            {
                if (args.PropertyName != nameof(IScaleComponent.Height))
                {
                    return;
                }
                _contentsPanel.BaseSize = new SizeF(_contentsPanel.Width, parent.Height - _searchBox.Height - _gutterSize);
                _searchBox.Y            = _parent.Height;
            };
        }
        public void TestFixBug_SearchGridSearchesTheGrid_DoesNotCallFilterOnGridbase()
        {
            //FirstName is not in the grid def therefore if the grid calls the filter gridbase filter
            // the dataview will try to filter with a column that does not exist this will raise an error
            //---------------Set up test pack-------------------
            //Clear all contact people from the DB
            ContactPerson.DeleteAllContactPeople();
            IClassDef classDef = ContactPersonTestBO.LoadDefaultClassDefWithUIDef();

            CreateContactPersonInDB();

            //Create grid setup for search
            IEditableGridControl gridControl = CreateEditableGridControl();

            ITextBox txtboxFirstName = gridControl.FilterControl.AddStringFilterTextBox("FirstName", "FirstName");

            gridControl.Initialise(classDef);
            gridControl.FilterMode = FilterModes.Search;
            //---------------Execute Test ----------------------
            txtboxFirstName.Text = "FFF";
            gridControl.FilterControl.ApplyFilter();
            //---------------Test Result -----------------------
            Assert.IsTrue(true); //No error was thrown by the grid.
            //---------------Tear Down -------------------------
        }
Пример #15
0
        public override void Start()
        {
            base.Start();

            IStack grid = Platform.Current.Create <IStack>();

            ILabel lblLabel = Platform.Current.Create <ILabel>();

            lblLabel.Text   = "This is a label";
            lblLabel.Height = 30;
            grid.Children.Add(lblLabel);

            ITextBox txtText = Platform.Current.Create <ITextBox>();

            txtText.Value         = "Update label text here";
            txtText.ValueChanged += (object sender, string e) => lblLabel.Text = txtText.Value;
            grid.Children.Add(txtText);

            IListPicker lstFont = Platform.Current.Create <IListPicker>();

            lstFont.Items.AddRange(new string[] { "Arial", "Verdana", "Times new roman", "Helvetica" });
            lstFont.ValueChanged += (object sender, string e) => lblLabel.FontFamily = lstFont.Value;
            grid.Children.Add(lstFont);

            Platform.Current.Page.Title   = "Test label";
            Platform.Current.Page.Content = grid;
        }
Пример #16
0
        /// <summary>
        /// Start this instance.
        /// <para xml:lang="es">
        /// Inicia una instancia de este objeto.
        /// </para>
        /// </summary>
        public override void Start()
        {
            base.Start();

            //Create an Stack
            IStack stack = Platform.Current.Create <IStack>();

            //Create an Label with text and height specific and adds it to the Stack.
            ILabel lblLabel = Platform.Current.Create <ILabel>();

            lblLabel.Text   = "Enter your name";
            lblLabel.Height = 30;
            stack.Children.Add(lblLabel);

            //Create an TextBox and adds it to the Stack
            ITextBox txtText = Platform.Current.Create <ITextBox>();

            txtText.Value = "Este es un TextBox";
            stack.Children.Add(txtText);

            //Create the button cmdClose with specific text with the event also click and adds it to the stack.
            IButton cmdClose = Platform.Current.Create <IButton>();

            cmdClose.Text   = "Close";
            cmdClose.Click += CmdClose_Click;
            stack.Children.Add(cmdClose);

            // Establishes the content and title of the page.
            Platform.Current.Page.Title   = "Test label";
            Platform.Current.Page.Content = stack;
        }
Пример #17
0
        internal IControlHabanero ConfigureInputControl(UIFormField formField, out IControlMapper controlMapper)
        {
            IControlHabanero inputControl = ControlFactory.CreateControl
                                                (formField.ControlTypeName, formField.ControlAssemblyName);

            controlMapper = ControlMapper.Create
                                (formField.MapperTypeName, formField.MapperAssembly, inputControl, formField.PropertyName,
                                !formField.Editable, ControlFactory);
            controlMapper.ClassDef = GetClassDef(formField);
            SetInputControlAlignment(formField, inputControl);
            SetInputControlNumLines(formField, inputControl);

            controlMapper.SetPropertyAttributes(formField.Parameters);

            AddDecimalPlacesToNumericUpDown(formField, inputControl);

            AddComboBoxItems(formField, inputControl);

            AddEmailFunctionalityToTextBox(formField, inputControl);

            AddMultiLineTextbox(formField, inputControl);

            if (formField.KeepValuePrivate)
            {
                ITextBox tBox = inputControl as ITextBox;
                if (tBox != null)
                {
                    tBox.PasswordChar = '*';
                }
            }

            SetToolTip(formField, inputControl);
            return(inputControl);
        }
Пример #18
0
        public void Test_Constructor()
        {
            //---------------Set up test pack-------------------
            IControlFactory controlFactory = GetControlFactory();
            //---------------Execute Test ----------------------
            IExtendedTextBox extendedTextBox = controlFactory.CreateExtendedTextBox();
            //---------------Test Result -----------------------
            ITextBox textBox = extendedTextBox.TextBox;

            Assert.IsNotNull(textBox);
            IButton button = extendedTextBox.Button;

            Assert.IsNotNull(button);
            Assert.AreEqual("...", button.Text);
            Assert.IsFalse(textBox.Enabled);
            if (controlFactory is ControlFactoryWin)
            {
                Assert.AreEqual(SystemColors.Window, textBox.BackColor);
            }
            else
            {
                Assert.AreEqual(Color.White, textBox.BackColor);
            }
            Assert.AreEqual(extendedTextBox.Height, textBox.Height);
            Assert.Greater(button.Left, textBox.Left);
        }
Пример #19
0
        public void Test_Acceptance_Filter_When_On_Page2_Of_Pagination()
        {
            //---------------Set up test pack-------------------
            //Get Grid with 4 items
            BusinessObjectCollection <MyBO> col;
            IReadOnlyGridControl            readOnlyGridControl = GetGridWith_4_Rows(out col, true);

            AddControlToForm(readOnlyGridControl);
            ITextBox tb = readOnlyGridControl.FilterControl.AddStringFilterTextBox("Test Prop", "TestProp");

            //Set items per page to 3 items
            readOnlyGridControl.Grid.ItemsPerPage = 3;
            //Go to page 2 (pagination page)
            readOnlyGridControl.Grid.CurrentPage = 2;

            //--------------Assert PreConditions ---------------
            Assert.AreEqual(2, readOnlyGridControl.Grid.CurrentPage);
            //---------------Execute Test ----------------------
            //enter data in filter for 1 item
            tb.Text = "b";
            readOnlyGridControl.FilterControl.ApplyFilter();
            //---------------Test Result -----------------------
            // verify that grid has moved back to page 1
            Assert.AreEqual(1, readOnlyGridControl.Grid.CurrentPage);
            //---------------Tear Down -------------------------
        }
Пример #20
0
        private static void BuildInterface(IGuiFactory factory)
        {
            IGrid grid = factory.GenerateGrid();

            for (int i = 0; i < 3; i++)
            {
                IButton btn = factory.GenerateButton();
                btn.Content = $"Button{i+1}";
                grid.AddButton(btn);

                ITextBox txtBox = factory.GenerateTextBox();
                txtBox.Content = $"TextBox{i + 1}";
                grid.AddTextBox(txtBox);
            }

            grid.GetButtons().First().ButtonPressed();

            foreach (var elem in grid.GetButtons())
            {
                elem.ButtonPressed();
                elem.DrawContent();
            }

            foreach (var elem in grid.GetTextBoxes())
            {
                elem.DrawContent();
            }
        }
            /// <summary>
            /// Constructor that sets up the error message form
            /// </summary>
            public CollapsibleExceptionNotifyForm(Exception ex, string furtherMessage, string title)
            {
                this._exception = ex;

                this._summary        = _controlFactory.CreatePanel();
                this._summary.Text   = title;
                this._summary.Height = SUMMARY_HEIGHT;
                ITextBox messageTextBox = GetSimpleMessage(ex.Message);

                messageTextBox.ScrollBars = ScrollBars.Vertical;
                ILabel messageLabel = GetErrorLabel(furtherMessage);
                BorderLayoutManager summaryManager = _controlFactory.CreateBorderLayoutManager(_summary);

                summaryManager.AddControl(messageLabel, BorderLayoutManager.Position.North);
                summaryManager.AddControl(messageTextBox, BorderLayoutManager.Position.Centre);

                this._buttonsOK = _controlFactory.CreateButtonGroupControl();
                this._buttonsOK.AddButton("&OK", new EventHandler(OKButtonClickHandler));

                this._buttonsDetail = _controlFactory.CreateButtonGroupControl();
                this._buttonsDetail.AddButton("Email Error", EmailErrorClickHandler);
                this._moreDetailButton    = _buttonsDetail.AddButton("More Detail »", MoreDetailClickHandler);
                this._buttonsDetail.Width = 2 * (_moreDetailButton.Width + 9);
                this._fullDetailsVisible  = false;

                this.SetFullDetailsPanel();
                this.LayoutForm();

                this.Text          = title;
                this.Width         = 600;
                this.Height        = SUMMARY_HEIGHT + BUTTONS_HEIGHT + 16;
                this.StartPosition = FormStartPosition.CenterScreen;
                //this.Resize += ResizeForm;
            }
Пример #22
0
 /// <summary>
 /// Constructor to initialise a new instance of the mapper
 /// </summary>
 /// <param name="tb">The TextBox to map</param>
 /// <param name="propName">The property name</param>
 /// <param name="isReadOnly">Whether this control is read only</param>
 /// <param name="factory">the control factory to be used when creating the controlMapperStrategy</param>
 public TextBoxMapper(ITextBox tb, string propName, bool isReadOnly, IControlFactory factory)
     : base(tb, propName, isReadOnly, factory)
 {
     _textBox = tb;
     _textBoxMapperStrategy = factory.CreateTextBoxMapperStrategy();
     _oldText = "";
 }
Пример #23
0
 /// <summary>
 /// Constructor to initialise a new instance of the mapper
 /// </summary>
 /// <param name="tb">The TextBox to map</param>
 /// <param name="propName">The property name</param>
 /// <param name="isReadOnly">Whether this control is read only</param>
 /// <param name="factory">the control factory to be used when creating the controlMapperStrategy</param>
 public TextBoxMapper(ITextBox tb, string propName, bool isReadOnly, IControlFactory factory)
     : base(tb, propName, isReadOnly, factory)
 {
     _textBox = tb;
     _textBoxMapperStrategy = factory.CreateTextBoxMapperStrategy();
     _oldText = "";
 }
Пример #24
0
 public void a(bool A_0)
 {
     if (this.g == A_0)
     {
         if (this.g)
         {
             this.d.Visible = true;
         }
     }
     else
     {
         this.g = A_0;
         if (A_0)
         {
             this.c();
             this.d       = ff.f(PluginCore.cq.ax, "uTank2.ViewXML.SelfBuffChoiceView.xml");
             this.d.Title = "Virindi Tank - Choose Blacklisted Buffs";
             this.e       = (IList)this.d["lExemplarList"];
             this.f       = (ITextBox)this.d["txtSearch"];
             this.f.Text  = "";
             this.b();
             this.f.Change += new EventHandler <MVTextBoxChangeEventArgs>(this.a);
             this.e.Click  += new dClickedList(this.a);
             this.d.Visible = true;
         }
         else
         {
             this.d.Dispose();
             this.d = null;
         }
     }
 }
Пример #25
0
 public void LoadDialogBox()
 {
     if (!_activeStory.Complete)
     {
         var storyText = _activeStory.CurrentText;
         var dialogBox = new DialogBox(ScreenSize, _font, storyText);
         dialogBox.InteractEvent += (sender, args) =>
         {
             if (_activeStory.CanContinue)
             {
                 _activeStory.Continue();
                 LoadDialogBox();
             }
             else
             {
                 LoadOptions();
             }
         };
         dialogBox.Show();
         _currentTextBox = dialogBox;
         StoryState      = StoryState.Dialog;
     }
     else
     {
         EndDialog();
     }
 }
Пример #26
0
        public ITextBox GetTextBox(string id, float x, float y, IObject parent = null, string watermark = "", ITextConfig config = null,
                                   bool addToUi = true, float width = -1F, float height = -1F)
        {
            TypedParameter idParam = new TypedParameter(typeof(string), id);
            ITextBox       textbox = _resolver.Container.Resolve <ITextBox>(idParam);

            textbox.LabelRenderSize = new SizeF(width, height);
            textbox.X = x;
            textbox.Y = y;
            if (config == null)
            {
                config = new AGSTextConfig(autoFit: AutoFit.TextShouldCrop);
            }
            textbox.TextConfig = config;
            textbox.Text       = "";
            setParent(textbox, parent);
            if (!string.IsNullOrEmpty(watermark))
            {
                var watermarkConfig = AGSTextConfig.Clone(config);
                watermarkConfig.Brush = _graphics.Brushes.LoadSolidBrush(Colors.LightGray);
                var watermarkLabel = GetLabel($"{id}_watermark", watermark, width, height, 0f, 0f, textbox, watermarkConfig, addToUi);
                watermarkLabel.Opacity = 50;
                textbox.Watermark      = watermarkLabel;
            }

            if (addToUi)
            {
                _gameState.UI.Add(textbox);
            }

            return(textbox);
        }
            /// <summary>
            /// Sets up the panel that shows the error details
            /// </summary>
            private void SetFullDetailsPanel()
            {
                _fullDetail      = _controlFactory.CreatePanel();
                _fullDetail.Text = "Error Detail";

                _errorDetails                   = _controlFactory.CreateTextBox();
                _errorDetails.Text              = ExceptionUtilities.GetExceptionString(_exception, 0, false);
                _errorDetails.Multiline         = true;
                _errorDetails.ScrollBars        = ScrollBars.Both;
                _showStackTrace                 = _controlFactory.CreateCheckBox();
                _showStackTrace.Text            = "&Show stack trace";
                _showStackTrace.CheckedChanged += ShowStackTraceClicked;

                var manager = _controlFactory.CreateBorderLayoutManager(_fullDetail);

                manager.AddControl(_errorDetails, BorderLayoutManager.Position.Centre);
                var chkPanel = _controlFactory.CreatePanel();
                var vgap     = LayoutManager.DefaultGapSize + LayoutManager.DefaultBorderSize;

                if (GlobalUIRegistry.UIStyleHints != null)
                {
                    vgap = GlobalUIRegistry.UIStyleHints.LayoutHints.DefaultVerticalGap + GlobalUIRegistry.UIStyleHints.LayoutHints.DefaultBorderSize;
                }
                chkPanel.Height = _showStackTrace.Height + 2 * vgap;
                var chkManager = _controlFactory.CreateBorderLayoutManager(chkPanel);

                chkManager.AddControl(_showStackTrace, BorderLayoutManager.Position.West);
                manager.AddControl(chkPanel, BorderLayoutManager.Position.South);
            }
        ///<summary>
        /// A constructor for the <see cref="ErrorDescriptionForm"/>
        ///</summary>
        public ErrorDescriptionForm()
        {

            IControlFactory controlFactory = GlobalUIRegistry.ControlFactory;
            ILabel label = controlFactory.CreateLabel("Please enter further details regarding the error : ");
            _errorDescriptionTextBox = controlFactory.CreateTextBox();
            ErrorDescriptionTextBox.Multiline = true;
            IButtonGroupControl buttonGroupControl = controlFactory.CreateButtonGroupControl();
            buttonGroupControl.AddButton("OK", delegate { this.Close(); });
            BorderLayoutManager layoutManager = controlFactory.CreateBorderLayoutManager(this);
            layoutManager.AddControl(label, BorderLayoutManager.Position.North);
            layoutManager.AddControl(ErrorDescriptionTextBox, BorderLayoutManager.Position.Centre);
            layoutManager.AddControl(buttonGroupControl, BorderLayoutManager.Position.South);
            this.Text = "Error Description";
            this.Width = 500;
            this.Height = 400;
            this.Closing += delegate(object sender, CancelEventArgs e)
            {
                if (ErrorDescriptionFormClosing == null)
                {
                    return;
                }
                ErrorDescriptionFormClosing(sender, e);
            };
        }
Пример #29
0
 public UndoRedoStack(ITextBox owner, int maxUndo)
 {
     Owner     = owner;
     MaxUndo   = maxUndo;
     UndoStack = new RoundStack <UndoRedoMementoBase> (MaxUndo);
     RedoStack = new RoundStack <UndoRedoMementoBase> (MaxUndo);
 }
Пример #30
0
        public override void Start()
        {
            base.Start();

            IStack stack = Platform.Current.Create <IStack>();

            ILabel lblLabel = Platform.Current.Create <ILabel>();

            lblLabel.Text   = "This is a label";
            lblLabel.Height = 30;
            stack.Children.Add(lblLabel);

            ITextBox txtText = Platform.Current.Create <ITextBox>();

            txtText.Value         = "Update label text here";
            txtText.ValueChanged += (object sender, string e) => lblLabel.Text = txtText.Value;
            stack.Children.Add(txtText);

            IListPicker lstFont = Platform.Current.Create <IListPicker>();

            lstFont.Items         = new string[] { "Arial", "Verdana", "Times new roman", "Helvetica" };
            lstFont.ValueChanged += (object sender, string e) => lblLabel.FontFamily = lstFont.Value;
            stack.Children.Add(lstFont);

            IButton cmdClose = Platform.Current.Create <IButton>();

            cmdClose.Text   = "Close";
            cmdClose.Click += CmdClose_Click;
            stack.Children.Add(cmdClose);

            Platform.Current.Page.Title   = "Test label";
            Platform.Current.Page.Content = stack;
        }
Пример #31
0
        public IComboBox GetComboBox(string id, IButton dropDownButton, ITextBox textBox,
                                     Func <IButton> itemButtonFactory, bool addToUi = true)
        {
            TypedParameter idParam       = new TypedParameter(typeof(string), id);
            IComboBox      comboBox      = _resolver.Resolve <IComboBox>(idParam);
            float          defaultHeight = dropDownButton != null ? dropDownButton.Height : textBox != null ? textBox.Height : 20f;
            float          itemWidth     = textBox != null ? textBox.Width : 100f;

            dropDownButton = dropDownButton ?? GetButton(id + "_DropDownButton", (string)null, null, null, 0f, 0f, width: 20f, height: defaultHeight);
            dropDownButton.SkinTags.Add(AGSSkin.DropDownButtonTag);
            if (dropDownButton.Skin != null)
            {
                dropDownButton.Skin.Apply(dropDownButton);
            }
            textBox           = textBox ?? GetTextBox(id + "_TextBox", 0f, 0f, width: itemWidth, height: defaultHeight);
            textBox.Enabled   = false;
            itemButtonFactory = itemButtonFactory ?? (() => GetButton(id + "_" + Guid.NewGuid().ToString(), (string)null, null, null, 0f, 0f, width: itemWidth,
                                                                      height: defaultHeight));
            comboBox.DropDownButton    = dropDownButton;
            comboBox.TextBox           = textBox;
            comboBox.ItemButtonFactory = itemButtonFactory;

            comboBox.TreeNode.AddChild(textBox);
            comboBox.TreeNode.AddChild(dropDownButton);

            if (addToUi)
            {
                _gameState.UI.Add(comboBox);
            }

            return(comboBox);
        }
Пример #32
0
        /// <summary>
        /// Constructs a new FileTextBox component.
        /// </summary>
        protected FileTextBox(ITextBox textBox)
        {
            InitializeComponent();

            ShowNewFolderButton = true;
            OverwritePrompt     = true;
            AllowAnyExtension   = true;

            buttonBrowse.Click += ShowDialog;

            TextBox = textBox;
            TextBox.Control.Size     = textBoxDummy.Size;
            TextBox.Control.Location = textBoxDummy.Location;
            TextBox.Control.Dock     = textBoxDummy.Dock;
            TextBox.Control.Anchor   = textBoxDummy.Anchor;
            TextBox.Control.Font     = textBoxDummy.Font;
            TextBox.Control.TabIndex = textBoxDummy.TabIndex;

            var parent = textBoxDummy.Parent;

            parent.Controls.Remove(textBoxDummy);
            parent.Controls.Add(TextBox.Control);

            TextBox.TextChanged    += (sender, args) => OnTextChanged(args);
            TextBox.PreviewKeyDown += TextBoxOnPreviewKeyDown;
        }
Пример #33
0
 public LowLevelView()
 {
     InitializeComponent();
     txtAddressWrapped = new ToolStripTextBoxWrapper(txtAddress);
     btnBackWrapped = new ToolStripButtonWrapper(btnBack);
     btnFwdWrapped = new ToolStripButtonWrapper(btnForward);
     btnGoWrapped = new ToolStripButtonWrapper(btnGo);
 }
 ///<summary>
 /// Constructs the <see cref="FileChooserManager"/>
 ///</summary>
 ///<param name="controlFactory"></param>
 ///<param name="fileChooser"></param>
 public FileChooserManager(IControlFactory controlFactory, IFileChooser fileChooser)
 {
     _controlFactory = controlFactory;
     _fileChooser = fileChooser;
     FlowLayoutManager manager = new FlowLayoutManager(_fileChooser, _controlFactory);
     _fileTextBox = _controlFactory.CreateTextBox();
     _selectFileButton = _controlFactory.CreateButton("Select...", null);
     manager.AddControl(_fileTextBox);
     manager.AddControl(_selectFileButton);
 }
 ///<summary>
 /// Constructor for <see cref="MultiplePropStringTextBoxFilter"/>
 ///</summary>
 ///<param name="controlFactory"></param>
 ///<param name="propertyNames"></param>
 ///<param name="filterClauseOperator"></param>
 public MultiplePropStringTextBoxFilter(IControlFactory controlFactory, List<string> propertyNames,
                                        FilterClauseOperator filterClauseOperator)
 {
     _controlFactory = controlFactory;
     _propertyNames = propertyNames;
     _propertyNames.Sort((s, s1) => s1.CompareTo(s));
     _filterClauseOperator = filterClauseOperator;
     _textBox = _controlFactory.CreateTextBox();
     _textBox.TextChanged += (sender, e) => FireValueChanged();
 }
        public GenericGridFilterControlWin(IGridBase grid)
        {
            var ds = grid.DataSource as DataView;
            if (ds != null) this._originalView = ds;
            (grid as DataGridView).DataSourceChanged += this.DataSourceChanged;

            this._lastForcedEvents = DateTime.Now;
            this.Grid = grid;
            this._timer = new Timer()
            {
                Enabled = true,
                Interval = 500,
            };
            this._timer.Tick += (sender, e) => 
            {
                if ((this._filterRequired) && (this._lastFilterChanged.AddMilliseconds(this._timer.Interval) < DateTime.Now))
                {
                    if (this._inFilter)
                        this._cancelCurrentFilter = true;
                    this._filterRequired = false;
                    this.DoFilter();
                }
            };

            var factory = new ControlFactoryWin();
            this._filterLabel = factory.CreateLabel("Filter:");
            this._filterTextBox = factory.CreateTextBox();
            var txt = this._filterTextBox as TextBox;
            txt.TextChanged += (sender, e) =>
                {
                    if (txt.Text == this._lastFilterText) return;
                    this._lastFilterChanged = DateTime.Now;
                    this._filterRequired = true;
                };
            var manager = factory.CreateBorderLayoutManager(this);
            manager.AddControl(this._filterLabel, BorderLayoutManager.Position.West);
            manager.AddControl(this._filterTextBox, BorderLayoutManager.Position.Centre);
            var vgap = manager.VerticalGapSize + manager.BorderSize;
            this.Height = this._filterTextBox.Height + 2 * vgap;

            this.FilterStarted += (sender, e) =>
                {
                    this.SetUIState(true);
                };
            this.FilterCompleted += (sender, e) =>
                {
                    this.SetUIState(false);
                };
            var wingrid = Grid as DataGridView;
            if (wingrid != null)
            {
                this._gridOriginalAlternatingStyle = wingrid.AlternatingRowsDefaultCellStyle;
                wingrid.AlternatingRowsDefaultCellStyleChanged += this.RecordGridAltStyle;
            }
        }
Пример #37
0
 /// <summary>
 /// Initialises the form with a message to display to the user.
 /// </summary>
 /// <param name="controlFactory">The <see cref="IControlFactory"/> to use to create the form</param>
 /// <param name="message">The message to display</param>
 /// <param name="numLines">The number of lines to make available</param>
 /// <param name="passwordChar">The Char to use if the Textbox is to be used as a password field</param>
 public InputFormTextBox(IControlFactory controlFactory, string message, int numLines, char passwordChar)
 {
     _controlFactory = controlFactory;
     _message = message;
     _textBox = _controlFactory.CreateTextBox();
     _textBox.PasswordChar = passwordChar;
     if (numLines > 1)
     {
         _textBox.Multiline = true;
         _textBox.Height = _textBox.Height * numLines;
         _textBox.ScrollBars = ScrollBars.Vertical;
     }
 }
Пример #38
0
		/// <summary>
		/// Gos the search button click.
		/// <para xml:lang="es">El clic del boton que nos envia a la parte donde buscamos.</para>
		/// </summary>
		/// <returns>The search button click.</returns>
		/// <param name="sender">Sender.</param>
		/// <param name="e">E.</param>
		private void GoSearchButton_Click(object sender, EventArgs e)
		{
			SearchText = Platform.Current.Create<ITextBox>();
			SearchButton = Platform.Current.Create<IButton>();
			SearchButton.Text = "Search";
			SearchButton.Click += SearchButton_Click;
			SearchStack = Platform.Current.Create<IStack>();
			SearchStack.Children.Add(SearchText);
			SearchStack.Children.Add(SearchButton);

			SearchPage = new Page();
			SearchPage.Content = SearchStack;

			((Page) Platform.Current.Page).Navigation.PushAsync(SearchPage);
		}
        public GenericGridFilterControlVwg(IGridBase grid)
        {
            this.Grid = grid;
            this._timer = new Timer()
            {
                Enabled = true,
                Interval = 500,
            };
            this._timer.Tick += (sender, e) => 
            {
                if ((!this._inFilter) && (this._filterRequired) && (this._lastFilterChanged.AddMilliseconds(this._timer.Interval) < DateTime.Now))
                {
                    this._filterRequired = false;
                    this.DoFilter();
                }
            };

            var factory = new ControlFactoryVWG();
            this._filterLabel = factory.CreateLabel("Filter:");
            this._filterTextBox = factory.CreateTextBox();
            var txt = this._filterTextBox as TextBox;
            txt.KeyPress += (sender, e) =>
                {
                    this._lastFilterChanged = DateTime.Now;
                    this._filterRequired = true;
                };
            var manager = factory.CreateBorderLayoutManager(this);
            manager.AddControl(this._filterLabel, BorderLayoutManager.Position.West);
            manager.AddControl(this._filterTextBox, BorderLayoutManager.Position.Centre);
            var vgap = manager.VerticalGapSize + manager.BorderSize;
            this.Height = this._filterTextBox.Height + 2 * vgap;

            this.FilterStarted += (sender, e) =>
                {
                    this.SetUIState(true);
                };
            this.FilterCompleted += (sender, e) =>
                {
                    this.SetUIState(false);
                };
        }
Пример #40
0
		public override void Start()
		{
			base.Start();

			//IGrid grid = CurrentPage.Create<IGrid>();
			IGrid grid = Platform.Current.Create<IGrid>();
			grid.ColumnCount = 2;
			grid.RowCount = 3;

			lblUserName = Platform.Current.Create<ILabel>();
			lblUserName.Text = "Username";
			grid.SetContent(0, 0, lblUserName);

			txtUserName = Platform.Current.Create<ITextBox>();
			grid.SetContent(0, 1, txtUserName);

			lblPassword = Platform.Current.Create<ILabel>();
			lblPassword.Text = "Password";
			grid.SetContent(1, 0, lblPassword);

			txtPassword = Platform.Current.Create<IPasswordTextBox>();
			grid.SetContent(1, 1, txtPassword);

			cmdLogin = Platform.Current.Create<IButton>();
			cmdLogin.Text = "Login";
			cmdLogin.Click += cmdLogin_Click;
			grid.SetContent(2, 0, cmdLogin);

			lblMessage = Platform.Current.Create<ILabel>();
			lblMessage.Text = "Wrong data";
			lblMessage.Visible = false;
			grid.SetContent(2, 1, lblMessage);

			Platform.Current.Page.Title = "Please login";
			Platform.Current.Page.Content = grid;
		}
Пример #41
0
 // Use this for initialization
 void Start()
 {
     textBox = (ITextBox)textBoxObject.GetComponent (typeof(ITextBox));
     textBoxObject.SetActive (true);
     textBox.hide ();
 }
Пример #42
0
 public void SetupTest()
 {
     _textBox = GetControlFactory().CreateTextBox();
     _mapper = new TextBoxMapper(_textBox,  "ShapeName", false, GetControlFactory());
     _shape = new Shape();
 }
Пример #43
0
        public Window(ScreenManager mgr, string text, int width, Button[] buttons, ITextBox textbox)
        {
            // Load font
            font = mgr.Content.Load<SpriteFont>("MainFont");

            textBox = textbox;

            // Starts at top left and rotates clockwise
            boxTextures = new Texture2D[8] {
                mgr.Content.Load<Texture2D>(@"Box\Box-Top-Left"),
                mgr.Content.Load<Texture2D>(@"Box\Box-Top"),
                mgr.Content.Load<Texture2D>(@"Box\Box-Top-Right"),
                mgr.Content.Load<Texture2D>(@"Box\Box-Right"),
                mgr.Content.Load<Texture2D>(@"Box\Box-Bottom-Right"),
                mgr.Content.Load<Texture2D>(@"Box\Box-Bottom"),
                mgr.Content.Load<Texture2D>(@"Box\Box-Bottom-Left"),
                mgr.Content.Load<Texture2D>(@"Box\Box-Left")
            };

            //
            // Dimensions
            //

            screenWidth = mgr.Width;
            screenHeight = mgr.Height;
            boxWidth = width;
            //boxHeight needs to be calculated
            cornerWidth = boxTextures[0].Width;
            cornerHeight = boxTextures[0].Height;

            //
            // Calculate boxHeight
            //

            Vector2 textDim = font.MeasureString(text);
            int innerBoxWidth = boxWidth - (PAD * 2);
            // Need word wrap?
            if (textDim.X > innerBoxWidth) {
                string[] tokens = text.Split(' ');
                StringBuilder lineBuilder = new StringBuilder();

                for (int i = 0; i < tokens.Length; i++) {
                    lineBuilder.Append(tokens[i]);
                    textDim = font.MeasureString(lineBuilder.ToString());

                    lineBuilder.Append(" ");

                    // Breaking point?
                    if (textDim.X > innerBoxWidth) {
                        // Remove last token (and space) because it went over boxWidth
                        lineBuilder.Remove(lineBuilder.Length - (tokens[i].Length + 1), tokens[i].Length + 1);
                        // Save newly-created line
                        lines.Add(lineBuilder.ToString());
                        // Clear for next line
                        lineBuilder.Clear();
                        // Start new line with last word that didn't fit (and space)
                        lineBuilder.Append(tokens[i]);
                        lineBuilder.Append(" ");
                    }
                }
                // Add left over as last line
                lines.Add(lineBuilder.ToString());
            }
            // No word wrap needed
            else {
                lines.Add(text);
            }
            // Add up all of this stuff to get the total height:
            //   number of lines of text * the height of a text letter
            // + box padding * 4 (top, middle, ... , middle, bottom)
            // + the height of a button
            // + the height of a textbox
            int textBoxHeight = 0;
            if (textBox != null) textBoxHeight = textBox.GetHeight() + (PAD * 2);
            boxHeight = (lines.Count * (int)textDim.Y) + (PAD * 3) + Button.Height + textBoxHeight;

            x1 = (screenWidth - boxWidth) / 2;
            x2 = x1 + boxWidth;
            y1 = (screenHeight - boxHeight) / 2;
            y2 = y1 + boxHeight;

            //
            // Buttons
            //

            this.btns = buttons;

            if (btns.Length >= 1) {
                btns[0].Position = new Vector2(x2 - PAD - Button.Width, y2 - PAD - Button.Height);

                if (btns.Length == 2) {
                    btns[1].Position = new Vector2(x1 + PAD, y2 - PAD - Button.Height);
                }
            }

            if (textBox != null)
                textBox.SetPosition(new Vector2(x1 + PAD, y2 - (PAD * 3) - Button.Height - textBox.GetHeight()));

            // Corners
            boxPositions[0] = new Vector2(x1, y1);
            boxPositions[2] = new Vector2(x2 - cornerWidth, y1);
            boxPositions[4] = new Vector2(x2 - cornerWidth, y2 - cornerHeight);
            boxPositions[6] = new Vector2(x1, y2 - cornerHeight);

            linePositions = new Vector2[lines.Count];
            for (int i = 0; i < linePositions.Length; i++) {
                linePositions[i] = new Vector2(x1 + PAD, y1 + PAD + (i * (int)textDim.Y));
            }

            // screenOverlay
            Color[] pixels = new Color[screenWidth * screenHeight];
            for (int i = 0; i < pixels.Length; i++) {
                pixels[i] = screenOverlayColor;
            }
            screenOverlay = new Texture2D(mgr.Game.GraphicsDevice, screenWidth, screenHeight);
            screenOverlay.SetData<Color>(pixels);

            // boxBackground
            pixels = new Color[boxWidth * boxHeight];
            for (int i = 0; i < pixels.Length; i++) {
                pixels[i] = boxBackgroundColor;
            }
            boxBackground = new Texture2D(mgr.Game.GraphicsDevice, boxWidth, boxHeight);
            boxBackground.SetData<Color>(pixels);
        }
Пример #44
0
 public DeclarationForm()
 {
     InitializeComponent();
     textWrapped = new TextBoxWrapper(text);
 }
 public TextBoxMapperStub(ITextBox tb, string propName, bool isReadOnly, IControlFactory factory) : base(tb, propName, isReadOnly, factory)
 {
 }
            /// <summary>
            /// Sets up the panel that shows the error details
            /// </summary>
            private void SetFullDetailsPanel()
            {
                _fullDetail = _controlFactory.CreatePanel();
                _fullDetail.Text = "Error Detail";

                _errorDetails = _controlFactory.CreateTextBox();
                _errorDetails.Text = ExceptionUtilities.GetExceptionString(_exception, 0, false);
                _errorDetails.Multiline = true;
                _errorDetails.ScrollBars = ScrollBars.Both;
                _showStackTrace = _controlFactory.CreateCheckBox();
                _showStackTrace.Text = "&Show stack trace";
                _showStackTrace.CheckedChanged += ShowStackTraceClicked;

                var manager = _controlFactory.CreateBorderLayoutManager(_fullDetail);
                manager.AddControl(_errorDetails, BorderLayoutManager.Position.Centre);
                var chkPanel = _controlFactory.CreatePanel();
                var vgap = LayoutManager.DefaultGapSize + LayoutManager.DefaultBorderSize;
                if (GlobalUIRegistry.UIStyleHints != null)
                    vgap = GlobalUIRegistry.UIStyleHints.LayoutHints.DefaultVerticalGap + GlobalUIRegistry.UIStyleHints.LayoutHints.DefaultBorderSize;
                chkPanel.Height = _showStackTrace.Height + 2 * vgap;
                var chkManager = _controlFactory.CreateBorderLayoutManager(chkPanel);
                chkManager.AddControl(_showStackTrace, BorderLayoutManager.Position.West);
                manager.AddControl(chkPanel, BorderLayoutManager.Position.South);
            }
Пример #47
0
        public IComboBox GetComboBox(string id, IButton dropDownButton, ITextBox textBox, 
            Func<IButton> itemButtonFactory, bool addToUi = true)
        {
            TypedParameter idParam = new TypedParameter(typeof(string), id);
            IComboBox comboBox = _resolver.Resolve<IComboBox>(idParam);
            float defaultHeight = dropDownButton != null ? dropDownButton.Height : textBox != null ? textBox.Height : 20f;
            float itemWidth = textBox != null ? textBox.Width : 100f;
            dropDownButton = dropDownButton ?? GetButton(id + "_DropDownButton", (string)null, null, null, 0f, 0f, width: 20f, height: defaultHeight);
            dropDownButton.SkinTags.Add(AGSSkin.DropDownButtonTag);
            if (dropDownButton.Skin != null) dropDownButton.Skin.Apply(dropDownButton);
            textBox = textBox ?? GetTextBox(id + "_TextBox", 0f, 0f, width: itemWidth, height: defaultHeight);
            textBox.Enabled = false;
            itemButtonFactory = itemButtonFactory ?? (() => GetButton(id + "_" + Guid.NewGuid().ToString(), (string)null, null, null, 0f, 0f, width: itemWidth,
                height: defaultHeight));
            comboBox.DropDownButton = dropDownButton;
            comboBox.TextBox = textBox;            
            comboBox.ItemButtonFactory = itemButtonFactory;

            comboBox.TreeNode.AddChild(textBox);
            comboBox.TreeNode.AddChild(dropDownButton);

            if (addToUi)
            {
                _gameState.UI.Add(comboBox);
            }

            return comboBox;
        }
Пример #48
0
 public CustomFilterStub(IControlFactory factory)
 {
     _factory = factory;
     _box = _factory.CreateTextBox();
     ValueChanged += CustomFilterStub_ValueChanged;
     _box.TextChanged += ValueChanged;
     _valueChangedFired = false;
 }
Пример #49
0
 public void SetBox(ITextBox box)
 {
     _box = box;
 }
Пример #50
0
Файл: TextBox.cs Проект: M1C/Eto
 public TextBox(Generator g)
     : base(g, typeof(ITextBox))
 {
     inner = (ITextBox)base.Handler;
 }
Пример #51
0
		protected TextBox (Generator g, Type type, bool initialize = true)
			: base (g, type, initialize)
		{
			handler = (ITextBox)base.Handler;
		}
Пример #52
0
        public async Task<string> Run()
        {
            IGameFactory factory = _game.Factory;
            float panelWidth = _game.Settings.VirtualResolution.Width * 3 / 4f;
            float panelHeight = _game.Settings.VirtualResolution.Height * 3 / 4f;
            const float labelHeight = 20f;
            const float textBoxHeight = 20f;
            const float buttonHeight = 20f;
            const float itemHeight = 20f;
            const float itemPaddingX = 5f;
            const float itemPaddingY = 5f;
            const float scrollButtonWidth = 20f;
            const float scrollButtonHeight = 20f;
            const float scrollButtonOffsetX = 5f;
            const float scrollButtonOffsetY = 5f;
            const float okButtonWidth = 50f;
            const float okButtonHeight = 20f;
            const float okButtonPaddingX = 20f;
            const float okButtonPaddingY = 20f;
            float okCancelWidth = okButtonWidth * 2 + okButtonPaddingX;
            float okButtonX = panelWidth / 2f - okCancelWidth / 2f;
            float cancelButtonX = okButtonX + okButtonWidth + okButtonPaddingX;
            float panelX = _game.Settings.VirtualResolution.Width / 2f - panelWidth / 2f;
            float panelY = _game.Settings.VirtualResolution.Height / 2f - panelHeight / 2f;
            ITextConfig textBoxConfig = new AGSTextConfig(alignment: Alignment.BottomLeft,
                autoFit: AutoFit.TextShouldCrop, font: Hooks.FontLoader.LoadFont(null, 10f));

            IPanel panel = factory.UI.GetPanel("SelectFilePanel", panelWidth, panelHeight, panelX, panelY);
            panel.SkinTags.Add(AGSSkin.DialogBoxTag);
            panel.Skin.Apply(panel);
            ILabel titleLabel = factory.UI.GetLabel("SelectFileTitle", _title, panelWidth, labelHeight, 0f, panelHeight - labelHeight, _buttonsTextConfig);
            _fileTextBox = factory.UI.GetTextBox("SelectFileTextBox", 0f, panelHeight - labelHeight - textBoxHeight, _startPath, textBoxConfig, width: panelWidth, height: textBoxHeight);

            _inventory = new AGSInventory();
            IInventoryWindow invWindow = factory.Inventory.GetInventoryWindow("SelectFileInventory", panelWidth - scrollButtonWidth - scrollButtonOffsetX * 2,
                                                                              panelHeight - labelHeight - buttonHeight - textBoxHeight - okButtonPaddingY, ITEM_WIDTH + itemPaddingX, itemHeight + itemPaddingY, 0f, okButtonPaddingY + okButtonHeight, _inventory);
            invWindow.Z = 1;
            IButton okButton = factory.UI.GetButton("SelectFileOkButton", (string)null, null, null, okButtonX, okButtonPaddingY, "OK", _buttonsTextConfig, width: okButtonWidth, height: okButtonHeight);
            IButton cancelButton = factory.UI.GetButton("SelectFileCancelButton", (string)null, null, null, cancelButtonX, okButtonPaddingY, "Cancel", _buttonsTextConfig, width: okButtonWidth, height: okButtonHeight);
            IButton scrollDownButton = factory.UI.GetButton("SelectFileScrollDown", (string)null, null, null, panelWidth - scrollButtonWidth - scrollButtonOffsetX, okButton.Y + okButtonHeight + scrollButtonOffsetY, "", _buttonsTextConfig, width: scrollButtonWidth, height: scrollButtonHeight);
            IButton scrollUpButton = factory.UI.GetButton("SelectFileScrollUp", (string)null, null, null, panelWidth - scrollButtonWidth - scrollButtonOffsetX, panelHeight - labelHeight - textBoxHeight - scrollButtonHeight - scrollButtonOffsetY, "", _buttonsTextConfig, width: scrollButtonWidth, height: scrollButtonHeight);
            titleLabel.TreeNode.SetParent(panel.TreeNode);
            _fileTextBox.TreeNode.SetParent(panel.TreeNode);
            invWindow.TreeNode.SetParent(panel.TreeNode);
            okButton.TreeNode.SetParent(panel.TreeNode);
            cancelButton.TreeNode.SetParent(panel.TreeNode);
            scrollDownButton.TreeNode.SetParent(panel.TreeNode);
            scrollUpButton.TreeNode.SetParent(panel.TreeNode);

            cancelButton.MouseClicked.Subscribe(onCancelClicked);
            okButton.MouseClicked.Subscribe(onOkClicked);

            scrollDownButton.MouseClicked.Subscribe((sender, args) => invWindow.ScrollDown());
            scrollUpButton.MouseClicked.Subscribe((sender, args) => invWindow.ScrollUp());

            _fileIcon = new FileIcon(_glUtils);
            _fileIconSelected = new FileIcon(_glUtils) { IsSelected = true };
            _folderIcon = new FolderIcon(_glUtils);
            _folderIconSelected = new FolderIcon(_glUtils) { IsSelected = true };

            var arrowDownIcon = getIcon("ArrowDown", factory, scrollButtonWidth, scrollButtonHeight, 
                                        new ArrowIcon(_glUtils) { Direction = ArrowIcon.ArrowDirection.Down });
            arrowDownIcon.Anchor = new PointF();
            arrowDownIcon.Enabled = false;
            arrowDownIcon.TreeNode.SetParent(scrollDownButton.TreeNode);
            _game.State.UI.Add(arrowDownIcon);

            var arrowUpIcon = getIcon("ArrowUp", factory, scrollButtonWidth, scrollButtonHeight,
                                      new ArrowIcon(_glUtils) { Direction = ArrowIcon.ArrowDirection.Up });
            arrowUpIcon.Anchor = new PointF();
            arrowUpIcon.Enabled = false;
            arrowUpIcon.TreeNode.SetParent(scrollUpButton.TreeNode);
            _game.State.UI.Add(arrowUpIcon);

            _fileGraphics = getIcon("FileGraphics", factory, ITEM_WIDTH, itemHeight, _fileIcon);
            _folderGraphics = getIcon("FolderGraphics", factory, ITEM_WIDTH, itemHeight, _folderIcon);

            fillAllFiles(_startPath);

            _fileTextBox.OnPressingKey.Subscribe(onTextBoxKeyPressed);

            bool okGiven = await _tcs.Task;
            removeAllUI(panel);
            if (!okGiven) return null;
            return _fileTextBox.Text;
        }
Пример #53
0
 public void Init() {
     _result = new Str();
     _textBox = new ExtFactory<User>().CreateTextBox( t => t.Name ).Width( 100 );
 }