public virtual IButtonBuilder SetPosition(ButtonLayout buttonLayout, Rectangle boundaryBox, int position) { int x = 0, y = 0; int xPadding = 1, yPadding = 1; int row = 0, col = 0; var maxRows = Math.Max(boundaryBox.Height / _Button.Sprite.Height, 1); var maxCols = Math.Max(boundaryBox.Width / _Button.Sprite.Width, 1); switch (buttonLayout) { case ButtonLayout.LeftToRight: row = position / maxCols; col = position % maxCols; break; case ButtonLayout.TopToBottom: row = position % maxCols; col = position / maxCols; break; } if (row >= maxRows || col >= maxCols) { BuildFailed($"Invalid button position: ({row},{col})"); } x = (col * _Button.Sprite.Width + xPadding) + boundaryBox.Left; y = (row * _Button.Sprite.Height + yPadding) + boundaryBox.Top; _Button.SetPosition(new Vector2(x, y)); _Button.Sprite.SetPosition(_Button.Position); return(this); }
void InternalReveal(bool revealed) { // make sure we're not doubly requesting the same thing. That would // cause a hitch in the animation. if (Revealed != revealed) { Revealed = revealed; // if we're currently animating, cancel the animation if (Animator != null) { Animator.Cancel( ); } int yOffset = revealed ? 0 : ButtonLayout.LayoutParameters.Height; // setup an animation from our current mask scale to the new one. Animator = ValueAnimator.OfInt((int)ButtonLayout.GetY( ), yOffset); Animator.AddUpdateListener(this); Animator.AddListener(new NavToolbarAnimationListener() { NavbarToolbar = this }); Animator.SetDuration((long)(PrivateSubNavToolbarConfig.SlideRate * 1000.0f)); Animator.Start( ); } }
public WidgetButton(WidgetStyleSheet style, string text = "") : base(style) { m_needLayout = true; m_label = new WidgetLabel(); m_label.Color = style.GetParameterColor("text_color", 0x0); m_label.FontSize = style.FontSize; m_label.Font = style.Font; m_label.Text = text; m_label.Parent = this; m_layout = ButtonLayout.Center; m_textPadding = style.Padding; m_image = new WidgetImage(WidgetBackgroundStyle.None, string.Empty); m_image.Parent = this; m_image.Color = style.GetParameterColor("image_color", 0xffffff); m_imagePadding = style.GetParameter <Margin>("image_padding"); m_hoveredStyle = WidgetManager.GetStyle(style.GetParameter("hovered_style")); m_disabledStyle = WidgetManager.GetStyle(style.GetParameter("disabled_style")); m_clickSound = "click"; Size = style.Size; }
private Task AnimateButtonOut() { var y = -30; var x = (Width / 2) - ButtonLayout.Height; return(ButtonLayout.TranslateTo(x, y, 150)); }
public void OnAnimationUpdate(ValueAnimator animation) { // update the mask scale int yPos = ((Java.Lang.Integer)animation.GetAnimatedValue("")).IntValue(); ButtonLayout.SetY(yPos); }
private void initialize(bool showRatings) { List <Participation> participations = new List <Participation>(this.participations); if (!showRatings) { this.orderRandomly(participations); } Vertical_GridLayout_Builder gridBuilder = new Vertical_GridLayout_Builder(); foreach (Participation participation in participations) { ParticipationView v = new ParticipationView(participation, this.scoreSummarizer, this.layoutStack, this.engine, showRatings); v.AddParticipationComment += Child_AddParticipationComment; gridBuilder.AddLayout(v); } if (!showRatings) { Button showRatings_button = new Button(); showRatings_button.Clicked += ShowRatings_button_Clicked; showRatings_button.Text = "Show Ratings"; ButtonLayout showRatings_layout = new ButtonLayout(showRatings_button); gridBuilder.AddLayout(showRatings_layout); } this.SubLayout = ScrollLayout.New(gridBuilder.BuildAnyLayout()); }
private void InitializeButton() { Task.Delay(200).ContinueWith(t => { Device.BeginInvokeOnMainThread(() => { ButtonLayout.TranslationY = this.Height; ButtonLayout.IsVisible = true; ButtonLayout.TranslationX = (Width / 2) - this.Height / 2; ButtonLayout.TranslateTo(0, -(this.Height / 6), 450).ContinueWith(w => { ButtonLayout.ScaleTo(1.4, 300, Easing.Linear).ContinueWith(y => { ButtonLayout.ScaleTo(1.0, 200, Easing.Linear).ContinueWith(k => { Task.Delay(300).ContinueWith(z => { Device.BeginInvokeOnMainThread(() => { AnimateButtonOut(); }); }); }); }); }); }); }); }
public void Open(Vector2 position, string message, ButtonLayout buttonLayout, UnityAction <bool> doneHandler) { m_panel.anchoredPosition = position; m_doneHandler = doneHandler; m_content.text = message; ApplyLayout(buttonLayout); m_panel.gameObject.SetActive(true); }
public void Open(string message, ButtonLayout buttonLayout, UnityAction <bool> doneHandler) { Vector2 position; position.x = Screen.width / 2 - m_panel.sizeDelta.x / 2; position.y = -(Screen.height / 2 - m_panel.sizeDelta.y / 2); Open(position, message, buttonLayout, doneHandler); }
private LayoutChoice_Set resultLayout(string label, PredictionErrors errors) { string text = label + errors.ToString(); Button button = new Button(); button.Clicked += ResultButton_Clicked; this.errorsByButton[button] = errors; ButtonLayout buttonLayout = new ButtonLayout(button, text); return(buttonLayout); }
public async Task SendMessageAsync(string text, ButtonLayout layout) { Message message = new Message() { Text = text, Recipient = this, Layout = layout }; await Messenger.SendMessageAsync(message); }
public IFactoryJob <IButton> Build(string name, int position, ButtonLayout buttonLayout, Action <IButton> action) { _buttonBuilder.SetName(name); _buttonBuilder.SetSize(); _buttonBuilder.SetVisual(); _buttonBuilder.SetPosition(buttonLayout, _Container.BoundaryBox, position); _buttonBuilder.SetHoverAnimation(); _buttonBuilder.SetClickAnimation(); _buttonBuilder.SetAction(action); return(Build()); }
private void showResult(string text, int index) { ButtonLayout largeLayout = this.largeFont_buttonLayouts[index]; largeLayout.setText(text); this.largeFont_autocomplete_gridLayout.PutLayout(largeLayout, 0, index); ButtonLayout smallLayout = this.smallFont_buttonLayouts[index]; smallLayout.setText(text); this.smallFont_autocomplete_gridLayout.PutLayout(smallLayout, 0, index); }
private LinearLayout createKeysLayout() { LinearLayout keyVertical = new LinearLayout(); keyVertical.setSizeParams(new SizeParams(MATCH_PARENT, MATCH_PARENT)); keyVertical.setDirection(Direction.HORIZONTAL); keyVertical.invertDirection = true; LinearLayout linearLayout = new LinearLayout(); linearLayout.setSizeParams(new SizeParams(FILL, FILL)); keyList = new LinearLayout(); keyList.setSizeParams(new SizeParams(MATCH_PARENT, WRAP_CONTENTS)); linearLayout.addItem(keyList); ButtonLayout addButton = new ButtonLayout(); addButton.setSizeParams(new SizeParams(30, 30)); addButton.color = new Color(50, 50, 50); addButton.setPositionParams(new PositionParams(CENTER, CENTER)); addButton.color = buttonBlue; TextBoxLayout text = new TextBoxLayout(); text.setSizeParams(new SizeParams(WRAP_CONTENTS, WRAP_CONTENTS)); text.text = "Add Key"; text.setPositionParams(new PositionParams(CENTER, CENTER)); text.textColor = uiWhite; addButton.setOnClickListener(() => { addKey(); }); addKey(); linearLayout.addItem(addButton); ColoredLayout verticalDivider = new ColoredLayout(); verticalDivider.setSizeParams(new SizeParams(2, MATCH_PARENT)); verticalDivider.color = new Color(63, 63, 70); keyVertical.addChild(verticalDivider); keyVertical.addChild(linearLayout); return(keyVertical); }
private void SetupView() { LayoutChoice_Set instructions = new TextblockLayout("This this txt file contains most of what you've provided to " + this.persona.Name + ", and so it may become large."); ButtonLayout buttonLayout = new ButtonLayout(this.exportButton, "Export"); LayoutChoice_Set credits = new CreditsButtonBuilder(this.layoutStack) .AddContribution(ActRecContributor.ANNI_ZHANG, new DateTime(2020, 04, 05), "Pointed out that exported data files could not be seen by users on iOS") .AddContribution(ActRecContributor.TOBY_HUANG, new DateTime(2021, 02, 16), "Pointed out that it was hard to find the exported files on ChromeOS") .Build(); this.SetContent(new Vertical_GridLayout_Builder().Uniform() .AddLayout(instructions) .AddLayout(buttonLayout) .AddLayout(credits) .Build()); }
private LayoutChoice_Set makeContent() { this.chooseFile_button = new Button(); this.chooseFile_button.Clicked += ChooseFile; ButtonLayout chooseLayout = new ButtonLayout(this.chooseFile_button, "Select file"); GridLayout_Builder builder = new Vertical_GridLayout_Builder() .Uniform() .AddLayout(new TextblockLayout("The file to import should be of the form created by the Export feature " + "(and the name of file should start with \"ActivityData\")")); builder.AddLayout(chooseLayout); return(builder.BuildAnyLayout()); }
public void UpdateLayout() { Vertical_GridLayout_Builder builder = new Vertical_GridLayout_Builder(); List <TextRule> TextPredicates = this.userPreferencesDatabase.ScoringRules; foreach (TextRule rule in TextPredicates) { string text = rule.ToString(); Button ruleButton = new Button(); ruleButton.Clicked += RuleButton_Clicked; ButtonLayout buttonLayout = new ButtonLayout(ruleButton, text, 16); builder.AddLayout(buttonLayout); } this.SubLayout = ScrollLayout.New(builder.Build()); }
public SignificantActivity_Layout(string text, Activity activity, DateTime start, Engine engine, ScoreSummarizer scoreSummarizer, LayoutStack layoutStack) { this.engine = engine; this.activity = activity; this.start = start; this.scoreSummarizer = scoreSummarizer; this.layoutStack = layoutStack; Button button = new Button(); button.Clicked += Button_Clicked; ButtonLayout buttonLayout = new ButtonLayout(button, text); this.SubLayout = buttonLayout; }
private void ApplyLayout(ButtonLayout layout) { if (layout == ButtonLayout.AcceptAndDecline) { m_acceptButton.gameObject.SetActive(true); m_declineButton.gameObject.SetActive(true); m_okButton.gameObject.SetActive(false); } else { m_acceptButton.gameObject.SetActive(false); m_declineButton.gameObject.SetActive(false); m_okButton.gameObject.SetActive(true); } }
internal BuildedMenu( string menuName, string startMessage, ButtonLayout layout, Action <User, UserData, object> closeAction = null, Action <Message, UserData> onUnusualMessageAction = null, Action <User, UserData, object> openAction = null) { Layout = layout ?? throw new ArgumentNullException(nameof(layout)); MenuName = menuName ?? throw new ArgumentNullException(nameof(menuName)); StartMessage = startMessage; _onUnusualMessageAction = onUnusualMessageAction; _closeAction = closeAction; _openAction = openAction; }
public DateEntryView(string title, LayoutStack layoutStack, bool placeTitleAbove = true) { this.layoutStack = layoutStack; this.chooseDate_button = new Button(); this.chooseDate_button.Clicked += ChooseDate_button_Clicked; this.title = title; LayoutChoice_Set titleLayout = new TextblockLayout(title).AlignHorizontally(TextAlignment.Center).AlignVertically(TextAlignment.Center); LayoutChoice_Set contentLayout = ButtonLayout.WithoutBevel(this.chooseDate_button); if (placeTitleAbove) { this.SubLayout = new Vertical_GridLayout_Builder().Uniform() .AddLayout(titleLayout) .AddLayout(contentLayout) .Build(); } else { this.SubLayout = new Horizontal_GridLayout_Builder().Uniform() .AddLayout(titleLayout) .AddLayout(contentLayout) .Build(); } // Use a dateFormat of "yyyy-MM-ddTHH:mm:ss"; this.dateFormat.Add(new DateCharacter('y', true)); this.dateFormat.Add(new DateCharacter('y', true)); this.dateFormat.Add(new DateCharacter('y', true)); this.dateFormat.Add(new DateCharacter('y', true)); this.dateFormat.Add(new DateCharacter('-', false)); this.dateFormat.Add(new DateCharacter('M', true)); this.dateFormat.Add(new DateCharacter('M', true)); this.dateFormat.Add(new DateCharacter('-', false)); this.dateFormat.Add(new DateCharacter('d', true)); this.dateFormat.Add(new DateCharacter('d', true)); this.dateFormat.Add(new DateCharacter('T', false)); this.dateFormat.Add(new DateCharacter('H', true)); this.dateFormat.Add(new DateCharacter('H', true)); this.dateFormat.Add(new DateCharacter(':', false)); this.dateFormat.Add(new DateCharacter('m', true)); this.dateFormat.Add(new DateCharacter('m', true)); this.dateFormat.Add(new DateCharacter(':', false)); this.dateFormat.Add(new DateCharacter('s', true)); this.dateFormat.Add(new DateCharacter('s', true)); this.implView = new FullscreenDateEntryView(title, this.dateFormat, layoutStack); }
void UpdateButtons( ) { if (ButtonLayout != null) { // start by resetting it ButtonLayout.RemoveAllViews( ); // now add each button //JHM: 4-13-15 - Google asks us not to add custom back buttons, since they are // completely redundant. //ButtonLayout.AddView( BackButton ); ButtonLayout.AddView(ShareButton); ButtonLayout.AddView(CreateButton); } }
internal VariableMenu( string menuName, string startMessage, Func <string, TVariable> parse, Action <TVariable, Message, UserData> onParsed, ButtonLayout layout, Action <Exception, Message, UserData> onParseError = null) { MenuName = menuName; StartMessage = startMessage ?? throw new ArgumentNullException(nameof(startMessage)); Parse = parse ?? throw new ArgumentNullException(nameof(parse)); OnVariableParsed = onParsed ?? throw new ArgumentNullException(nameof(onParsed)); Layout = layout ?? throw new ArgumentNullException(nameof(layout)); OnParseError = onParseError; }
public HelpDurationInput_Layout(LayoutStack layoutStack) { this.layoutStack = layoutStack; Button button = new Button(); button.Clicked += Button_Clicked; this.button = button; ButtonLayout buttonLayout = ButtonLayout.WithoutBevel(button); this.SubLayout = buttonLayout; this.detailsLayout = new HelpDurationInput_DetailsLayout(); this.updateButtonText(); }
public static IReplyMarkup ToReplyMarkup(this ButtonLayout layout) { ButtonInfo[][] buttons = layout.GetButtons(); KeyboardButton[][] keyboardButtons = new KeyboardButton[buttons.Length][]; for (int i = 0; i < buttons.Length; i++) { keyboardButtons[i] = new KeyboardButton[buttons[i].Length]; for (int j = 0; j < buttons[i].Length; j++) { keyboardButtons[i][j] = buttons[i][j].ToTelegramButton(); } } return(new ReplyKeyboardMarkup(keyboardButtons, layout.OneTimeKeyboard, layout.ResizeKeyboard)); }
private LayoutChoice_Set makeSublayout() { TextblockLayout title = new TextblockLayout("Export Protoactivities"); TextblockLayout subtitle = new TextblockLayout("This feature exports a file containing all of your protoactivies. You can send them to your friends!"); Button button = new Button(); button.Clicked += Button_Clicked; ButtonLayout buttonLayout = new ButtonLayout(button, "Export"); GridLayout_Builder builder = new Vertical_GridLayout_Builder() .AddLayout(title) .AddLayout(subtitle) .AddLayout(buttonLayout); return(builder.BuildAnyLayout()); }
private BaseLayout createSwitchViewLayout() { CustomPlacementLayout space = new CustomPlacementLayout(); space.setSizeParams(new SizeParams(MATCH_PARENT, 125)); space.color = new Color(37, 37, 38); ButtonLayout button = new ButtonLayout(); button.setSizeParams(new SizeParams(WRAP_CONTENTS, WRAP_CONTENTS)); button.setPositionParams(new PositionParams(CENTER, CENTER)); button.color = buttonBlue; TextBoxLayout text = new TextBoxLayout(); text.setSizeParams(new SizeParams(WRAP_CONTENTS, WRAP_CONTENTS)); text.text = "See Results"; text.setPositionParams(new PositionParams(CENTER, CENTER)); text.textColor = uiWhite; button.setContents(text); button.setOnClickListener(() => { if (inputMode) { contentHolder.removeChild(jsonInput); contentHolder.addChild(jsonResultLayout); text.text = "Change Input"; } else { contentHolder.removeChild(jsonResultLayout); contentHolder.addChild(jsonInput); text.text = "See Results"; } inputMode = !inputMode; }); space.AddItem(button); return(space); }
public ParticipationSummarizerLayout(Engine engine, Persona persona, LayoutStack layoutStack) { this.lifeSummarizer = new LifeSummarizer(engine, persona, new Random()); this.layoutStack = layoutStack; this.sinceView = new DateEntryView("since", layoutStack); this.sinceView.SetDay(DateTime.Now.Subtract(TimeSpan.FromDays(7))); Button button = new Button(); button.Clicked += Button_Clicked; ButtonLayout buttonLayout = new ButtonLayout(button, "See my Story!"); LayoutChoice_Set sublayout = new Vertical_GridLayout_Builder() .AddLayout(new TextblockLayout("Summarize Recent Participations")) .AddLayout(this.sinceView) .AddLayout(buttonLayout) .BuildAnyLayout(); this.SubLayout = sublayout; }
private BaseLayout createKeyLayout() { int marginSize = 10; LinearLayout horizontalStack = new LinearLayout(); horizontalStack.setDirection(LinearLayout.Direction.HORIZONTAL); horizontalStack.setSizeParams(new SizeParams(FILL, WRAP_CONTENTS)); horizontalStack.invertDirection = true; ButtonLayout deleteButton = new ButtonLayout(); deleteButton.setSizeParams(new SizeParams(25, MATCH_PARENT)); deleteButton.color = buttonRed; TextBoxLayout delText = new TextBoxLayout(); delText.setSizeParams(new SizeParams(WRAP_CONTENTS, WRAP_CONTENTS)); delText.text = "X"; delText.textSize = 11; deleteButton.setContents(delText); ColoredLayout blankLeftMargin = new ColoredLayout(); blankLeftMargin.color.a = 0; blankLeftMargin.setSizeParams(new SizeParams(marginSize, 0)); keyEditText = new EditTextLayout(); keyEditText.edgeColor = LayoutLoader.buttonBlue; keyEditText.setSizeParams(new SizeParams(FILL, 22)); keyEditText.singleLine = true; keyEditText.susbcribeToTextChanges(() => { if (onKeyChanged != null) { onKeyChanged(); } }); horizontalStack.addItem(blankLeftMargin); horizontalStack.addItem(deleteButton); horizontalStack.addItem(blankLeftMargin); horizontalStack.addItem(keyEditText); LinearLayout leftLay = new LinearLayout(); leftLay.setSizeParams(new SizeParams(FILL, WRAP_CONTENTS)); leftLay.setDirection(Direction.HORIZONTAL); leftLay.addItem(blankLeftMargin); leftLay.addItem(horizontalStack); ColoredLayout blankTopMargin = new ColoredLayout(); blankTopMargin.color.a = 0; blankTopMargin.setSizeParams(new SizeParams(0, marginSize)); LinearLayout topLay = new LinearLayout(); topLay.setSizeParams(new SizeParams(FILL, WRAP_CONTENTS)); topLay.setDirection(Direction.VERTICAL); topLay.invertDirection = true; topLay.addItem(blankTopMargin); topLay.addItem(leftLay); deleteButton.metaData = topLay; deleteButton.setOnClickListener(() => { if (onKeyDeletePressed != null) { onKeyDeletePressed(); } }); return(topLay); }
private async Task ButtonAnimation() { await ButtonLayout.FadeTo(1, 1000, Easing.SpringIn); }
internal PdfPushButton RenderPushButton(string text, Font font, RectangleF rc, System.Drawing.Image icon, ButtonLayout layout) { return RenderPushButton(text, font, rc, Color.Transparent, Color.Transparent, null, icon, layout); }
// add push button box field for fields of the PDF document // with common parameters and default names. // internal PdfPushButton RenderPushButton(string text, Font font, RectangleF rc, Color back, Color fore, string toolTip, System.Drawing.Image image, ButtonLayout layout) { // create string name = string.Format("ACFPB{0}", _pushButtonCount + 1); PdfPushButton pushButton = new PdfPushButton(); // parameters pushButton.Name = name; pushButton.DefaultValue = text; pushButton.Value = text; pushButton.Font = font; pushButton.ToolTip = string.IsNullOrEmpty(toolTip) ? string.Format("{0} ({1})", text, name) : toolTip; if (back != Color.Transparent && !back.IsEmpty) { pushButton.BackColor = back; } if (fore != Color.Transparent && !fore.IsEmpty) { pushButton.ForeColor = fore; } // icon if (image != null) { pushButton.Image = image; pushButton.Layout = layout; } // add _c1pdf.AddField(pushButton, rc); _pushButtonCount++; // done return pushButton; }
internal PdfPushButton RenderPushButton(string text, Font font, RectangleF rc, ButtonLayout layout) { return RenderPushButton(text, font, rc, Color.Transparent, Color.Transparent, null, null, layout); }