/core/externals/update-engine/externals/google-toolbox-for-mac/AppKit/GTMNSBezierPath+RoundRect.h

http://macfuse.googlecode.com/ · C++ Header · 73 lines · 18 code · 6 blank · 49 comment · 0 complexity · 1efe0fbb86f89b393052fd07576a8be2 MD5 · raw file

  1. //
  2. // GTMNSBezierPath+RoundRect.h
  3. //
  4. // Category for adding utility functions for creating
  5. // round rectangles.
  6. //
  7. // Copyright 2006-2008 Google Inc.
  8. //
  9. // Licensed under the Apache License, Version 2.0 (the "License"); you may not
  10. // use this file except in compliance with the License. You may obtain a copy
  11. // of the License at
  12. //
  13. // http://www.apache.org/licenses/LICENSE-2.0
  14. //
  15. // Unless required by applicable law or agreed to in writing, software
  16. // distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
  17. // WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
  18. // License for the specific language governing permissions and limitations under
  19. // the License.
  20. //
  21. #import <Cocoa/Cocoa.h>
  22. #import "GTMDefines.h"
  23. /// Category for adding utility functions for creating round rectangles.
  24. @interface NSBezierPath (GMBezierPathRoundRectAdditions)
  25. /// Inscribe a round rectangle inside of rectangle |rect| with a corner radius of |radius|
  26. //
  27. // Args:
  28. // rect: outer rectangle to inscribe into
  29. // radius: radius of the corners. |radius| is clamped internally
  30. // to be no larger than the smaller of half |rect|'s width or height
  31. //
  32. // Returns:
  33. // Auto released NSBezierPath
  34. + (NSBezierPath *)gtm_bezierPathWithRoundRect:(NSRect)rect
  35. cornerRadius:(CGFloat)radius;
  36. /// Inscribe a round rectangle inside of rectangle |rect| with corner radii specified
  37. //
  38. // Args:
  39. // rect: outer rectangle to inscribe into
  40. // radius*: radii of the corners
  41. //
  42. // Returns:
  43. // Auto released NSBezierPath
  44. + (NSBezierPath *)gtm_bezierPathWithRoundRect:(NSRect)rect
  45. topLeftCornerRadius:(CGFloat)radiusTL
  46. topRightCornerRadius:(CGFloat)radiusTR
  47. bottomLeftCornerRadius:(CGFloat)radiusBL
  48. bottomRightCornerRadius:(CGFloat)radiusBR;
  49. /// Adds a path which is a round rectangle inscribed inside of rectangle |rect| with a corner radius of |radius|
  50. //
  51. // Args:
  52. // rect: outer rectangle to inscribe into
  53. // radius: radius of the corners. |radius| is clamped internally
  54. // to be no larger than the smaller of half |rect|'s width or height
  55. - (void)gtm_appendBezierPathWithRoundRect:(NSRect)rect
  56. cornerRadius:(CGFloat)radius;
  57. /// Adds a path which is a round rectangle inscribed inside of rectangle |rect| with a corner radii specified
  58. //
  59. // Args:
  60. // rect: outer rectangle to inscribe into
  61. // radius*: radii of the corners
  62. - (void)gtm_appendBezierPathWithRoundRect:(NSRect)rect
  63. topLeftCornerRadius:(CGFloat)radiusTL
  64. topRightCornerRadius:(CGFloat)radiusTR
  65. bottomLeftCornerRadius:(CGFloat)radiusBL
  66. bottomRightCornerRadius:(CGFloat)radiusBR;
  67. @end