VLCEventManager.h 3.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384
  1. /*****************************************************************************
  2. * VLCEventManager.h: VLCKit.framework VLCEventManager header
  3. *****************************************************************************
  4. * Copyright (C) 2007 Pierre d'Herbemont
  5. * Copyright (C) 2007 VLC authors and VideoLAN
  6. * $Id$
  7. *
  8. * Authors: Pierre d'Herbemont <pdherbemont # videolan.org>
  9. *
  10. * This program is free software; you can redistribute it and/or modify it
  11. * under the terms of the GNU Lesser General Public License as published by
  12. * the Free Software Foundation; either version 2.1 of the License, or
  13. * (at your option) any later version.
  14. *
  15. * This program is distributed in the hope that it will be useful,
  16. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  17. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  18. * GNU Lesser General Public License for more details.
  19. *
  20. * You should have received a copy of the GNU Lesser General Public License
  21. * along with this program; if not, write to the Free Software Foundation,
  22. * Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
  23. *****************************************************************************/
  24. #import <pthread.h>
  25. /**
  26. * The VLCEventManager class provides a safe way for inter-thread communications.
  27. */
  28. @interface VLCEventManager : NSObject
  29. /* Factories */
  30. /**
  31. * Returns the shared VLCEventManager. There should only be one instance of this class.
  32. * \return Shared event manager.
  33. */
  34. + (id)sharedManager;
  35. /* Operations */
  36. /**
  37. * Sends a message to the target's delegate on the main thread.
  38. * \discussion The main thread is the one in which the main run loop is run, which usually
  39. * means the one in which the NSApplication object receives events. The method is performed
  40. * when the main thread runs the run loop in one of the common run loop modes (as specified
  41. * in the CFRunLoop documentation).
  42. *
  43. * The receiver is retained until the call is finished.
  44. * \param aTarget The target object who's delegate should receive the specified message.
  45. * \param aSelector A selector that identifies the method to invoke. The method should not
  46. * have a significant return value and should take a single argument of type NSNotification,
  47. * or no arguments.
  48. *
  49. * \param aNotificationName The name of the notification that should be sent to the
  50. * distributed notification center.
  51. */
  52. - (void)callOnMainThreadDelegateOfObject:(id)aTarget
  53. withDelegateMethod:(SEL)aSelector
  54. withNotificationName:(NSString *)aNotificationName;
  55. /**
  56. * Sends a message to the target on the main thread.
  57. * \discussion The main thread is the one in which the main run loop is run, which usually
  58. * means the one in which the NSApplication object receives events. The method is performed
  59. * when the main thread runs the run loop in one of the common run loop modes (as specified
  60. * in the CFRunLoop documentation).
  61. *
  62. * The receiver and arg are retained until the call is finished.
  63. * \param aTarget The target object who should receive the specified message.
  64. * \param aSelector A selector that identifies the method to invoke. The method should not
  65. * have a significant return value and should take a single argument of type id,
  66. * or no arguments.
  67. *
  68. * See “Selectors” for a description of the SEL type.
  69. * \param arg The argument to pass in the message. Pass nil if the method does not take an
  70. * argument.
  71. * distributed notification center.
  72. */
  73. - (void)callOnMainThreadObject:(id)aTarget
  74. withMethod:(SEL)aSelector
  75. withArgumentAsObject:(id)arg;
  76. - (void)cancelCallToObject:(id)target;
  77. @end