wxMac Unicode support

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@19840 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Stefan Csomor
2003-03-27 20:21:51 +00:00
parent 3dd709d8c3
commit 44c44c82a3
7 changed files with 136 additions and 104 deletions

View File

@@ -1784,18 +1784,18 @@ public :
} }
MacDefaultExtensionRecord( const MacDefaultExtensionRecord& from ) MacDefaultExtensionRecord( const MacDefaultExtensionRecord& from )
{ {
strcpy( m_ext , from.m_ext ) ; wxStrcpy( m_ext , from.m_ext ) ;
m_type = from.m_type ; m_type = from.m_type ;
m_creator = from.m_creator ; m_creator = from.m_creator ;
} }
MacDefaultExtensionRecord( const char * extension , OSType type , OSType creator ) MacDefaultExtensionRecord( const wxChar * extension , OSType type , OSType creator )
{ {
strncpy( m_ext , extension , kMacExtensionMaxLength ) ; wxStrncpy( m_ext , extension , kMacExtensionMaxLength ) ;
m_ext[kMacExtensionMaxLength] = 0 ; m_ext[kMacExtensionMaxLength] = 0 ;
m_type = type ; m_type = type ;
m_creator = creator ; m_creator = creator ;
} }
char m_ext[kMacExtensionMaxLength] ; wxChar m_ext[kMacExtensionMaxLength] ;
OSType m_type ; OSType m_type ;
OSType m_creator ; OSType m_creator ;
} ; } ;
@@ -1819,7 +1819,7 @@ static void MacEnsureDefaultExtensionsLoaded()
// load the default extensions // load the default extensions
MacDefaultExtensionRecord defaults[1] = MacDefaultExtensionRecord defaults[1] =
{ {
MacDefaultExtensionRecord( "txt" , 'TEXT' , 'ttxt' ) , MacDefaultExtensionRecord( wxT("txt") , 'TEXT' , 'ttxt' ) ,
} ; } ;
// we could load the pc exchange prefs here too // we could load the pc exchange prefs here too
@@ -1891,7 +1891,7 @@ void wxFileName::MacRegisterDefaultTypeAndCreator( const wxString& ext , wxUint3
MacDefaultExtensionRecord rec ; MacDefaultExtensionRecord rec ;
rec.m_type = type ; rec.m_type = type ;
rec.m_creator = creator ; rec.m_creator = creator ;
strncpy( rec.m_ext , ext.Lower().c_str() , kMacExtensionMaxLength ) ; wxStrncpy( rec.m_ext , ext.Lower().c_str() , kMacExtensionMaxLength ) ;
gMacDefaultExtensions.Add( rec ) ; gMacDefaultExtensions.Add( rec ) ;
} }
#endif #endif

View File

@@ -463,8 +463,7 @@ void wxInitializeStockObjects ()
GetThemeFont(kThemeSystemFont , GetApplicationScript() , fontName , &fontSize , &fontStyle ) ; GetThemeFont(kThemeSystemFont , GetApplicationScript() , fontName , &fontSize , &fontStyle ) ;
sizeFont = fontSize ; sizeFont = fontSize ;
p2cstrcpy( (char*) fontName , fontName ) ; wxSWISS_FONT = new wxFont (fontSize, wxSWISS, wxNORMAL, wxNORMAL , false , wxMacMakeStringFromPascal(fontName) );
wxSWISS_FONT = new wxFont (fontSize, wxSWISS, wxNORMAL, wxNORMAL , false , fontName );
#elif defined(__WXPM__) #elif defined(__WXPM__)
static const int sizeFont = 12; static const int sizeFont = 12;
#else #else
@@ -485,8 +484,7 @@ void wxInitializeStockObjects ()
wxNORMAL_FONT = new wxFont (sizeFont, wxMODERN, wxNORMAL, wxNORMAL); wxNORMAL_FONT = new wxFont (sizeFont, wxMODERN, wxNORMAL, wxNORMAL);
wxITALIC_FONT = new wxFont (sizeFont, wxROMAN, wxITALIC, wxNORMAL); wxITALIC_FONT = new wxFont (sizeFont, wxROMAN, wxITALIC, wxNORMAL);
GetThemeFont(kThemeSmallSystemFont , GetApplicationScript() , fontName , &fontSize , &fontStyle ) ; GetThemeFont(kThemeSmallSystemFont , GetApplicationScript() , fontName , &fontSize , &fontStyle ) ;
p2cstrcpy( (char*) fontName , fontName ) ; wxSMALL_FONT = new wxFont (fontSize, wxSWISS, wxNORMAL, wxNORMAL , false , wxMacMakeStringFromPascal( fontName ) );
wxSMALL_FONT = new wxFont (fontSize, wxSWISS, wxNORMAL, wxNORMAL , false , fontName );
#else #else
wxSMALL_FONT = new wxFont (sizeFont - 2, wxSWISS, wxNORMAL, wxNORMAL); wxSMALL_FONT = new wxFont (sizeFont - 2, wxSWISS, wxNORMAL, wxNORMAL);
wxITALIC_FONT = new wxFont (sizeFont, wxROMAN, wxITALIC, wxNORMAL); wxITALIC_FONT = new wxFont (sizeFont, wxROMAN, wxITALIC, wxNORMAL);

