code_junkie

Object Scope - Objective C Question

Nov 12th, 2011
66
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.49 KB | None | 0 0
  1. Canvas.h
  2.  
  3. Canvas.m
  4.  
  5. -(NSBezierPath *)createPath:(NSRect) aRect
  6. {
  7.  
  8. NSBezierPath * tempPath;
  9. //I need to know what tool
  10.  
  11. switch(0){ //temporary - this would use the toolType as a selector
  12. case 0:
  13. tempPath = [NSBezierPath bezierPathWithOvalInRect:aRect];
  14. break;
  15. case 1:
  16. tempPath = [NSBezierPath bezierPathWithRect:aRect];
  17. break;
  18. default:
  19. tempPath = [NSBezierPath bezierPathWithOvalInRect:aRect];
  20. break;
  21. }
  22. return tempPath;
  23. }
  24.  
  25. -(NSBezierPath *)createPath:(NSRect) aRect
  26. {
  27.  
  28. NSBezierPath * tempPath;
  29. //I need to know what tool
  30.  
  31. switch(0){ //temporary - this would use the toolType as a selector
  32. case 0:
  33. tempPath = [NSBezierPath bezierPathWithOvalInRect:aRect];
  34. break;
  35. case 1:
  36. tempPath = [NSBezierPath bezierPathWithRect:aRect];
  37. break;
  38. default:
  39. tempPath = [NSBezierPath bezierPathWithOvalInRect:aRect];
  40. break;
  41. }
  42. return tempPath;
  43. }
  44.  
  45. -(void)init {
  46. [super init];
  47. //set default color = black
  48. toolColor.rd=1.0;
  49. toolColor.grn=1.0;
  50. toolColor.blu=1.0;
  51. toolColor.alp=1.0;
  52. //set default size
  53. toolSize=0.8;
  54. //set default toolType
  55. toolType=0;
  56. //oval
  57. NSLog(@"Init %@",self);
  58. }
  59.  
  60. -(id)init {
  61. if (self = [super init]) {
  62. //set default color = black
  63. toolColor.rd=1.0;
  64. toolColor.grn=1.0;
  65. toolColor.blu=1.0;
  66. toolColor.alp=1.0;
  67. //set default size
  68. toolSize=0.8;
  69. //set default toolType
  70. toolType=0;
  71. //oval
  72. NSLog(@"Init %@",self);
  73. }
  74. return self;
  75. }
Add Comment
Please, Sign In to add comment