1 /* AbiSource Application Framework
2  * Copyright (C) 1998 AbiSource, Inc.
3  *
4  * This program is free software; you can redistribute it and/or
5  * modify it under the terms of the GNU General Public License
6  * as published by the Free Software Foundation; either version 2
7  * of the License, or (at your option) any later version.
8  *
9  * This program is distributed in the hope that it will be useful,
10  * but WITHOUT ANY WARRANTY; without even the implied warranty of
11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
12  * GNU General Public License for more details.
13  *
14  * You should have received a copy of the GNU General Public License
15  * along with this program; if not, write to the Free Software
16  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
17  * 02110-1301 USA.
18  */
19 
20 #ifndef XAP_WIN32PREVIEWWIDGET_H
21 #define XAP_WIN32PREVIEWWIDGET_H
22 
23 // this defines the base class for a preview widget
24 // that will be used in various dialogs.  subclass
25 // this to define the drawing/interaction necessary
26 // for a specific dialog.
27 
28 #include "ut_types.h"
29 #include "xap_Win32App.h"
30 #include "xap_Preview.h"
31 #include "xap_Win32Dlg_Insert_Symbol.h"
32 
33 // fwd. decl
34 class GR_Win32Graphics;
35 
36 //////////////////////////////////////////////////////////////////
37 //////////////////////////////////////////////////////////////////
38 
39 class ABI_EXPORT XAP_Win32PreviewWidget
40 {
41 public:
42 	XAP_Win32PreviewWidget(XAP_Win32App * pWin32App,
43 						   HWND hwndParent,
44 						   UINT style);			// pass CS_DBLCLKS or zero
45 	virtual ~XAP_Win32PreviewWidget(void);
46 
getWindow(void)47 	inline HWND					getWindow(void)		const { return m_hwndPreview; };
getGraphics(void)48 	inline GR_Win32Graphics *	getGraphics(void)	const { return m_pGraphics; };
49 	void						getWindowSize(UT_uint32 * pWidth, UT_uint32 * pHeight) const;
setPreview(XAP_Preview * pPreview)50 	inline void					setPreview(XAP_Preview * pPreview) { m_pPreview = pPreview; };
setInsertSymbolParent(XAP_Win32Dialog_Insert_Symbol * pParent)51 	inline void					setInsertSymbolParent(XAP_Win32Dialog_Insert_Symbol *pParent) { m_pInsertSymbol = pParent; };
52 
53 	virtual LRESULT				onPaint(HWND hwnd);
54 	virtual LRESULT				onLeftButtonDown(UT_sint32 x, UT_sint32 y);
55 
56 protected:
57 	static LRESULT CALLBACK		_wndProc(HWND hwnd, UINT iMsg, WPARAM wParam, LPARAM lParam);
58 
59 	static ATOM					m_atomPreviewWidgetClass;		// atom for RegisterClass()
60 	HWND						m_hwndPreview;					// hwnd that we draw into (child of a dlg control)
61 	XAP_Win32App *				m_pWin32App;
62 	GR_Win32Graphics *			m_pGraphics;					// GR_Graphics we give to View to draw in our window
63 	XAP_Preview *				m_pPreview;						// View which will draw formatted stuff in our window
64 	XAP_Win32Dialog_Insert_Symbol *m_pInsertSymbol;				// Insert symbol dialog parent (if applicable)
65 	static wchar_t					m_bufClassName[100];			// name for RegisterClass()
66 	static UT_uint32			m_iInstanceCount;				// Number of instance of this window type.
67 };
68 
69 #endif /* XAP_WIN32PREVIEWWIDGET_H */
70