00001 /* AbiSource Application Framework 00002 * Copyright (C) 1998 AbiSource, Inc. 00003 * 00004 * This program is free software; you can redistribute it and/or 00005 * modify it under the terms of the GNU General Public License 00006 * as published by the Free Software Foundation; either version 2 00007 * of the License, or (at your option) any later version. 00008 * 00009 * This program is distributed in the hope that it will be useful, 00010 * but WITHOUT ANY WARRANTY; without even the implied warranty of 00011 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00012 * GNU General Public License for more details. 00013 * 00014 * You should have received a copy of the GNU General Public License 00015 * along with this program; if not, write to the Free Software 00016 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 00017 * 02110-1301 USA. 00018 */ 00019 00020 #ifndef XAP_WIN32PREVIEWWIDGET_H 00021 #define XAP_WIN32PREVIEWWIDGET_H 00022 00023 // this defines the base class for a preview widget 00024 // that will be used in various dialogs. subclass 00025 // this to define the drawing/interaction necessary 00026 // for a specific dialog. 00027 00028 #include "ut_types.h" 00029 #include "xap_Win32App.h" 00030 #include "xap_Preview.h" 00031 #include "xap_Win32Dlg_Insert_Symbol.h" 00032 00033 // fwd. decl 00034 class GR_Win32Graphics; 00035 00038 00039 class ABI_EXPORT XAP_Win32PreviewWidget 00040 { 00041 public: 00042 XAP_Win32PreviewWidget(XAP_Win32App * pWin32App, 00043 HWND hwndParent, 00044 UINT style); // pass CS_DBLCLKS or zero 00045 virtual ~XAP_Win32PreviewWidget(void); 00046 00047 inline HWND getWindow(void) const { return m_hwndPreview; }; 00048 inline GR_Win32Graphics * getGraphics(void) const { return m_pGraphics; }; 00049 void getWindowSize(UT_uint32 * pWidth, UT_uint32 * pHeight) const; 00050 inline void setPreview(XAP_Preview * pPreview) { m_pPreview = pPreview; }; 00051 inline void setInsertSymbolParent(XAP_Win32Dialog_Insert_Symbol *pParent) { m_pInsertSymbol = pParent; }; 00052 00053 virtual LRESULT onPaint(HWND hwnd); 00054 virtual LRESULT onLeftButtonDown(UT_sint32 x, UT_sint32 y); 00055 00056 protected: 00057 static LRESULT CALLBACK _wndProc(HWND hwnd, UINT iMsg, WPARAM wParam, LPARAM lParam); 00058 00059 static ATOM m_atomPreviewWidgetClass; // atom for RegisterClass() 00060 HWND m_hwndPreview; // hwnd that we draw into (child of a dlg control) 00061 XAP_Win32App * m_pWin32App; 00062 GR_Win32Graphics * m_pGraphics; // GR_Graphics we give to View to draw in our window 00063 XAP_Preview * m_pPreview; // View which will draw formatted stuff in our window 00064 XAP_Win32Dialog_Insert_Symbol *m_pInsertSymbol; // Insert symbol dialog parent (if applicable) 00065 static wchar_t m_bufClassName[100]; // name for RegisterClass() 00066 static UT_uint32 m_iInstanceCount; // Number of instance of this window type. 00067 }; 00068 00069 #endif /* XAP_WIN32PREVIEWWIDGET_H */