| 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 |
|
| 21 |
#ifndef XAP_DRAW_SYMBOL_H |
| 22 |
#define XAP_DRAW_SYMBOL_H |
| 23 |
|
| 24 |
/* pre-emptive dismissal; ut_types.h is needed by just about everything, |
| 25 |
* so even if it's commented out in-file that's still a lot of work for |
| 26 |
* the preprocessor to do... |
| 27 |
*/ |
| 28 |
#ifndef UT_TYPES_H |
| 29 |
#include "ut_types.h" |
| 30 |
#endif |
| 31 |
#include "ut_misc.h" |
| 32 |
|
| 33 |
#include "xap_Preview.h" |
| 34 |
|
| 35 |
class GR_Font; |
| 36 |
|
| 37 |
class ABI_EXPORT XAP_Draw_Symbol : public XAP_Preview |
| 38 |
{ |
| 39 |
public: |
| 40 |
|
| 41 |
XAP_Draw_Symbol(GR_Graphics * gc); |
| 42 |
virtual ~XAP_Draw_Symbol(); |
| 43 |
|
| 44 |
// data twiddlers |
| 45 |
void setSelectedFont(const char *font); |
| 46 |
void setFontString(); |
| 47 |
void setFontStringarea(); |
| 48 |
void setFontToGC(GR_Graphics *p_gc, UT_uint32 MaxWidthAllowable, UT_uint32 MaxHeightAllowable); |
| 49 |
void setFontfont(GR_Font * font); |
| 50 |
void setWindowSize(UT_uint32 width, UT_uint32 height); |
| 51 |
void setAreaSize(UT_uint32 width, UT_uint32 height); |
| 52 |
void setAreaGc(GR_Graphics *); |
| 53 |
void setRow(UT_uint32 row); |
| 54 |
|
| 55 |
const char* getSelectedFont(); |
| 56 |
UT_uint32 getSymbolRows (); |
| 57 |
|
| 58 |
// where all the Symbol-specific drawing happens |
| 59 |
|
| 60 |
void draw(const UT_Rect *clip=NULL); |
| 61 |
void drawarea(UT_UCSChar c, UT_UCSChar p); |
| 62 |
|
| 63 |
UT_UCSChar calcSymbol(UT_uint32 x, UT_uint32 y); |
| 64 |
UT_UCSChar calcSymbolFromCoords(UT_uint32 x, UT_uint32 y); |
| 65 |
void setCurrent(UT_UCSChar c); |
| 66 |
UT_UCSChar getCurrent() { return m_CurrentSymbol; } |
| 67 |
|
| 68 |
void onLeftButtonDown(UT_sint32 x, UT_sint32 y); |
| 69 |
void calculatePosition(UT_UCSChar c, UT_uint32 &x, UT_uint32 &y); |
| 70 |
GR_Graphics * getGraphics(void){return m_areagc;}; |
| 71 |
|
| 72 |
protected: |
| 73 |
GR_Graphics * m_areagc; |
| 74 |
GR_Font * m_pFont; // so we can delete it |
| 75 |
|
| 76 |
UT_uint32 m_drawWidth; |
| 77 |
UT_uint32 m_drawHeight; |
| 78 |
UT_uint32 m_drawareaWidth; |
| 79 |
UT_uint32 m_drawareaHeight; |
| 80 |
UT_sint32 m_start_base; |
| 81 |
UT_sint32 m_start_nb_char; |
| 82 |
|
| 83 |
UT_UCSChar m_CurrentSymbol; |
| 84 |
UT_UCSChar m_PreviousSymbol; |
| 85 |
|
| 86 |
private: |
| 87 |
|
| 88 |
UT_NumberVector m_vCharSet; |
| 89 |
UT_String m_stFont; |
| 90 |
}; |
| 91 |
|
| 92 |
#endif /* XAP_Draw_Symbol_H */ |
| 93 |
|
| 94 |
|
| 95 |
|
| 96 |
|
| 97 |
|
| 98 |
|
| 99 |
|
| 100 |
|
| 101 |
|
| 102 |
|
| 103 |
|
| 104 |
|
| 105 |
|