예제 #1
0
        public TextField TextField(int x, int y,
                                   int sizeX, int sizeY,
                                   Color textColor,
                                   SpriteFont font,
                                   ARenderStyle style,
                                   string hint = null,
                                   IHorizontalAlignable horizontalAlignment = null,
                                   IVerticalAlignable verticalAlignment     = null,
                                   IAlignmentTransition alignmentTransition = null,
                                   IColorPattern pattern       = null,
                                   TextAppenderHelper appender = null)
        {
            TextField textField = null;

            return(textField =
                       controlFactory.CreateTextBox(appender ?? TextAppenderHelper.Default,
                                                    font,
                                                    GetTexture(sizeX, sizeY, pattern),
                                                    new Region(new Vector2(x, y),
                                                               new Vector2(sizeX, sizeY)),
                                                    textColor,
                                                    style,
                                                    hint ?? string.Empty,
                                                    horizontalAlignment ?? HorizontalAlignment.Left,
                                                    verticalAlignment ?? VerticalAlignment.Center,
                                                    alignmentTransition ?? AlignmentTransition.Instant));
        }
예제 #2
0
        public static AControl TextHorizontalAlignment(this AControl control, IHorizontalAlignable horizontalAignment)
        {
            Contract.Requires(control.Text != null, "Use Text() before setting the text's color");

            control.Text.Alignment.HorizontalAlignment = horizontalAignment;
            return(control);
        }
예제 #3
0
 public AlignmentContext(IHorizontalAlignable horizontal,
                         IVerticalAlignable vertical,
                         IAlignmentTransition transition)
 {
     this.horizontal = horizontal;
     this.vertical   = vertical;
     this.Transition = transition;
 }
예제 #4
0
 public Label CreateLabel(string text,
                          SpriteFont font,
                          Color textcolor,
                          Texture2D texture,
                          Region region,
                          IHorizontalAlignable horizontalAlignment,
                          IVerticalAlignable verticalAlignment,
                          IAlignmentTransition transition)
 {
     return(new Label(text,
                      font,
                      texture,
                      region,
                      textcolor,
                      new AlignmentContext(horizontalAlignment, verticalAlignment, transition)));
 }
예제 #5
0
 public ListView ListView(int x, int y,
                          int sizeX, int sizeY,
                          Orientation orientation,
                          IHorizontalAlignable horizontalAlignment,
                          IVerticalAlignable verticalAlignment,
                          IAlignmentTransition alignmentTransition,
                          IColorPattern pattern = null,
                          params AControl[] controls)
 {
     return(controlFactory.CreateListView(GetTexture(sizeX, sizeY, pattern ?? Pattern.SolidColor(Color.White)),
                                          new Region(new Vector2(x, y),
                                                     new Vector2(sizeX, sizeY)),
                                          orientation,
                                          new AlignmentContext(horizontalAlignment, verticalAlignment, alignmentTransition),
                                          controls.ToList().AsReadOnly()));
 }
예제 #6
0
 public CheckBox CreateCheckBox(Texture2D backgroundTexture,
                                Texture2D checkedTexture,
                                Texture2D unCheckedTexture,
                                ARenderStyle style,
                                Region region,
                                IHorizontalAlignable checkBoxHorizontalAlignment,
                                IVerticalAlignable checkBoxVerticalAlignment,
                                string text,
                                SpriteFont font)
 {
     return(new CheckBox(backgroundTexture,
                         region,
                         style,
                         new AlignmentContext(checkBoxHorizontalAlignment, checkBoxVerticalAlignment, AlignmentTransition.Instant),
                         checkedTexture,
                         unCheckedTexture,
                         text,
                         font));
 }
예제 #7
0
 public TextField CreateTextBox(TextAppenderHelper appender,
                                SpriteFont font,
                                Texture2D texture,
                                Region region,
                                Color textcolor,
                                ARenderStyle style,
                                string hint,
                                IHorizontalAlignable horizontalAlignment,
                                IVerticalAlignable verticalAlignment,
                                IAlignmentTransition transition)
 {
     return(new TextField(appender,
                          font,
                          texture,
                          region,
                          textcolor,
                          style,
                          hint,
                          new AlignmentContext(horizontalAlignment, verticalAlignment, transition)));
 }
예제 #8
0
 public Label Label(int x, int y,
                    int sizeX, int sizeY,
                    string text,
                    SpriteFont font,
                    Color textColor,
                    IColorPattern pattern,
                    IHorizontalAlignable horizontalAlignment = null,
                    IVerticalAlignable verticalAlignment     = null,
                    IAlignmentTransition alignmentTransition = null)
 {
     return(controlFactory.CreateLabel(text,
                                       font,
                                       textColor,
                                       GetTexture(sizeX, sizeY, pattern),
                                       new Region(new Vector2(x, y),
                                                  new Vector2(sizeX, sizeY)),
                                       horizontalAlignment ?? HorizontalAlignment.Left,
                                       verticalAlignment ?? VerticalAlignment.Center,
                                       alignmentTransition ?? AlignmentTransition.Instant));
 }
예제 #9
0
 public static AControl ScreenAlignment(this AControl listView, IHorizontalAlignable horizontalAignment, IVerticalAlignable verticalAignment)
 {
     listView.ScreenAlignment.HorizontalAlignment = horizontalAignment;
     listView.ScreenAlignment.VerticalAlignment   = verticalAignment;
     return(listView);
 }