00001 /* AbiWord 00002 * Copyright (C) 1998 AbiSource, Inc. 00003 * Copyright (C) 2001-2003, 2005 Hubert Figuiere 00004 * 00005 * This program is free software; you can redistribute it and/or 00006 * modify it under the terms of the GNU General Public License 00007 * as published by the Free Software Foundation; either version 2 00008 * of the License, or (at your option) any later version. 00009 * 00010 * This program is distributed in the hope that it will be useful, 00011 * but WITHOUT ANY WARRANTY; without even the implied warranty of 00012 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00013 * GNU General Public License for more details. 00014 * 00015 * You should have received a copy of the GNU General Public License 00016 * along with this program; if not, write to the Free Software 00017 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 00018 * 02110-1301 USA. 00019 */ 00020 00021 #import <Cocoa/Cocoa.h> 00022 00023 #import "xap_CocoaFrame.h" 00024 #import "xap_CocoaFrameImpl.h" 00025 00026 00027 class AP_CocooApp; 00028 00029 @class XAP_CocoaTextView, XAP_NSScroller; 00030 00031 @interface AP_DocViewDelegate : NSObject <XAP_MouseEventDelegate> 00032 { 00033 } 00034 @end 00035 00036 @interface AP_CocoaFrameController : XAP_CocoaFrameController 00037 { 00038 IBOutlet XAP_CocoaNSView *hRuler; 00039 IBOutlet XAP_CocoaNSView *vRuler; 00040 } 00041 + (XAP_CocoaFrameController*)createFrom:(XAP_CocoaFrameImpl *)frame; 00042 - (id)initWith:(XAP_CocoaFrameImpl *)frame; 00043 - (IBAction)rulerClick:(id)sender; 00044 - (XAP_CocoaNSView *)getVRuler; 00045 - (XAP_CocoaNSView *)getHRuler; 00046 - (IBAction)scrollAction:(id)sender; 00047 @end 00048 00049 /*****************************************************************/ 00050 class AP_CocoaFrameImpl : public XAP_CocoaFrameImpl 00051 { 00052 public: 00053 AP_CocoaFrameImpl(AP_CocoaFrame *pCocoaFrame); 00054 virtual XAP_FrameImpl * createInstance(XAP_Frame *pFrame); 00055 00056 virtual NSString * _getNibName (); /* must be public to be called from Obj-C */ 00057 00058 UT_sint32 _getHScrollValue() { return m_HCurrentScroll; }; 00059 UT_sint32 _getHScrollMin() { return m_HMinScroll; }; 00060 UT_sint32 _getHScrollMax() { return m_HMaxScroll; }; 00061 UT_sint32 _getHVisible() { return m_HVisible; }; 00062 void _setHScrollValue(UT_sint32); 00063 void _setHScrollMin(UT_sint32); 00064 void _setHScrollMax(UT_sint32); 00065 void _setHVisible(UT_sint32); 00066 UT_sint32 _getVScrollValue() { return m_VCurrentScroll; }; 00067 UT_sint32 _getVScrollMin() { return m_VMinScroll; }; 00068 UT_sint32 _getVScrollMax() { return m_VMaxScroll; }; 00069 UT_sint32 _getVVisible() { return m_VVisible; }; 00070 void _setVScrollValue(UT_sint32); 00071 void _setVScrollMin(UT_sint32); 00072 void _setVScrollMax(UT_sint32); 00073 void _setVVisible(UT_sint32); 00074 void _scrollAction(id sender); 00075 00076 void _showTopRulerNSView(void); 00077 void _hideTopRulerNSView(void); 00078 void _showLeftRulerNSView(void); 00079 void _hideLeftRulerNSView(void); 00080 XAP_CocoaTextView *_getDocAreaGRView(void) 00081 { return m_docAreaGRView; } 00082 protected: 00083 00084 void _showOrHideStatusbar(void); 00085 00086 void _showOrHideToolbars(void); 00087 virtual void _refillToolbarsInFrameData(); 00088 void _bindToolbars(AV_View * pView); 00089 00090 virtual void _createDocumentWindow(); 00091 virtual void _createStatusBarWindow(XAP_CocoaNSStatusBar *); 00092 00093 friend class AP_CocoaFrame; 00094 virtual void _setWindowIcon(); 00095 /* Cocoa specific stuff */ 00096 virtual XAP_CocoaFrameController *_createController(); 00097 virtual void _createDocView(GR_Graphics* &pG); 00098 00099 virtual void _hideMenuScroll(bool /*bHideMenuScroll*/) { UT_ASSERT_HARMLESS(UT_NOT_IMPLEMENTED); } 00100 00101 void giveFocus(); 00102 private: 00103 XAP_NSScroller* m_hScrollbar; 00104 XAP_NSScroller* m_vScrollbar; 00105 XAP_CocoaTextView* m_docAreaGRView; 00106 static bool _graphicsUpdateCB(NSRect * aRect, GR_CocoaCairoGraphics *pG, void* param); 00107 private: 00108 UT_sint32 m_HMinScroll; 00109 UT_sint32 m_HMaxScroll; 00110 UT_sint32 m_HCurrentScroll; 00111 UT_sint32 m_HVisible; 00112 UT_sint32 m_VMinScroll; 00113 UT_sint32 m_VMaxScroll; 00114 UT_sint32 m_VCurrentScroll; 00115 UT_sint32 m_VVisible; 00116 /* called when updating */ 00117 void _setHScrollbarValues(); 00118 void _setVScrollbarValues(); 00119 };