public override UITableViewCell GetCell(UITableView tableView, NSIndexPath indexPath) { DataListViewCell cell = (DataListViewCell)tableView.DequeueReusableCell("AvailableViewDataSourceCell"); if (cell == null) { cell = new DataListViewCell(UITableViewCellStyle.Default, "AvailableViewDataSourceCell"); } SkillValue v = state._CurrentSkills[indexPath.Row]; cell.TextLabel.Text = v.FullName; cell.TextLabel.Font = UIFont.SystemFontOfSize(16f); cell.Data = v; GradientButton b = new GradientButton(); var man = new ButtonPropertyManager(b, state.DialogParent, v, "Mod"); man.FormatDelegate = a => ((int)a).PlusFormat(); state._SkillModManagers[indexPath.Row] = man; b.SetSize(65, 22); cell.AccessoryView = b; return(cell); }
public override UITableViewCell GetCell(UITableView tableView, NSIndexPath indexPath) { DataListViewCell cell = (DataListViewCell)tableView.DequeueReusableCell("AvailableFeatsViewCell"); if (cell == null) { cell = new DataListViewCell(UITableViewCellStyle.Default, "AvailableFeatsViewCell"); } Feat f = state._FilteredFeats[indexPath.Row]; GradientButton addButton = new GradientButton(); addButton.Bounds = new CGRect(0, 0, 100, 24); addButton.SetText("Add"); addButton.SetImage(UIExtensions.GetSmallIcon("prev"), UIControlState.Normal); addButton.ImageEdgeInsets = new UIEdgeInsets(0, 0, 0, 5); addButton.TouchUpInside += (sender, e) => state.AddClicked(f); addButton.TitleLabel.Font = UIFont.SystemFontOfSize(15); addButton.CornerRadius = 3.0f; cell.AccessoryView = addButton; cell.TextLabel.Text = f.Name; cell.TextLabel.Font = UIFont.SystemFontOfSize(15); return(cell); }
private void BuildFilters() { float locX = 0; float locY = 5; float bHeight = 30; float marginX = 10; GradientButton b; //group filter b = new GradientButton(); StyleFilterButton(b); b.Frame = new CGRect(locX, locY, 120, bHeight); locX += (float)b.Frame.Width + marginX; b.SetText(AllGroupText); _GroupFilterPopover = new ButtonStringPopover(b); _GroupFilterPopover.Items.Add(new ButtonStringPopoverItem() { Text = AllGroupText, Tag = null }); foreach (string s in MagicItem.Groups) { _GroupFilterPopover.Items.Add(new ButtonStringPopoverItem() { Text = s, Tag = s }); } _GroupFilterPopover.SetButtonText = true; _GroupFilterPopover.ItemClicked += HandleTypeFilterItemClicked;; _GroupFilterButton = b; FilterView.AddSubview(b); //cl filter b = new GradientButton(); StyleFilterButton(b); b.Frame = new CGRect(locX, locY, 75, bHeight); locX += (float)b.Frame.Width + marginX; b.SetText(AllCLText); _CLFilterPopover = new ButtonStringPopover(b); _CLFilterPopover.Items.Add(new ButtonStringPopoverItem() { Text = AllCLText, Tag = null }); foreach (int x in MagicItem.CLs) { _CLFilterPopover.Items.Add(new ButtonStringPopoverItem() { Text = "CL " + x.PastTense(), Tag = new int?(x) }); } _CLFilterPopover.SetButtonText = true; _CLFilterPopover.ItemClicked += HandleCLFilterItemClicked; _CLFilterButton = b; FilterView.AddSubview(b); }
void StylePadButton(GradientButton button) { button.CornerRadius = 0; button.SetTitleColor(UIColor.White, UIControlState.Normal); button.Gradient = new GradientHelper(CMUIColors.SecondaryColorAMedium, CMUIColors.SecondaryColorADarker); }
void HandleOtherPopoverItemClicked(object sender, ButtonStringPopover.PopoverEventArgs e) { ButtonStringPopover popover = (ButtonStringPopover)sender; GradientButton b = (GradientButton)popover.Button; switch (template) { case AdvancerTemplate.HalfDragon: _DragonColor = (string)e.Tag; break; case AdvancerTemplate.Skeleton: _SelectedSkeletonTypes[b.Tag] = (bool)e.Tag; break; case AdvancerTemplate.HalfCelestial: case AdvancerTemplate.HalfFiend: _SelectedStats[b.Tag] = (bool)e.Tag; break; case AdvancerTemplate.Zombie: _ZombieType = (Monster.ZombieType)e.Tag; break; } HandleChange(); }
private void BuildFilters() { float locX = 0; float locY = 5; float bHeight = 30; float marginX = 10; GradientButton b; //type filter b = new GradientButton(); StyleFilterButton(b); b.Frame = new CGRect(locX, locY, 220, bHeight); locX += (float)b.Frame.Width + marginX; b.SetText(AllTypeText); typePopover = new ButtonStringPopover(b); typePopover.Items.Add(new ButtonStringPopoverItem() { Text = AllTypeText }); foreach (String type in Rule.Types) { typePopover.Items.Add(new ButtonStringPopoverItem() { Text = type.Capitalize(), Tag = type }); } typePopover.SetButtonText = true; typePopover.ItemClicked += HandleTypePopoverItemClicked; typeFilterButton = b; typeFilterButton.Hidden = false; FilterView.AddSubview(b); //subtype filter b = new GradientButton(); StyleFilterButton(b); b.Frame = new CGRect(locX, locY, 100, bHeight); locX += (float)b.Frame.Width + marginX; b.SetText(AllSubtypeText); subtypePopover = new ButtonStringPopover(b); subtypePopover.Items.Add(new ButtonStringPopoverItem() { Text = AllSubtypeText }); subtypePopover.SetButtonText = true; subtypePopover.ItemClicked += HandleSubtypePopoverItemClicked; subtypeFilterButton = b; subtypeFilterButton.Hidden = true; FilterView.AddSubview(b); }
partial void OKClicked(GradientButton sender) { ImportExportComplete?.Invoke(this, new ImportExportDialogEventArgs() { Data = Results }); this.View.RemoveFromSuperview(); }
public static void StyleStandardButton(this GradientButton b) { b.BorderColor = UIExtensions.RGBColor(0xFFFFFF); b.SetTitleColor(UIColor.White, UIControlState.Normal); b.SetTitleColor(UIColor.DarkGray, UIControlState.Highlighted); b.Border = 2; b.DisabledGradient = new GradientHelper(0xFF999999.UIColor(), 0xFF555555.UIColor()); }
public LookupTab(CombatState state) : base(state) { BackgroundColor = CMUIColors.PrimaryColorDark; listTable = new UITableView(); listTable.Delegate = new TableDelegate(this); listTable.DataSource = new TableSource(this); AddSubview(listTable); filterField = new UITextField(new CGRect(0, 0, 100, 23)); filterField.BorderStyle = UITextBorderStyle.RoundedRect; filterField.EditingChanged += HandleFilterFieldEditingChanged; filterField.AllEditingEvents += HandleFilterFieldAllEditingEvents; filterField.ClearButtonMode = UITextFieldViewMode.Always; AddSubview(filterField); filterText = ""; _FilterView = new UIView(new CGRect(0, 0, 100, 0)); _FilterView.BackgroundColor = CMUIColors.PrimaryColorDark; AddSubview(_FilterView); _ResetButton = new GradientButton(); _ResetButton.TouchUpInside += Handle_ResetButtonTouchUpInside; _ResetButton.SetImage(UIExtensions.GetSmallIcon("reset"), UIControlState.Normal); _FilterView.AddSubview(_ResetButton); if (ShowSideBar) { _SideTabBar = new SideTabBar(); _SideTabBar.TabSelected += HandleTabSelected; _SideTabBar.Hidden = true; _SideTabBar.AddTab(new SideTab { Name = DefaultTabName, Tag = null, Icon = DefaultTabImage }); Add(_SideTabBar); List <LookupSideTabItem> tabItems = LoadTabItems(); if (tabItems != null) { foreach (LookupSideTabItem item in tabItems) { _SideTabBar.AddTab(new SideTab { Name = item.Name, Tag = item, Icon = item.Icon }); } } } Filter(); webView = new UIWebView(new CGRect(100, 0, 100, 100)); AddSubview(webView); if (currentViewItems.Count > 0) { SetSelectedItem(0); } }
void UpdateConditionDisplay() { if (View != null) { foreach (GradientButton b in ConditionButtons) { b.RemoveFromSuperview(); } ConditionButtons.Clear(); float xLoc = ConditionMargin; float yLoc = 79 + ConditionMargin; foreach (ActiveCondition c in _Character.Monster.ActiveConditions) { GradientButton b = new GradientButton(); b.Frame = new CGRect(xLoc, yLoc, ConditionWidth, ConditionHeight); b.SetImage(UIExtensions.GetSmallIcon(c.Condition.Image), UIControlState.Normal); View.AddSubview(b); if (c.Turns != null) { b.SetText(c.Turns.ToString()); } b.Data = c; c.PropertyChanged += delegate(object sender, PropertyChangedEventArgs e) { if (e.PropertyName == "Turns") { string text = ""; if (c.Turns != null) { text = c.Turns.ToString(); } b.SetText(text); b.TitleLabel.AdjustsFontSizeToFitWidth = true; } }; ButtonStringPopover p = new ButtonStringPopover(b); BuildConditionMenu(p, c); xLoc += ConditionWidth + ConditionMargin; if (xLoc + ConditionWidth > View.Bounds.Width) { xLoc = ConditionMargin; yLoc += ConditionHeight + ConditionMargin; } UIWebView v = new UIWebView(new CGRect(0, 0, 300, 300)); v.LoadHtmlString(ConditionViewController.ConditionHTML(c.Condition), new NSUrl("http://localhost/")); p.AccessoryView = v; } } }
public static void TextFieldStyle(GradientButton b, float fontsize = 15.0f) { b.SetTitleColor(UIColor.Black, UIControlState.Normal); b.BorderColor = 0xFF777777.UIColor(); b.Gradient = new GradientHelper(0xFFFFFFFF.UIColor()); b.TitleLabel.Font = UIFont.SystemFontOfSize(fontsize); b.TitleLabel.LineBreakMode = UILineBreakMode.TailTruncation; AlignButtonLeft(b); b.CornerRadius = 3.0f; }
void HandleBTouchUpInside(object sender, EventArgs e) { clickedButton.Gradient = new GradientHelper(CMUIColors.PrimaryColorMedium, CMUIColors.PrimaryColorDarker); clickedButton = (GradientButton)sender; if (ButtonClicked != null) { ButtonClicked(this, (int)((UIButton)sender).Tag); } clickedButton.Gradient = new GradientHelper(CMUIColors.PrimaryColorDarker, CMUIColors.PrimaryColorMedium); }
public override UITableViewCell GetCell(UITableView tableView, NSIndexPath indexPath) { DataListViewCell cell = (DataListViewCell)tableView.DequeueReusableCell("HDEditorDialogCell"); if (cell == null) { cell = new DataListViewCell(UITableViewCellStyle.Default, "HDEditorDialogCell"); } DieStep step = state._DieSteps[indexPath.Row]; UIView buttonView = new UIView(new CGRect(0, 0, bWidth * 4 + 1, bHeight)); GradientButton b = new GradientButton(); b.SetText(step.Count.ToString()); StyleButton(b); b.Frame = new CGRect(0, 0, bWidth, bHeight); b.TouchUpInside += HandleCountTouchUpInside; b.Tag = indexPath.Row; buttonView.AddSubview(b); UILabel l = new UILabel(new CGRect(bWidth, 0, bWidth, bHeight)); l.Text = "d"; l.TextAlignment = UITextAlignment.Center; l.BackgroundColor = UIColor.Clear; buttonView.AddSubview(l); b = new GradientButton(); b.SetText(step.Die.ToString()); StyleButton(b); b.Frame = new CGRect(bWidth * 2, 0, bWidth, bHeight); b.TouchUpInside += HandleDieTouchUpInside; b.Tag = indexPath.Row; buttonView.AddSubview(b); b = new GradientButton(); b.SetImage(UIExtensions.GetSmallIcon("delete"), UIControlState.Normal); StyleButton(b); b.Frame = new CGRect(bWidth * 3, 0, bWidth + 1, bHeight); buttonView.AddSubview(b); b.Tag = indexPath.Row; b.TouchUpInside += HandleDeleteTouchUpInside; cell.AccessoryView = buttonView; cell.Data = state._DieSteps[indexPath.Row]; //cell.TextLabel.Text = state._DieSteps.ToString(); return(cell); }
private void StyleButton(GradientButton button) { button.CornerRadius = 0; button.SetTitleColor(UIColor.White, UIControlState.Normal); button.SetTitleColor(UIColor.Black, UIControlState.Selected); button.TitleLabel.Font = UIFont.BoldSystemFontOfSize(17f); button.TitleLabel.AdjustsFontSizeToFitWidth = true; button.TitleLabel.MinimumFontSize = 14f; button.Gradient = new GradientHelper(CMUIColors.SecondaryColorADark, CMUIColors.SecondaryColorADarker); }
void SetClickedButtonGradients(GradientButton b) { if (clickedButton != null) { clickedButton.Gradient = new GradientHelper(CMUIColors.PrimaryColorMedium, CMUIColors.PrimaryColorDarker); } clickedButton = b; if (clickedButton != null) { clickedButton.Gradient = new GradientHelper(CMUIColors.PrimaryColorDarker, CMUIColors.PrimaryColorMedium); } }
partial void DeleteClicked(GradientButton sender) { if (_SelectedCondition.Custom) { Condition.CustomConditions.Remove(_SelectedCondition); Condition.SaveCustomConditions(); _VisibleConditions.Remove(_SelectedCondition); RebuildConditionList(); SelectionTable.ReloadData(); UpdateConditionDisplay(); } }
public SpecialAbilityView(Monster monster, SpecialAbility ability) { _Monster = monster; _Ability = ability; BackgroundColor = UIColor.Clear; BorderColor = 0xFFFFFFFF.UIColor(); Border = 2.0f; Gradient = new GradientHelper(CMUIColors.PrimaryColorDark); _DeleteButton = new UIButton(); _DeleteImage = UIImage.FromFile("Images/External/redx.png"); _DeleteButton.SetImage(_DeleteImage, UIControlState.Normal); _DeleteButton.TouchUpInside += delegate { _Monster.SpecialAbilitiesList.Remove(_Ability); }; _SpecialTextButton = new GradientButton(); _SpecialTextButton.SetTitleColor(0x00000000.UIColor(), UIControlState.Normal); _SpecialTextManager = new ButtonPropertyManager(_SpecialTextButton, MainUI.MainView, _Ability, "Text") { Multiline = true }; _Manager.Add(_SpecialTextManager); _NameButton = new GradientButton(); CMStyles.TextFieldStyle(_NameButton); _Manager.Add(new ButtonPropertyManager(_NameButton, MainUI.MainView, _Ability, "Name")); _TypeButton = new GradientButton(); ButtonPropertyManager typeMan = new ButtonPropertyManager(_TypeButton, MainUI.MainView, _Ability, "Type"); typeMan.ValueList = new List <KeyValuePair <object, string> > { new KeyValuePair <object, string>("Ex", "Ex"), new KeyValuePair <object, string>("Sp", "Sp"), new KeyValuePair <object, string>("Su", "Su"), new KeyValuePair <object, string>("", "-"), }; _Manager.Add(typeMan); Add(_DeleteButton); Add(_NameButton); Add(_TypeButton); Add(_SpecialTextButton); LayoutSubviews(); }
void HandleDieSwipe(UISwipeGestureRecognizer rec) { GradientButton b = _Recs[rec]; _BottomView.BringSubviewToFront(b); int value = (int)b.Tag; DieRoll r = DieRoll.FromString("1d" + value); SlideView(b, true); AddRoll(r); }
public static void StyleSideTab(this GradientButton button, bool selected) { button.Border = 2; button.CornerRadii = new float[] { 16, 4, 0, 0 }; if (selected) { button.Gradient = new GradientHelper(CMUIColors.PrimaryColorDarker, CMUIColors.PrimaryColorMedium); } else { button.Gradient = new GradientHelper(CMUIColors.PrimaryColorMedium, CMUIColors.PrimaryColorDarker); } button.BorderColor = 0xFFFFFFFF.UIColor(); }
private void StyleTabButton(GradientButton button, bool selected) { button.Border = 0; if (selected) { button.Gradient = new GradientHelper(CMUIColors.PrimaryColorDark, CMUIColors.PrimaryColorMedium); } else { button.Gradient = new GradientHelper(CMUIColors.PrimaryColorMedium, CMUIColors.PrimaryColorDark); } button.CornerRadius = 2.0f; }
private void InitButtonTouchUpInside(object sender, EventArgs e) { GradientButton b = (GradientButton)sender; Character ch = (Character)b.Data; if (ch != null) { NumberModifyPopover pop = new NumberModifyPopover(); pop.ShowOnView((UIView)sender); pop.Value = ch.CurrentInitiative; pop.ValueType = "CurrentInit"; pop.Data = ch; pop.ValueFormat = "Initiative: {0}"; pop.NumberModified += HandleInitPopNumberModified; } }
public void StyleButton(GradientButton button, bool selected) { button.SetTitleColor(UIColor.White, UIControlState.Normal); UIColor color1 = CMUIColors.PrimaryColorDarker; UIColor color2 = CMUIColors.PrimaryColorLight; if (selected) { button.Gradient = new GradientHelper(color1, color2); button.SetTitleColor(UIColor.White, UIControlState.Normal); } else { button.Gradient = new GradientHelper(UIExtensions.RGBColor(0xEEEEEE), UIExtensions.RGBColor(0xEEEEEE)); button.SetTitleColor(UIExtensions.ARGBColor(0xFF999999), UIControlState.Normal); } }
void TabButtonClicked(object sender, EventArgs e) { if (_SelectedTab != sender) { _SelectedTab = (GradientButton)sender; StyleTabs(); if (TabSelected != null) { TabSelected(this, new SideTabEventArgs() { Tab = (SideTab)((GradientButton)sender).Data }); } } }
public static void MakeCheckButtonStyle(this GradientButton button, bool isChecked) { button.HorizontalAlignment = UIControlContentHorizontalAlignment.Left; button.ImageEdgeInsets = new UIEdgeInsets(0, 6, 0, 12); UIEdgeInsets s = button.TitleEdgeInsets; s.Left = 12; button.TitleEdgeInsets = s; if (isChecked) { button.SetImage(UIImage.FromFile("Images/External/CheckBox.png"), UIControlState.Normal); } else { button.SetImage(UIImage.FromFile("Images/External/CheckBoxUnchecked.png"), UIControlState.Normal); } }
private void StyleTab(GradientButton b, bool selected) { b.CornerRadius = 0; UIColor colorA = CMUIColors.PrimaryColorDarker; UIColor colorB = CMUIColors.PrimaryColorMedium; if (selected) { b.Gradient = new GradientHelper(colorA, colorB); } else { b.Gradient = new GradientHelper(colorB, colorA); } b.SetTitleColor(UIColor.White, UIControlState.Normal); b.SetTitleColor(UIColor.Gray, UIControlState.Highlighted); }
void HandleInitPopNumberModified(object sender, NumberModifyEventArgs args) { NumberModifyPopover pop = (NumberModifyPopover)sender; GradientButton b = (GradientButton)pop.ParentView; Character ch = (Character)pop.Data; if (args.Set) { ch.CurrentInitiative = args.Value.Value; } else { ch.CurrentInitiative += args.Value.Value; } pop.Value = ch.CurrentInitiative; b.SetText(ch.CurrentInitiative.ToString()); }
public override UITableViewCell GetCell(UITableView tableView, NSIndexPath indexPath) { DataListViewCell cell = (DataListViewCell)tableView.DequeueReusableCell("CurrentFeatsViewCell"); if (cell == null) { cell = new DataListViewCell(UITableViewCellStyle.Default, "CurrentFeatsViewCell"); } Spell.SpellAdjuster.LevelAdjusterInfo info = state._spell.Adjuster.Levels[indexPath.Row]; cell.TextLabel.Text = info.Class; cell.TextLabel.Font = UIFont.SystemFontOfSize(15); GradientButton b = new GradientButton(); b.Frame = new CGRect(0, 3, 160, 22); b.TitleLabel.Font = UIFont.SystemFontOfSize(15); CMStyles.TextFieldStyle(b); b.SetText(info.Class); b.TouchUpInside += (sender, e) => state.SpellLevelClicked(info); UIView view = new UIView(); UIButton x = new UIButton(); UIImage redx = UIImage.FromFile("Images/External/redx.png"); x.SetImage(redx, UIControlState.Normal); x.Frame = new CGRect(165, 0, redx.Size.Width, redx.Size.Height); x.TouchUpInside += (sender, e) => state.DeleteLevelClicked(info); view.Bounds = new CGRect(0, 0, x.Frame.Right, x.Frame.Bottom); view.Add(b); view.Add(x); cell.AccessoryView = view; return(cell); }
public void RemoveTab(SideTab tab) { int index = _Tabs.IndexOf(tab); if (index != -1) { GradientButton b = _Buttons[index]; _Tabs.RemoveAt(index); _Buttons.RemoveAt(index); if (b == _SelectedTab) { _SelectedTab = null; if (_Tabs.Count > 0) { int newTab = Math.Max(0, index--); _SelectedTab = _Buttons[newTab]; } } } }
public void InsertTab(int index, SideTab tab) { if (!_Tabs.Contains(tab)) { GradientButton b = new GradientButton(); b.SetText(tab.Name); b.SetImage(tab.Icon, UIControlState.Normal); b.Data = tab; b.CornerRadii = new float[] { 16, 4, 0, 0 }; b.ImageEdgeInsets = new UIEdgeInsets(0, 0, 0, 5); b.TitleLabel.AdjustsFontSizeToFitWidth = true; b.TouchUpInside += TabButtonClicked; Add(b); _Tabs.Insert(index, tab); _Buttons.Insert(index, b); if (_SelectedTab == null) { _SelectedTab = b; } StyleTabs(); } }
private void BuildFilters() { float locX = 0; float locY = 5; float bHeight = 30; float marginX = 10; GradientButton b; //type filter b = new GradientButton(); StyleFilterButton(b); b.Frame = new CGRect(locX, locY, 100, bHeight); locX += (float)b.Frame.Width + marginX; b.SetText(AllTypesText); typeFilterPopover = new ButtonStringPopover(b); typeFilterPopover.Items.Add(new ButtonStringPopoverItem() { Text = AllTypesText, Tag = null }); foreach (String s in Feat.FeatTypes) { typeFilterPopover.Items.Add(new ButtonStringPopoverItem() { Text = s, Tag = s }); } typeFilterPopover.SetButtonText = true; typeFilterPopover.ItemClicked += HandleTypeFilterPopoverItemClicked;; typeFilterButton = b; FilterView.AddSubview(b); b = new GradientButton(); StyleDBButton(b); b.Frame = new CGRect(locX, locY, 90, bHeight); locX += (float)b.Frame.Width + marginX; b.SetText("New"); b.TouchUpInside += NewButtonClicked; FilterView.AddSubview(b); b = new GradientButton(); StyleDBButton(b); b.Frame = new CGRect(locX, locY, 90, bHeight); locX += (float)(b.Frame.Width + marginX); b.SetText("Customize"); b.TouchUpInside += CustomizeButtonClicked; FilterView.AddSubview(b); b = new GradientButton(); StyleDBButton(b); b.Frame = new CGRect(locX, locY, 90, bHeight); locX += (float)b.Frame.Width + marginX; b.SetText("Edit"); b.TouchUpInside += EditButtonClicked; FilterView.AddSubview(b); editButton = b; b = new GradientButton(); StyleDBButton(b); b.Frame = new CGRect(locX, locY, 90, bHeight); locX += (float)b.Frame.Width + marginX; b.SetText("Delete"); b.TouchUpInside += DeleteButtonClicked; FilterView.AddSubview(b); deleteButton = b; }