ZenScript main repository
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

DButtonStyle.java 2.4KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354
  1. /*
  2. * To change this license header, choose License Headers in Project Properties.
  3. * To change this template file, choose Tools | Templates
  4. * and open the template in the editor.
  5. */
  6. package org.openzen.drawablegui;
  7. import org.openzen.drawablegui.style.DDpDimension;
  8. import org.openzen.drawablegui.style.DShadow;
  9. import org.openzen.drawablegui.style.DStyleDefinition;
  10. /**
  11. *
  12. * @author Hoofdgebruiker
  13. */
  14. public class DButtonStyle {
  15. public final int paddingTop;
  16. public final int paddingLeft;
  17. public final int paddingRight;
  18. public final int paddingBottom;
  19. public final DFont font;
  20. public final int textColor;
  21. public final int textColorDisabled;
  22. public final int backgroundColorNormal;
  23. public final int backgroundColorHover;
  24. public final int backgroundColorPress;
  25. public final int backgroundColorDisabled;
  26. public final DShadow shadowNormal;
  27. public final DShadow shadowHover;
  28. public final DShadow shadowPress;
  29. public final DShadow shadowDisabled;
  30. public DButtonStyle(DStyleDefinition style) {
  31. this.paddingTop = style.getDimension("paddingTop", new DDpDimension(4));
  32. this.paddingBottom = style.getDimension("paddingBottom", new DDpDimension(4));
  33. this.paddingLeft = style.getDimension("paddingLeft", new DDpDimension(8));
  34. this.paddingRight = style.getDimension("paddingRight", new DDpDimension(8));
  35. font = style.getFont("font", context -> new DFont(DFontFamily.UI, false, false, false, (int)(14 * context.getTextScale())));
  36. textColor = style.getColor("textColor", 0xFF000000);
  37. textColorDisabled = style.getColor("textColorDisabled", 0xFF888888);
  38. backgroundColorNormal = style.getColor("backgroundColorNormal", 0xFFE1E1E1);
  39. backgroundColorHover = style.getColor("backgroundColorHover", 0xFFE5EFF8);
  40. backgroundColorPress = style.getColor("backgroundColorPress", 0xFFE5EFF8);
  41. backgroundColorDisabled = style.getColor("backgroundColorDisabled", 0xFFE5EFF8);
  42. shadowNormal = style.getShadow("shadowNormal", context -> new DShadow(0xFF888888, 0, 1f * context.getScale(), 4 * context.getScale()));
  43. shadowHover = style.getShadow("shadowHover", context -> new DShadow(0xFF888888, 0, 1f * context.getScale(), 4 * context.getScale()));
  44. shadowPress = style.getShadow("shadowPress", context -> new DShadow(0xFF888888, 0, 1f * context.getScale(), 3 * context.getScale()));
  45. shadowDisabled = style.getShadow("shadowDisabled", context -> new DShadow(0xFF888888, 0, 1f * context.getScale(), 3 * context.getScale()));
  46. }
  47. }