Debian Codegraph @

src/af/xap/win/xap_Win32FrameImpl.h

raw
1 /* AbiSource Application Framework
2 * Copyright (C) 1998-2000 AbiSource, Inc.
3 * Copyright (C) 2002
4 *
5 * This program is free software; you can redistribute it and/or
6 * modify it under the terms of the GNU General Public License
7 * as published by the Free Software Foundation; either version 2
8 * of the License, or (at your option) any later version.
9 *
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
14 *
15 * You should have received a copy of the GNU General Public License
16 * along with this program; if not, write to the Free Software
17 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
18 * 02110-1301 USA.
19 */
20
21
22 #ifndef XAP_WIN32FRAMEIMPL_H
23 #define XAP_WIN32FRAMEIMPL_H
24
25 #include <windows.h>
26 #include <winuser.h>
27 #include "xap_FrameImpl.h"
28 #include "xap_Win32App.h"
29 #include "xap_Win32DialogFactory.h"
30 #include "xap_Win32DragAndDrop.h"
31
32 #include "ev_Win32Keyboard.h"
33 #include "ev_Win32Mouse.h"
34 #include "ev_Win32Menu.h"
35 #include "ev_Win32Toolbar.h"
36
37
38 /********************************************************************
39 *********************************************************************
40 ** This file defines the Win32-platform-specific class for the
41 ** cross-platform application frame helper. This is used to hold all
42 ** Win32-specific data. One of these is created for each top-level
43 ** document window.
44 *********************************************************************
45 ********************************************************************/
46
47 class ABI_EXPORT XAP_Win32FrameImpl : public XAP_FrameImpl
48 {
49 public:
50 XAP_Win32FrameImpl(XAP_Frame *pFrame);
51 virtual ~XAP_Win32FrameImpl(void);
52
53 virtual XAP_FrameImpl * createInstance(XAP_Frame *pFrame) = 0;
54
55 inline HWND getTopLevelWindow(void) const { return _getTopLevelWindow(); }
56 inline HWND getToolbarWindow(void) const { return m_hwndRebar; }
57
58 protected:
59 friend class XAP_Frame;
60
61 virtual UT_RGBColor getColorSelBackground () const;
62 virtual UT_RGBColor getColorSelForeground () const;
63
64 #if 0
65 void _startViewAutoUpdater(void);
66 static void viewAutoUpdater(UT_Worker *wkr);
67 #endif
68
69 virtual bool _updateTitle(void);
70
71 virtual void _initialize(void);
72 virtual bool _close(void);
73 virtual bool _raise(void);
74 virtual bool _show(void);
75
76 virtual XAP_DialogFactory * _getDialogFactory(void);
77 virtual EV_Toolbar * _newToolbar(XAP_Frame *frame, const char *szLayout, const char *szLanguage);
78 virtual EV_Menu* _getMainMenu(void);
79 virtual void _rebuildMenus(void);
80
81 // Useful to refresh the size of the Frame. For instance,
82 // when the user selects hide statusbar, the Frame has to be
83 // resized in order to fill the gap leaved by the statusbar
84 virtual void _queue_resize(void);
85
86 virtual bool _runModalContextMenu(AV_View * pView, const char * szMenuName,
87 UT_sint32 x, UT_sint32 y);
88 virtual void _setFullScreen(bool isFullScreen);
89 virtual void _nullUpdate (void) const;
90 virtual void _setCursor(GR_Graphics::Cursor cursor);
91
92 static bool _RegisterClass(XAP_Win32App * app);
93
94 /*** Win32 help functions ***/
95 virtual void _translateDocumentToScreen(UT_sint32 &x, UT_sint32 &y) = 0;
96 virtual HWND _getTopLevelWindow(void) const { return m_hwndFrame; }
97
98 virtual HWND _createDocumentWindow(XAP_Frame *pFrame, HWND hwndParent,
99 UT_uint32 iLeft, UT_uint32 iTop, UT_uint32 iWidth, UT_uint32 iHeight) = 0;
100 virtual HWND _createStatusBarWindow(XAP_Frame *pFrame, HWND hwndParent,
101 UT_uint32 iLeft, UT_uint32 iTop, UT_uint32 iWidth) = 0;
102 void _createTopLevelWindow(void);
103
104 void _setHwndRebar(HWND hWnd) { m_hwndRebar = hWnd; }
105 HWND _getHwndRebar(void) { return m_hwndRebar; }
106 void _setHwndContainer(HWND hWnd) { m_hwndContainer = hWnd; }
107 HWND _getHwndContainer(void) { return m_hwndContainer; }
108 void _setHwndStatusBar(HWND hWnd) { m_hwndStatusBar = hWnd; }
109 HWND _getHwndStatusBar(void) { return m_hwndStatusBar; }
110
111 UT_uint32 _getBarHeight(void) { return m_iBarHeight; }
112 void _setBarHeight(UT_uint32 iBarHeight) { m_iBarHeight = iBarHeight; }
113 UT_uint32 _getSizeWidth(void) { return m_iSizeWidth; }
114 UT_uint32 _getSizeHeight(void) { return m_iSizeHeight; }
115
116 /** window class related functions **/
117 static LRESULT CALLBACK _FrameWndProc(HWND hwnd, UINT iMsg, WPARAM wParam, LPARAM lParam);
118
119 private:
120 HWND m_hwndFrame; /* the entire window, menu, toolbar, document, etc. */
121 HWND m_hwndRebar;
122 HWND m_hwndContainer; /* the document and all rulers and scroll bars */
123 HWND m_hwndStatusBar;
124
125 AP_Win32DialogFactory m_dialogFactory; /* class defined[.h] in XAP, implemented[.cpp] in AP */
126
127 EV_Win32MenuBar * m_pWin32Menu;
128 EV_Win32MenuPopup * m_pWin32Popup; /* only valid while a context popup is up */
129 UT_uint32 m_iBarHeight;
130 UT_uint32 m_iStatusBarHeight;
131 UT_uint32 m_iRealSizeHeight;
132 UT_uint32 m_iRealSizeWidth;
133 UT_uint32 m_iWindowStateBeforeFS; /* was Abi maximized/normal/minimized before we went full-screen */
134 UT_uint32 m_iWindowXBeforeFS;
135 UT_uint32 m_iWindowYBeforeFS;
136 UT_uint32 m_iWindowHeightBeforeFS;
137 UT_uint32 m_iWindowWidthBeforeFS;
138
139 UINT m_mouseWheelMessage;
140 XAP_Win32DropTarget m_dropTarget;
141
142 /* These 2 variables are used in the frame
143 ** to remember the last values we used to set
144 ** the size of client area of the frame (on
145 ** a resize of the frame window). That is,
146 ** the values we used to calculate the layout
147 ** of the various toolbars, view, and anything
148 ** else that goes in the frame window. We do
149 ** this because Win32 plays funny games with
150 ** window sizes (NonClient vs Client coordinates).
151 ** We do this so that we can short-circuit some
152 ** of the resizing and the resulting flashing.
153 */
154 UT_uint32 m_iSizeWidth;
155 UT_uint32 m_iSizeHeight;
156
157 public:
158
159 UT_UTF8String m_sColorBack;
160 UT_UTF8String m_sColorFore;
161
162 };
163
164 #endif /* XAP_WIN32FRAME_H */