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 813B

1234567891011121314151617181920212223242526272829303132333435363738
  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 "MainWindow.h"
  9. #import "MainView.h"
  10. @interface MainView ()
  11. @end
  12. @implementation MainView
  13. @synthesize render;
  14. -(void)awakeFromNib {
  15. render = [[Render alloc] init];
  16. [(MainWindow*)[self window] setDefaultBackgroundSize:[render baseSize]]; // Set window to a useful default size
  17. }
  18. -(void)drawRect:(NSRect)dirtyRect {
  19. // Clear background
  20. [[NSColor clearColor] set];
  21. NSRectFill([self frame]);
  22. [render drawInto:self]; // Draw composite image
  23. }
  24. -(BOOL)acceptsFirstMouse:(NSEvent *)theEvent {
  25. // This is required so we get mouse events even if we don't have focus
  26. // (needed to allow dragging the window without focus)
  27. return YES;
  28. }
  29. @end