KTFigure.m 1.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  1. classdef KTFigure
  2. properties (Hidden, SetAccess = private, GetAccess = private)
  3. figureHandle
  4. end
  5. methods (Hidden)
  6. function obj = KTFigure
  7. obj.figureHandle = figure;
  8. set(obj.figureHandle, 'Visible', 'off');
  9. end
  10. function screenSize = getScreenSize(~)
  11. screenSize = get(0, 'ScreenSize');
  12. end
  13. end
  14. methods
  15. function handle = getHandle(obj)
  16. handle = obj.figureHandle;
  17. end
  18. function EnlargeFigure(obj)
  19. screenSize = obj.getScreenSize;
  20. set(gcf, 'position', [screenSize(3:4).*[1.7, 1]*0.1 screenSize(3:4).*[1, 1.3]*0.6]);
  21. end
  22. function EnlargeFigureWide(obj)
  23. screenSize = obj.getScreenSize;
  24. set(gcf, 'position', [screenSize(3:4).*[0.3, 1]*0.1 screenSize(3:4).*[1.55, 1.3]*0.6]);
  25. end
  26. function HideFigure(obj)
  27. set(obj.figureHandle, 'Visible', 'off');
  28. end
  29. function ShowFigure(obj)
  30. set(obj.figureHandle, 'Visible', 'on');
  31. end
  32. function MakeBackgroundWhite(obj)
  33. set(obj.figureHandle, 'color', [1 1 1]);
  34. end
  35. function MakeBackgroundGray(obj)
  36. set(obj.figureHandle, 'color', [0.5 0.5 0.5]);
  37. end
  38. function MakeBackgroundBlack(obj)
  39. set(obj.figureHandle, 'color', [0 0 0]);
  40. end
  41. function SetActive(obj)
  42. figure(obj.figureHandle);
  43. end
  44. function CloseFigure(obj)
  45. close(obj.figureHandle);
  46. end
  47. end
  48. end