00001 /* -*- mode: C++; tab-width: 4; c-basic-offset: 4; -*- */ 00002 00003 /* AbiSource Application Framework 00004 * Copyright (C) 1998 AbiSource, Inc. 00005 * Copyright (C) 2001-2002 Hubert Figuiere 00006 * 00007 * This program is free software; you can redistribute it and/or 00008 * modify it under the terms of the GNU General Public License 00009 * as published by the Free Software Foundation; either version 2 00010 * of the License, or (at your option) any later version. 00011 * 00012 * This program is distributed in the hope that it will be useful, 00013 * but WITHOUT ANY WARRANTY; without even the implied warranty of 00014 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00015 * GNU General Public License for more details. 00016 * 00017 * You should have received a copy of the GNU General Public License 00018 * along with this program; if not, write to the Free Software 00019 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 00020 * 02110-1301 USA. 00021 */ 00022 00023 00024 #ifndef XAP_COCOAFRAMEIMPL_H 00025 #define XAP_COCOAFRAMEIMPL_H 00026 00027 #import <Cocoa/Cocoa.h> 00028 #import "xap_CocoaDialogFactory.h" 00029 #import "xap_FrameImpl.h" 00030 #import "xap_CocoaAppController.h" 00031 00032 @class XAP_CocoaNSStatusBar; 00033 00034 class XAP_CocoaFrameImpl; 00035 00036 @interface XAP_CocoaFrameController : NSWindowController 00037 { 00038 XAP_CocoaFrameImpl *m_frame; 00039 IBOutlet NSView *mainView; 00040 IBOutlet XAP_CocoaNSStatusBar *statusBar; 00041 NSView <NSTextInput> *m_textView; 00042 } 00043 + (XAP_CocoaFrameController*)createFrom:(XAP_CocoaFrameImpl *)frame; 00044 - (id)initWith:(XAP_CocoaFrameImpl *)frame; 00045 - (NSView *)getMainView; 00046 - (XAP_CocoaNSStatusBar *)getStatusBar; 00047 - (XAP_CocoaFrameImpl *)frameImpl; 00048 - (void)setTextView:(NSView <NSTextInput>*)tv; 00049 - (NSView <NSTextInput>*)textView; 00050 00051 - (NSArray *)getToolbars; 00052 - (NSString *)getToolbarSummaryID; 00053 @end 00054 00055 00056 class EV_Menu; 00057 class EV_CocoaMenuBar; 00058 class EV_CocoaMenuPopup; 00059 class XAP_DialogFactory; 00060 class XAP_Frame; 00061 class GR_CocoaGraphics; 00062 00063 class XAP_CocoaFrameImpl : public XAP_FrameImpl 00064 { 00065 public: 00066 static NSString* XAP_FrameNeedToolbar; 00067 static NSString* XAP_FrameReleaseToolbar; 00068 00069 XAP_CocoaFrameImpl(XAP_Frame* frame); 00070 friend class XAP_Frame; 00071 // XAP_CocoaFrameImpl(XAP_CocoaFrame * f); 00072 virtual ~XAP_CocoaFrameImpl(); 00073 /* 00074 virtual bool initialize(const char * szKeyBindingsKey, const char * szKeyBindingsDefaultValue, 00075 const char * szMenuLayoutKey, const char * szMenuLayoutDefaultValue, 00076 const char * szMenuLabelSetKey, const char * szMenuLabelSetDefaultValue, 00077 const char * szToolbarLayoutsKey, const char * szToolbarLayoutsDefaultValue, 00078 const char * szToolbarLabelSetKey, const char * szToolbarLabelSetDefaultValue); 00079 */ 00080 virtual void _initialize(); 00081 virtual void notifyViewChanged(AV_View * pView); 00082 // virtual XAP_Frame * cloneFrame() = 0; 00083 // virtual UT_Error loadDocument(const char * szFilename, int ieft) = 0; 00084 // virtual UT_Error loadDocument(const char * szFilename, int ieft, bool createNew) = 0; 00085 virtual bool _close(); 00086 virtual bool _raise(); 00087 virtual bool _show(); 00088 virtual void _setFullScreen(bool /*isFullScreen*/ ) { UT_ASSERT(UT_NOT_IMPLEMENTED); } 00089 virtual bool _updateTitle(); 00090 virtual UT_sint32 _setInputMode(const char * szName); 00091 virtual void _hideMenuScroll(bool /*bHideMenuScroll*/) 00092 { UT_ASSERT(UT_NOT_IMPLEMENTED); } 00093 virtual void _nullUpdate () const; 00094 virtual void _setCursor(GR_Graphics::Cursor /*c*/) { } 00095 00096 NSWindow * getTopLevelWindow() const; 00097 NSView * getVBoxWidget() const; 00098 virtual XAP_DialogFactory * _getDialogFactory(); 00099 // virtual void setXScrollRange() = 0; 00100 // virtual void setYScrollRange() = 0; 00101 virtual bool _runModalContextMenu(AV_View * pView, const char * szMenuName, 00102 UT_sint32 x, UT_sint32 y); 00103 // virtual void translateDocumentToScreen(UT_sint32 &x, UT_sint32 &y) = 0; 00104 // virtual void setStatusMessage(const char * szMsg) = 0; 00105 00106 void setTimeOfLastEvent(NSTimeInterval timestamp); 00107 00108 // virtual void toggleRuler(bool bRulerOn) = 0; 00109 virtual void _queue_resize(); 00110 virtual EV_Menu* _getMainMenu(); 00111 00112 virtual void _rebuildMenus(void); 00113 virtual void _rebuildToolbar(UT_uint32 ibar); 00114 void _setController (XAP_CocoaFrameController * ctrl); 00115 XAP_CocoaFrameController * _getController () { return m_frameController; }; 00116 virtual NSString * _getNibName () = 0; 00117 virtual XAP_CocoaFrameController *_createController() = 0; 00118 static void setToolbarRect(const NSRect &r); 00119 protected: 00120 virtual void _createDocumentWindow() = 0; 00121 virtual void _createStatusBarWindow(XAP_CocoaNSStatusBar *) = 0; 00122 virtual void _createTopLevelWindow(); 00123 virtual void _setWindowIcon() = 0; 00124 virtual void _createDocView(GR_Graphics* &pG) = 0; /* Cocoa specific */ 00125 00126 virtual EV_Toolbar * _newToolbar(XAP_Frame *frame, const char *, const char *); 00127 00128 virtual UT_RGBColor getColorSelBackground () const; 00129 private: 00130 AP_CocoaDialogFactory m_dialogFactory; 00131 EV_CocoaMenuPopup * m_pCocoaPopup; /* only valid while a context popup is up */ 00132 00133 XAP_CocoaFrameController * m_frameController; 00134 }; 00135 00136 00137 #endif