| 1 |
/* -*- mode: C++; tab-width: 4; c-basic-offset: 4; -*- */ |
| 2 |
|
| 3 |
/* AbiSource Application Framework |
| 4 |
* Copyright (C) 2005 Francis James Franklin |
| 5 |
* |
| 6 |
* This program is free software; you can redistribute it and/or |
| 7 |
* modify it under the terms of the GNU General Public License |
| 8 |
* as published by the Free Software Foundation; either version 2 |
| 9 |
* of the License, or (at your option) any later version. |
| 10 |
* |
| 11 |
* This program is distributed in the hope that it will be useful, |
| 12 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 13 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 14 |
* GNU General Public License for more details. |
| 15 |
* |
| 16 |
* You should have received a copy of the GNU General Public License |
| 17 |
* along with this program; if not, write to the Free Software |
| 18 |
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA |
| 19 |
* 02110-1301 USA. |
| 20 |
*/ |
| 21 |
|
| 22 |
#ifndef XAP_COCOATOOLPROVIDER_H |
| 23 |
#define XAP_COCOATOOLPROVIDER_H |
| 24 |
|
| 25 |
#import <Cocoa/Cocoa.h> |
| 26 |
|
| 27 |
#include "xap_CocoaPlugin.h" |
| 28 |
|
| 29 |
@interface XAP_CocoaToolProvider : NSObject <XAP_CocoaPlugin_ToolProvider> |
| 30 |
{ |
| 31 |
NSString * m_name; |
| 32 |
|
| 33 |
NSMutableArray * m_identifiers; |
| 34 |
NSMutableDictionary * m_tools; |
| 35 |
} |
| 36 |
+ (XAP_CocoaToolProvider *)AbiWordToolProvider; // don't use this method; use XAP_CocoaAppController's toolProvider:@"AbiWord" |
| 37 |
|
| 38 |
- (id)initWithName:(NSString *)name; |
| 39 |
- (void)dealloc; |
| 40 |
|
| 41 |
/** |
| 42 |
* Get the name of the provider. |
| 43 |
* |
| 44 |
* \return The name identifying the provider. |
| 45 |
*/ |
| 46 |
- (NSString *)name; |
| 47 |
|
| 48 |
/** |
| 49 |
* Add a tool to the provider's list of tools. The provider will send the tool a setProvider: message. |
| 50 |
* |
| 51 |
* \param tool An object which implements the XAP_CocoaPlugin_Tool protocol. |
| 52 |
*/ |
| 53 |
- (void)addTool:(id <NSObject, XAP_CocoaPlugin_Tool>)tool; |
| 54 |
|
| 55 |
/** |
| 56 |
* Remove a tool from the provider's list of tools. The provider will send the tool a setProvider:nil message. |
| 57 |
* |
| 58 |
* \param identifier The identifier of the tool which is to be removed. |
| 59 |
*/ |
| 60 |
- (void)removeToolWithIdentifier:(NSString *)identifier; |
| 61 |
|
| 62 |
/** |
| 63 |
* Get the tool with the specified identifier. |
| 64 |
* |
| 65 |
* \param identifier The identifier of the tool which is desired. |
| 66 |
* |
| 67 |
* \return The specified tool, or nil if the identifier is not matched. |
| 68 |
*/ |
| 69 |
- (id <NSObject, XAP_CocoaPlugin_Tool>)toolWithIdentifier:(NSString *)identifier; |
| 70 |
|
| 71 |
/** |
| 72 |
* Get the identifiers of the tools provided. |
| 73 |
* |
| 74 |
* \return The identifiers of the tools provided. |
| 75 |
*/ |
| 76 |
- (NSArray *)toolIdentifiers; |
| 77 |
|
| 78 |
/** |
| 79 |
* See whether the provider provides a specific tool, and get the description (tooltip). |
| 80 |
* |
| 81 |
* \param identifier The internal identifier of the desired tool. |
| 82 |
* |
| 83 |
* \return The description (the tooltip) of the tool if the identifier is recognized, otherwise nil. |
| 84 |
*/ |
| 85 |
- (NSString *)toolDescription:(NSString *)identifier; |
| 86 |
|
| 87 |
@end |
| 88 |
|
| 89 |
#endif /* ! XAP_COCOATOOLPROVIDER_H */ |