PageRenderTime 25ms CodeModel.GetById 20ms RepoModel.GetById 0ms app.codeStats 0ms

/core/externals/google-toolbox-for-mac/iPhone/GTMUIView+SubtreeDescription.h

http://macfuse.googlecode.com/
C Header | 60 lines | 11 code | 10 blank | 39 comment | 1 complexity | 2567f4e1fa2b986ab83547a31f5c76d2 MD5 | raw file
Possible License(s): Apache-2.0, BSD-3-Clause, GPL-2.0
  1. //
  2. // GTMUIView+SubtreeDescription.h
  3. //
  4. // Copyright 2009 Google Inc.
  5. //
  6. // Licensed under the Apache License, Version 2.0 (the "License"); you may not
  7. // use this file except in compliance with the License. You may obtain a copy
  8. // of the License at
  9. //
  10. // http://www.apache.org/licenses/LICENSE-2.0
  11. //
  12. // Unless required by applicable law or agreed to in writing, software
  13. // distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
  14. // WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
  15. // License for the specific language governing permissions and limitations
  16. // under the License.
  17. //
  18. #import <UIKit/UIKit.h>
  19. // This entire file, and the corresponding .m is similar to, and predates
  20. // Apple's recursiveDescription, used like so:
  21. //
  22. // (lldb) po [[self view] recursiveDescription]
  23. //
  24. // As documented in Technical Note TN2239 iOS Debugging Magic.
  25. // This entire file, and the corresponding .m is DEBUG only.
  26. // But you can define INCLUDE_UIVIEW_SUBTREE_DESCRIPTION to no-zero to override.
  27. #if DEBUG || INCLUDE_UIVIEW_SUBTREE_DESCRIPTION
  28. // Example, in debugger, pause the program, then type:
  29. // po [[[UIApplication sharedApplication] keyWindow] subtreeDescription]
  30. @interface UIView (SubtreeDescription)
  31. // Returns one line, without leading indent, but with a trailing newline,
  32. // describing the view.
  33. // If you define a |myViewDescriptionLine| method in your own UIView classes,
  34. // this will append that result to its description.
  35. - (NSString *)gtm_subtreeDescriptionLine;
  36. // For debugging. Returns a nicely indented representation of this view's
  37. // subview hierarchy, each with frame and isHidden.
  38. - (NSString *)subtreeDescription;
  39. // For debugging. Returns a nicely indented representation of this view's
  40. // layer hierarchy, with frames and isHidden.
  41. // Requires QuartzCore to be useful, but your app will still link without it.
  42. // TODO: should there be an analog of myViewDescriptionLine for layers?
  43. - (NSString *)sublayersDescription;
  44. @end
  45. @protocol GTMUIViewSubtreeDescription
  46. // A UIView can implement this and it can add it's own custom description
  47. // in gtm_subtreeDescriptionLine.
  48. - (NSString *)myViewDescriptionLine;
  49. @end
  50. #endif // DEBUG