Debian Codegraph @

src/af/xap/cocoa/xap_CocoaFrameImpl.h

raw
1 /* -*- mode: C++; tab-width: 4; c-basic-offset: 4; -*- */
2
3 /* AbiSource Application Framework
4 * Copyright (C) 1998 AbiSource, Inc.
5 * Copyright (C) 2001-2002 Hubert Figuiere
6 *
7 * This program is free software; you can redistribute it and/or
8 * modify it under the terms of the GNU General Public License
9 * as published by the Free Software Foundation; either version 2
10 * of the License, or (at your option) any later version.
11 *
12 * This program is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 * GNU General Public License for more details.
16 *
17 * You should have received a copy of the GNU General Public License
18 * along with this program; if not, write to the Free Software
19 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
20 * 02110-1301 USA.
21 */
22
23
24 #ifndef XAP_COCOAFRAMEIMPL_H
25 #define XAP_COCOAFRAMEIMPL_H
26
27 #import <Cocoa/Cocoa.h>
28 #import "xap_CocoaDialogFactory.h"
29 #import "xap_FrameImpl.h"
30 #import "xap_CocoaAppController.h"
31
32 @class XAP_CocoaNSStatusBar;
33
34 class XAP_CocoaFrameImpl;
35
36 @interface XAP_CocoaFrameController : NSWindowController
37 {
38 XAP_CocoaFrameImpl *m_frame;
39 IBOutlet NSView *mainView;
40 IBOutlet XAP_CocoaNSStatusBar *statusBar;
41 NSView <NSTextInput> *m_textView;
42 }
43 + (XAP_CocoaFrameController*)createFrom:(XAP_CocoaFrameImpl *)frame;
44 - (id)initWith:(XAP_CocoaFrameImpl *)frame;
45 - (NSView *)getMainView;
46 - (XAP_CocoaNSStatusBar *)getStatusBar;
47 - (XAP_CocoaFrameImpl *)frameImpl;
48 - (void)setTextView:(NSView <NSTextInput>*)tv;
49 - (NSView <NSTextInput>*)textView;
50
51 - (NSArray *)getToolbars;
52 - (NSString *)getToolbarSummaryID;
53 @end
54
55
56 class EV_Menu;
57 class EV_CocoaMenuBar;
58 class EV_CocoaMenuPopup;
59 class XAP_DialogFactory;
60 class XAP_Frame;
61 class GR_CocoaGraphics;
62
63 class XAP_CocoaFrameImpl : public XAP_FrameImpl
64 {
65 public:
66 static NSString* XAP_FrameNeedToolbar;
67 static NSString* XAP_FrameReleaseToolbar;
68
69 XAP_CocoaFrameImpl(XAP_Frame* frame);
70 friend class XAP_Frame;
71 // XAP_CocoaFrameImpl(XAP_CocoaFrame * f);
72 virtual ~XAP_CocoaFrameImpl();
73 /*
74 virtual bool initialize(const char * szKeyBindingsKey, const char * szKeyBindingsDefaultValue,
75 const char * szMenuLayoutKey, const char * szMenuLayoutDefaultValue,
76 const char * szMenuLabelSetKey, const char * szMenuLabelSetDefaultValue,
77 const char * szToolbarLayoutsKey, const char * szToolbarLayoutsDefaultValue,
78 const char * szToolbarLabelSetKey, const char * szToolbarLabelSetDefaultValue);
79 */
80 virtual void _initialize();
81 virtual void notifyViewChanged(AV_View * pView);
82 // virtual XAP_Frame * cloneFrame() = 0;
83 // virtual UT_Error loadDocument(const char * szFilename, int ieft) = 0;
84 // virtual UT_Error loadDocument(const char * szFilename, int ieft, bool createNew) = 0;
85 virtual bool _close();
86 virtual bool _raise();
87 virtual bool _show();
88 virtual void _setFullScreen(bool /*isFullScreen*/ ) { UT_ASSERT(UT_NOT_IMPLEMENTED); }
89 virtual bool _updateTitle();
90 virtual UT_sint32 _setInputMode(const char * szName);
91 virtual void _hideMenuScroll(bool /*bHideMenuScroll*/)
92 { UT_ASSERT(UT_NOT_IMPLEMENTED); }
93 virtual void _nullUpdate () const;
94 virtual void _setCursor(GR_Graphics::Cursor /*c*/) { }
95
96 NSWindow * getTopLevelWindow() const;
97 NSView * getVBoxWidget() const;
98 virtual XAP_DialogFactory * _getDialogFactory();
99 // virtual void setXScrollRange() = 0;
100 // virtual void setYScrollRange() = 0;
101 virtual bool _runModalContextMenu(AV_View * pView, const char * szMenuName,
102 UT_sint32 x, UT_sint32 y);
103 // virtual void translateDocumentToScreen(UT_sint32 &x, UT_sint32 &y) = 0;
104 // virtual void setStatusMessage(const char * szMsg) = 0;
105
106 void setTimeOfLastEvent(NSTimeInterval timestamp);
107
108 // virtual void toggleRuler(bool bRulerOn) = 0;
109 virtual void _queue_resize();
110 virtual EV_Menu* _getMainMenu();
111
112 virtual void _rebuildMenus(void);
113 virtual void _rebuildToolbar(UT_uint32 ibar);
114 void _setController (XAP_CocoaFrameController * ctrl);
115 XAP_CocoaFrameController * _getController () { return m_frameController; };
116 virtual NSString * _getNibName () = 0;
117 virtual XAP_CocoaFrameController *_createController() = 0;
118 static void setToolbarRect(const NSRect &r);
119 protected:
120 virtual void _createDocumentWindow() = 0;
121 virtual void _createStatusBarWindow(XAP_CocoaNSStatusBar *) = 0;
122 virtual void _createTopLevelWindow();
123 virtual void _setWindowIcon() = 0;
124 virtual void _createDocView(GR_Graphics* &pG) = 0; /* Cocoa specific */
125
126 virtual EV_Toolbar * _newToolbar(XAP_Frame *frame, const char *, const char *);
127
128 virtual UT_RGBColor getColorSelBackground () const;
129 private:
130 AP_CocoaDialogFactory m_dialogFactory;
131 EV_CocoaMenuPopup * m_pCocoaPopup; /* only valid while a context popup is up */
132
133 XAP_CocoaFrameController * m_frameController;
134 };
135
136
137 #endif