View File

@@ -924,279 +924,279 @@ void wxLocale::AddCatalogLookupPathPrefix(const wxString& prefix)
} }
} }
#elif defined(__WXMAC__) #elif defined(__WXMAC__)
const char* lc = NULL ; const wxChar * lc = NULL ;
long lang = GetScriptVariable( smSystemScript, smScriptLang) ; long lang = GetScriptVariable( smSystemScript, smScriptLang) ;
switch( GetScriptManagerVariable( smRegionCode ) ) { switch( GetScriptManagerVariable( smRegionCode ) ) {
case verUS : case verUS :
lc = "en_US" ; lc = wxT("en_US") ;
break ; break ;
case verFrance : case verFrance :
lc = "fr_FR" ; lc = wxT("fr_FR") ;
break ; break ;
case verBritain : case verBritain :
lc = "en_GB" ; lc = wxT("en_GB") ;
break ; break ;
case verGermany : case verGermany :
lc = "de_DE" ; lc = wxT("de_DE") ;
break ; break ;
case verItaly : case verItaly :
lc = "it_IT" ; lc = wxT("it_IT") ;
break ; break ;
case verNetherlands : case verNetherlands :
lc = "nl_NL" ; lc = wxT("nl_NL") ;
break ; break ;
case verFlemish : case verFlemish :
lc = "nl_BE" ; lc = wxT("nl_BE") ;
break ; break ;
case verSweden : case verSweden :
lc = "sv_SE" ; lc = wxT("sv_SE" );
break ; break ;
case verSpain : case verSpain :
lc = "es_ES" ; lc = wxT("es_ES" );
break ; break ;
case verDenmark : case verDenmark :
lc = "da_DK" ; lc = wxT("da_DK") ;
break ; break ;
case verPortugal : case verPortugal :
lc = "pt_PT" ; lc = wxT("pt_PT") ;
break ; break ;
case verFrCanada: case verFrCanada:
lc = "fr_CA" ; lc = wxT("fr_CA") ;
break ; break ;
case verNorway: case verNorway:
lc = "no_NO" ; lc = wxT("no_NO") ;
break ; break ;
case verIsrael: case verIsrael:
lc = "iw_IL" ; lc = wxT("iw_IL") ;
break ; break ;
case verJapan: case verJapan:
lc = "ja_JP" ; lc = wxT("ja_JP") ;
break ; break ;
case verAustralia: case verAustralia:
lc = "en_AU" ; lc = wxT("en_AU") ;
break ; break ;
case verArabic: case verArabic:
lc = "ar" ; lc = wxT("ar") ;
break ; break ;
case verFinland: case verFinland:
lc = "fi_FI" ; lc = wxT("fi_FI") ;
break ; break ;
case verFrSwiss: case verFrSwiss:
lc = "fr_CH" ; lc = wxT("fr_CH") ;
break ; break ;
case verGrSwiss: case verGrSwiss:
lc = "de_CH" ; lc = wxT("de_CH") ;
break ; break ;
case verGreece: case verGreece:
lc = "el_GR" ; lc = wxT("el_GR") ;
break ; break ;
case verIceland: case verIceland:
lc = "is_IS" ; lc = wxT("is_IS") ;
break ; break ;
case verMalta: case verMalta:
lc = "mt_MT" ; lc = wxT("mt_MT") ;
break ; break ;
case verCyprus: case verCyprus:
// _CY is not part of wx, so we have to translate according to the system language // _CY is not part of wx, so we have to translate according to the system language
if ( lang == langGreek ) { if ( lang == langGreek ) {
lc = "el_GR" ; lc = wxT("el_GR") ;
} }
else if ( lang == langTurkish ) { else if ( lang == langTurkish ) {
lc = "tr_TR" ; lc = wxT("tr_TR") ;
} }
break ; break ;
case verTurkey: case verTurkey:
lc = "tr_TR" ; lc = wxT("tr_TR") ;
break ; break ;
case verYugoCroatian: case verYugoCroatian:
lc = "hr_HR" ; lc = wxT("hr_HR") ;
break ; break ;
case verIndiaHindi: case verIndiaHindi:
lc = "hi_IN" ; lc = wxT("hi_IN") ;
break ; break ;
case verPakistanUrdu: case verPakistanUrdu:
lc = "ur_PK" ; lc = wxT("ur_PK") ;
break ; break ;
case verTurkishModified: case verTurkishModified:
lc = "tr_TR" ; lc = wxT("tr_TR") ;
break ; break ;
case verItalianSwiss: case verItalianSwiss:
lc = "it_CH" ; lc = wxT("it_CH") ;
break ; break ;
case verInternational: case verInternational:
lc = "en" ; lc = wxT("en") ;
break ; break ;
case verRomania: case verRomania:
lc = "ro_RO" ; lc = wxT("ro_RO") ;
break ; break ;
case verGreecePoly: case verGreecePoly:
lc = "el_GR" ; lc = wxT("el_GR") ;
break ; break ;
case verLithuania: case verLithuania:
lc = "lt_LT" ; lc = wxT("lt_LT") ;
break ; break ;
case verPoland: case verPoland:
lc = "pl_PL" ; lc = wxT("pl_PL") ;
break ; break ;
case verMagyar : case verMagyar :
case verHungary: case verHungary:
lc = "hu_HU" ; lc = wxT("hu_HU") ;
break ; break ;
case verEstonia: case verEstonia:
lc = "et_EE" ; lc = wxT("et_EE") ;
break ; break ;
case verLatvia: case verLatvia:
lc = "lv_LV" ; lc = wxT("lv_LV") ;
break ; break ;
case verSami: case verSami:
// not known // not known
break ; break ;
case verFaroeIsl: case verFaroeIsl:
lc = "fo_FO" ; lc = wxT("fo_FO") ;
break ; break ;
case verIran: case verIran:
lc = "fa_IR" ; lc = wxT("fa_IR") ;
break ; break ;
case verRussia: case verRussia:
lc = "ru_RU" ; lc = wxT("ru_RU") ;
break ; break ;
case verIreland: case verIreland:
lc = "ga_IE" ; lc = wxT("ga_IE") ;
break ; break ;
case verKorea: case verKorea:
lc = "ko_KR" ; lc = wxT("ko_KR") ;
break ; break ;
case verChina: case verChina:
lc = "zh_CN" ; lc = wxT("zh_CN") ;
break ; break ;
case verTaiwan: case verTaiwan:
lc = "zh_TW" ; lc = wxT("zh_TW") ;
break ; break ;
case verThailand: case verThailand:
lc = "th_TH" ; lc = wxT("th_TH") ;
break ; break ;
case verCzech: case verCzech:
lc = "cs_CZ" ; lc = wxT("cs_CZ") ;
break ; break ;
case verSlovak: case verSlovak:
lc = "sk_SK" ; lc = wxT("sk_SK") ;
break ; break ;
case verBengali: case verBengali:
lc = "bn" ; lc = wxT("bn") ;
break ; break ;
case verByeloRussian: case verByeloRussian:
lc = "be_BY" ; lc = wxT("be_BY") ;
break ; break ;
case verUkraine: case verUkraine:
lc = "uk_UA" ; lc = wxT("uk_UA") ;
break ; break ;
case verGreeceAlt: case verGreeceAlt:
lc = "el_GR" ; lc = wxT("el_GR") ;
break ; break ;
case verSerbian: case verSerbian:
lc = "sr_YU" ; lc = wxT("sr_YU") ;
break ; break ;
case verSlovenian: case verSlovenian:
lc = "sl_SI" ; lc = wxT("sl_SI") ;
break ; break ;
case verMacedonian: case verMacedonian:
lc = "mk_MK" ; lc = wxT("mk_MK") ;
break ; break ;
case verCroatia: case verCroatia:
lc = "hr_HR" ; lc = wxT("hr_HR") ;
break ; break ;
case verBrazil: case verBrazil:
lc = "pt_BR " ; lc = wxT("pt_BR ") ;
break ; break ;
case verBulgaria: case verBulgaria:
lc = "bg_BG" ; lc = wxT("bg_BG") ;
break ; break ;
case verCatalonia: case verCatalonia:
lc = "ca_ES" ; lc = wxT("ca_ES") ;
break ; break ;
case verScottishGaelic: case verScottishGaelic:
lc = "gd" ; lc = wxT("gd") ;
break ; break ;
case verManxGaelic: case verManxGaelic:
lc = "gv" ; lc = wxT("gv") ;
break ; break ;
case verBreton: case verBreton:
lc = "br" ; lc = wxT("br") ;
break ; break ;
case verNunavut: case verNunavut:
lc = "iu_CA" ; lc = wxT("iu_CA") ;
break ; break ;
case verWelsh: case verWelsh:
lc = "cy" ; lc = wxT("cy") ;
break ; break ;
case verIrishGaelicScript: case verIrishGaelicScript:
lc = "ga_IE" ; lc = wxT("ga_IE") ;
break ; break ;
case verEngCanada: case verEngCanada:
lc = "en_CA" ; lc = wxT("en_CA") ;
break ; break ;
case verBhutan: case verBhutan:
lc = "dz_BT" ; lc = wxT("dz_BT") ;
break ; break ;
case verArmenian: case verArmenian:
lc = "hy_AM" ; lc = wxT("hy_AM") ;
break ; break ;
case verGeorgian: case verGeorgian:
lc = "ka_GE" ; lc = wxT("ka_GE") ;
break ; break ;
case verSpLatinAmerica: case verSpLatinAmerica:
lc = "es_AR" ; lc = wxT("es_AR") ;
break ; break ;
case verTonga: case verTonga:
lc = "to_TO" ; lc = wxT("to_TO" );
break ; break ;
case verFrenchUniversal: case verFrenchUniversal:
lc = "fr_FR" ; lc = wxT("fr_FR") ;
break ; break ;
case verAustria: case verAustria:
lc = "de_AT" ; lc = wxT("de_AT") ;
break ; break ;
case verGujarati: case verGujarati:
lc = "gu_IN" ; lc = wxT("gu_IN") ;
break ; break ;
case verPunjabi: case verPunjabi:
lc = "pa" ; lc = wxT("pa") ;
break ; break ;
case verIndiaUrdu: case verIndiaUrdu:
lc = "ur_IN" ; lc = wxT("ur_IN") ;
break ; break ;
case verVietnam: case verVietnam:
lc = "vi_VN" ; lc = wxT("vi_VN") ;
break ; break ;
case verFrBelgium: case verFrBelgium:
lc = "fr_BE" ; lc = wxT("fr_BE") ;
break ; break ;
case verUzbek: case verUzbek:
lc = "uz_UZ" ; lc = wxT("uz_UZ") ;
break ; break ;
case verSingapore: case verSingapore:
lc = "zh_SG" ; lc = wxT("zh_SG") ;
break ; break ;
case verNynorsk: case verNynorsk:
lc = "nn_NO" ; lc = wxT("nn_NO") ;
break ; break ;
case verAfrikaans: case verAfrikaans:
lc = "af_ZA" ; lc = wxT("af_ZA") ;
break ; break ;
case verEsperanto: case verEsperanto:
lc = "eo" ; lc = wxT("eo") ;
break ; break ;
case verMarathi: case verMarathi:
lc = "mr_IN" ; lc = wxT("mr_IN") ;
break ; break ;
case verTibetan: case verTibetan:
lc = "bo" ; lc = wxT("bo") ;
break ; break ;
case verNepal: case verNepal:
lc = "ne_NP" ; lc = wxT("ne_NP") ;
break ; break ;
case verGreenland: case verGreenland:
lc = "kl_GL" ; lc = wxT("kl_GL") ;
break ; break ;
default : default :
break ; break ;

View File

@@ -717,9 +717,8 @@ void wxLogStderr::DoLogString(const wxChar *szString, time_t WXUNUSED(t))
#if defined(__WXMAC__) && !defined(__DARWIN__) && wxUSE_GUI #if defined(__WXMAC__) && !defined(__DARWIN__) && wxUSE_GUI
Str255 pstr ; Str255 pstr ;
strcpy( (char*) pstr , str.c_str() ) ; wxString output = str + wxT(";g") ;
strcat( (char*) pstr , ";g" ) ; wxMacStringToPascal( output.c_str() , pstr ) ;
c2pstr( (char*) pstr ) ;
Boolean running = false ; Boolean running = false ;

View File

@@ -848,8 +848,11 @@ int wxFscanf( FILE *stream, const wxChar *format, ... )
{ {
va_list argptr; va_list argptr;
va_start(argptr, format); va_start(argptr, format);
#ifdef __WXMAC__
int ret = ::vfwscanf(stream, wxFormatConverter(format), argptr);
#else
int ret = vfwscanf(stream, wxFormatConverter(format), argptr); int ret = vfwscanf(stream, wxFormatConverter(format), argptr);
#endif
va_end(argptr); va_end(argptr);

View File

@@ -330,7 +330,7 @@ bool wxStatusBarGeneric::GetFieldRect(int n, wxRect& rect) const
void wxStatusBarGeneric::InitColours() void wxStatusBarGeneric::InitColours()
{ {
// Shadow colours // Shadow colours
#if defined(__WIN95__) #if defined(__WIN95__) || defined(__WXMAC__)
wxColour mediumShadowColour(wxSystemSettings::GetColour(wxSYS_COLOUR_3DSHADOW)); wxColour mediumShadowColour(wxSystemSettings::GetColour(wxSYS_COLOUR_3DSHADOW));
m_mediumShadowPen = wxPen(mediumShadowColour, 1, wxSOLID); m_mediumShadowPen = wxPen(mediumShadowColour, 1, wxSOLID);

View File

@@ -38,6 +38,10 @@
#include "wx/settings.h" #include "wx/settings.h"
#include "wx/dcclient.h" #include "wx/dcclient.h"
#ifdef __WXMAC__
#include "wx/mac/private.h"
#endif
// ----------------------------------------------------------------------------- // -----------------------------------------------------------------------------
// array types // array types
// ----------------------------------------------------------------------------- // -----------------------------------------------------------------------------
@@ -2128,7 +2132,20 @@ void wxGenericTreeCtrl::PaintItem(wxGenericTreeItem *item, wxDC& dc)
if ( item->IsSelected() ) if ( item->IsSelected() )
{ {
// under mac selections are only a rectangle in case they don't have the focus
#ifdef __WXMAC__
if ( !m_hasFocus )
{
dc.SetBrush( *wxTRANSPARENT_BRUSH ) ;
dc.SetPen( wxPen( wxSystemSettings::GetColour( wxSYS_COLOUR_HIGHLIGHT ) , 1 , wxSOLID ) ) ;
}
else
{
dc.SetBrush( *m_hilightBrush ) ;
}
#else
dc.SetBrush(*(m_hasFocus ? m_hilightBrush : m_hilightUnfocusedBrush)); dc.SetBrush(*(m_hasFocus ? m_hilightBrush : m_hilightUnfocusedBrush));
#endif
} }
else else
{ {
@@ -2309,10 +2326,25 @@ void wxGenericTreeCtrl::PaintLevel( wxGenericTreeItem *item, wxDC &dc, int level
if (HasFlag(wxTR_AQUA_BUTTONS)) if (HasFlag(wxTR_AQUA_BUTTONS))
{ {
#ifdef __WXMAC__
wxMacPortSetter helper(&dc) ;
wxMacWindowClipper clipper(this) ;
wxDC::MacSetupBackgroundForCurrentPort( MacGetBackgroundBrush() ) ;
int loc_x = x - 5 ;
int loc_y = y_mid - 6 ;
MacWindowToRootWindow( & loc_x , & loc_y ) ;
Rect bounds = { loc_y , loc_x , loc_y + 18 , loc_x + 12 } ;
ThemeButtonDrawInfo info = { kThemeStateActive , item->IsExpanded() ? kThemeDisclosureDown : kThemeDisclosureRight ,
kThemeAdornmentNone };
DrawThemeButton( &bounds, kThemeDisclosureButton ,
&info , NULL , NULL , NULL , NULL ) ;
#else
if (item->IsExpanded()) if (item->IsExpanded())
dc.DrawBitmap( *m_arrowDown, x-5, y_mid-6, TRUE ); dc.DrawBitmap( *m_arrowDown, x-5, y_mid-6, TRUE );
else else
dc.DrawBitmap( *m_arrowRight, x-5, y_mid-6, TRUE ); dc.DrawBitmap( *m_arrowRight, x-5, y_mid-6, TRUE );
#endif
} }
else else
{ {