NSApplication.h 2.9 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667
  1. ///////////////////////////////////////////////////////////////////////////////
  2. // Name: wx/cocoa/NSApplication.h
  3. // Purpose: wxNSApplicationDelegate definition
  4. // Author: David Elliott
  5. // Modified by:
  6. // Created: 2004/01/26
  7. // Copyright: (c) 2003,2004 David Elliott
  8. // Licence: wxWindows licence
  9. ///////////////////////////////////////////////////////////////////////////////
  10. #ifndef _WX_COCOA_NSAPPLICATION_H__
  11. #define _WX_COCOA_NSAPPLICATION_H__
  12. #include "wx/cocoa/objc/objc_uniquifying.h"
  13. // ========================================================================
  14. // wxNSApplicationDelegate
  15. // ========================================================================
  16. /*!
  17. @class wxNSApplicationDelegate
  18. @discussion Implements an NSApplication delegate which can respond to messages sent by Cocoa to change Cocoa's behaviour.
  19. wxCocoa will set a singleton instance of this class as the NSApplication delegate upon startup unless wxWidgets is running
  20. in a "plugin" manner in which case it would not be appropriate to do this.
  21. Although Cocoa will send notifications to the delegate it is also possible to register a different object to listen for
  22. them. Because we want to support the plugin case, we use a separate notification observer object when we can.
  23. */
  24. @interface wxNSApplicationDelegate : NSObject
  25. {
  26. }
  27. // Delegate methods
  28. - (BOOL)applicationShouldTerminateAfterLastWindowClosed:(NSApplication *)theApplication;
  29. @end // interface wxNSApplicationDelegate : NSObject
  30. WX_DECLARE_GET_OBJC_CLASS(wxNSApplicationDelegate,NSObject)
  31. // ========================================================================
  32. // wxNSApplicationObserver
  33. // ========================================================================
  34. /*!
  35. @class wxNSApplicationObserver
  36. @discussion Observes most notifications sent by the NSApplication singleton.
  37. wxCocoa will create a singleton instance of this class upon startup and register it with the default notification center to
  38. listen for several events sent by the NSApplication singleton.
  39. Because there can be any number of notification observers, this method allows wxCocoa to function properly even when it is
  40. running as a plugin of some other (most likely not wxWidgets) application.
  41. */
  42. @interface wxNSApplicationObserver : NSObject
  43. {
  44. }
  45. // Methods defined as (but not used here) as NSApplication delegate methods.
  46. - (void)applicationWillBecomeActive:(NSNotification *)notification;
  47. - (void)applicationDidBecomeActive:(NSNotification *)notification;
  48. - (void)applicationWillResignActive:(NSNotification *)notification;
  49. - (void)applicationDidResignActive:(NSNotification *)notification;
  50. - (void)applicationWillUpdate:(NSNotification *)notification;
  51. // Other notifications
  52. - (void)controlTintChanged:(NSNotification *)notification;
  53. @end // interface wxNSApplicationObserver : NSObject
  54. WX_DECLARE_GET_OBJC_CLASS(wxNSApplicationObserver,NSObject)
  55. #endif //ndef _WX_COCOA_NSAPPLICATION_H__