PageRenderTime 28ms CodeModel.GetById 23ms app.highlight 3ms RepoModel.GetById 1ms 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
 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
20// This entire file, and the corresponding .m is similar to, and predates
21// Apple's recursiveDescription, used like so:
22//
23// (lldb) po [[self view] recursiveDescription]
24//
25// As documented in Technical Note TN2239 iOS Debugging Magic.
26
27// This entire file, and the corresponding .m is DEBUG only.
28// But you can define INCLUDE_UIVIEW_SUBTREE_DESCRIPTION to no-zero to override.
29#if DEBUG || INCLUDE_UIVIEW_SUBTREE_DESCRIPTION
30
31// Example, in debugger, pause the program, then type:
32// po [[[UIApplication sharedApplication] keyWindow] subtreeDescription]
33
34@interface UIView (SubtreeDescription)
35
36// Returns one line, without leading indent, but with a trailing newline,
37// describing the view.
38// If you define a |myViewDescriptionLine| method in your own UIView classes,
39// this will append that result to its description.
40- (NSString *)gtm_subtreeDescriptionLine;
41
42// For debugging. Returns a nicely indented representation of this view's
43// subview hierarchy, each with frame and isHidden.
44- (NSString *)subtreeDescription;
45
46// For debugging. Returns a nicely indented representation of this view's
47// layer hierarchy, with frames and isHidden.
48// Requires QuartzCore to be useful, but your app will still link without it.
49// TODO: should there be an analog of myViewDescriptionLine for layers?
50- (NSString *)sublayersDescription;
51
52@end
53
54@protocol GTMUIViewSubtreeDescription
55// A UIView can implement this and it can add it's own custom description
56// in gtm_subtreeDescriptionLine.
57- (NSString *)myViewDescriptionLine;
58@end
59
60#endif  // DEBUG