Class ThemedIcon

All Implemented Interfaces:
Icon, Proxy

@Generated("org.javagi.JavaGI") public class ThemedIcon extends GObject implements Icon

GThemedIcon is an implementation of Icon that supports icon themes.

GThemedIcon contains a list of all of the icons present in an icon theme, so that icons can be looked up quickly. GThemedIcon does not provide actual pixmaps for icons, just the icon names. Ideally something like org.gnome.gtk.IconTheme.chooseIcon should be used to resolve the list of names so that fallback icons work nicely with themes that inherit other themes.

  • Constructor Details

    • ThemedIcon

      public ThemedIcon(MemorySegment address)
      Create a ThemedIcon instance for the provided memory address.
      Parameters:
      address - the memory address of the native object
    • ThemedIcon

      public ThemedIcon(String iconname)
      Creates a new themed icon for iconname.
      Parameters:
      iconname - a string containing an icon name.
    • ThemedIcon

      public ThemedIcon()
      Create a new ThemedIcon.
  • Method Details

    • getType

      public static @Nullable Type getType()
      Get the GType of the ThemedIcon class.
      Returns:
      the GType
    • getMemoryLayout

      public static MemoryLayout getMemoryLayout()
      The memory layout of the native struct.
      Returns:
      the memory layout
    • asParent

      protected ThemedIcon asParent()
      Return this instance as if it were its parent type. Comparable to the Java super keyword, but ensures the parent typeclass is also used in native code.
      Overrides:
      asParent in class GObject
      Returns:
      the instance as if it were its parent type
    • fromNames

      public static ThemedIcon fromNames(@Nullable String @Nullable [] iconnames)
      Creates a new themed icon for iconnames.
      Parameters:
      iconnames - an array of strings containing icon names.
      Returns:
      a new GThemedIcon
    • withDefaultFallbacks

      public static ThemedIcon withDefaultFallbacks(String iconname)

      Creates a new themed icon for iconname, and all the names that can be created by shortening iconname at '-' characters.

      In the following example, icon1 and icon2 are equivalent:

      const char *names[] = {
        "gnome-dev-cdrom-audio",
        "gnome-dev-cdrom",
        "gnome-dev",
        "gnome"
      };
      
      icon1 = g_themed_icon_new_from_names (names, 4);
      icon2 = g_themed_icon_new_with_default_fallbacks ("gnome-dev-cdrom-audio");
      
      Parameters:
      iconname - a string containing an icon name
      Returns:
      a new GThemedIcon.
    • appendName

      public void appendName(String iconname)

      Append a name to the list of icons from within icon.

      Note that doing so invalidates the hash computed by prior calls to g_icon_hash().

      Parameters:
      iconname - name of icon to append to list of icons from within icon.
    • getNames

      public String[] getNames()
      Gets the names of icons from within icon.
      Returns:
      a list of icon names.
    • prependName

      public void prependName(String iconname)

      Prepend a name to the list of icons from within icon.

      Note that doing so invalidates the hash computed by prior calls to g_icon_hash().

      Parameters:
      iconname - name of icon to prepend to list of icons from within icon.
      Since:
      2.18
    • builder

      public static ThemedIcon.Builder<? extends ThemedIcon.Builder> builder()
      A ThemedIcon.Builder object constructs a ThemedIcon with the specified properties. Use the various set...() methods to set properties, and finish construction with ThemedIcon.Builder.build().
      Returns:
      the builder object