From d5bef0a32337a8e8b2666fd64f78dbbbf01cda3f Mon Sep 17 00:00:00 2001
From: Vadim Zeitlin <vadim@wxwidgets.org>
Date: Tue, 11 Apr 2006 00:36:24 +0000
Subject: [PATCH] added wxConvUI which determines the conversion used for the
 UI elements and can be changed from the user code

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@38665 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
---
 docs/latex/wx/mbconv.tex | 5 +++++
 include/wx/strconv.h     | 6 ++++++
 src/common/strconv.cpp   | 2 +-
 src/gtk/utilsgtk.cpp     | 2 +-
 4 files changed, 13 insertions(+), 2 deletions(-)

diff --git a/docs/latex/wx/mbconv.tex b/docs/latex/wx/mbconv.tex
index b91107369f..3f11aa5894 100644
--- a/docs/latex/wx/mbconv.tex
+++ b/docs/latex/wx/mbconv.tex
@@ -32,6 +32,11 @@ There are several predefined instances of this class:
 current locale.}
 \twocolitem{\textbf{wxConvLocal}}{Another conversion corresponding to the
 current locale but this one uses the best available conversion.}
+\twocolitem{\textbf{wxConvUI}}{The conversion used for hte standard UI elements
+such as menu items and buttons. This is a pointer which is initially set to
+\texttt{wxConvLocal} as the program uses the current locale by default but can
+be set to some specific conversion if the program needs to use a specific
+encoding for its UI.}
 \twocolitem{\textbf{wxConvISO8859\_1}}{Conversion to and from ISO-8859-1 (Latin I)
 encoding.}
 \twocolitem{\textbf{wxConvUTF8}}{Conversion to and from UTF-8 encoding.}
diff --git a/include/wx/strconv.h b/include/wx/strconv.h
index 477c9de967..c56ae9af2f 100644
--- a/include/wx/strconv.h
+++ b/include/wx/strconv.h
@@ -438,6 +438,12 @@ extern WXDLLIMPEXP_DATA_BASE(wxMBConv *) wxConvCurrent;
 // the conversion corresponding to the current locale
 extern WXDLLIMPEXP_DATA_BASE(wxCSConv&) wxConvLocal;
 
+// the conversion corresponding to the encoding of the standard UI elements
+//
+// by default this is the same as wxConvLocal but may be changed if the program
+// needs to use a fixed encoding
+extern WXDLLIMPEXP_DATA_BASE(wxMBConv *) wxConvUI;
+
 // ----------------------------------------------------------------------------
 // endianness-dependent conversions
 // ----------------------------------------------------------------------------
diff --git a/src/common/strconv.cpp b/src/common/strconv.cpp
index 3f00282a39..f92260934f 100644
--- a/src/common/strconv.cpp
+++ b/src/common/strconv.cpp
@@ -3395,6 +3395,7 @@ WXDLLIMPEXP_DATA_BASE(wxCSConv&) wxConvISO8859_1 = wxConvISO8859_1Obj;
 WXDLLIMPEXP_DATA_BASE(wxMBConvUTF7&) wxConvUTF7 = wxConvUTF7Obj;
 WXDLLIMPEXP_DATA_BASE(wxMBConvUTF8&) wxConvUTF8 = wxConvUTF8Obj;
 WXDLLIMPEXP_DATA_BASE(wxMBConv *) wxConvCurrent = &wxConvLibcObj;
+WXDLLIMPEXP_DATA_BASE(wxMBConv *) wxConvUI = &wxConvLocal;
 WXDLLIMPEXP_DATA_BASE(wxMBConv *) wxConvFileName = &
 #ifdef __WXOSX__
                                     wxConvUTF8Obj;
@@ -3402,7 +3403,6 @@ WXDLLIMPEXP_DATA_BASE(wxMBConv *) wxConvFileName = &
                                     wxConvLibcObj;
 #endif
 
-
 #else // !wxUSE_WCHAR_T
 
 // stand-ins in absence of wchar_t
diff --git a/src/gtk/utilsgtk.cpp b/src/gtk/utilsgtk.cpp
index 35dd71d871..cb2455bbcd 100644
--- a/src/gtk/utilsgtk.cpp
+++ b/src/gtk/utilsgtk.cpp
@@ -193,7 +193,7 @@ wxCharBuffer wxConvertToGTK(const wxString& s, wxFontEncoding enc)
     wxWCharBuffer wbuf;
     if ( enc == wxFONTENCODING_SYSTEM || enc == wxFONTENCODING_DEFAULT )
     {
-        wbuf = wxConvLocal.cMB2WC(s);
+        wbuf = wxConvUI->cMB2WC(s);
     }
     else // another encoding, use generic conversion class
     {
-- 
2.50.0

