| 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_ENCODING_H |
| 21 |
#define XAP_DIALOG_ENCODING_H |
| 22 |
|
| 23 |
/* pre-emptive dismissal; ut_types.h is needed by just about everything, |
| 24 |
* so even if it's commented out in-file that's still a lot of work for |
| 25 |
* the preprocessor to do... |
| 26 |
*/ |
| 27 |
#ifndef UT_TYPES_H |
| 28 |
#include "ut_types.h" |
| 29 |
#endif |
| 30 |
/* #include "ut_Encoding.h" */ |
| 31 |
/* #include "ut_assert.h" */ |
| 32 |
/* #include "ut_debugmsg.h" */ |
| 33 |
|
| 34 |
#include "xap_Dialog.h" |
| 35 |
|
| 36 |
class UT_Encoding; |
| 37 |
|
| 38 |
/******************************************************************** |
| 39 |
INSTRUCTIONS FOR DESIGN OF THE PLATFORM VERSIONS OF THIS DIALOGUE |
| 40 |
|
| 41 |
(1) implement runModal(); at the moment we display a single listbox |
| 42 |
|
| 43 |
(2) m_iEncCount will tell you how many list entries there will be; |
| 44 |
the encoding strings are then in m_ppEncodings (already sorted) |
| 45 |
|
| 46 |
(3) use _setEncoding() to set the member variables in response |
| 47 |
to the user selection when the dialog is closing. |
| 48 |
*********************************************************************/ |
| 49 |
|
| 50 |
|
| 51 |
|
| 52 |
class ABI_EXPORT XAP_Dialog_Encoding : public XAP_Dialog_NonPersistent |
| 53 |
{ |
| 54 |
public: |
| 55 |
typedef enum { a_OK, a_CANCEL, a_YES, a_NO } tAnswer; |
| 56 |
|
| 57 |
XAP_Dialog_Encoding(XAP_DialogFactory * pDlgFactory, XAP_Dialog_Id id); |
| 58 |
virtual ~XAP_Dialog_Encoding(void); |
| 59 |
|
| 60 |
virtual void runModal(XAP_Frame * pFrame) = 0; |
| 61 |
void setEncoding(const gchar * pEncoding); |
| 62 |
const gchar * getEncoding() const; |
| 63 |
XAP_Dialog_Encoding::tAnswer getAnswer(void) const; |
| 64 |
|
| 65 |
protected: |
| 66 |
void _setEncoding(const gchar * pEnc); |
| 67 |
|
| 68 |
void _setAnswer (XAP_Dialog_Encoding::tAnswer answer) |
| 69 |
{ m_answer = answer; }; |
| 70 |
void _setSelectionIndex (UT_uint32 index) |
| 71 |
{ m_iSelIndex = index; }; |
| 72 |
UT_uint32 _getSelectionIndex () const |
| 73 |
{ return m_iSelIndex; }; |
| 74 |
const gchar ** _getAllEncodings () const |
| 75 |
{ return m_ppEncodings; }; |
| 76 |
UT_uint32 _getEncodingsCount() const |
| 77 |
{ return m_iEncCount; }; |
| 78 |
|
| 79 |
private: |
| 80 |
XAP_Dialog_Encoding::tAnswer m_answer; |
| 81 |
|
| 82 |
// the following keeps the string that the user sees in the dialogue; this is locale-dependent |
| 83 |
const gchar * m_pDescription; |
| 84 |
// this keeps the actual encoding string corresponding to m_pDescription |
| 85 |
const gchar * m_pEncoding; |
| 86 |
UT_Encoding * m_pEncTable; |
| 87 |
const gchar ** m_ppEncodings; |
| 88 |
UT_uint32 m_iEncCount; |
| 89 |
UT_uint32 m_iSelIndex; |
| 90 |
}; |
| 91 |
#endif /* XAP_DIALOG_ENCODING_H */ |
| 92 |
|
| 93 |
|