Native Mac OS X OtaClock replica
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.

MainView.m 847B

123456789101112131415161718192021222324252627282930313233343536373839
  1. //
  2. // MainView.m
  3. // OtaClock
  4. //
  5. // Created by Thomas Buck on 16.08.15.
  6. // Copyright (c) 2015 xythobuz. All rights reserved.
  7. //
  8. #import "Render.h"
  9. #import "MainWindow.h"
  10. #import "MainView.h"
  11. @interface MainView ()
  12. @end
  13. @implementation MainView
  14. @synthesize render;
  15. -(void)awakeFromNib {
  16. render = [[Render alloc] initWithParent:self];
  17. [(MainWindow*)[self window] setDefaultBackgroundSize:[render baseSize]]; // Set window to a useful default size
  18. }
  19. -(void)drawRect:(NSRect)dirtyRect {
  20. // Clear background
  21. [[NSColor clearColor] set];
  22. NSRectFill([self frame]);
  23. [render drawInto:self]; // Draw composite image
  24. }
  25. -(BOOL)acceptsFirstMouse:(NSEvent *)theEvent {
  26. // This is required so we get mouse events even if we don't have focus
  27. // (needed to allow dragging the window without focus)
  28. return YES;
  29. }
  30. @end