00001 /* -*- mode: C++; tab-width: 4; c-basic-offset: 4; -*- */ 00002 00003 /* AbiSource Application Framework 00004 * Copyright (C) 2005 Francis James Franklin 00005 * 00006 * This program is free software; you can redistribute it and/or 00007 * modify it under the terms of the GNU General Public License 00008 * as published by the Free Software Foundation; either version 2 00009 * of the License, or (at your option) any later version. 00010 * 00011 * This program is distributed in the hope that it will be useful, 00012 * but WITHOUT ANY WARRANTY; without even the implied warranty of 00013 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00014 * GNU General Public License for more details. 00015 * 00016 * You should have received a copy of the GNU General Public License 00017 * along with this program; if not, write to the Free Software 00018 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 00019 * 02110-1301 USA. 00020 */ 00021 00022 #ifndef AP_COCOATOOLPROVIDER_H 00023 #define AP_COCOATOOLPROVIDER_H 00024 00025 #include "xap_CocoaToolProvider.h" 00026 00027 @interface AP_CocoaTool : NSObject <XAP_CocoaPlugin_Tool> 00028 { 00029 NSString * m_identifier; 00030 NSString * m_description; 00031 NSString * m_icon_name; 00032 00033 id <XAP_CocoaPlugin_ToolProvider> m_provider; 00034 00035 unsigned m_toolbarID; 00036 } 00037 + (void)addStandardToolsToProvider:(XAP_CocoaToolProvider *)provider; 00038 00039 - (id)initWithIdentifier:(NSString *)identifier description:(NSString *)description iconName:(NSString *)iconName toolbarID:(unsigned)tlbrid; 00040 - (void)dealloc; 00041 00042 - (NSString *)identifier; 00043 - (NSString *)description; 00044 - (NSString *)iconName; /* note: an internal ID, not an actual file name */ 00045 00046 - (void)setProvider:(id <XAP_CocoaPlugin_ToolProvider>)provider; 00047 - (id <XAP_CocoaPlugin_ToolProvider>)provider; 00048 00049 - (id <NSObject, XAP_CocoaPlugin_ToolInstance>)tool; 00050 @end 00051 00052 @interface AP_CocoaToolInstance_StandardButton : NSObject <XAP_CocoaPlugin_ToolInstance> 00053 { 00054 AP_CocoaTool * m_tool; 00055 00056 unsigned m_toolbarID; 00057 00058 NSButton * m_button; 00059 NSMenuItem * m_item; 00060 00061 NSString * m_defaultImage; 00062 NSString * m_defaultAltImage; 00063 00064 NSString * m_configImage; 00065 NSString * m_configAltImage; 00066 } 00067 - (id)initWithTool:(AP_CocoaTool *)tool toolbarID:(unsigned)tlbrid; 00068 - (void)dealloc; 00069 00070 - (BOOL)validateMenuItem:(NSMenuItem *)menuItem; 00071 00072 - (IBAction)click:(id)sender; 00073 00074 /* XAP_CocoaPlugin_ToolInstance implementation 00075 */ 00076 - (id <NSObject, XAP_CocoaPlugin_Tool>)tool; 00077 00078 - (NSView *)toolbarButton; 00079 00080 - (NSMenuItem *)toolbarMenuItem; 00081 00082 - (NSString *)configWidth; 00083 - (NSString *)configHeight; 00084 - (NSString *)configImage; 00085 - (NSString *)configAltImage; 00086 00087 - (void)setConfigWidth:(NSString *)width; 00088 - (void)setConfigHeight:(NSString *)height; 00089 - (void)setConfigImage:(NSString *)image; 00090 - (void)setConfigAltImage:(NSString *)altImage; 00091 @end 00092 00093 #endif /* ! AP_COCOATOOLPROVIDER_H */