00001 /* -*- mode: C++; tab-width: 4; c-basic-offset: 4; indent-tabs-mode: t -*- */ 00002 /* AbiSource Application Framework 00003 * Copyright (C) 1998 AbiSource, Inc. 00004 * 00005 * This program is free software; you can redistribute it and/or 00006 * modify it under the terms of the GNU General Public License 00007 * as published by the Free Software Foundation; either version 2 00008 * of the License, or (at your option) any later version. 00009 * 00010 * This program is distributed in the hope that it will be useful, 00011 * but WITHOUT ANY WARRANTY; without even the implied warranty of 00012 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00013 * GNU General Public License for more details. 00014 * 00015 * You should have received a copy of the GNU General Public License 00016 * along with this program; if not, write to the Free Software 00017 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 00018 * 02110-1301 USA. 00019 */ 00020 00021 #ifndef AP_PREVIEW_ANNOTATION_H 00022 #define AP_PREVIEW_ANNOTATION_H 00023 00024 #include <string> 00025 #ifndef UT_TYPES_H 00026 #include "ut_types.h" 00027 #endif 00028 #include "gr_Graphics.h" 00029 #include "xap_Preview.h" 00030 #include "xap_Dialog.h" 00031 00032 // default annotation preview values 00033 #define PREVIEW_DEFAULT_WIDTH 320 00034 #define PREVIEW_DEFAULT_HEIGHT 80 00035 00036 class ABI_EXPORT AP_Preview_Annotation : public XAP_Preview, public XAP_Dialog_Modeless 00037 { 00038 public: 00039 AP_Preview_Annotation(XAP_DialogFactory * pDlgFactory, XAP_Dialog_Id id); 00040 virtual ~AP_Preview_Annotation(void); 00041 00042 void setTitle(const gchar * pTitle); 00043 void setTitle(const std::string & sTitle) 00044 { m_sTitle = sTitle; } 00045 const std::string& getTitle() const 00046 { return m_sTitle; } 00047 00048 void setAuthor(const gchar * pAuthor); 00049 void setAuthor(const std::string & sAuthor) 00050 { m_sAuthor = sAuthor; } 00051 const std::string& getAuthor() const 00052 { return m_sAuthor; } 00053 00054 void setDescription(const gchar * pDescription); 00055 void setDescription(const std::string & sDescription) 00056 { m_sDescription = sDescription; } 00057 const std::string& getDescription() const 00058 { return m_sDescription; } 00059 00060 void setAnnotationID(UT_uint32 aID); 00061 UT_uint32 getAnnotationID() const 00062 { return m_iAID; } 00063 00064 00065 virtual void draw(const UT_Rect *clip=NULL); 00066 void clearScreen(void); 00067 void setXY(UT_sint32 x, UT_sint32 y); void setOffset(UT_sint32 ioff); 00068 void setActiveFrame(XAP_Frame *pFrame); 00069 void setSizeFromAnnotation(void); 00070 00071 protected: 00072 void _createAnnotationPreviewFromGC(GR_Graphics * gc, UT_uint32 width, UT_uint32 height); 00073 UT_sint32 m_width; 00074 UT_sint32 m_height; 00075 UT_sint32 m_left; 00076 UT_sint32 m_top; 00077 UT_sint32 m_Offset; 00078 void ConstructWindowName(void); 00079 UT_RGBColor m_clrBackground; 00080 00081 private: 00082 UT_uint32 m_iAID; 00083 // assume that these strings are always UTF8 00084 std::string m_sTitle; 00085 std::string m_sAuthor; 00086 std::string m_sDescription; 00087 UT_UCS4String m_drawString; 00088 GR_Font * m_pFont; 00089 UT_sint32 m_iAscent; 00090 UT_sint32 m_iDescent; 00091 UT_sint32 m_iHeight; 00092 }; 00093 00094 #endif /* AP_PREVIEW_ANNOTATION_H */