• Main Page
  • Related Pages
  • Namespaces
  • Classes
  • Files
  • File List
  • File Members

xap_CocoaAppController.h

Go to the documentation of this file.
00001 /* -*- mode: C++; tab-width: 4; c-basic-offset: 4; -*- */
00002 
00003 /* AbiSource Application Framework
00004  * Copyright (C) 2003 Hubert Figuiere
00005  * Copyright (C) 2004 Francis James Franklin
00006  * Copyright (C) 2009 Hubert Figuiere
00007  *
00008  * This program is free software; you can redistribute it and/or
00009  * modify it under the terms of the GNU General Public License
00010  * as published by the Free Software Foundation; either version 2
00011  * of the License, or (at your option) any later version.
00012  *
00013  * This program is distributed in the hope that it will be useful,
00014  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00015  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00016  * GNU General Public License for more details.
00017  *
00018  * You should have received a copy of the GNU General Public License
00019  * along with this program; if not, write to the Free Software
00020  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
00021  * 02110-1301 USA.
00022  */
00023 
00024 #ifndef XAP_COCOAAPPCONTROLLER_H
00025 #define XAP_COCOAAPPCONTROLLER_H
00026 
00027 #import <Cocoa/Cocoa.h>
00028 
00029 #include "xap_CocoaPlugin.h"
00030 
00031 class AV_View;
00032 class XAP_Frame;
00033 
00034 @class EV_CocoaMenuDelegate;
00035 
00036 @class AP_CocoaPlugin_MenuIDRef;
00037 
00038 @interface XAP_CocoaApplication : NSApplication
00039 {
00040     //
00041 }
00042 - (void)terminate:(id)sender;
00043 - (void)orderFrontStandardAboutPanel:(id)sender;
00044 - (void)orderFrontPreferencesPanel:(id)sender;
00045 - (void)openContextHelp:(id)sender;
00046 - (void)sendEvent:(NSEvent *)anEvent;
00047 @end
00048 
00049 enum XAP_CocoaAppMenu_Id
00050 {
00051     XAP_CocoaAppMenu_AbiWord = 0,
00052     XAP_CocoaAppMenu_File,
00053     XAP_CocoaAppMenu_Edit,
00054     XAP_CocoaAppMenu_View,
00055     XAP_CocoaAppMenu_Insert,
00056     XAP_CocoaAppMenu_Format,
00057     XAP_CocoaAppMenu_Tools,
00058     XAP_CocoaAppMenu_Table,
00059     XAP_CocoaAppMenu_Window,
00060     XAP_CocoaAppMenu_Help,
00061     XAP_CocoaAppMenu_count__
00062 };
00063 
00064 @interface XAP_CocoaAppController : NSObject
00065 {
00066     IBOutlet NSMenu *       oMenu_AbiWord;
00067 
00068     IBOutlet NSMenuItem *   oMenuItem_AboutAbiWord;
00069     IBOutlet NSMenuItem *   oMenuItem_Preferences;
00070 
00071     IBOutlet NSMenu *       oMenu_File;
00072     IBOutlet NSMenu *       oMenu_Edit;
00073     IBOutlet NSMenu *       oMenu_View;
00074     IBOutlet NSMenu *       oMenu_Insert;
00075     IBOutlet NSMenu *       oMenu_Format;
00076     IBOutlet NSMenu *       oMenu_Tools;
00077     IBOutlet NSMenu *       oMenu_Table;
00078     IBOutlet NSMenu *       oMenu_Window;
00079     IBOutlet NSMenu *       oMenu_Help;
00080 
00081     IBOutlet NSMenuItem *   oMenuItem_File;
00082     IBOutlet NSMenuItem *   oMenuItem_Edit;
00083     IBOutlet NSMenuItem *   oMenuItem_View;
00084     IBOutlet NSMenuItem *   oMenuItem_Insert;
00085     IBOutlet NSMenuItem *   oMenuItem_Format;
00086     IBOutlet NSMenuItem *   oMenuItem_Tools;
00087     IBOutlet NSMenuItem *   oMenuItem_Table;
00088     IBOutlet NSMenuItem *   oMenuItem_Window;
00089     IBOutlet NSMenuItem *   oMenuItem_Help;
00090 
00091     IBOutlet NSMenuItem *   oMenuItem_AbiWordHelp;
00092 
00093     NSMenu *                m_PanelMenu;
00094     NSMenu *                m_ContextMenu;
00095 
00096     NSMenu *                m_AppMenu[XAP_CocoaAppMenu_count__];
00097     NSMenuItem *            m_AppItem[XAP_CocoaAppMenu_count__];
00098 
00099     NSMutableDictionary *   m_MenuIDRefDictionary;
00100 
00101     NSMutableArray *        m_Plugins;
00102     NSMutableArray *        m_PluginsTools;
00103 
00104     NSMenuItem *            m_PluginsToolsSeparator;
00105 
00106     NSMutableArray *        m_FilesRequestedDuringLaunch;
00107 
00108     NSMutableArray *        m_ToolProviders;
00109 
00110     BOOL            m_bApplicationLaunching;
00111     BOOL            m_bAutoLoadPluginsAfterLaunch;
00112 
00113     AV_View *       m_pViewCurrent;
00114     XAP_Frame *     m_pFrameCurrent;
00115 
00116     AV_View *       m_pViewPrevious;
00117     XAP_Frame *     m_pFramePrevious;
00118 }
00119 + (XAP_CocoaAppController*)sharedAppController;
00120 
00121 - (id)init;
00122 - (void)dealloc;
00123 
00124 - (void)setAutoLoadPluginsAfterLaunch:(BOOL)autoLoadPluginsAfterLaunch;
00125 
00126 - (BOOL)application:(NSApplication *)sender delegateHandlesKey:(NSString *)key;
00127 
00128 - (void)applicationWillFinishLaunching:(NSNotification *)aNotification;
00129 - (void)applicationDidFinishLaunching:(NSNotification *)aNotification;
00130 
00131 - (NSApplicationTerminateReply)applicationShouldTerminate:(NSApplication *)sender;
00132 - (void)applicationWillTerminate:(NSNotification *)aNotification;
00133 
00134 - (BOOL)application:(NSApplication *)theApplication openFile:(NSString *)filename;
00135 - (BOOL)application:(NSApplication *)theApplication openTempFile:(NSString *)filename;
00136 - (BOOL)application:(NSApplication *)theApplication printFile:(NSString *)filename;
00137 - (BOOL)applicationOpenUntitledFile:(NSApplication *)theApplication;
00138 - (BOOL)applicationOpenFile:(NSApplication *)theApplication;
00139 
00140 - (id)dockFileNew:(id)sender;
00141 - (id)dockFileOpen:(id)sender;
00142 
00143 /* - (NSMenu *)applicationDockMenu:(NSApplication *)sender; */
00144 
00145 /* For building the Application Menu
00146  */
00147 - (void)setAboutTitle:(NSString *)title;
00148 - (void)setPrefsTitle:(NSString *)title;
00149 - (void)setCHelpTitle:(NSString *)title; // context-help
00150 
00151 - (void)setTitle:(NSString *)title forMenu:(XAP_CocoaAppMenu_Id)appMenu;
00152 
00153 - (const char *)keyEquivalentForMenuID:(int /* XAP_Menu_Id */)menuid modifierMask:(unsigned int *)mask;
00154 
00155 - (NSMenu *)panelMenu;
00156 - (NSMenu *)contextMenu;
00157 
00158 - (void)appendPanelItem:(NSMenuItem *)item;
00159 - (void)appendContextItem:(NSMenuItem *)item;
00160 - (void)appendItem:(NSMenuItem *)item toMenu:(XAP_CocoaAppMenu_Id)appMenu;
00161 
00162 - (void)clearContextMenu;
00163 - (void)clearMenu:(XAP_CocoaAppMenu_Id)appMenu; // except AbiWord & Windows
00164 - (void)clearAllMenus;                          // except AbiWord & Windows
00165 
00166 
00167 - (void)reappendPluginMenuItems; // for use after rebuilding menus - see XAP_CocoaApp::rebuildMenus()
00168 - (void)appendPluginMenuItem:(NSMenuItem *)menuItem;
00169 - (void)removePluginMenuItem:(NSMenuItem *)menuItem;
00170 
00171 /* Do we need this? getLastFocussedFrame() should be tracking this now... [TODO!!]
00172  */
00173 - (void)setCurrentView:(AV_View *)view inFrame:(XAP_Frame *)frame;
00174 - (void)resetCurrentView:(AV_View *)view inFrame:(XAP_Frame *)frame;
00175 - (void)unsetCurrentView:(AV_View *)view inFrame:(XAP_Frame *)frame;
00176 
00177 - (AV_View *)currentView;
00178 - (XAP_Frame *)currentFrame;
00179 
00180 - (AV_View *)previousView;
00181 - (XAP_Frame *)previousFrame;
00182 
00183 - (void)notifyFrameViewChange; // [re/un]setCurrentView call this
00184 
00190 - (XAP_CocoaPlugin *)loadPlugin:(NSString *)path;
00191 
00195 - (NSArray *)plugins;
00196 
00202 - (BOOL)deactivateAllPlugins;
00203 
00209 - (BOOL)deactivatePlugin:(XAP_CocoaPlugin *)plugin overridePlugin:(BOOL)override;
00210 
00215 - (void)addRef:(AP_CocoaPlugin_MenuIDRef *)ref forMenuID:(NSNumber *)menuid;
00216 
00221 - (AP_CocoaPlugin_MenuIDRef *)refForMenuID:(NSNumber *)menuid;
00222 
00227 - (void)removeRefForMenuID:(NSNumber *)menuid;
00228 
00235 - (NSArray *)toolProviders;
00236 
00246 - (id <NSObject, XAP_CocoaPlugin_ToolProvider>)toolProvider:(NSString *)name;
00247 
00248 @end
00249 
00250 #endif /* ! XAP_COCOAAPPCONTROLLER_H */

Generated on Sun Feb 14 2021 for AbiWord by  doxygen 1.7.1