void ApplyBarItemColors(EToolbarItem item, BarItemColorType type, EColor color) { if (color.IsDefault) { ClearBarItemColors(item, type); } else { switch (type) { case BarItemColorType.Background: item.SetBackgroundColor(color); break; case BarItemColorType.Text: item.SetTextColor(color); break; case BarItemColorType.SelectedTab: item.SetSelectedTabColor(color); break; case BarItemColorType.UnselectedTab: item.SetUnselectedTabColor(color); break; default: break; } } }
void ClearBarItemColors(EToolbarItem item, BarItemColorType type) { switch (type) { case BarItemColorType.Background: item.DeletePartColor("bg"); break; case BarItemColorType.Text: if (string.IsNullOrEmpty(item.Icon)) { item.DeletePartColor("text"); item.DeletePartColor("text_pressed"); item.DeletePartColor("text_selected"); } else { item.DeletePartColor("text_under_icon"); item.DeletePartColor("text_under_icon_pressed"); item.DeletePartColor("text_under_icon_selected"); } item.DeletePartColor("underline"); break; case BarItemColorType.SelectedTab: if (string.IsNullOrEmpty(item.Icon)) { item.DeletePartColor("text_selected"); } else { item.DeletePartColor("text_under_icon_selected"); item.DeletePartColor("icon_selected"); } item.DeletePartColor("underline"); break; case BarItemColorType.UnselectedTab: if (string.IsNullOrEmpty(item.Icon)) { item.DeletePartColor("text"); item.DeletePartColor("text_pressed"); } else { item.DeletePartColor("text_under_icon"); item.DeletePartColor("text_under_icon_pressed"); item.DeletePartColor("icon"); item.DeletePartColor("icon_pressed"); } break; default: break; } }
void ClearBarItemColors(EToolbarItem item, BarItemColorType type) { switch (type) { case BarItemColorType.Background: item.DeleteBackgroundColor(); break; case BarItemColorType.Text: item.DeleteTextColor(); break; case BarItemColorType.SelectedTab: item.DeleteSelectedTabColor(); break; case BarItemColorType.UnselectedTab: item.DeleteUnselectedTabColor(); break; default: break; } }
void ApplyBarItemColors(EToolbarItem item, BarItemColorType type, EColor color) { if (color.IsDefault) { ClearBarItemColors(item, type); } else { switch (type) { case BarItemColorType.Background: item.SetPartColor("bg", color); break; case BarItemColorType.Text: if (string.IsNullOrEmpty(item.Icon)) { item.SetPartColor("text", color); item.SetPartColor("text_pressed", color); item.SetPartColor("text_selected", color); } else { item.SetPartColor("text_under_icon", color); item.SetPartColor("text_under_icon_pressed", color); item.SetPartColor("text_under_icon_selected", color); } item.SetPartColor("underline", color); break; case BarItemColorType.SelectedTab: if (string.IsNullOrEmpty(item.Icon)) { item.SetPartColor("text_selected", color); } else { item.SetPartColor("text_under_icon_selected", color); item.SetPartColor("icon_selected", color); } item.SetPartColor("underline", color); break; case BarItemColorType.UnselectedTab: if (string.IsNullOrEmpty(item.Icon)) { item.SetPartColor("text", color); item.SetPartColor("text_pressed", color); } else { item.SetPartColor("text_under_icon", color); item.SetPartColor("text_under_icon_pressed", color); item.SetPartColor("icon", color); item.SetPartColor("icon_pressed", color); } break; default: break; } } }