ZenScript main repository
Du kannst nicht mehr als 25 Themen auswählen Themen müssen mit entweder einem Buchstaben oder einer Ziffer beginnen. Sie können Bindestriche („-“) enthalten und bis zu 35 Zeichen lang sein.

DUIContext.java 1.2KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859
  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.DStyleSheets;
  8. /**
  9. *
  10. * @author Hoofdgebruiker
  11. */
  12. public interface DUIContext {
  13. DStyleSheets getStylesheets();
  14. float getScale();
  15. float getTextScale();
  16. void repaint(int x, int y, int width, int height);
  17. default void repaint(DIRectangle rectangle) {
  18. repaint(rectangle.x, rectangle.y, rectangle.width, rectangle.height);
  19. }
  20. void setCursor(Cursor cursor);
  21. DTimerHandle setTimer(int millis, Runnable target);
  22. DClipboard getClipboard();
  23. DFontMetrics getFontMetrics(DFont font);
  24. DUIWindow getWindow();
  25. DUIWindow openDialog(int x, int y, DAnchor anchor, String title, DComponent root);
  26. DUIWindow openView(int x, int y, DAnchor anchor, DComponent root);
  27. default int dp(float dp) {
  28. return (int)(dp * getScale());
  29. }
  30. default int sp(float sp) {
  31. return (int)(sp * getTextScale());
  32. }
  33. enum Cursor {
  34. NORMAL,
  35. HAND,
  36. MOVE,
  37. TEXT,
  38. E_RESIZE,
  39. S_RESIZE,
  40. NE_RESIZE,
  41. NW_RESIZE,
  42. }
  43. }