cocoa_protocols.h revision 21d179b334e59e9a3bfcaed4c4430bef1bc5759d
1// Copyright (c) 2009 The Chromium Authors. All rights reserved.
2// Use of this source code is governed by a BSD-style license that can be
3// found in the LICENSE file.
4
5#ifndef BASE_COCOA_PROTOCOLS_MAC_H_
6#define BASE_COCOA_PROTOCOLS_MAC_H_
7#pragma once
8
9#import <Cocoa/Cocoa.h>
10
11// GTM also maintinas a list of empty protocols, but only the ones the library
12// requires. Augment that below.
13#import "third_party/GTM/GTMDefines.h"
14
15// The Mac OS X 10.6 SDK introduced new protocols used for delegates.  These
16// protocol defintions were not present in earlier releases of the Mac OS X
17// SDK.  In order to support building against the new SDK, which requires
18// delegates to conform to these protocols, and earlier SDKs, which do not
19// define these protocols at all, this file will provide empty protocol
20// definitions when used with earlier SDK versions.
21
22#if !defined(MAC_OS_X_VERSION_10_6) || \
23    MAC_OS_X_VERSION_MAX_ALLOWED < MAC_OS_X_VERSION_10_6
24
25#define DEFINE_EMPTY_PROTOCOL(p) \
26@protocol p \
27@end
28
29DEFINE_EMPTY_PROTOCOL(NSAlertDelegate)
30DEFINE_EMPTY_PROTOCOL(NSApplicationDelegate)
31DEFINE_EMPTY_PROTOCOL(NSControlTextEditingDelegate)
32DEFINE_EMPTY_PROTOCOL(NSMatrixDelegate)
33DEFINE_EMPTY_PROTOCOL(NSMenuDelegate)
34DEFINE_EMPTY_PROTOCOL(NSOpenSavePanelDelegate)
35DEFINE_EMPTY_PROTOCOL(NSOutlineViewDataSource)
36DEFINE_EMPTY_PROTOCOL(NSOutlineViewDelegate)
37DEFINE_EMPTY_PROTOCOL(NSTableViewDataSource)
38DEFINE_EMPTY_PROTOCOL(NSTableViewDelegate)
39DEFINE_EMPTY_PROTOCOL(NSTextFieldDelegate)
40DEFINE_EMPTY_PROTOCOL(NSTextViewDelegate)
41DEFINE_EMPTY_PROTOCOL(NSWindowDelegate)
42
43#undef DEFINE_EMPTY_PROTOCOL
44
45#endif
46
47#endif  // BASE_COCOA_PROTOCOLS_MAC_H_
48