| 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_Dialog_Insert_Symbol_H |
| 21 |
#define XAP_Dialog_Insert_Symbol_H |
| 22 |
|
| 23 |
/* #include "xap_Frame.h" */ |
| 24 |
#include "xap_Dialog.h" |
| 25 |
/* #include "xap_Draw_Symbol.h" */ |
| 26 |
#include "gr_Graphics.h" |
| 27 |
|
| 28 |
/* #include "xav_View.h" */ |
| 29 |
class AV_View; |
| 30 |
|
| 31 |
class XAP_Frame; |
| 32 |
class XAP_Draw_Symbol; |
| 33 |
|
| 34 |
class ABI_EXPORT XAP_Insert_symbol_listener |
| 35 |
{ |
| 36 |
public: |
| 37 |
virtual ~XAP_Insert_symbol_listener() {} |
| 38 |
|
| 39 |
virtual void setView( AV_View * /*pJustPocussedView*/) {}; |
| 40 |
virtual bool insertSymbol(UT_UCSChar Char, const char *p_font_name) = 0; |
| 41 |
}; |
| 42 |
|
| 43 |
class ABI_EXPORT XAP_Dialog_Insert_Symbol : public XAP_Dialog_Modeless |
| 44 |
{ |
| 45 |
public: |
| 46 |
XAP_Dialog_Insert_Symbol(XAP_DialogFactory * pDlgFactory, XAP_Dialog_Id id); |
| 47 |
virtual ~XAP_Dialog_Insert_Symbol(void); |
| 48 |
|
| 49 |
//------------------------------------------------------------ |
| 50 |
// All these are needed for a modeless dialog |
| 51 |
|
| 52 |
virtual void useStart(void); |
| 53 |
virtual void useEnd(void); |
| 54 |
virtual void runModal(XAP_Frame * pFrame) = 0; |
| 55 |
virtual void runModeless(XAP_Frame * pFrame) = 0; |
| 56 |
virtual void destroy(void)=0; |
| 57 |
virtual void activate(void)=0; |
| 58 |
void setActiveFrame(XAP_Frame *pFrame); |
| 59 |
virtual void notifyActiveFrame(XAP_Frame *pFrame) = 0; |
| 60 |
|
| 61 |
//-------------------------------------------------------------- |
| 62 |
|
| 63 |
void ConstructWindowName(void); |
| 64 |
// read these back |
| 65 |
UT_UCSChar getInsertedSymbol(void); |
| 66 |
char * getInsertedFont(void); |
| 67 |
typedef enum { a_OK, a_CANCEL} tAnswer; |
| 68 |
XAP_Dialog_Insert_Symbol::tAnswer getAnswer(void) const; |
| 69 |
void setListener(XAP_Insert_symbol_listener *p_listener_in) |
| 70 |
{ |
| 71 |
m_pListener = p_listener_in; |
| 72 |
} |
| 73 |
|
| 74 |
protected: |
| 75 |
// handle the XP-job of drawing our symbols. |
| 76 |
void _updateDrawSymbol(); |
| 77 |
|
| 78 |
// handle the XP-job of laying out our matrix of symbols |
| 79 |
void _createSymbolFromGC(GR_Graphics * gc, UT_uint32 width, |
| 80 |
UT_uint32 height); |
| 81 |
|
| 82 |
// handle the XP-job of drawing our symbol onto the preview area. |
| 83 |
void _updateDrawSymbolarea( UT_UCSChar c, UT_UCSChar p); |
| 84 |
|
| 85 |
// handle the XP-job of constructing the preview area |
| 86 |
void _createSymbolareaFromGC(GR_Graphics * gc, UT_uint32 width, |
| 87 |
UT_uint32 height); |
| 88 |
void _onInsertButton(); |
| 89 |
void _insert(UT_UCSChar c, const char* symfont); |
| 90 |
|
| 91 |
// This function returns the current Symbol Map class |
| 92 |
XAP_Draw_Symbol * _getCurrentSymbolMap(); |
| 93 |
|
| 94 |
// This function lays out the symbol matrix |
| 95 |
XAP_Draw_Symbol * m_DrawSymbol; |
| 96 |
|
| 97 |
// This variable stores the current symbol font |
| 98 |
GR_Font * m_Insert_Symbol_font; |
| 99 |
char m_FontName[50]; |
| 100 |
char m_WindowName[100]; |
| 101 |
// This is character selected. |
| 102 |
UT_UCSChar m_Inserted_Symbol; |
| 103 |
|
| 104 |
XAP_Dialog_Insert_Symbol::tAnswer m_answer; |
| 105 |
|
| 106 |
XAP_Insert_symbol_listener* m_pListener; |
| 107 |
}; |
| 108 |
|
| 109 |
#endif /* XAP_Dialog_Insert_Symbol_H */ |