| 1 |
/* -*- mode: C++; tab-width: 4; c-basic-offset: 4; -*- */ |
| 2 |
|
| 3 |
/* AbiSource Application Framework |
| 4 |
* Copyright (C) 1998 AbiSource, Inc. |
| 5 |
* Copyright (C) 2002 William Lachance |
| 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 |
#ifndef XAP_FrameImpl_H |
| 24 |
#define XAP_FrameImpl_H |
| 25 |
|
| 26 |
#include "ut_types.h" |
| 27 |
#include "ut_vector.h" |
| 28 |
#include "gr_Graphics.h" |
| 29 |
|
| 30 |
#define MAX_TITLE_LENGTH 256 |
| 31 |
|
| 32 |
class XAP_Frame; |
| 33 |
class XAP_App; |
| 34 |
class XAP_DialogFactory; |
| 35 |
class EV_Menu; |
| 36 |
class EV_Toolbar; |
| 37 |
class EV_Mouse; |
| 38 |
class EV_Keyboard; |
| 39 |
class UT_Timer; |
| 40 |
class UT_Worker; |
| 41 |
class GR_Graphics; |
| 42 |
class AV_View; |
| 43 |
|
| 44 |
typedef enum _FrameModes |
| 45 |
{ |
| 46 |
XAP_NormalFrame, // Normal Frame |
| 47 |
XAP_NoMenusWindowLess, // No toplevel window or menus |
| 48 |
XAP_WindowLess // No toplevel window but menus are OK. |
| 49 |
} XAP_FrameMode; |
| 50 |
|
| 51 |
class ABI_EXPORT XAP_FrameImpl |
| 52 |
{ |
| 53 |
public: |
| 54 |
XAP_Frame* getFrame() { return m_pFrame; }; /* needed for Obj-C access */ |
| 55 |
virtual XAP_FrameImpl * createInstance(XAP_Frame *pFrame) = 0; |
| 56 |
const UT_GenericVector<EV_Toolbar*> & _getToolbars() const |
| 57 |
{ return m_vecToolbars; }; |
| 58 |
|
| 59 |
virtual void notifyViewChanged(AV_View * pView); // default dows nothing |
| 60 |
|
| 61 |
protected: |
| 62 |
XAP_FrameImpl(XAP_Frame *pFrame); |
| 63 |
virtual ~XAP_FrameImpl(void); |
| 64 |
|
| 65 |
friend class XAP_Frame; |
| 66 |
|
| 67 |
void _startViewAutoUpdater(void); |
| 68 |
static void viewAutoUpdater(UT_Worker *wkr); |
| 69 |
|
| 70 |
virtual bool _updateTitle(); |
| 71 |
|
| 72 |
virtual void _initialize() = 0; |
| 73 |
virtual bool _close() = 0; |
| 74 |
virtual bool _raise() = 0; |
| 75 |
virtual bool _show() = 0; |
| 76 |
|
| 77 |
virtual XAP_DialogFactory * _getDialogFactory() = 0; |
| 78 |
virtual EV_Toolbar * _newToolbar(XAP_Frame *frame, const char *szLayout, const char *szLanguage) = 0; |
| 79 |
virtual EV_Menu* _getMainMenu() = 0; |
| 80 |
virtual void _rebuildMenus(void)= 0; |
| 81 |
virtual void _createToolbars(); |
| 82 |
virtual void _refillToolbarsInFrameData() = 0; |
| 83 |
virtual void _rebuildToolbar(UT_uint32 ibar) = 0; |
| 84 |
// Useful to refresh the size of the Frame. For instance, |
| 85 |
// when the user selects hide statusbar, the Frame has to be |
| 86 |
// resized in order to fill the gap leaved by the statusbar |
| 87 |
virtual void _queue_resize() = 0; |
| 88 |
|
| 89 |
virtual bool _runModalContextMenu(AV_View * pView, const char * szMenuName, |
| 90 |
UT_sint32 x, UT_sint32 y) = 0; |
| 91 |
virtual void _setFullScreen(bool isFullScreen) = 0; |
| 92 |
virtual void _hideMenuScroll(bool bHideMenuScroll) = 0; |
| 93 |
virtual void _nullUpdate () const = 0; |
| 94 |
virtual void _setCursor(GR_Graphics::Cursor cursor) = 0; |
| 95 |
|
| 96 |
virtual UT_RGBColor getColorSelBackground () const; |
| 97 |
virtual UT_RGBColor getColorSelForeground () const; |
| 98 |
|
| 99 |
EV_Mouse * m_pMouse; |
| 100 |
EV_Keyboard * m_pKeyboard; |
| 101 |
XAP_FrameMode m_iFrameMode; |
| 102 |
|
| 103 |
UT_uint32 m_ViewAutoUpdaterID; |
| 104 |
UT_Timer * m_ViewAutoUpdater; |
| 105 |
|
| 106 |
UT_Vector m_vecToolbarLayoutNames; |
| 107 |
const char * m_szToolbarLabelSetName; /* language for toolbars */ |
| 108 |
const char * m_szToolbarAppearance; |
| 109 |
UT_GenericVector<EV_Toolbar*> m_vecToolbars; |
| 110 |
|
| 111 |
const char * m_szMenuLayoutName; |
| 112 |
const char * m_szMenuLabelSetName; /* language for menus */ |
| 113 |
|
| 114 |
virtual void dragText() {} |
| 115 |
|
| 116 |
private: |
| 117 |
XAP_Frame * m_pFrame; |
| 118 |
}; |
| 119 |
|
| 120 |
#endif |