public static void Init() { if (!init) { init = true; var iconFactory = new IconFactory(); iconFactory.Add("allors-program", new IconSet(Pixbuf.LoadFromResource("Allors.R1.Development.GtkSharp.Icons.allors.ico"))); iconFactory.Add("allors-association", new IconSet(Pixbuf.LoadFromResource("Allors.R1.Development.GtkSharp.Icons.association.ico"))); iconFactory.Add("allors-class", new IconSet(Pixbuf.LoadFromResource("Allors.R1.Development.GtkSharp.Icons.class.ico"))); iconFactory.Add("allors-class-locked", new IconSet(Pixbuf.LoadFromResource("Allors.R1.Development.GtkSharp.Icons.class-locked.ico"))); iconFactory.Add("allors-cluster", new IconSet(Pixbuf.LoadFromResource("Allors.R1.Development.GtkSharp.Icons.cluster.ico"))); iconFactory.Add("allors-domain", new IconSet(Pixbuf.LoadFromResource("Allors.R1.Development.GtkSharp.Icons.domain.ico"))); iconFactory.Add("allors-domain-environment", new IconSet(Pixbuf.LoadFromResource("Allors.R1.Development.GtkSharp.Icons.domainenvironment.ico"))); iconFactory.Add("allors-except", new IconSet(Pixbuf.LoadFromResource("Allors.R1.Development.GtkSharp.Icons.except.ico"))); iconFactory.Add("allors-extension", new IconSet(Pixbuf.LoadFromResource("Allors.R1.Development.GtkSharp.Icons.extension.ico"))); iconFactory.Add("allors-filter", new IconSet(Pixbuf.LoadFromResource("Allors.R1.Development.GtkSharp.Icons.filter.ico"))); iconFactory.Add("allors-interface", new IconSet(Pixbuf.LoadFromResource("Allors.R1.Development.GtkSharp.Icons.interface.ico"))); iconFactory.Add("allors-interface-locked", new IconSet(Pixbuf.LoadFromResource("Allors.R1.Development.GtkSharp.Icons.interface-locked.ico"))); iconFactory.Add("allors-intersect", new IconSet(Pixbuf.LoadFromResource("Allors.R1.Development.GtkSharp.Icons.intersect.ico"))); iconFactory.Add("allors-method", new IconSet(Pixbuf.LoadFromResource("Allors.R1.Development.GtkSharp.Icons.method.ico"))); iconFactory.Add("allors-method-locked", new IconSet(Pixbuf.LoadFromResource("Allors.R1.Development.GtkSharp.Icons.method-locked.ico"))); iconFactory.Add("allors-namespace-locked", new IconSet(Pixbuf.LoadFromResource("Allors.R1.Development.GtkSharp.Icons.namespace-locked.ico"))); iconFactory.Add("allors-predicate", new IconSet(Pixbuf.LoadFromResource("Allors.R1.Development.GtkSharp.Icons.predicate.ico"))); iconFactory.Add("allors-role", new IconSet(Pixbuf.LoadFromResource("Allors.R1.Development.GtkSharp.Icons.role.ico"))); iconFactory.Add("allors-union", new IconSet(Pixbuf.LoadFromResource("Allors.R1.Development.GtkSharp.Icons.union.ico"))); iconFactory.Add("allors-namespace", new IconSet(Pixbuf.LoadFromResource("Allors.R1.Development.GtkSharp.Icons.namespace.ico"))); iconFactory.Add("allors-role-locked", new IconSet(Pixbuf.LoadFromResource("Allors.R1.Development.GtkSharp.Icons.role-locked.ico"))); iconFactory.AddDefault(); } }
void CreateStockIcons() { var factory = new IconFactory(); factory.AddDefault(); AddStockIcon(factory, "slice-tool-arrow", "stock-arrow.png"); }
void BuildToolBar() { IconFactory icon_factory = new IconFactory(); AddIcon(icon_factory, "logic-games", "logic-games-32.png"); AddIcon(icon_factory, "math-games", "math-games-32.png"); AddIcon(icon_factory, "memory-games", "memory-games-32.png"); AddIcon(icon_factory, "verbal-games", "verbal-games-32.png"); AddIcon(icon_factory, "pause", "pause-32.png"); AddIcon(icon_factory, "resume", "resume-32.png"); AddIcon(icon_factory, "endgame", "endgame-32.png"); AddIcon(icon_factory, "allgames", "allgames-32.png"); icon_factory.AddDefault(); IconSize = Gtk.IconSize.Dnd; AllButton = new ToolButton("allgames"); AllButton.TooltipText = Catalog.GetString("Play all the games"); AllButton.Label = Catalog.GetString("All"); Insert(AllButton, -1); LogicButton = new ToolButton("logic-games"); LogicButton.TooltipText = Catalog.GetString("Play games that challenge your reasoning and thinking"); LogicButton.Label = Catalog.GetString("Logic"); Insert(LogicButton, -1); CalculationButton = new ToolButton("math-games"); CalculationButton.Label = Catalog.GetString("Calculation"); CalculationButton.TooltipText = Catalog.GetString("Play games that challenge your mental calculation skills"); Insert(CalculationButton, -1); MemoryButton = new ToolButton("memory-games"); MemoryButton.Label = Catalog.GetString("Memory"); MemoryButton.TooltipText = Catalog.GetString("Play games that challenge your short term memory"); Insert(MemoryButton, -1); VerbalButton = new ToolButton("verbal-games"); VerbalButton.Label = Catalog.GetString("Verbal"); VerbalButton.TooltipText = Catalog.GetString("Play games that challenge your verbal aptitude"); Insert(VerbalButton, -1); PauseButton = new ToolButton("pause"); PauseButton.Label = Catalog.GetString("Pause"); PauseButton.TooltipText = Catalog.GetString("Pause or resume the game"); Insert(PauseButton, -1); FinishButton = new ToolButton("endgame"); FinishButton.TooltipText = Catalog.GetString("End the game and show score"); FinishButton.Label = Catalog.GetString("End"); Insert(FinishButton, -1); }
static DemoApplicationWindow() { // Register our custom toolbar icons, for themability Gdk.Pixbuf pixbuf = Gdk.Pixbuf.LoadFromResource("gtk-logo-rgb.gif"); Gdk.Pixbuf transparent = pixbuf.AddAlpha(true, 0xff, 0xff, 0xff); IconFactory factory = new IconFactory(); factory.Add("demo-gtk-logo", new IconSet(transparent)); factory.AddDefault(); StockManager.Add(new StockItem("demo-gtk-logo", "_GTK#", 0, 0, null)); }
// Methods // Methods :: Public // Methods :: Public :: Initalize public static void Initialize() { IconFactory factory = new IconFactory(); factory.AddDefault(); // Stock Icons foreach (string name in stock_icons) { Pixbuf pixbuf = new Pixbuf(null, name + ".png"); IconSet iconset = new IconSet(pixbuf); // Add menu variant if we have it Assembly a = Assembly.GetCallingAssembly(); Stream menu_stream = a.GetManifestResourceStream(name + "-16.png"); if (menu_stream != null) { IconSource source = new IconSource(); source.Pixbuf = new Pixbuf(menu_stream); source.Size = IconSize.Menu; source.SizeWildcarded = false; iconset.AddSource(source); } factory.Add(name, iconset); } // Themed Icons foreach (string name in icon_theme_icons) { IconSet iconset = new IconSet(); IconSource iconsource = new IconSource(); iconsource.IconName = name; iconset.AddSource(iconsource); factory.Add(name, iconset); } // register cover image icon size cover_size = Icon.SizeRegister("muine-album-cover-size", CoverDatabase.CoverSize, CoverDatabase.CoverSize); }
private void AddToToolbar(BaseTemplate i) { var w1 = new IconFactory(); var w2 = new IconSet(new Pixbuf( Assembly.GetExecutingAssembly(), i.GetIcon())); w1.Add(i.Type + "_icon", w2); w1.AddDefault(); var act = new Gtk.Action("c_Create" + i.Type + "Action", null, "Create " + i.Type + " Project", null); act.Activated += (object sender, System.EventArgs e) => { this.PromptCreateProject(i.Type); }; var t = act.CreateToolItem(); (t as ToolButton).StockId = i.Type + "_icon"; this.c_Toolbar.Add(t); }
// Methods :: Private :: InitStockIcons private void InitStockIcons() { string [] stock_icons = { "muine-tray-paused", "muine-tray-playing" }; IconFactory factory = new IconFactory(); factory.AddDefault(); // Stock Icons foreach (string name in stock_icons) { Pixbuf pixbuf = new Pixbuf(null, name + ".png"); IconSet iconset = new IconSet(pixbuf); factory.Add(name, iconset); } }
public static void Initialize() { Gtk.StockItem [] stock_items = { FromDef("f-spot-adjust-colors", Catalog.GetString("Adjust Colors"), 0, Gdk.ModifierType.ShiftMask, null), FromDef("f-spot-autocolor", Catalog.GetString("Auto Color"), 0, Gdk.ModifierType.ShiftMask, null), FromDef("f-spot-browse", Catalog.GetString("Browse"), 0, Gdk.ModifierType.ShiftMask, null), FromDef("f-spot-camera", Catalog.GetString("Camera"), 0, Gdk.ModifierType.ShiftMask, null), FromDef("f-spot-crop", Catalog.GetString("Crop"), 0, Gdk.ModifierType.ShiftMask, null), FromDef("f-spot-desaturate", Catalog.GetString("Desaturate"), 0, Gdk.ModifierType.ShiftMask, null), FromDef("f-spot-edit-image", Catalog.GetString("Edit Photo"), 0, Gdk.ModifierType.ShiftMask, null), FromDef("f-spot-fullscreen", Catalog.GetString("Fullscreen"), 0, Gdk.ModifierType.ShiftMask, null), FromDef("f-spot-horizon", Catalog.GetString("Straighten"), 0, Gdk.ModifierType.ShiftMask, null), FromDef("f-spot-loading", Catalog.GetString("Loading"), 0, Gdk.ModifierType.ShiftMask, null), FromDef("f-spot-new-tag", Catalog.GetString("Create New Tag"), 0, Gdk.ModifierType.ShiftMask, null), FromDef("f-spot-question-mark", Catalog.GetString("Question"), 0, Gdk.ModifierType.ShiftMask, null), FromDef("f-spot-red-eye", Catalog.GetString("Reduce Red-Eye"), 0, Gdk.ModifierType.ShiftMask, null), FromDef("f-spot-rotate-270", Catalog.GetString("Rotate _Left"), 0, Gdk.ModifierType.ShiftMask, null), FromDef("f-spot-rotate-90", Catalog.GetString("Rotate _Right"), 0, Gdk.ModifierType.ShiftMask, null), FromDef("f-spot-sepia", Catalog.GetString("Sepia Tone"), 0, Gdk.ModifierType.ShiftMask, null), FromDef("f-spot-slideshow", Catalog.GetString("Slideshow"), 0, Gdk.ModifierType.ShiftMask, null), FromDef("f-spot-soft-focus", Catalog.GetString("Soft Focus"), 0, Gdk.ModifierType.ShiftMask, null), FromDef("f-spot-stock_near", Catalog.GetString("Near"), 0, Gdk.ModifierType.ShiftMask, null), FromDef("f-spot-stock_far", Catalog.GetString("Far"), 0, Gdk.ModifierType.ShiftMask, null), FromDef("f-spot-view-restore", Catalog.GetString("Restore View"), 0, Gdk.ModifierType.ShiftMask, null), }; IconFactory icon_factory = new IconFactory(); icon_factory.AddDefault(); foreach (Gtk.StockItem item in stock_items) { Pixbuf pixbuf = PixbufUtils.LoadFromAssembly(item.StockId + ".png"); IconSet icon_set = new IconSet(pixbuf); icon_factory.Add(item.StockId, icon_set); Gtk.StockManager.Add(item); } }
public static void Initialize() { IconFactory icon_factory = new IconFactory(); icon_factory.AddDefault(); foreach (string item_id in stock_icon_names) { StockItem item = new StockItem(item_id, null, 0, Gdk.ModifierType.ShiftMask, null); IconSet icon_set = null; string file = System.IO.Path.Combine(MainClass.Paths.ResDir, item_id); icon_set = new IconSet(); if (System.IO.File.Exists(file)) { try{ IconSource source = new IconSource(); source.Pixbuf = new Pixbuf(file); source.Size = IconSize.LargeToolbar; icon_set.AddSource(source); }catch (Exception ex) { Tool.Logger.Error(ex.Message); //continue; } } if (icon_set == null) { continue; } icon_factory.Add(item.StockId, icon_set); StockManager.Add(item); } }
/// <summary> /// Initialize a widget /// </summary> /// <param name="widget">Widget to initialize</param> internal static void Initialize(Widget widget) { if (_initialized) { return; } if (_initialized) { _initialized = false; } _initialized = true; var factory = new IconFactory(); var save = new IconSet( new Pixbuf(Path.Combine(AppDomain.CurrentDomain.BaseDirectory, !ApplicationHelper.IsUnix ? @"Content\img\CircledSave.png": @"Content/img/CircledSave.png"))); factory.Add("CircledSave", save); var add = new IconSet( new Pixbuf(Path.Combine(AppDomain.CurrentDomain.BaseDirectory, !ApplicationHelper.IsUnix ? @"Content\img\CircledPlus.png": @"Content/img/CircledPlus.png"))); factory.Add("CircledPlus", add); var remove = new IconSet( new Pixbuf(Path.Combine(AppDomain.CurrentDomain.BaseDirectory, !ApplicationHelper.IsUnix ? @"Content\img\CircledMinus.png" : @"Content/img/CircledMinus.png"))); factory.Add("CircledMinus", remove); var calendar = new IconSet(new Pixbuf(Path.Combine(AppDomain.CurrentDomain.BaseDirectory, !ApplicationHelper.IsUnix ? @"Content\img\calendar.png": @"Content/img/calendar.png"))); factory.Add("Calendar", calendar); factory.AddDefault(); }
public static void AddDefaultToIconFactory(IconFactory factory) => factory.AddDefault();
public static void Load(string themePath) { if (themePath == null) { throw new ArgumentNullException("themePath"); } if (themePath.Length == 0) { throw new ArgumentException("Argument is empty", "themePath"); } // gtk requires an absolute path if (!Path.IsPathRooted(themePath)) { throw new ArgumentException("Path must be absolute", "themePath"); } if (!Directory.Exists(themePath)) { throw new DirectoryNotFoundException(string.Format("Path to theme \"{0}\" not found", themePath)); } //IconSize[] iconSizes = (IconSize[])Enum.GetValues(typeof(IconSize)); // all icon sizes the app uses IconSize[] iconSizes = { IconSize.Menu, /* 16px */ IconSize.LargeToolbar, /* 24px */ IconSize.Button, /* 24px */ IconSize.Dialog /* 48px */ }; Dictionary <string, string> iconNames = GetAllIconNames(); IconFactory fac = new IconFactory(); foreach (KeyValuePair <string, string> namePair in iconNames) { string name = namePair.Key; string nameInCustomTheme = namePair.Value; IconSet iconSet = new IconSet(); bool setHasSources = false; foreach (Gtk.IconSize size in iconSizes) { int sz = IconUtils.GetIconSizeVal(size); string fullPath = Path.Combine(Path.Combine(themePath, sz.ToString()), nameInCustomTheme); if (!File.Exists(fullPath)) { if (Global.EnableDebugging) { Debug.WriteLine(string.Format("IconTheme: could not find custom icon for \"{0}\" (size = {1}), using system default", name, sz)); } continue; } IconSource source = new IconSource(); #if LOAD_PIXBUFS source.Pixbuf = new Gdk.Pixbuf(fullPath); #else source.Filename = fullPath; #endif source.Size = size; //source.IconName = name; source.SizeWildcarded = false; iconSet.AddSource(source); setHasSources = true; } if (setHasSources) { fac.Add(name, iconSet); } } fac.AddDefault(); // add icon factory to the apps default factories }