/core/externals/google-toolbox-for-mac/AppKit/GTMLargeTypeWindow.h

http://macfuse.googlecode.com/ · C++ Header · 70 lines · 12 code · 10 blank · 48 comment · 0 complexity · 1b1341f72771cd2568f4ec5149ca0cd5 MD5 · raw file

  1. //
  2. // GTMLargeTypeWindow.h
  3. //
  4. // Copyright 2008 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 under
  16. // the License.
  17. //
  18. #import <Cocoa/Cocoa.h>
  19. // GTMLargeTypeWindow displays a block of text in a large panel window much
  20. // like Address Book displays phone numbers. It will also display an image
  21. // so you can pop up "alerts" similar to the way BBEdit does when you attempt
  22. // to do a find and find nothing. It will fade in and out appropriately when
  23. // ordered forward or backward.
  24. // A typical fire-and-forget type usage would be:
  25. // GTMLargeTypeWindow *window
  26. // = [[[GTMLargeTypeWindow alloc] initWithString:@"Foo"] autorelease];
  27. // [window makeKeyAndOrderFront:nil];
  28. // NB This class appears to have a problem with GC on 10.5.6 and below.
  29. // Radar 6137322 CIFilter crashing when run with GC enabled
  30. // This appears to be an Apple bug with GC.
  31. // We do a copy animation that causes things to crash, but only with GC
  32. // on. Currently I have left this enabled in GTMLargeTypeWindow pending
  33. // info from Apple on the bug. It's hard to reproduce, and only appears
  34. // at this time on our test machines.
  35. // Dual-Core Intel Xeon with ATI Radeon X1300
  36. @interface GTMLargeTypeWindow : NSPanel
  37. // Setter and getter for the copy animation duration. Default value is .5s.
  38. // Note that this affects all windows.
  39. + (NSTimeInterval)copyAnimationDuration;
  40. + (void)setCopyAnimationDuration:(NSTimeInterval)duration;
  41. // Setter and getter for the fade animation duration. Default value is .3s.
  42. // Note that this affects all windows.
  43. + (NSTimeInterval)fadeAnimationDuration;
  44. + (void)setFadeAnimationDuration:(NSTimeInterval)duration;
  45. // Creates a display window with |string| displayed.
  46. // Formats |string| as best as possible to fill the screen.
  47. - (id)initWithString:(NSString *)string;
  48. // Creates a display window with |attrString| displayed.
  49. // Expects you to format it as you want it to appear.
  50. - (id)initWithAttributedString:(NSAttributedString *)attrString;
  51. // Creates a display window with |image| displayed.
  52. // Make sure you set the image size to what you want
  53. - (id)initWithImage:(NSImage*)image;
  54. // Creates a display window with |view| displayed.
  55. - (id)initWithContentView:(NSView *)view;
  56. // Copy the text out of the window if appropriate. This is normally called
  57. // as part of the responder chain so that the user can copy the displayed text
  58. // using cmd-c.
  59. - (void)copy:(id)sender;
  60. @end