private async void addUser(object obj) { user = await _userServices.GetUser(); isEnabled = false; isBusy = true; user.name = nom; user.lastName = prenom; user.sex = sex.Equals("Homme"); user.bDate = date; user.username = username; await Task.Run(() => { if (!(_restServices.UpdateProfile(user))) { //Console.WriteLine("error updating profile , user save for local db"); _dialogService.ShowMessage("Erreur : Veuillez réessayer plus tard", true); isBusy = false; isEnabled = true; } _userServices.SaveUser(user); ButtonBar.initBar(); }); }
override protected void CreateChildren() { base.CreateChildren(); #region Controls Toolbar toolbar = new Toolbar(); AddChild(toolbar); Button button = new Button { Text = "Add data", SkinClass = typeof(ImageButtonSkin), Icon = ImageLoader.Instance.Load("Icons/add"), AutoRepeat = true }; button.ButtonDown += delegate { _dataProvider.AddItem("data " + _random.Next(1, 100)); }; toolbar.AddContentChild(button); button = new Button { Text = "Previous tab", SkinClass = typeof(ImageButtonSkin), Icon = ImageLoader.Instance.Load("Icons/previous") }; button.Click += delegate { _buttonBar.SelectedIndex--; _viewstack.Previous(); }; toolbar.AddContentChild(button); button = new Button { Text = "Next tab", SkinClass = typeof(ImageButtonSkin), Icon = ImageLoader.Instance.Load("Icons/next") }; button.Click += delegate { _buttonBar.SelectedIndex++; _viewstack.Next(); }; toolbar.AddContentChild(button); #endregion #region Scroller Scroller scroller = new Scroller { SkinClass = typeof(ScrollerSkin2), PercentWidth = 100, PercentHeight = 100 }; //scroller.SetStyle("horizontalScrollPolicy", ScrollPolicy.On); //scroller.SetStyle("verticalScrollPolicy", ScrollPolicy.On); AddChild(scroller); Group viewport = new Group { MouseEnabled = true, Layout = new VerticalLayout { HorizontalAlign = HorizontalAlign.Left, PaddingLeft = 10, PaddingRight = 10, PaddingTop = 10, PaddingBottom = 10, Gap = 10 } }; scroller.Viewport = viewport; #endregion List <object> source = new List <object> { "Failure", "Teaches", "Success", "One", "Two", "Three", "Four", "Five", "Six" }; _dataProvider = new ArrayList(source); viewport.AddChild(new Label { Text = "ButtonBar:" }); #region Button bar _buttonBar = new ButtonBar { DataProvider = new ArrayList(new List <object> { "List 1", "List 2", "List 3", "List 4", "List 5" }), SkinClass = typeof(ButtonBarSkin2), RequireSelection = true }; _buttonBar.AddEventListener(Event.CHANGE, delegate(Event e) { IndexChangeEvent ice = e as IndexChangeEvent; if (null != ice) { int newIndex = ice.NewIndex; //Debug.Log("Changed to: " + newIndex); _viewstack.SelectedIndex = newIndex; } }); viewport.AddChild(_buttonBar); #endregion #region ViewStack viewport.AddChild(new Label { Text = "ViewStack (having 5 lists as children):" }); _viewstack = new ViewStack { ResizeToContent = true }; viewport.AddChild(_viewstack); #endregion /* Factory is used for creating renderer instances */ var factory = new ItemRendererFactory <DefaultItemRenderer>(); /* LISTS */ #region List 1 List list = new List { Id = "list1", //Layout = new TileLayout { RequestedColumnCount = 4 }, Width = 200, Height = 200, DataProvider = _dataProvider, //ItemRenderer = new ItemRendererFactory <DefaultItemRenderer>(), /* ItemRendererFunction is used for switching between different factories, based on the supplied item */ ItemRendererFunction = delegate { return(factory); } }; _viewstack.AddChild(list); #endregion #region List 2 list = new List { Id = "list2", //Layout = new TileLayout { RequestedColumnCount = 3 }, Width = 200, Height = 245, DataProvider = _dataProvider, //ItemRenderer = new ItemRendererFactory <DefaultItemRenderer>(), ItemRendererFunction = delegate { return(factory); } }; _viewstack.AddChild(list); #endregion #region List 3 list = new List { Id = "list3", Width = 400, Height = 450, DataProvider = _dataProvider, SkinClass = typeof(ListSkin2), ItemRenderer = new ItemRendererFactory <BigItemRenderer>() }; _viewstack.AddChild(list); #endregion #region List 4 list = new List { Id = "list4", Width = 600, Height = 800, Layout = new TileLayout { HorizontalGap = 0, VerticalGap = 0, RequestedRowCount = 4, RequestedColumnCount = 3 }, DataProvider = _dataProvider, SkinClass = typeof(ListSkin2), ItemRenderer = new ItemRendererFactory <BigItemRenderer>() }; _viewstack.AddChild(list); #endregion #region List 5 (horizontal) list = new List { Id = "list5", Width = 800, Height = 100, Layout = new HorizontalLayout { Gap = 0, RequestedColumnCount = 3 }, DataProvider = _dataProvider, SkinClass = typeof(ListSkin2), ItemRenderer = new ItemRendererFactory <BigItemRenderer>() }; _viewstack.AddChild(list); #endregion #region Process renderer click AddEventListener(BigItemRenderer.ADD_BUTTON_CLICKED, delegate(Event e) { IItemRenderer itemRenderer = (IItemRenderer)e.Target; Alert.Show("Info", itemRenderer.Data.ToString(), AlertButtonFlag.Ok, new AlertOption(AlertOptionType.HeaderIcon, ImageLoader.Instance.Load("Icons/information"))); }); #endregion }
/// <summary> /// Required method for Designer support - do not modify /// the contents of this method with the code editor. /// </summary> private void InitializeComponent() { this.components = new System.ComponentModel.Container(); var barItem1 = new ButtonBarsControl.Control.BarItem(); var barItem2 = new ButtonBarsControl.Control.BarItem(); var barItem3 = new ButtonBarsControl.Control.BarItem(); var barItem4 = new ButtonBarsControl.Control.BarItem(); var barItem5 = new ButtonBarsControl.Control.BarItem(); var barItem6 = new ButtonBarsControl.Control.BarItem(); this.pnlTop = new System.Windows.Forms.Panel(); this.pnlRight = new System.Windows.Forms.Panel(); this.tabMain = new System.Windows.Forms.TabControl(); this.tpBar = new System.Windows.Forms.TabPage(); this.pgrdBar = new System.Windows.Forms.PropertyGrid(); this.tpItems = new System.Windows.Forms.TabPage(); this.pgrdItem = new System.Windows.Forms.PropertyGrid(); this.lblCurrentStyle = new System.Windows.Forms.Label(); this.pnlLeft = new System.Windows.Forms.Panel(); this.lblReload = new System.Windows.Forms.LinkLabel(); this.lblReset = new System.Windows.Forms.LinkLabel(); this.lblSave = new System.Windows.Forms.LinkLabel(); this.lblLoad = new System.Windows.Forms.LinkLabel(); this.lblPreview = new System.Windows.Forms.Label(); this.bBar = new ButtonBarsControl.Control.ButtonBar(this.components); this.lblAvailableTheme = new System.Windows.Forms.Label(); this.lblApply = new System.Windows.Forms.LinkLabel(); this.lbxTemplate = new System.Windows.Forms.ListBox(); this.pnlBottom = new System.Windows.Forms.Panel(); this.btnCancel = new System.Windows.Forms.Button(); this.btnOK = new System.Windows.Forms.Button(); this.pnlTop.SuspendLayout(); this.pnlRight.SuspendLayout(); this.tabMain.SuspendLayout(); this.tpBar.SuspendLayout(); this.tpItems.SuspendLayout(); this.pnlLeft.SuspendLayout(); this.pnlBottom.SuspendLayout(); this.SuspendLayout(); // // pnlTop // this.pnlTop.Controls.Add(this.pnlRight); this.pnlTop.Controls.Add(this.pnlLeft); this.pnlTop.Dock = System.Windows.Forms.DockStyle.Top; this.pnlTop.Location = new System.Drawing.Point(0, 0); this.pnlTop.Name = "pnlTop"; this.pnlTop.Size = new System.Drawing.Size(420, 441); this.pnlTop.TabIndex = 0; // // pnlRight // this.pnlRight.Controls.Add(this.tabMain); this.pnlRight.Controls.Add(this.lblCurrentStyle); this.pnlRight.Dock = System.Windows.Forms.DockStyle.Fill; this.pnlRight.Location = new System.Drawing.Point(179, 0); this.pnlRight.Name = "pnlRight"; this.pnlRight.Size = new System.Drawing.Size(241, 441); this.pnlRight.TabIndex = 1; // // tabMain // this.tabMain.Anchor = ((System.Windows.Forms.AnchorStyles) ((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) | System.Windows.Forms.AnchorStyles.Left) | System.Windows.Forms.AnchorStyles.Right))); this.tabMain.Controls.Add(this.tpBar); this.tabMain.Controls.Add(this.tpItems); this.tabMain.Location = new System.Drawing.Point(3, 26); this.tabMain.Name = "tabMain"; this.tabMain.SelectedIndex = 0; this.tabMain.Size = new System.Drawing.Size(235, 409); this.tabMain.TabIndex = 2; // // tpBar // this.tpBar.Controls.Add(this.pgrdBar); this.tpBar.Location = new System.Drawing.Point(4, 22); this.tpBar.Name = "tpBar"; this.tpBar.Padding = new System.Windows.Forms.Padding(3); this.tpBar.Size = new System.Drawing.Size(227, 383); this.tpBar.TabIndex = 0; this.tpBar.Text = global::ButtonBarsControl.Properties.Resources.TAB_BAR; this.tpBar.UseVisualStyleBackColor = true; // // pgrdBar // this.pgrdBar.CommandsVisibleIfAvailable = false; this.pgrdBar.Dock = System.Windows.Forms.DockStyle.Fill; this.pgrdBar.HelpVisible = false; this.pgrdBar.Location = new System.Drawing.Point(3, 3); this.pgrdBar.Name = "pgrdBar"; this.pgrdBar.PropertySort = System.Windows.Forms.PropertySort.NoSort; this.pgrdBar.Size = new System.Drawing.Size(221, 377); this.pgrdBar.TabIndex = 1; this.pgrdBar.ToolbarVisible = false; // // tpItems // this.tpItems.Controls.Add(this.pgrdItem); this.tpItems.Location = new System.Drawing.Point(4, 22); this.tpItems.Name = "tpItems"; this.tpItems.Padding = new System.Windows.Forms.Padding(3); this.tpItems.Size = new System.Drawing.Size(227, 383); this.tpItems.TabIndex = 1; this.tpItems.Text = global::ButtonBarsControl.Properties.Resources.TAB_ITEMS; this.tpItems.UseVisualStyleBackColor = true; // // pgrdItem // this.pgrdItem.CommandsVisibleIfAvailable = false; this.pgrdItem.Dock = System.Windows.Forms.DockStyle.Fill; this.pgrdItem.HelpVisible = false; this.pgrdItem.Location = new System.Drawing.Point(3, 3); this.pgrdItem.Name = "pgrdItem"; this.pgrdItem.PropertySort = System.Windows.Forms.PropertySort.NoSort; this.pgrdItem.Size = new System.Drawing.Size(221, 377); this.pgrdItem.TabIndex = 2; this.pgrdItem.ToolbarVisible = false; // // lblCurrentStyle // this.lblCurrentStyle.AutoSize = true; this.lblCurrentStyle.Font = new System.Drawing.Font("Microsoft Sans Serif", 8.25F, ((System.Drawing.FontStyle) ((System.Drawing.FontStyle.Bold | System.Drawing.FontStyle.Underline)))); this.lblCurrentStyle.Location = new System.Drawing.Point(6, 9); this.lblCurrentStyle.Name = "lblCurrentStyle"; this.lblCurrentStyle.Size = new System.Drawing.Size(80, 13); this.lblCurrentStyle.TabIndex = 0; this.lblCurrentStyle.Text = "Current Style"; // // pnlLeft // this.pnlLeft.Controls.Add(this.lblReload); this.pnlLeft.Controls.Add(this.lblReset); this.pnlLeft.Controls.Add(this.lblSave); this.pnlLeft.Controls.Add(this.lblLoad); this.pnlLeft.Controls.Add(this.lblPreview); this.pnlLeft.Controls.Add(this.bBar); this.pnlLeft.Controls.Add(this.lblAvailableTheme); this.pnlLeft.Controls.Add(this.lblApply); this.pnlLeft.Controls.Add(this.lbxTemplate); this.pnlLeft.Dock = System.Windows.Forms.DockStyle.Left; this.pnlLeft.Location = new System.Drawing.Point(0, 0); this.pnlLeft.Name = "pnlLeft"; this.pnlLeft.Size = new System.Drawing.Size(179, 441); this.pnlLeft.TabIndex = 0; // // lblReload // this.lblReload.AutoSize = true; this.lblReload.Location = new System.Drawing.Point(6, 213); this.lblReload.Name = "lblReload"; this.lblReload.Size = new System.Drawing.Size(41, 13); this.lblReload.TabIndex = 8; this.lblReload.TabStop = true; this.lblReload.Text = "Re&load"; this.lblReload.LinkClicked += new System.Windows.Forms.LinkLabelLinkClickedEventHandler(this.OnReloadClicked); // // lblReset // this.lblReset.AutoSize = true; this.lblReset.Location = new System.Drawing.Point(6, 194); this.lblReset.Name = "lblReset"; this.lblReset.Size = new System.Drawing.Size(35, 13); this.lblReset.TabIndex = 7; this.lblReset.TabStop = true; this.lblReset.Text = "&Reset"; this.lblReset.LinkClicked += new System.Windows.Forms.LinkLabelLinkClickedEventHandler(this.OnResetClick); // // lblSave // this.lblSave.AutoSize = true; this.lblSave.Location = new System.Drawing.Point(6, 175); this.lblSave.Name = "lblSave"; this.lblSave.Size = new System.Drawing.Size(68, 13); this.lblSave.TabIndex = 6; this.lblSave.TabStop = true; this.lblSave.Text = "&Save Theme"; this.lblSave.LinkClicked += new System.Windows.Forms.LinkLabelLinkClickedEventHandler(this.OnSaveClick); // // lblLoad // this.lblLoad.AutoSize = true; this.lblLoad.Location = new System.Drawing.Point(6, 156); this.lblLoad.Name = "lblLoad"; this.lblLoad.Size = new System.Drawing.Size(67, 13); this.lblLoad.TabIndex = 5; this.lblLoad.TabStop = true; this.lblLoad.Text = "&Load Theme"; this.lblLoad.LinkClicked += new System.Windows.Forms.LinkLabelLinkClickedEventHandler(this.OnLoadClick); // // lblPreview // this.lblPreview.AutoSize = true; this.lblPreview.Font = new System.Drawing.Font("Microsoft Sans Serif", 8.25F, ((System.Drawing.FontStyle) ((System.Drawing.FontStyle.Bold | System.Drawing.FontStyle.Underline)))); this.lblPreview.Location = new System.Drawing.Point(6, 234); this.lblPreview.Name = "lblPreview"; this.lblPreview.Size = new System.Drawing.Size(52, 13); this.lblPreview.TabIndex = 3; this.lblPreview.Text = "Preview"; // // bBar // this.bBar.AutoScroll = true; this.bBar.AutoScrollMinSize = new System.Drawing.Size(0, 165); this.bBar.ButtonWidth = 150; barItem1.Caption = global::ButtonBarsControl.Properties.Resources.NORMAL_TEXT; barItem1.Selected = true; barItem1.Tag = "0"; barItem1.ToolTipText = global::ButtonBarsControl.Properties.Resources.NORMAL_TEXT; barItem2.Caption = global::ButtonBarsControl.Properties.Resources.DISABLED_TEXT; barItem2.Tag = "1"; barItem2.ToolTipText = global::ButtonBarsControl.Properties.Resources.DISABLED_TEXT; barItem3.Caption = global::ButtonBarsControl.Properties.Resources.SELECTED_TEXT; barItem3.Tag = "2"; barItem3.ToolTipText = global::ButtonBarsControl.Properties.Resources.SELECTED_TEXT; barItem4.Caption = global::ButtonBarsControl.Properties.Resources.CLICKED_TEXT; barItem4.Tag = "3"; barItem4.ToolTipText = global::ButtonBarsControl.Properties.Resources.CLICKED_TEXT; barItem5.Caption = global::ButtonBarsControl.Properties.Resources.HOVERED_TEXT; barItem5.Tag = "4"; barItem5.ToolTipText = global::ButtonBarsControl.Properties.Resources.HOVERED_TEXT; barItem6.Caption = global::ButtonBarsControl.Properties.Resources.SELECTED_HOVER_TEXT; barItem6.Tag = "5"; barItem6.ToolTipText = global::ButtonBarsControl.Properties.Resources.SELECTED_HOVER_TEXT; this.bBar.Items.AddRange(new ButtonBarsControl.Control.BarItem[] { barItem1, barItem2, barItem3, barItem4, barItem5, barItem6 }); this.bBar.Location = new System.Drawing.Point(7, 250); this.bBar.Name = "bBar"; this.bBar.Padding = new System.Windows.Forms.Padding(3); this.bBar.Size = new System.Drawing.Size(150, 189); this.bBar.TabIndex = 4; this.bBar.Text = "Button Bar"; this.bBar.ThemeProperty.UseTheme = false; this.bBar.CustomDrawItems += new System.EventHandler <ButtonBarsControl.Design.Entity.DrawItemsEventArgs>(this.OnCustomDrawItems); this.bBar.SelectionChanging += new ButtonBarsControl.Control.ItemChangingHandler(this.OnSelectionChanging); // // lblAvailableTheme // this.lblAvailableTheme.AutoSize = true; this.lblAvailableTheme.Font = new System.Drawing.Font("Microsoft Sans Serif", 8.25F, ((System.Drawing.FontStyle) ((System.Drawing.FontStyle.Bold | System.Drawing.FontStyle.Underline)))); this.lblAvailableTheme.Location = new System.Drawing.Point(6, 8); this.lblAvailableTheme.Name = "lblAvailableTheme"; this.lblAvailableTheme.Size = new System.Drawing.Size(103, 13); this.lblAvailableTheme.TabIndex = 0; this.lblAvailableTheme.Text = "Available themes"; // // lblApply // this.lblApply.AutoSize = true; this.lblApply.Location = new System.Drawing.Point(6, 137); this.lblApply.Name = "lblApply"; this.lblApply.Size = new System.Drawing.Size(117, 13); this.lblApply.TabIndex = 2; this.lblApply.TabStop = true; this.lblApply.Text = "&Apply to current Theme"; this.lblApply.LinkClicked += new System.Windows.Forms.LinkLabelLinkClickedEventHandler(this.OnApplyClick); // // lbxTemplate // this.lbxTemplate.FormattingEnabled = true; this.lbxTemplate.Location = new System.Drawing.Point(7, 26); this.lbxTemplate.Name = "lbxTemplate"; this.lbxTemplate.Size = new System.Drawing.Size(165, 108); this.lbxTemplate.TabIndex = 1; // // pnlBottom // this.pnlBottom.Controls.Add(this.btnCancel); this.pnlBottom.Controls.Add(this.btnOK); this.pnlBottom.Dock = System.Windows.Forms.DockStyle.Fill; this.pnlBottom.Location = new System.Drawing.Point(0, 441); this.pnlBottom.Name = "pnlBottom"; this.pnlBottom.Size = new System.Drawing.Size(420, 33); this.pnlBottom.TabIndex = 1; // // btnCancel // this.btnCancel.Anchor = ((System.Windows.Forms.AnchorStyles) ((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right))); this.btnCancel.DialogResult = System.Windows.Forms.DialogResult.Cancel; this.btnCancel.Location = new System.Drawing.Point(333, 6); this.btnCancel.Name = "btnCancel"; this.btnCancel.Size = new System.Drawing.Size(75, 23); this.btnCancel.TabIndex = 1; this.btnCancel.Text = global::ButtonBarsControl.Properties.Resources.BTN_CANCEL; this.btnCancel.UseVisualStyleBackColor = true; this.btnCancel.Click += new System.EventHandler(this.OnCancelClick); // // btnOK // this.btnOK.Anchor = ((System.Windows.Forms.AnchorStyles) ((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right))); this.btnOK.DialogResult = System.Windows.Forms.DialogResult.OK; this.btnOK.Location = new System.Drawing.Point(252, 6); this.btnOK.Name = "btnOK"; this.btnOK.Size = new System.Drawing.Size(75, 23); this.btnOK.TabIndex = 0; this.btnOK.Text = global::ButtonBarsControl.Properties.Resources.BTN_OK; this.btnOK.UseVisualStyleBackColor = true; this.btnOK.Click += new System.EventHandler(this.OnOKClick); // // AppearanceEditorUI // this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; this.ClientSize = new System.Drawing.Size(420, 474); this.Controls.Add(this.pnlBottom); this.Controls.Add(this.pnlTop); this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedToolWindow; this.MaximizeBox = false; this.MinimizeBox = false; this.Name = "AppearanceEditorUI"; this.StartPosition = System.Windows.Forms.FormStartPosition.CenterParent; this.Text = "Appearance Editor"; this.pnlTop.ResumeLayout(false); this.pnlRight.ResumeLayout(false); this.pnlRight.PerformLayout(); this.tabMain.ResumeLayout(false); this.tpBar.ResumeLayout(false); this.tpItems.ResumeLayout(false); this.pnlLeft.ResumeLayout(false); this.pnlLeft.PerformLayout(); this.pnlBottom.ResumeLayout(false); this.ResumeLayout(false); }
/// <summary> /// Initializes a new instance of <see cref="DrawItemEventArgs"/> with supplied arguments. /// </summary> /// <param name="ge">Graphics object where drawing will be done</param> /// <param name="bounds">Bound of <see cref="BarItem"/></param> /// <param name="item"><see cref="BarItem"/> to draw</param> /// <param name="state"><see cref="Enums.State"/> or <see cref="BarItem"/></param> /// <param name="bar"><see cref="ButtonBar"/> control</param> public DrawItemsEventArgs(Graphics ge, Rectangle bounds, BarItem item, State state, ButtonBar bar) { Handeled = false; Graphics = ge; Bounds = bounds; Item = item; State = state; Bar = bar; }
public void RebuildToolbar (IEnumerable<IButtonBarButton> buttons) { List<IButtonBarButton> barItems = new List<IButtonBarButton> (); List<ButtonBar> buttonBars = new List<ButtonBar> (); foreach (var item in buttons) { if (item.IsSeparator) { var bar = new ButtonBar (barItems); buttonBars.Add (bar); barItems.Clear (); } else { barItems.Add (item); } } awesomeBar.ButtonBarContainer.ButtonBars = buttonBars; }
private void SpawnDefender(Vector2 position) { Instantiate(ButtonBar.selectedDefender, position, Quaternion.identity, defenderParent.transform); ButtonBar.UnselectDefender(); }
static async void Manager_TaskNormalWindow(NormalWindow normal, ModifiableEntity entity) { ButtonBar bar = normal.Child <ButtonBar>(); var wrapPanel = (WrapPanel)bar.Content; bar.Content = null; HelpButton helpButton = new HelpButton { MainControl = normal, Margin = new Thickness(4), IsEnabled = false, }.Set(DockPanel.DockProperty, Dock.Right); bar.Content = new DockPanel { Children = { helpButton, wrapPanel } }; helpButton.IsActive = await Server.ReturnAsync((IHelpServer s) => s.HasEntityHelpService(entity.GetType())); helpButton.Checked += async(sender, args) => { var entityHelp = await Server.ReturnAsync((IHelpServer s) => s.GetEntityHelpService(entity.GetType())); SetHelpInfo(normal.Child <EntityTitle>(), entityHelp.Info); var properties = (from control in normal.Children <Control>(p => p.IsSet(Common.PropertyRouteProperty), HelpButton.WhereFlags) let propertyRoute = Common.GetPropertyRoute(control).SimplifyToPropertyOrRoot() where propertyRoute.PropertyRouteType != PropertyRouteType.Root select new { control, propertyRoute }).ToList(); var external = properties.Extract(t => t.propertyRoute.RootType != entity.GetType()); foreach (var t in properties) { SetHelpInfo(t.control, entityHelp.Properties.GetOrThrow(t.propertyRoute)); } var buttonBar = normal.Child <ButtonBar>(); var operations = (from control in buttonBar.Children <ToolBarButton>(p => p.Tag is OperationInfo, HelpButton.WhereFlags) select new { control, operation = ((OperationInfo)control.Tag).OperationSymbol }).ToList(); foreach (var t in operations) { SetHelpInfo(t.control, entityHelp.Operations.GetOrThrow(t.operation)); } var menuInfos = (from c in buttonBar.Children <ToolBarButton>(p => p.ContextMenu != null, HelpButton.WhereFlags) from mi in c.ContextMenu.Children <MenuItem>(p => p.Tag is OperationInfo, HelpButton.WhereFlags) select new { mi, operation = ((OperationInfo)mi.Tag).OperationSymbol }).ToList(); foreach (var t in menuInfos) { SetHelpInfo(t.mi, entityHelp.Operations.GetOrThrow(t.operation)); //ConstructFrom OperationInfo } if (external.Any()) { var externalRoutes = external.Select(a => a.propertyRoute).Distinct().ToList(); var dictionary = await Server.ReturnAsync((IHelpServer s) => s.GetPropertyRoutesService(externalRoutes)); foreach (var t in external) { SetHelpInfo(t.control, dictionary.GetOrThrow(t.propertyRoute)); } } }; helpButton.IsEnabled = true; }
private static void AddToButtonBar(ButtonBar bar, ExplorerBarContainerControl container, ButtonBarItem item) { bar.Groups[0].Items.Add(item); container.Height = bar.Groups[0].Items.Count * 95; }
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// public override void DisableButtons(ButtonBar.ElementTypes elemType) { base.DisableButtons(elemType); EditButton.Enable=false; }
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// public override void EnableButtons(ButtonBar.ElementTypes elemType) { base.EnableButtons(elemType); }
override protected void CreateChildren() { base.CreateChildren(); #region Controls Toolbar toolbar = new Toolbar(); AddChild(toolbar); Button button = new Button { Text = "Add data", SkinClass = typeof(ImageButtonSkin), Icon = ImageLoader.Instance.Load("Icons/add"), AutoRepeat = true }; button.ButtonDown += delegate { _dataProvider.AddItem("data " + _random.Next(1, 100)); }; toolbar.AddContentChild(button); button = new Button { Text = "Previous tab", SkinClass = typeof(ImageButtonSkin), Icon = ImageLoader.Instance.Load("Icons/previous") }; button.Click += delegate { _buttonBar.SelectedIndex--; _viewstack.Previous(); }; toolbar.AddContentChild(button); button = new Button { Text = "Next tab", SkinClass = typeof(ImageButtonSkin), Icon = ImageLoader.Instance.Load("Icons/next") }; button.Click += delegate { _buttonBar.SelectedIndex++; _viewstack.Next(); }; toolbar.AddContentChild(button); #endregion #region Scroller Scroller scroller = new Scroller { SkinClass = typeof (ScrollerSkin2), PercentWidth = 100, PercentHeight = 100 }; //scroller.SetStyle("horizontalScrollPolicy", ScrollPolicy.On); //scroller.SetStyle("verticalScrollPolicy", ScrollPolicy.On); AddChild(scroller); Group viewport = new Group { MouseEnabled = true, Layout = new VerticalLayout { HorizontalAlign = HorizontalAlign.Left, PaddingLeft = 10, PaddingRight = 10, PaddingTop = 10, PaddingBottom = 10, Gap = 10 } }; scroller.Viewport = viewport; #endregion List<object> source = new List<object> { "Failure", "Teaches", "Success", "One", "Two", "Three", "Four", "Five", "Six" }; _dataProvider = new ArrayList(source); viewport.AddChild(new Label {Text = "ButtonBar:"}); #region Button bar _buttonBar = new ButtonBar { DataProvider = new ArrayList(new List<object> {"List 1", "List 2", "List 3", "List 4", "List 5"}), SkinClass = typeof(ButtonBarSkin2), RequireSelection = true }; _buttonBar.AddEventListener(Event.CHANGE, delegate(Event e) { IndexChangeEvent ice = e as IndexChangeEvent; if (null != ice) { int newIndex = ice.NewIndex; //Debug.Log("Changed to: " + newIndex); _viewstack.SelectedIndex = newIndex; } }); viewport.AddChild(_buttonBar); #endregion #region ViewStack viewport.AddChild(new Label { Text = "ViewStack (having 5 lists as children):" }); _viewstack = new ViewStack { ResizeToContent = true }; viewport.AddChild(_viewstack); #endregion /* Factory is used for creating renderer instances */ var factory = new ItemRendererFactory<DefaultItemRenderer>(); /* LISTS */ #region List 1 List list = new List { Id = "list1", //Layout = new TileLayout { RequestedColumnCount = 4 }, Width = 200, Height = 200, DataProvider = _dataProvider, //ItemRenderer = new ItemRendererFactory <DefaultItemRenderer>(), /* ItemRendererFunction is used for switching between different factories, based on the supplied item */ ItemRendererFunction = delegate { return factory; } }; _viewstack.AddChild(list); #endregion #region List 2 list = new List { Id = "list2", //Layout = new TileLayout { RequestedColumnCount = 3 }, Width = 200, Height = 245, DataProvider = _dataProvider, //ItemRenderer = new ItemRendererFactory <DefaultItemRenderer>(), ItemRendererFunction = delegate { return factory; } }; _viewstack.AddChild(list); #endregion #region List 3 list = new List { Id = "list3", Width = 400, Height = 450, DataProvider = _dataProvider, SkinClass = typeof(ListSkin2), ItemRenderer = new ItemRendererFactory<BigItemRenderer>() }; _viewstack.AddChild(list); #endregion #region List 4 list = new List { Id = "list4", Width = 600, Height = 800, Layout = new TileLayout { HorizontalGap = 0, VerticalGap = 0, RequestedRowCount = 4, RequestedColumnCount = 3 }, DataProvider = _dataProvider, SkinClass = typeof(ListSkin2), ItemRenderer = new ItemRendererFactory<BigItemRenderer>() }; _viewstack.AddChild(list); #endregion #region List 5 (horizontal) list = new List { Id = "list5", Width = 800, Height = 100, Layout = new HorizontalLayout { Gap = 0, RequestedColumnCount = 3 }, DataProvider = _dataProvider, SkinClass = typeof(ListSkin2), ItemRenderer = new ItemRendererFactory<BigItemRenderer>() }; _viewstack.AddChild(list); #endregion #region Process renderer click AddEventListener(BigItemRenderer.ADD_BUTTON_CLICKED, delegate(Event e) { IItemRenderer itemRenderer = (IItemRenderer)e.Target; Alert.Show("Info", itemRenderer.Data.ToString(), AlertButtonFlag.Ok, new AlertOption(AlertOptionType.HeaderIcon, ImageLoader.Instance.Load("Icons/information"))); }); #endregion }
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// public virtual void DisableButtons(ButtonBar.ElementTypes elemType) { LeftButtonBar.DisableButtons(); //if(elemType==ButtonBar.ElementTypes.blocks){ PlayButton.Enable=false; //} }
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// public virtual void EnableButtons(ButtonBar.ElementTypes elemType) { LeftButtonBar.EnableButtons(); if(elemType==ButtonBar.ElementTypes.blocks){ PlayButton.Enable=true; } }
private void closebutton(object obj) { ButtonBar.initBar(); }
private static void ClearButtonBar(ButtonBar buttonBar, ExplorerBarContainerControl containerControl) { buttonBar.Groups[0].Items.Clear(); containerControl.Height = 64; }
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// void Init() { if(!bInit){ mButtonBar = transform.parent.GetComponent<ButtonBar>(); if(mButtonBar!=null){ mGUIManager = mButtonBar.mGUIManager; }else{ mGUIManager = transform.parent.GetComponent<GUIManager>(); } SetCallback(); bInit=true; } }
/// <summary> /// Updates the camera by following the rectangle given in a smooth manner. /// </summary> /// <param name="rectangle"></param> /// <param name="width"></param> /// <param name="height"></param> /// <param name="active">Should the camera follow the rectangle.</param> public void UpdateSmoothly(Rectangle rectangle, int width, int height, bool active) { Vector3 currentLeftCorner; // If the camera is not active, which is used to show the player is dead, the camera stops moving. if (active) { Vector2 playerPos = new Vector2(rectangle.X + rectangle.Width / 2, rectangle.Y + rectangle.Height / 2); currentLeftCorner = new Vector3(-playerPos.X + _defRes.X / _zoom / 2, -playerPos.Y + (3 * _defRes.Y / _zoom / 5), 0); } else { currentLeftCorner = LastCameraLeftCorner; } if (LockedX) { currentLeftCorner.X = LastCameraLeftCorner.X; } if (LockedY) { currentLeftCorner.Y = LastCameraLeftCorner.Y; } if (RestricedToGameWorld) { if (currentLeftCorner.X > 0) { currentLeftCorner.X = 0; } if (currentLeftCorner.X < -(width * TMBAW_Game.Tilesize - _defRes.X)) { currentLeftCorner.X = -(width * TMBAW_Game.Tilesize - _defRes.X); } if (currentLeftCorner.Y > 0) { currentLeftCorner.Y = 0; } if (currentLeftCorner.Y < -(height * TMBAW_Game.Tilesize - _defRes.Y)) { currentLeftCorner.Y = -(height * TMBAW_Game.Tilesize - _defRes.Y); } } if (InputSystem.IsKeyDown(Keys.OemMinus)) { ButtonBar.MinusButton_MouseClicked(null); } if (InputSystem.IsKeyDown(Keys.OemPlus)) { ButtonBar.PlusButton_MouseClicked(null); } if (InputSystem.IsKeyDown(Keys.R)) { ResetZoom(); } Velocity = (currentLeftCorner - LastCameraLeftCorner) / 5; Vector3 cameraLeftCorner = LastCameraLeftCorner; // Used if the camera zoom changed. if (_updateInstantly) { cameraLeftCorner = currentLeftCorner; _updateInstantly = false; } else { cameraLeftCorner += Velocity; } CenterGameCoords = new Vector2(-currentLeftCorner.X, -currentLeftCorner.Y); LeftTopGameCoords = CenterGameCoords; CenterGameCoords.X += TMBAW_Game.DefaultResWidth / 2; CenterGameCoords.Y += TMBAW_Game.DefaultResHeight * 2 / 3; TileIndex = (int)((int)CenterGameCoords.Y / TMBAW_Game.Tilesize * GameWorld.WorldData.LevelWidth) + (int)((int)CenterGameCoords.X / TMBAW_Game.Tilesize); LastCameraLeftCorner = cameraLeftCorner; _lastVelocity = Velocity; int shakeOffset = 1; if (_shakeTimer.TimeElapsedInMilliSeconds < 100) { switch (TMBAW_Game.Random.Next(0, 5)) { case 0: cameraLeftCorner.X += shakeOffset; break; case 1: cameraLeftCorner.X -= shakeOffset; break; case 2: cameraLeftCorner.Y += shakeOffset; break; case 3: cameraLeftCorner.Y -= shakeOffset; break; } } //cameraLeftCorner = new Vector3(DrawRectangle.X, DrawRectangle.Y, 0); cameraLeftCorner = new Vector3((int)cameraLeftCorner.X, (int)cameraLeftCorner.Y, 0); _translation = Matrix.CreateTranslation(cameraLeftCorner) * Matrix.CreateScale(new Vector3(_zoom, _zoom, 0)); HalfTranslate = Matrix.CreateTranslation(cameraLeftCorner * 2); }
protected virtual void ShowBorders() { ButtonBar.ShowBorders = !ButtonBar.ShowBorders; ButtonBar.Invalidate(); RefreshComponent(); }
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// void Init() { mBasicButton = GetComponent<BasicButton>(); mButtonBar = mBasicButton.mButtonBar; bInit=true; }
NSToolbarItem CreateButtonBarToolbarItem () { var bar = new ButtonBar (barItems); buttonBarCache.Add (bar); // Note: We're leaving a 1 dead pixel size here because Apple bug // on Yosemite. Segmented controls have 3px padding on left and right // on Mavericks. nfloat size = 6 + 33 * bar.SegmentCount; // By default, Cocoa doesn't want to duplicate items in the toolbar. // Use different Ids to prevent this and not have to subclass. var item = new NSToolbarItem (ButtonBarId + buttonBarCount) { View = bar, MinSize = new CGSize (size, bar.FittingSize.Height), MaxSize = new CGSize (size, bar.FittingSize.Height), }; bar.ResizeRequested += (o, e) => { nfloat resize = 6 + 33 * bar.SegmentCount; item.MinSize = new CGSize (resize, bar.FittingSize.Height); item.MaxSize = new CGSize (resize, bar.FittingSize.Height); selector.RequestResize (); centeringSpace.UpdateWidth (); }; return item; }
/// <summary> /// Initializes a new instance of <see cref="DrawBackGroundEventArgs"/> with supplied arguments. /// </summary> /// <param name="graphics">Graphics surface where drawing has to be done.</param> /// <param name="bounds"><see cref="ButtonBar"/> control's boundry.</param> /// <param name="appearance">Appearance of current <see cref="ButtonBar"/></param> /// <param name="bar">Related <see cref="ButtonBar"/></param> public DrawBackGroundEventArgs(Graphics graphics, Rectangle bounds, AppearanceBar appearance, ButtonBar bar) { Graphics = graphics; Bounds = bounds; Appearance = appearance; Bar = bar; }