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_Dialog_Insert_Symbol_H 00021 #define XAP_Dialog_Insert_Symbol_H 00022 00023 /* #include "xap_Frame.h" */ 00024 #include "xap_Dialog.h" 00025 /* #include "xap_Draw_Symbol.h" */ 00026 #include "gr_Graphics.h" 00027 00028 /* #include "xav_View.h" */ 00029 class AV_View; 00030 00031 class XAP_Frame; 00032 class XAP_Draw_Symbol; 00033 00034 class ABI_EXPORT XAP_Insert_symbol_listener 00035 { 00036 public: 00037 virtual ~XAP_Insert_symbol_listener() {} 00038 00039 virtual void setView( AV_View * /*pJustPocussedView*/) {}; 00040 virtual bool insertSymbol(UT_UCSChar Char, const char *p_font_name) = 0; 00041 }; 00042 00043 class ABI_EXPORT XAP_Dialog_Insert_Symbol : public XAP_Dialog_Modeless 00044 { 00045 public: 00046 XAP_Dialog_Insert_Symbol(XAP_DialogFactory * pDlgFactory, XAP_Dialog_Id id); 00047 virtual ~XAP_Dialog_Insert_Symbol(void); 00048 00049 //------------------------------------------------------------ 00050 // All these are needed for a modeless dialog 00051 00052 virtual void useStart(void); 00053 virtual void useEnd(void); 00054 virtual void runModal(XAP_Frame * pFrame) = 0; 00055 virtual void runModeless(XAP_Frame * pFrame) = 0; 00056 virtual void destroy(void)=0; 00057 virtual void activate(void)=0; 00058 void setActiveFrame(XAP_Frame *pFrame); 00059 virtual void notifyActiveFrame(XAP_Frame *pFrame) = 0; 00060 00061 //-------------------------------------------------------------- 00062 00063 void ConstructWindowName(void); 00064 // read these back 00065 UT_UCSChar getInsertedSymbol(void); 00066 char * getInsertedFont(void); 00067 typedef enum { a_OK, a_CANCEL} tAnswer; 00068 XAP_Dialog_Insert_Symbol::tAnswer getAnswer(void) const; 00069 void setListener(XAP_Insert_symbol_listener *p_listener_in) 00070 { 00071 m_pListener = p_listener_in; 00072 } 00073 00074 protected: 00075 // handle the XP-job of drawing our symbols. 00076 void _updateDrawSymbol(); 00077 00078 // handle the XP-job of laying out our matrix of symbols 00079 void _createSymbolFromGC(GR_Graphics * gc, UT_uint32 width, 00080 UT_uint32 height); 00081 00082 // handle the XP-job of drawing our symbol onto the preview area. 00083 void _updateDrawSymbolarea( UT_UCSChar c, UT_UCSChar p); 00084 00085 // handle the XP-job of constructing the preview area 00086 void _createSymbolareaFromGC(GR_Graphics * gc, UT_uint32 width, 00087 UT_uint32 height); 00088 void _onInsertButton(); 00089 void _insert(UT_UCSChar c, const char* symfont); 00090 00091 // This function returns the current Symbol Map class 00092 XAP_Draw_Symbol * _getCurrentSymbolMap(); 00093 00094 // This function lays out the symbol matrix 00095 XAP_Draw_Symbol * m_DrawSymbol; 00096 00097 // This variable stores the current symbol font 00098 GR_Font * m_Insert_Symbol_font; 00099 char m_FontName[50]; 00100 char m_WindowName[100]; 00101 // This is character selected. 00102 UT_UCSChar m_Inserted_Symbol; 00103 00104 XAP_Dialog_Insert_Symbol::tAnswer m_answer; 00105 00106 XAP_Insert_symbol_listener* m_pListener; 00107 }; 00108 00109 #endif /* XAP_Dialog_Insert_Symbol_H */