private static void PlatformInit() { Linux = true; _theme = IconTheme.Default; var iconMissing = _theme.LoadIcon("dialog-error", 16, 0); var file = _theme.LoadIcon("text-x-generic", 16, 0); var fileMissing = file.Copy(); iconMissing.Composite(fileMissing, 8, 8, 8, 8, 8, 8, 0.5, 0.5, Gdk.InterpType.Tiles, 255); var folder = _theme.LoadIcon("folder", 16, 0); var folderMissing = folder.Copy(); iconMissing.Composite(folderMissing, 8, 8, 8, 8, 8, 8, 0.5, 0.5, Gdk.InterpType.Tiles, 255); _files["."] = ToEtoImage(file); _fileMissing = ToEtoImage(fileMissing); _folder = ToEtoImage(folder); _folderMissing = ToEtoImage(folderMissing); _xwtFiles["."] = ToXwtImage(file); _xwtFileMissing = ToXwtImage(fileMissing); _xwtFolder = ToXwtImage(folder); _xwtFolderMissing = ToXwtImage(folderMissing); if (Gtk.Global.MajorVersion >= 3 && Gtk.Global.MinorVersion >= 16) { _app = new Application(null, GLib.ApplicationFlags.None); _app.Register(GLib.Cancellable.Current); UseHeaderBar = Gtk3Wrapper.gtk_application_prefers_app_menu(_app.Handle); } }
public ImageSource TryGetImage(IconId iconId, IconTheme theme, IThemedIconManagerPerThemeCache cache, OnError onerror) { var emojiIconId = iconId as EmojiIconId; var image = emojiIconId?.Emoji.Bitmap(); return image; }
private async void ExecuteLoginCommand() { try { Body = false; Load = true; if (!CrossConnectivity.Current.IsConnected) { DialogParameters param = new DialogParameters { { "Message", "Sem conexão com a internet" }, { "Title", "Erro" }, { "Icon", IconTheme.IconName("bug") } }; DialogService.ShowDialog("DialogPage", param, CloseDialogCallback); } else { User = await HeritageAPIService.UserLogin(User); if (User == null) { DialogParameters param = new DialogParameters { { "Message", "Email ou senha incorretos" }, { "Title", "Erro" }, { "Icon", IconTheme.IconName("bug") } }; DialogService.ShowDialog("DialogPage", param, CloseDialogCallback); } else { if (Application.Current.Properties.ContainsKey("Login")) { Application.Current.Properties["Login"] = IsChecked; } else { Application.Current.Properties.Add("Login", IsChecked); } UserJson.SetUsuarioJson(User); await NavigationService.NavigateAsync(new Uri("https://www.Heritage/Menu/NavigationPage/Main", UriKind.Absolute)); } } } catch (Exception ex) { Console.WriteLine($"Ocorreu um erro ao baixar os dados: {ex.Message}, Página: Login"); } finally { Body = true; Load = false; } }
/// <summary> /// Loads all embedded builtin icons into the application's icon theme. /// </summary> public static void LoadEmbeddedIcons() { Assembly executingAssembly = Assembly.GetExecutingAssembly(); string[] manifestResourceNames = executingAssembly .GetManifestResourceNames(); IEnumerable <string> manifestIcons = manifestResourceNames .Where ( path => path.Contains(".Icons.") && ( path.EndsWith(".png", StringComparison.OrdinalIgnoreCase) || path.EndsWith(".svg", StringComparison.OrdinalIgnoreCase) ) ); foreach (string manifestIconName in manifestIcons) { // Grab the second to last part of the resource name, that is, the filename before the extension. // Note that this assumes that there is only a single extension. string[] manifestNameParts = manifestIconName.Split('.'); string iconName = manifestNameParts.ElementAt(manifestNameParts.Length - 2); Pixbuf iconBuffer = LoadEmbeddedImage(manifestIconName); if (iconBuffer != null) { IconTheme.AddBuiltinIcon(iconName, 16, iconBuffer); } } }
Pixbuf IconFromTheme(string name, int size, IconTheme theme) { Pixbuf pixbuf = null; string name_noext = name; // We may have to remove the extension. if (name.Contains(".")) { name_noext = name.Remove(name.LastIndexOf(".")); } try { if (theme.HasIcon(name)) { pixbuf = theme.LoadIcon(name, size, 0); } else if (theme.HasIcon(name_noext)) { pixbuf = theme.LoadIcon(name_noext, size, 0); } else if (name == "gnome-mime-text-plain" && theme.HasIcon("gnome-mime-text")) { pixbuf = theme.LoadIcon("gnome-mime-text", size, 0); } } catch (Exception e) { Log <DrawingService> .Warn("Error loading themed icon '" + name + "': " + e.Message); Log <DrawingService> .Debug(e.StackTrace); pixbuf = null; } return(pixbuf); }
protected internal override Widget build(BuildContext context) { ThemeData themeData = Theme.of(context); TabBarTheme tabBarTheme = TabBarTheme.of(context); TextStyle defaultStyle = this.labelStyle ?? themeData.primaryTextTheme.body2; TextStyle defaultUnselectedStyle = this.unselectedLabelStyle ?? this.labelStyle ?? themeData.primaryTextTheme.body2; Animation <float> animation = (Animation <float>) this.listenable; TextStyle textStyle = this.selected ? TextStyle.lerp(defaultStyle, defaultUnselectedStyle, animation.value) : TextStyle.lerp(defaultUnselectedStyle, defaultStyle, animation.value); Color selectedColor = this.labelColor ?? tabBarTheme.labelColor ?? themeData.primaryTextTheme.body2.color; Color unselectedColor = this.unselectedLabelColor ?? tabBarTheme.unselectedLabelColor ?? selectedColor.withAlpha(0xB2); Color color = this.selected ? Color.lerp(selectedColor, unselectedColor, animation.value) : Color.lerp(unselectedColor, selectedColor, animation.value); return(new DefaultTextStyle( style: textStyle.copyWith(color: color), child: IconTheme.merge( data: new IconThemeData( size: 24.0f, color: color), child: this.child ) )); }
// Looks up an icon from the system's theme public static Gdk.Pixbuf GetIcon(string name, int size) { IconTheme icon_theme = new IconTheme(); // foreach (string search_path in IconTheme.Default.SearchPath) // icon_theme.AppendSearchPath (search_path); // FIXME: Temporary workaround for a bug in IconTheme.SearchPath in Gtk# on 64-bit systems // https://github.com/mono/gtk-sharp/commit/9c54fd5ae77f63d11fdc6873a3cb90691990e37f icon_theme.AppendSearchPath("/usr/share/icons"); icon_theme.AppendSearchPath("/usr/local/share/icons"); icon_theme.AppendSearchPath("/opt/local/share/icons"); icon_theme.AppendSearchPath(Path.Combine(SparkleUI.AssetsPath, "icons")); try { return(icon_theme.LoadIcon(name, size, IconLookupFlags.GenericFallback)); } catch { try { return(icon_theme.LoadIcon("gtk-missing-image", size, IconLookupFlags.GenericFallback)); } catch { return(null); } } }
static Pixbuf IconFromTheme(string name, int size, IconTheme theme) { Pixbuf pixbuf = null; string name_noext; // We may have to remove the extension. if (name.Contains(".")) { name_noext = name.Remove(name.LastIndexOf(".")); } else { name_noext = name; } try { if (theme.HasIcon(name)) { pixbuf = theme.LoadIcon(name, size, 0); } else if (theme.HasIcon(name_noext)) { pixbuf = theme.LoadIcon(name_noext, size, 0); } else if (name == "gnome-mime-text-plain" && theme.HasIcon("gnome-mime-text")) { pixbuf = theme.LoadIcon("gnome-mime-text", size, 0); } } catch { pixbuf = null; } return(pixbuf); }
private void LoadPixbufs() { int width, height; Icon.SizeLookup(icon_size, out width, out height); IconTheme theme = IconTheme.GetForScreen(Screen); if (normal_pixbuf != null) { normal_pixbuf.Dispose(); normal_pixbuf = null; } if (active_pixbuf != null) { active_pixbuf.Dispose(); active_pixbuf = null; } for (int i = 0; i < icon_names.Length; i++) { try { normal_pixbuf = RenderIcon(icon_names[i], icon_size, null) ?? theme.LoadIcon(icon_names[i], width, 0); active_pixbuf = ColorShiftPixbuf(normal_pixbuf, 30); break; } catch { } } UpdateImage(); }
private static void PlatformInit() { Linux = true; _theme = IconTheme.Default; var iconMissing = _theme.LoadIcon("dialog-error", 16, 0); var file = _theme.LoadIcon("text-x-generic", 16, 0); var fileMissing = file.Copy(); iconMissing.Composite(fileMissing, 8, 8, 8, 8, 8, 8, 0.5, 0.5, Gdk.InterpType.Tiles, 255); var folder = _theme.LoadIcon("folder", 16, 0); var folderMissing = folder.Copy(); iconMissing.Composite(folderMissing, 8, 8, 8, 8, 8, 8, 0.5, 0.5, Gdk.InterpType.Tiles, 255); _files["."] = ToEtoImage(file); _fileMissing = ToEtoImage(fileMissing); _folder = ToEtoImage(folder); _folderMissing = ToEtoImage(folderMissing); _xwtFiles["."] = ToXwtImage(file); _xwtFileMissing = ToXwtImage(fileMissing); _xwtFolder = ToXwtImage(folder); _xwtFolderMissing = ToXwtImage(folderMissing); }
public IPv4Entry() { CanFocus = true; Spacing = 2; int width, height; Icon.SizeLookup(icon_size, out width, out height); IconTheme theme = IconTheme.GetForScreen(Screen); DrawingCellHBox entrycontents = new DrawingCellHBox(); entrycontents.PackStart(new DrawingCellNull(), true); entrycontents.Spacing = 0; labelcontents = new DrawingCellHBox(); entrycontents.PackEnd(labelcontents, false); cells[0] = new IpText(this, DataPart.A); cells[1] = new IpText(this, DataPart.Separator); cells[2] = new IpText(this, DataPart.B); cells[3] = new IpText(this, DataPart.Separator); cells[4] = new IpText(this, DataPart.C); cells[5] = new IpText(this, DataPart.Separator); cells[6] = new IpText(this, DataPart.D); foreach (IpText t in cells) { labelcontents.PackEnd(t, false); } clearimg = new DrawingCellActivePixbuf(theme.LoadIcon(Stock.Clear, width, 0)); clearimg.Activated += delegate { OnClearData(); }; entrycontents.PackStart(clearimg, false); addimg = new DrawingCellActivePixbuf(theme.LoadIcon(Stock.Add, width, 0)); addimg.Activated += delegate { OnStartCalculator(); }; entrycontents.PackStart(addimg, false); entry = new DrawingCellEntry(entrycontents); entry.SideCut = SideCut.Right; PackStart(entry, true); dropdown = new DrawingCellButton(new DrawingCellComboArrow()); dropdown.SideCut = SideCut.Left; dropdown.Activated += delegate { OnDropDown(); }; PackEnd(dropdown, false); /* Gtk.Drag.DestSet (this, DestDefaults.All, ValidTargets, Gdk.DragAction.Copy); * DragDataReceived += HandleDragDataReceived; * * Gtk.Drag.SourceSet (this, Gdk.ModifierType.Button1Mask, ValidTargets, DragAction.Copy); * DragBegin += HandleDragBegin; * DragDataGet += HandleDragDataGet;*/ }
public override void Initialize(INavigationParameters parameters) { User = new User(); UserJson = new UserJson(); IconTheme = new IconTheme(); Body = true; }
public ImageSource TryGetImage(IconId iconId, IconTheme theme, IThemedIconManagerPerThemeCache cache, OnError onerror) { var emojiIconId = iconId as EmojiIconId; var image = emojiIconId?.Emoji.Bitmap(); return(image); }
protected override void OnRealized() { base.OnRealized(); theme = Gtk.IconTheme.GetForScreen(Screen); theme.Changed += ThemeChanged; LoadImages(); }
private async Task <bool> Verification(Heritage heritage) { try { Load = true; Body = false; LoadMessage = "Verificando patrimônio"; heritage.SerializeCode = false; heritage.State = true; bool up = await HeritageAPIService.PutAsync(heritage); if (up) { Xamarin.Forms.DependencyService.Get <IMessage>().LongAlert("Patrimônio verificado com sucesso"); Load = false; Body = true; return(true); } else { DialogParameters param = new DialogParameters { { "Message", "Erro ao atualizar patrimônio" }, { "Title", "Erro" }, { "Icon", IconTheme.IconName("bug") } }; DialogService.ShowDialog("DialogPage", param, CloseDialogCallback); Load = false; Body = true; return(false); } } catch (Exception) { Body = true; DialogParameters param = new DialogParameters { { "Message", "Erro ao atualizar patrimônio" }, { "Title", "Erro" }, { "Icon", IconTheme.IconName("bug") } }; DialogService.ShowDialog("DialogPage", param, CloseDialogCallback); Load = false; Body = true; return(false); } }
public override Widget build(BuildContext context) { D.assert(MaterialD.debugCheckHasMaterial(context)); Color currentColor; if (this.onPressed != null) { currentColor = this.color; } else { currentColor = this.disabledColor ?? Theme.of(context).disabledColor; } Widget result = new ConstrainedBox( constraints: new BoxConstraints(minWidth: IconButtonUtils._kMinButtonSize, minHeight: IconButtonUtils._kMinButtonSize), child: new Padding( padding: this.padding, child: new SizedBox( height: this.iconSize, width: this.iconSize, child: new Align( alignment: this.alignment, child: IconTheme.merge( data: new IconThemeData( size: this.iconSize, color: currentColor), child: this.icon) ) ) ) ); if (this.tooltip != null) { result = new Tooltip( message: this.tooltip, child: result); } return(new InkResponse( onTap: () => { if (this.onPressed != null) { this.onPressed(); } }, child: result, highlightColor: this.highlightColor ?? Theme.of(context).highlightColor, splashColor: this.splashColor ?? Theme.of(context).splashColor, radius: Mathf.Max( Material.defaultSplashRadius, (this.iconSize + Mathf.Min(this.padding.horizontal, this.padding.vertical)) * 0.7f) )); }
static void AddListstoreRows(ListStore store, params String[] names) { var theme = new IconTheme(); foreach (var s in names) { var pixbuf = theme.LoadIcon(s, 48, (IconLookupFlags)0); store.InsertWithValues(-1, new object[] { s, pixbuf }); } }
public ContextPage() { Id = "karaoke"; Name = AddinManager.CurrentLocalizer.GetString("Karaoke"); Gdk.Pixbuf icon = new Gdk.Pixbuf(System.Reflection.Assembly.GetExecutingAssembly() .GetManifestResourceStream("microphone.png")); IconTheme.AddBuiltinIcon("microphone", 100, icon); IconNames = new string[] { "microphone", "gtk-edit" }; }
public override Widget build(BuildContext context) { IconThemeData iconTheme = IconTheme.of(context); return(new Container( margin: EdgeInsets.all(4.0f), width: iconTheme.size - 8.0f, height: iconTheme.size - 8.0f, color: iconTheme.color )); }
public override async void Initialize(INavigationParameters parameters) { Historics = new ObservableCollection <Historic>(); UserJson = new UserJson(); CurrentUser = new User(); IconTheme = new IconTheme(); CurrentUser = UserJson.GetUsuarioJson(); await LoadAsync(); }
public override Widget build(BuildContext context) { IconThemeData iconTheme = IconTheme.of(context); return(new Container( margin: EdgeInsets.all(4.0f), width: iconTheme.size - 8.0f, height: iconTheme.size - 8.0f, decoration: new BoxDecoration( border: Border.all(color: iconTheme.color, width: 2.0f) ) )); }
public BansheeIconFactory() { theme = IconTheme.Default; string icon_theme_path = Banshee.Base.Paths.GetInstalledDataDirectory("icons"); if (Directory.Exists(icon_theme_path)) { Hyena.Log.DebugFormat("Adding icon theme search path: {0}", icon_theme_path); Theme.AppendSearchPath(icon_theme_path); } AddDefault(); }
private static void PlatformInit() { Linux = true; _theme = IconTheme.Default; var linkIcon = new Gdk.Pixbuf(Gdk.Colorspace.Rgb, true, 8, 16, 16); linkIcon.Fill(0x00000000); _theme.LoadIcon("emblem-symbolic-link", 16, 0).Composite(linkIcon, 8, 8, 8, 8, 8, 8, 0.5, 0.5, Gdk.InterpType.Tiles, 255); _files["0."] = ToEtoImage(_theme.LoadIcon("text-x-generic", 16, 0)); _folder = ToEtoImage(_theme.LoadIcon("folder", 16, 0)); _link = ToEtoImage(linkIcon); }
public ImageSource TryGetImage(IconId iconId, IconTheme theme, IThemedIconManagerPerThemeCache cache, OnError onerror) { try { var emojiIconId = iconId as EmojiIconId; var image = emojiIconId?.Emoji.Bitmap(); return(image); } catch (Exception ex) { onerror.Handle(ex); return(null); } }
public override async void Initialize(INavigationParameters parameters) { CurrentUser = new User(); UserJson = new UserJson(); IconTheme = new IconTheme(); Environments = new ObservableCollection <Environment>(); Heritages = new ObservableCollection <Heritage>(); Users = new ObservableCollection <User>(); Body = true; CurrentUser = UserJson.GetUsuarioJson(); await LoadAsync(); }
public void UpdateData(IconSize size, IconTheme theme) { //icon size switch (size) { case IconSize.Big: this.size = "128"; break; default: case IconSize.Medium: this.size = "64"; break; case IconSize.Small: this.size = "32"; break; } //icon theme switch (theme) { default: case IconTheme.Standart: this.theme = "Standart"; break; case IconTheme.Thin: this.theme = "Thin"; break; case IconTheme.Square: this.theme = "Square"; break; case IconTheme.Ring: this.theme = "Ring"; break; case IconTheme.Pixel: this.theme = "Pixel"; break; case IconTheme.Murky: this.theme = "Murky"; break; } }
private async Task LoadAsync() { try { Body = false; Load = true; Null = false; ObservableCollection <Historic> historics = await HeritageAPIService.GetAsyncHistorics(CurrentUser.CompanyId); Historics.Clear(); foreach (Historic historic in historics) { Historics.Add(historic); } if (Historics.Count == 0) { Null = true; } else { Body = true; } IsBusy = true; } catch (Exception ex) { DialogParameters param = new DialogParameters { { "Message", "Erro ao carregar os historicos" }, { "Title", "Erro" }, { "Icon", IconTheme.IconName("bug") } }; DialogService.ShowDialog("DialogPage", param, CloseDialogCallback); Null = true; Console.WriteLine($"Ocorreu um erro ao baixar os dados: {ex.Message}, Página: Ambientes"); } finally { IsBusy = false; Load = false; } }
public static Gdk.Pixbuf GetIcon(string name, int size) { IconTheme icon_theme = new IconTheme(); icon_theme.AppendSearchPath(Path.Combine(UI.AssetsPath, "icons")); try { return(icon_theme.LoadIcon(name, size, IconLookupFlags.GenericFallback)); } catch { try { return(icon_theme.LoadIcon("gtk-image-missing", size, IconLookupFlags.GenericFallback)); } catch { return(null); } } }
// Looks up an icon from the system's theme public static Gdk.Pixbuf GetIcon(string name, int size) { IconTheme icon_theme = new IconTheme(); icon_theme.AppendSearchPath(SparklePaths.SparkleIconPath); icon_theme.AppendSearchPath(SparklePaths.SparkleLocalIconPath); try { return(icon_theme.LoadIcon(name, size, IconLookupFlags.GenericFallback)); } catch { try { return(icon_theme.LoadIcon("gtk-missing-image", size, IconLookupFlags.GenericFallback)); } catch { return(null); } } }
public override Widget build(BuildContext context) { ThemeData theme = Theme.of(context); Color foregroundColor = this.foregroundColor ?? theme.accentIconTheme.color; Widget result = null; if (this.child != null) { result = IconTheme.merge( data: new IconThemeData( color: foregroundColor), child: this.child ); } result = new RawMaterialButton( onPressed: this.onPressed, elevation: this.elevation, highlightElevation: this.highlightElevation, disabledElevation: this.disabledElevation ?? this.elevation, constraints: this._sizeConstraints, materialTapTargetSize: this.materialTapTargetSize ?? theme.materialTapTargetSize, fillColor: this.backgroundColor ?? theme.accentColor, textStyle: theme.accentTextTheme.button.copyWith( color: foregroundColor, letterSpacing: 1.2f), shape: this.shape, clipBehavior: this.clipBehavior, child: result); if (this.tooltip != null) { result = new Tooltip( message: this.tooltip, child: result); } if (this.heroTag != null) { result = new Hero( tag: this.heroTag, child: result); } return(result); }
Widget _wrapActiveItem(BuildContext context, Widget item, bool active) { if (!active) { return(item); } Color activeColor = this.activeColor ?? CupertinoTheme.of(context).primaryColor; return(IconTheme.merge( data: new IconThemeData(color: activeColor), child: DefaultTextStyle.merge( style: new TextStyle(color: activeColor), child: item ) )); }