public Popup(ContentManager content, SpriteFont smallFont, string transAsset, int windowWidth, int windowHeight, bool hasCancelButton, SpriteFont bigFont, OnButtonClick whenOkButtonClicked) { this.hasCancelButton = hasCancelButton; backgroundImage = content.Load <Texture2D>(transAsset); drawRectangle = new Rectangle(0, 0, BACKGROUND_WIDTH, BACKGROUND_HEIGHT); whenCancelButtonClicked = new OnButtonClick(HidePopup); this.whenOkButtonClicked = whenOkButtonClicked; font = smallFont; okButton = new MenuButton(new OnButtonClick(OnButtonClick), BUTTON1, content, 0, 0, true, bigFont); if (hasCancelButton) { cancelButton = new MenuButton(whenCancelButtonClicked, BUTTON2, content, 0, 0, true, bigFont); } textPosition = new Vector2(0, 0); transImg = content.Load <Texture2D>(transAsset); transRect = new Rectangle(0, 0, windowWidth, windowHeight); transColor = Color.Black; transColor.A = ALPHA; }
public DonationButton(OnButtonClick onButtonClick, int value = 0, bool isMonthly = false) : base() { Lbl_tierName = new Label(); Lbl_donationValue = new Label(); Lbl_monthly = new Label(); Lbl_description = new Label(); Link_description = new LinkLabel(); this.value = value; initialize_panel(onButtonClick); initialize_labels(); base.BackColor = Color.Red; base.Font = new Font("Century Gothic", 15.75F, FontStyle.Bold, GraphicsUnit.Point, ((byte)(0))); base.Location = new Point(428, 15); base.Margin = new Padding(30, 15, 3, 3); base.Name = "panel"; base.Size = new Size(168, 144); base.TabIndex = 6; this.Controls.Add(pnl_optionPnl); this.MouseClick += (s, e) => onButtonClick(value, isMonthly); this.MouseDown += new MouseEventHandler(this.pnl_displayOptions_MouseDown); this.MouseUp += new MouseEventHandler(this.pnl_displayOptions_MouseEnter); this.MouseEnter += new EventHandler(this.pnl_displayOptions_MouseEnter); this.MouseLeave += new EventHandler(this.pnl_displayOptions_MouseLeave); foreach (Control childs in Controls) { foreach (Control child in childs.Controls) { setEvents(child, onButtonClick); } setEvents(childs, onButtonClick); } }
public void ButtonClick() { if (Enabled) { OnButtonClick?.Invoke(); } }
private void Button_Click(object sender, RoutedEventArgs e) { if (OnButtonClick != null) { OnButtonClick.Invoke(this, new TextEventArgs(MessageTextBox.Text)); } }
protected override void AdditionalInitialize() { Text = null; TextColor = Color.Black; FontName = null; TriggerOnRelease = true; OnMouseClicked += (b, x, y) => { if (TriggerOnRelease) { return; } OnButtonClick?.Invoke(this); }; OnMouseReleased += (b, x, y) => { if (!TriggerOnRelease) { return; } OnButtonClick?.Invoke(this); }; }
public MenuButton(OnButtonClick onButtonClick, string buttonText, ContentManager content, int x, int y, bool hasBackground, SpriteFont font) { Active = true; this.onButtonClick = onButtonClick; text = buttonText; bgImage = content.Load <Texture2D>(ASSET_NAME); this.font = font; buttonType = ButtonType.Text; if (font != null) { drawRectangle = new Rectangle(x, y, ((int)font.MeasureString(buttonText).X + SPACING_X), ((int)font.MeasureString(buttonText).Y + SPACING_Y)); } else { drawRectangle = new Rectangle(x, y, 1, 1); } this.hasBackground = hasBackground; textLoc = new Vector2(drawRectangle.X + drawRectangle.Width / 2 - font.MeasureString(text).X / 2, drawRectangle.Y + drawRectangle.Height / 2 - font.MeasureString(text).Y / 2); GameInfo.Buttons.Add(this); }
public override void OnPointerClick() { if (transform.parent == Container) { OnButtonClick?.Invoke(); } }
private void Save_OnClick(object sender, RoutedEventArgs e) { string module = $"{_product}.{_class}.{MethodBase.GetCurrentMethod().Name}()"; // Copy current model values to options before saving AcmeOptions.BondLength = (int)SettingsModel.CurrentBondLength; AcmeOptions.ShowMoleculeGrouping = SettingsModel.ShowMoleculeGroups; AcmeOptions.ShowHydrogens = SettingsModel.ShowImplicitHydrogens; AcmeOptions.ColouredAtoms = SettingsModel.ShowAtomsInColour; AcmeOptions.ShowCarbons = SettingsModel.ShowAllCarbonAtoms; AcmeOptions.Save(); if (AcmeOptions.Errors.Any()) { Telemetry.Write(module, "Exception", string.Join(Environment.NewLine, AcmeOptions.Errors)); AcmeOptions.Errors = new List <string>(); } AcmeOptions.Dirty = false; WpfEventArgs args = new WpfEventArgs(); args.Button = "SAVE"; args.OutputValue = ""; OnButtonClick?.Invoke(this, args); }
public void Update() { if (Mod.Instance.Config.EnableHexColorInput && Menu && Menu.currentMenuLayer_ == CustomizeCarColorsMenuLogic.MenuLayer.ColorPicker && G.Sys.InputManager_.GetKeyUp(InternalResources.Constants.INPUT_EDIT_COLOR)) { OnButtonClick?.Invoke(); } }
public MyGuiControlButton(IMyGuiControlsParent parent, Vector2 position, Vector2?size, Vector4 backgroundColor, MyTexture2D buttonTexture, MyTexture2D hoverButtonTexture, MyTexture2D pressedButtonTexture, MyTextsWrapperEnum textEnum, Vector4 textColor, float textScale, MyGuiControlButtonTextAlignment textAlignment, OnButtonClick onButtonClick, bool canHandleKeyboardInput, MyGuiDrawAlignEnum align, bool implementedFeature, bool canHandleKeyboardActiveControl) : this(parent, position, size, backgroundColor, buttonTexture, hoverButtonTexture, pressedButtonTexture, textEnum, textColor, textScale, textAlignment, onButtonClick, canHandleKeyboardInput, align, implementedFeature, canHandleKeyboardActiveControl, MyGuiControlHighlightType.WHEN_ACTIVE) { }
public Popup(ContentManager content, OnButtonClick whenOkButtonClicked, string checkboxSprite, string checkSprite, SpriteFont font, string transAsset, int windowWidth, int windowHeight, bool hasCancelButton, SpriteFont bigFont) { this.hasCancelButton = hasCancelButton; backgroundImage = content.Load <Texture2D>(transAsset); drawRectangle = new Rectangle(0, 0, BACKGROUND_WIDTH, BACKGROUND_HEIGHT); whenCancelButtonClicked = new OnButtonClick(HidePopup); this.whenOkButtonClicked = whenOkButtonClicked; queryCheckbox = new Checkbox(LanguageTranslator.Translate("Do not show again"), content, font, checkboxSprite, checkSprite); this.font = font; okButton = new MenuButton(new OnButtonClick(OnButtonClick), BUTTON1, content, 0, 0, true, bigFont); if (hasCancelButton) { cancelButton = new MenuButton(whenCancelButtonClicked, BUTTON2, content, 0, 0, true, bigFont); } textPosition = new Vector2(0, 0); transImg = content.Load <Texture2D>(transAsset); transRect = new Rectangle(0, 0, windowWidth, windowHeight); transColor = Color.Black; transColor.A = ALPHA; }
public MyGuiControlButton(IMyGuiControlsParent parent, Vector2 position, Vector2?size, Vector4 backgroundColor, MyTextsWrapperEnum textEnum, MyTextsWrapperEnum tooltip, Vector4 textColor, float textScale, OnButtonClick onButtonClick, MyGuiControlButtonTextAlignment textAlignement, bool canHandleKeyboardInput, MyGuiDrawAlignEnum align, bool implementedFeature) : this(parent, position, size, backgroundColor, MyTextsWrapper.Get(textEnum), MyTextsWrapper.Get(tooltip), textColor, textScale, onButtonClick, textAlignement, canHandleKeyboardInput, align, implementedFeature) { }
//sự kiện khi nhấn vào button public void Clicked() { Random random = new Random(); int x = random.Next(1, 100); int y = random.Next(1, 20); OnButtonClick?.Invoke(this, x, y); }
// Image without text constructor public MyGuiControlButton(IMyGuiControlsParent parent, Vector2 position, Vector2?size, Vector4 backgroundColor, MyTexture2D buttonTexture, MyTexture2D hoverButtonTexture, MyTexture2D pressedButtonTexture, StringBuilder tooltip, OnButtonClick onButtonClick, bool canHandleKeyboardInput, MyGuiDrawAlignEnum align, bool implementedFeature, bool canHandleKeyboardActiveControl, MyGuiControlHighlightType highlightType) : this(parent, position, size, backgroundColor, buttonTexture, hoverButtonTexture, pressedButtonTexture, tooltip, onButtonClick, canHandleKeyboardInput, align, implementedFeature, canHandleKeyboardActiveControl, highlightType, null, null /*, null, null*/) { }
public static void ButtonClick() { if (!PlayerProfile.sounds) { return; } OnButtonClick.Invoke(); }
private void setEvents(Control child, OnButtonClick onButtonClick) { child.MouseEnter += this.pnl_displayOptions_MouseEnter; child.MouseLeave += (s, e) => this.OnMouseLeave(e); child.MouseUp += this.pnl_displayOptions_MouseEnter; child.MouseClick += (s, e) => onButtonClick(value, isMonthly); child.MouseDown += this.pnl_displayOptions_MouseDown; }
public DevBarButtonInfo(BarManager barManager, string name, string caption, Image image, OnButtonClick clickEvent) { _btn = new BarButtonItem(barManager, caption); _btn.Glyph = image; _btn.PaintStyle = BarItemPaintStyle.CaptionGlyph; _btn.Name = name; _clickEvent = clickEvent; _btn.ItemClick += new ItemClickEventHandler(OnBarItemClick); }
private void Cancel_OnClick(object sender, RoutedEventArgs e) { AcmeOptions.Dirty = false; WpfEventArgs args = new WpfEventArgs(); args.Button = "CANCEL"; args.OutputValue = ""; OnButtonClick?.Invoke(this, args); }
private void Start() { Button.onClick.AddListener(() => OnButtonClick?.Invoke(Weapon)); Button.onClick.AddListener(() => CheckWeaponState()); Label.text = Weapon.Label; Price.text = Weapon.Price.ToString(); Icon.sprite = Weapon.Icon; }
public DevBarButtonInfo(BarManager barManager, string name, string caption, Image image, OnButtonClick clickEvent) { _btn = new BarButtonItem(barManager, caption); _btn.Glyph = image; _btn.PaintStyle = BarItemPaintStyle.CaptionGlyph; _btn.Name = name; _clickEvent = clickEvent; _btn.ItemClick += new ItemClickEventHandler(OnBarItemClick); }
public MyGuiControlButton(IMyGuiControlsParent parent, Vector2 position, Vector2?size, Vector4 backgroundColor, MyTextsWrapperEnum textEnum, Vector4 textColor, float textScale, OnButtonClick onButtonClick, MyGuiControlButtonTextAlignment textAlignment, bool canHandleKeyboardInput, MyGuiDrawAlignEnum align, bool implementedFeature, MyTextsWrapperEnum?accessForbiddenReason) : this(parent, position, size, backgroundColor, MyTextsWrapper.Get(textEnum), null, textColor, textScale, onButtonClick, textAlignment, canHandleKeyboardInput, align, implementedFeature) { m_accessForbiddenReason = accessForbiddenReason; m_canHandleKeyboardActiveControl &= m_accessForbiddenReason == null; }
// Image without text constructor and with custom mouse cursor textures public MyGuiControlButton(IMyGuiControlsParent parent, Vector2 position, Vector2?size, Vector4 backgroundColor, MyTexture2D buttonTexture, MyTexture2D hoverButtonTexture, MyTexture2D pressedButtonTexture, StringBuilder tooltip, OnButtonClick onButtonClick, bool canHandleKeyboardInput, MyGuiDrawAlignEnum align, bool implementedFeature, bool canHandleKeyboardActiveControl, MyGuiControlHighlightType highlightType, MyTexture2D mouseCursorHoverTexture, MyTexture2D mouseCursorPressedTexture /*, * System.Drawing.Bitmap mouseCursorHoverBitmap, System.Drawing.Bitmap mouseCursorPressedBitmap*/) : this(parent, position, size, backgroundColor, buttonTexture, hoverButtonTexture, pressedButtonTexture, onButtonClick, canHandleKeyboardInput, align, tooltip, implementedFeature, canHandleKeyboardActiveControl, highlightType, mouseCursorHoverTexture, mouseCursorPressedTexture /*, mouseCursorHoverBitmap, mouseCursorPressedBitmap*/) { }
// Text constructor public MyGuiControlButton(IMyGuiControlsParent parent, Vector2 position, Vector2?size, Vector4 backgroundColor, StringBuilder text, StringBuilder tooltip, Vector4 textColor, float textScale, OnButtonClick onButtonClick, MyGuiControlButtonTextAlignment textAlignment, bool canHandleKeyboardInput, MyGuiDrawAlignEnum align, bool implementedFeature) : this(parent, position, size, backgroundColor, null, null, null, onButtonClick, canHandleKeyboardInput, align, tooltip, implementedFeature, true, MyGuiControlHighlightType.WHEN_ACTIVE, null, null /*, null, null*/) { m_textColor = textColor; Text = text; m_textScale = textScale; m_textAlignment = textAlignment; }
public virtual void OnPointerClick() { if (Time.time < touchStartTime + DisposeTouchTime) { OnButtonClick?.Invoke(); } touchStartTime = 0f; toolIcon.sprite = buttonSpriteSet.normal; }
public DevBarButtonInfo(BarManager barManager, string name, string caption, Image image, OnButtonClick clickEvent) { _btn = new BarButtonItem(barManager, caption); _btn.Glyph = image; _btn.PaintStyle = BarItemPaintStyle.CaptionGlyph; _btn.Name = name; _clickEvent = clickEvent; _btn.RibbonStyle = DevExpress.XtraBars.Ribbon.RibbonItemStyles.SmallWithText; _btn.ItemClick += new ItemClickEventHandler(OnBarItemClick); }
private void Button_Click(object sender, EventArgs e) { var button = (Button)sender; var buttonInfo = (ButtonInfo)button.Tag; OnButtonClick?.Invoke(this, new ButtonPressedEventArgs() { ButtonInfo = buttonInfo }); }
// Image constructor public MyGuiControlButton(IMyGuiControlsParent parent, Vector2 position, Vector2?size, Vector4 backgroundColor, MyTexture2D buttonTexture, MyTexture2D hoverButtonTexture, MyTexture2D pressedButtonTexture, MyTextsWrapperEnum textEnum, Vector4 textColor, float textScale, MyGuiControlButtonTextAlignment textAlignment, OnButtonClick onButtonClick, bool canHandleKeyboardInput, MyGuiDrawAlignEnum align, bool implementedFeature, bool canHandleKeyboardActiveControl, MyGuiControlHighlightType highlightType) : this(parent, position, size, backgroundColor, buttonTexture, hoverButtonTexture, pressedButtonTexture, onButtonClick, canHandleKeyboardInput, align, null, implementedFeature, canHandleKeyboardActiveControl, highlightType, null, null /*, null, null*/) { Text = MyTextsWrapper.Get(textEnum); m_textColor = textColor; m_textAlignment = textAlignment; m_textScale = textScale; }
public UITextButton(string text, OnButtonClick onButtonClick) : base() { this.text = text; this.textSize = Main.fontMouseText.MeasureString(text); this.Width.Set(textSize.X, 0.0f); this.Height.Set(textSize.Y, 0.0f); // Set up delegate this.onButtonClick += onButtonClick; }
private void ButtonClick(UIComponent component, UIMouseEventParameter eventParam) { if (component is UIButton button) { var index = Buttons.IndexOf(button); if (index != -1) { OnButtonClick?.Invoke(index); } } }
private void ButtonClick(int position) { selectedButton.Image.color = Color.white; selectedButton = ConfigButtons[position]; selectedButton.Image.color = selectedColor; if (OnButtonClick != null) { OnButtonClick.Invoke(position); } }
private void initialize_panel(OnButtonClick onButtonClick) { this.pnl_optionPnl.BackColor = this.baseColor; this.pnl_optionPnl.Font = new Font("Century Gothic", 15.75F, FontStyle.Bold, GraphicsUnit.Point, ((byte)(0))); this.pnl_optionPnl.Location = new Point(428, 15); this.pnl_optionPnl.Margin = new Padding(30, 15, 3, 3); this.pnl_optionPnl.Name = "panel"; this.pnl_optionPnl.Size = new Size(166, 142); this.pnl_optionPnl.TabIndex = 6; this.pnl_optionPnl.Dock = DockStyle.Fill; this.MouseClick += (s, e) => onButtonClick(value, isMonthly); }
/// <summary> /// 构造器重载 /// </summary> /// <param name="caption">按钮标题</param> /// <param name="tooltiptext">鼠标移到按钮上的提示</param> /// <param name="image">按钮图片</param> /// <param name="onbuttonclick">按钮单击事件</param> public Factory_ToolBtn(string caption, string tooltiptext, Image image, OnButtonClick onbuttonclick, object tag, bool flag) { _btn = new ToolStripButton(); this._btn.ImageScaling = ToolStripItemImageScaling.SizeToFit; this._btn.ImageTransparentColor = Color.Magenta; this._btn.Size = new System.Drawing.Size(32, 32); this._btn.Text = caption; this._btn.Image = image; this._btn.ToolTipText = tooltiptext; this._btn.Click += new EventHandler(onbuttonclick); this._btn.Enabled = flag; this._btn.Tag = tag; }
public AlertDialog SetButton(DialogButtonInterface whichButton, string text, OnButtonClick onButtonClick) { AlertButton alertButton = new AlertButton(whichButton, text, onButtonClick); switch(whichButton) { case DialogButtonInterface.BUTTON_POSITIVE: _PositiveButton = alertButton; break; default: case DialogButtonInterface.BUTTON_NEUTRAL: _NeutralButton = alertButton; break; case DialogButtonInterface.BUTTON_NEGATIVE: _NegativeButton = alertButton; break; } return this; }
public IButtonInfo CreateButton(string name, string caption, Bitmap image, Size size, OnButtonClick clickEvent, string tag) { return new DevBarButtonInfo(_bar.Manager, name, caption, image, clickEvent,tag); }
public ToolStripButtonInfo(string name, string caption, Bitmap image, Size size, OnButtonClick clickEvent,string tag) { _btn = new ToolStripButton(); _btn.Name = name; _btn.Image = image; _btn.Text = caption; _btn.Tag = tag; _btn.Size = size; _btn.ImageScaling = System.Windows.Forms.ToolStripItemImageScaling.None; _btn.ImageTransparentColor = System.Drawing.Color.Magenta; _clickEvent = clickEvent; _btn.Click += new EventHandler(OnClick); }
public MyGuiControlButton(IMyGuiControlsParent parent, Vector2 position, Vector2? size, Vector4 backgroundColor, MyTextsWrapperEnum textEnum, MyTextsWrapperEnum tooltip, Vector4 textColor, float textScale, OnButtonClick onButtonClick, MyGuiControlButtonTextAlignment textAlignement, bool canHandleKeyboardInput, MyGuiDrawAlignEnum align, bool implementedFeature) : this(parent, position, size, backgroundColor, MyTextsWrapper.Get(textEnum), MyTextsWrapper.Get(tooltip), textColor, textScale, onButtonClick, textAlignement, canHandleKeyboardInput, align, implementedFeature) { }
public void Create( object masterView, string bgLayerImageName, string logoImageName, RectangleF frame, OnButtonClick onClick ) { View = PlatformView.Create( ); View.BackgroundColor = ControlStylingConfig.OOBE_Splash_BG_Color; View.AddAsSubview( masterView ); ImageBG = PlatformImageView.Create( true ); ImageBG.AddAsSubview( View.PlatformNativeObject ); MemoryStream stream = Rock.Mobile.IO.AssetConvert.AssetToStream( bgLayerImageName ); stream.Position = 0; ImageBG.Opacity = 0; ImageBG.Image = stream; ImageBG.SizeToFit( ); ImageBG.ImageScaleType = PlatformImageView.ScaleType.ScaleAspectFill; stream.Dispose( ); WelcomeLabel = PlatformLabel.Create( ); WelcomeLabel.SetFont( ControlStylingConfig.Font_Bold, 85 ); WelcomeLabel.TextColor = 0xCCCCCCFF; WelcomeLabel.Text = OOBEStrings.Welcome; WelcomeLabel.Opacity = 0; WelcomeLabel.SizeToFit( ); WelcomeLabel.AddAsSubview( View.PlatformNativeObject ); RegisterButton = PlatformButton.Create( ); RegisterButton.SetFont( ControlStylingConfig.Font_Light, ControlStylingConfig.Large_FontSize ); RegisterButton.TextColor = 0xCCCCCCFF; RegisterButton.Text = string.Format( OOBEStrings.WantAccount, GeneralConfig.OrganizationShortName ); RegisterButton.Opacity = 0; RegisterButton.SizeToFit( ); RegisterButton.ClickEvent = (PlatformButton button ) => { onClick( 0 ); }; RegisterButton.AddAsSubview( View.PlatformNativeObject ); RegisterSeperator = PlatformView.Create( ); RegisterSeperator.BackgroundColor = ControlStylingConfig.BG_Layer_BorderColor; RegisterSeperator.Bounds = new RectangleF( 0, 0, 0, 1 ); RegisterSeperator.AddAsSubview( View.PlatformNativeObject ); LoginButton = PlatformButton.Create( ); LoginButton.SetFont( ControlStylingConfig.Font_Light, ControlStylingConfig.Large_FontSize ); LoginButton.TextColor = 0xCCCCCCFF; LoginButton.Text = string.Format( OOBEStrings.HaveAccount, GeneralConfig.OrganizationShortName ); LoginButton.Opacity = 0; LoginButton.SizeToFit( ); LoginButton.ClickEvent = (PlatformButton button ) => { onClick( 1 ); }; LoginButton.AddAsSubview( View.PlatformNativeObject ); LoginSeperator = PlatformView.Create( ); LoginSeperator.BackgroundColor = ControlStylingConfig.BG_Layer_BorderColor; LoginSeperator.Bounds = new RectangleF( 0, 0, 0, 1 ); LoginSeperator.AddAsSubview( View.PlatformNativeObject ); SkipButton = PlatformButton.Create( ); SkipButton.SetFont( ControlStylingConfig.Font_Light, ControlStylingConfig.Large_FontSize ); SkipButton.TextColor = 0xCCCCCCFF; SkipButton.Text = OOBEStrings.SkipAccount; SkipButton.Opacity = 0; SkipButton.SizeToFit( ); SkipButton.ClickEvent = (PlatformButton button ) => { onClick( 2 ); }; SkipButton.AddAsSubview( View.PlatformNativeObject ); stream = Rock.Mobile.IO.AssetConvert.AssetToStream( logoImageName ); stream.Position = 0; ImageLogo = PlatformImageView.Create( true ); ImageLogo.AddAsSubview( View.PlatformNativeObject ); ImageLogo.Image = stream; ImageLogo.SizeToFit( ); ImageLogo.ImageScaleType = PlatformImageView.ScaleType.ScaleAspectFit; stream.Dispose( ); State = OOBE_State.Startup; }
public AlertButton(DialogButtonInterface whichButton, string text, OnButtonClick onButtonClick) { WhichButton = whichButton; Text = text; OnButtonClick = onButtonClick; }
// Text constructor public MyGuiControlButton(IMyGuiControlsParent parent, Vector2 position, Vector2? size, Vector4 backgroundColor, StringBuilder text, StringBuilder tooltip, Vector4 textColor, float textScale, OnButtonClick onButtonClick, MyGuiControlButtonTextAlignment textAlignment, bool canHandleKeyboardInput, MyGuiDrawAlignEnum align, bool implementedFeature) : this(parent, position, size, backgroundColor, null, null, null, onButtonClick, canHandleKeyboardInput, align, tooltip, implementedFeature, true, MyGuiControlHighlightType.WHEN_ACTIVE, null, null/*, null, null*/) { m_textColor = textColor; Text = text; m_textScale = textScale; m_textAlignment = textAlignment; }
public MyButton(Control owner, string name, string caption, Bitmap image, Size size, OnButtonClick clickEvent,string tag) { _btn = new Button(); _btn.AutoSize = true; _btn.Name = name; _btn.Image = image; _btn.Text = caption; _btn.Tag = tag; _btn.FlatStyle = FlatStyle.Flat; _btn.TextImageRelation = TextImageRelation.ImageBeforeText; _clickEvent = clickEvent; _btn.Click += new EventHandler(OnClick); owner.Controls.Add(_btn); }
// Image constructor public MyGuiControlButton(IMyGuiControlsParent parent, Vector2 position, Vector2? size, Vector4 backgroundColor, MyTexture2D buttonTexture, MyTexture2D hoverButtonTexture, MyTexture2D pressedButtonTexture, MyTextsWrapperEnum textEnum, Vector4 textColor, float textScale, MyGuiControlButtonTextAlignment textAlignment, OnButtonClick onButtonClick, bool canHandleKeyboardInput, MyGuiDrawAlignEnum align, bool implementedFeature, bool canHandleKeyboardActiveControl, MyGuiControlHighlightType highlightType) : this(parent, position, size, backgroundColor, buttonTexture, hoverButtonTexture, pressedButtonTexture, onButtonClick, canHandleKeyboardInput, align, null, implementedFeature, canHandleKeyboardActiveControl, highlightType, null, null/*, null, null*/) { Text = MyTextsWrapper.Get(textEnum); m_textColor = textColor; m_textAlignment = textAlignment; m_textScale = textScale; }
public IButtonInfo CreateButton(string name, string caption, Bitmap image, Size size, OnButtonClick clickEvent, string tag) { return new ToolStripButtonInfo(name, caption, image, size, clickEvent,tag); }
// Base constructor private MyGuiControlButton(IMyGuiControlsParent parent, Vector2 position, Vector2? size, Vector4 backgroundColor, MyTexture2D buttonTexture, MyTexture2D hoverButtonTexture, MyTexture2D pressedButtonTexture, OnButtonClick onButtonClick, bool canHandleKeyboardInput, MyGuiDrawAlignEnum align, StringBuilder tooltip, bool implementedFeature, bool canHandleKeyboardActiveControl, MyGuiControlHighlightType highlightType, MyTexture2D mouseCursorHoverTexture, MyTexture2D mouseCursorPressedTexture/*, System.Drawing.Bitmap mouseCursorHoverBitmap, System.Drawing.Bitmap mouseCursorPressedBitmap*/) : base(parent, MyGuiManager.GetAlignedCoordinate(position, size.Value, align) + new Vector2(size.Value.X / 2.0f, size.Value.Y / 2.0f), size, backgroundColor, tooltip, buttonTexture, hoverButtonTexture, pressedButtonTexture, true, highlightType, mouseCursorHoverTexture, mouseCursorPressedTexture/*, mouseCursorHoverBitmap, mouseCursorPressedBitmap*/) { m_canHandleKeyboardActiveControl = canHandleKeyboardActiveControl && implementedFeature; m_onButtonClick = onButtonClick; m_canHandleKeyboardInput = canHandleKeyboardInput && implementedFeature; m_implementedFeature = implementedFeature; }
public MyGuiControlButton(IMyGuiControlsParent parent, Vector2 position, Vector2? size, Vector4 backgroundColor, MyTextsWrapperEnum textEnum, Vector4 textColor, float textScale, OnButtonClick onButtonClick, MyGuiControlButtonTextAlignment textAlignment, bool canHandleKeyboardInput, MyGuiDrawAlignEnum align, bool implementedFeature, MyTextsWrapperEnum? accessForbiddenReason) : this(parent, position, size, backgroundColor, MyTextsWrapper.Get(textEnum), null, textColor, textScale, onButtonClick, textAlignment, canHandleKeyboardInput, align, implementedFeature) { m_accessForbiddenReason = accessForbiddenReason; m_canHandleKeyboardActiveControl &= m_accessForbiddenReason == null; }
public MyGuiControlButton(IMyGuiControlsParent parent, Vector2 position, Vector2? size, Vector4 backgroundColor, MyTexture2D buttonTexture, MyTexture2D hoverButtonTexture, MyTexture2D pressedButtonTexture, MyTextsWrapperEnum textEnum, Vector4 textColor, float textScale, MyGuiControlButtonTextAlignment textAlignment, OnButtonClick onButtonClick, bool canHandleKeyboardInput, MyGuiDrawAlignEnum align, bool implementedFeature, bool canHandleKeyboardActiveControl, bool useBackground, bool drawCrossTextureWhenDisabled = true) : this(parent, position, size, backgroundColor, buttonTexture, hoverButtonTexture, pressedButtonTexture, textEnum, textColor, textScale, textAlignment, onButtonClick, canHandleKeyboardInput, align, implementedFeature, canHandleKeyboardActiveControl, MyGuiControlHighlightType.WHEN_ACTIVE) { m_useBackground = useBackground; }
public IButtonInfo CreateButton(string name, string caption, Bitmap image, Size size, OnButtonClick clickEvent) { return new MyButton(_pnl, name, caption, image, size, clickEvent); }
public void Create( object masterView, string bgLayerImageName, string logoImageName, bool scaleImageLogo, RectangleF frame, OnButtonClick onClick ) { View = PlatformView.Create( ); View.BackgroundColor = ControlStylingConfig.OOBE_Splash_BG_Color; View.AddAsSubview( masterView ); ImageBG = PlatformImageView.Create( true ); ImageBG.AddAsSubview( View.PlatformNativeObject ); MemoryStream stream = Rock.Mobile.IO.AssetConvert.AssetToStream( bgLayerImageName ); if ( stream != null ) { stream.Position = 0; ImageBG.Opacity = 0; ImageBG.Image = stream; ImageBG.SizeToFit( ); ImageBG.ImageScaleType = PlatformImageView.ScaleType.ScaleAspectFill; stream.Dispose( ); } WelcomeLabel = PlatformLabel.Create( ); WelcomeLabel.SetFont( ControlStylingConfig.Font_Bold, 85 ); WelcomeLabel.TextColor = 0xCCCCCCFF; WelcomeLabel.Text = OOBEStrings.Welcome; WelcomeLabel.Opacity = 0; WelcomeLabel.SizeToFit( ); WelcomeLabel.AddAsSubview( View.PlatformNativeObject ); // TODO: We need to support scrolling for the eventual day we have too many campuses for a single screen. // TODO: We should be downloading these before display, but I don't want to risk that for the first release. // Setup campuses CampusHeader = PlatformLabel.Create( ); CampusHeader.SetFont( ControlStylingConfig.Font_Light, 18 ); CampusHeader.TextColor = 0xCCCCCCFF; CampusHeader.Text = OOBEStrings.CampusIntro; CampusHeader.TextAlignment = TextAlignment.Center; CampusHeader.Opacity = 0; CampusHeader.SizeToFit( ); CampusHeader.AddAsSubview( View.PlatformNativeObject ); CampusButtons = new List<PlatformButton>( ); foreach ( Rock.Client.Campus campus in App.Shared.Network.RockGeneralData.Instance.Data.Campuses ) { PlatformButton campusButton = PlatformButton.Create( ); campusButton.SetFont( ControlStylingConfig.Font_Light, ControlStylingConfig.Large_FontSize ); campusButton.TextColor = 0xCCCCCCFF; campusButton.Text = campus.Name; campusButton.Opacity = 0; campusButton.SizeToFit( ); campusButton.ClickEvent = (PlatformButton button ) => { // do not allow multiple campus button taps if( State == OOBE_State.WaitForCampus ) { onClick( campus.Id, true ); EnterNextState( OOBE_State.AccountChoice ); PerformAccountChoice( ); } }; campusButton.AddAsSubview( View.PlatformNativeObject ); CampusButtons.Add( campusButton ); } RegisterButton = PlatformButton.Create( ); RegisterButton.SetFont( ControlStylingConfig.Font_Light, ControlStylingConfig.Large_FontSize ); RegisterButton.TextColor = 0xCCCCCCFF; RegisterButton.Text = string.Format( OOBEStrings.WantAccount, GeneralConfig.OrganizationShortName ); RegisterButton.Opacity = 0; RegisterButton.SizeToFit( ); RegisterButton.ClickEvent = (PlatformButton button ) => { // do not allow multiple register taps if( State == OOBE_State.WaitForAccountChoice ) { onClick( 0, false ); EnterNextState( OOBE_State.Done ); } }; RegisterButton.AddAsSubview( View.PlatformNativeObject ); RegisterSeperator = PlatformView.Create( ); RegisterSeperator.BackgroundColor = ControlStylingConfig.BG_Layer_BorderColor; RegisterSeperator.Bounds = new RectangleF( 0, 0, 0, 1 ); RegisterSeperator.AddAsSubview( View.PlatformNativeObject ); LoginButton = PlatformButton.Create( ); LoginButton.SetFont( ControlStylingConfig.Font_Light, ControlStylingConfig.Large_FontSize ); LoginButton.TextColor = 0xCCCCCCFF; LoginButton.Text = string.Format( OOBEStrings.HaveAccount, GeneralConfig.OrganizationShortName ); LoginButton.Opacity = 0; LoginButton.SizeToFit( ); LoginButton.ClickEvent = (PlatformButton button ) => { // do not allow multiple register taps if( State == OOBE_State.WaitForAccountChoice ) { onClick( 1, false ); EnterNextState( OOBE_State.Done ); } }; LoginButton.AddAsSubview( View.PlatformNativeObject ); LoginSeperator = PlatformView.Create( ); LoginSeperator.BackgroundColor = ControlStylingConfig.BG_Layer_BorderColor; LoginSeperator.Bounds = new RectangleF( 0, 0, 0, 1 ); LoginSeperator.AddAsSubview( View.PlatformNativeObject ); SkipButton = PlatformButton.Create( ); SkipButton.SetFont( ControlStylingConfig.Font_Light, ControlStylingConfig.Large_FontSize ); SkipButton.TextColor = 0xCCCCCCFF; SkipButton.Text = OOBEStrings.SkipAccount; SkipButton.Opacity = 0; SkipButton.SizeToFit( ); SkipButton.ClickEvent = (PlatformButton button ) => { // do not allow multiple register taps if( State == OOBE_State.WaitForAccountChoice ) { onClick( 2, false ); EnterNextState( OOBE_State.Done ); } }; SkipButton.AddAsSubview( View.PlatformNativeObject ); stream = Rock.Mobile.IO.AssetConvert.AssetToStream( logoImageName ); stream.Position = 0; ImageLogo = PlatformImageView.Create( scaleImageLogo ); ImageLogo.AddAsSubview( View.PlatformNativeObject ); ImageLogo.Image = stream; ImageLogo.SizeToFit( ); ImageLogo.ImageScaleType = PlatformImageView.ScaleType.ScaleAspectFit; stream.Dispose( ); State = OOBE_State.Startup; }
// Image without text constructor public MyGuiControlButton(IMyGuiControlsParent parent, Vector2 position, Vector2? size, Vector4 backgroundColor, MyTexture2D buttonTexture, MyTexture2D hoverButtonTexture, MyTexture2D pressedButtonTexture, StringBuilder tooltip, OnButtonClick onButtonClick, bool canHandleKeyboardInput, MyGuiDrawAlignEnum align, bool implementedFeature, bool canHandleKeyboardActiveControl, MyGuiControlHighlightType highlightType) : this(parent, position, size, backgroundColor, buttonTexture, hoverButtonTexture, pressedButtonTexture, tooltip, onButtonClick, canHandleKeyboardInput, align, implementedFeature, canHandleKeyboardActiveControl, highlightType, null, null/*, null, null*/) { }
public void SetOnClickFunction(OnButtonClick onClick) { _onClickFunction = onClick; }
// Image without text constructor and with custom mouse cursor textures public MyGuiControlButton(IMyGuiControlsParent parent, Vector2 position, Vector2? size, Vector4 backgroundColor, MyTexture2D buttonTexture, MyTexture2D hoverButtonTexture, MyTexture2D pressedButtonTexture, StringBuilder tooltip, OnButtonClick onButtonClick, bool canHandleKeyboardInput, MyGuiDrawAlignEnum align, bool implementedFeature, bool canHandleKeyboardActiveControl, MyGuiControlHighlightType highlightType, MyTexture2D mouseCursorHoverTexture, MyTexture2D mouseCursorPressedTexture/*, System.Drawing.Bitmap mouseCursorHoverBitmap, System.Drawing.Bitmap mouseCursorPressedBitmap*/) : this(parent, position, size, backgroundColor, buttonTexture, hoverButtonTexture, pressedButtonTexture, onButtonClick, canHandleKeyboardInput, align, tooltip, implementedFeature, canHandleKeyboardActiveControl, highlightType, mouseCursorHoverTexture, mouseCursorPressedTexture/*, mouseCursorHoverBitmap, mouseCursorPressedBitmap*/) { }