From ed9b9841b32afa2e97353263e3563b4387e2fe0e Mon Sep 17 00:00:00 2001 From: Ove Kaaven Date: Wed, 14 Apr 1999 22:47:16 +0000 Subject: [PATCH] OK, enough for today. To be continued tomorrow... git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@2168 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- src/gtk/dialog.cpp | 18 ++++---- src/gtk/filedlg.cpp | 52 +++++++++++------------ src/gtk/font.cpp | 98 ++++++++++++++++++++++---------------------- src/gtk/frame.cpp | 48 +++++++++++----------- src/gtk/listbox.cpp | 69 +++++++++++++++---------------- src/gtk/mdi.cpp | 2 +- src/gtk1/dialog.cpp | 18 ++++---- src/gtk1/filedlg.cpp | 52 +++++++++++------------ src/gtk1/font.cpp | 98 ++++++++++++++++++++++---------------------- src/gtk1/frame.cpp | 48 +++++++++++----------- src/gtk1/listbox.cpp | 69 +++++++++++++++---------------- src/gtk1/mdi.cpp | 2 +- 12 files changed, 286 insertions(+), 288 deletions(-) diff --git a/src/gtk/dialog.cpp b/src/gtk/dialog.cpp index 2bb5127425..deab62ab69 100644 --- a/src/gtk/dialog.cpp +++ b/src/gtk/dialog.cpp @@ -195,8 +195,8 @@ wxDialog::~wxDialog() void wxDialog::SetTitle( const wxString& title ) { m_title = title; - if (m_title.IsNull()) m_title = ""; - gtk_window_set_title( GTK_WINDOW(m_widget), m_title ); + if (m_title.IsNull()) m_title = _T(""); + gtk_window_set_title( GTK_WINDOW(m_widget), m_title.mbc_str() ); } wxString wxDialog::GetTitle() const @@ -281,7 +281,7 @@ bool wxDialog::Destroy() void wxDialog::OnSize( wxSizeEvent &WXUNUSED(event) ) { - wxASSERT_MSG( (m_widget != NULL), "invalid dialog" ); + wxASSERT_MSG( (m_widget != NULL), _T("invalid dialog") ); if (GetAutoLayout()) { @@ -314,8 +314,8 @@ void wxDialog::OnSize( wxSizeEvent &WXUNUSED(event) ) void wxDialog::DoSetSize( int x, int y, int width, int height, int sizeFlags ) { - wxASSERT_MSG( (m_widget != NULL), "invalid dialog" ); - wxASSERT_MSG( (m_wxwindow != NULL), "invalid dialog" ); + wxASSERT_MSG( (m_widget != NULL), _T("invalid dialog") ); + wxASSERT_MSG( (m_wxwindow != NULL), _T("invalid dialog") ); if (m_resizing) return; /* I don't like recursions */ m_resizing = TRUE; @@ -401,7 +401,7 @@ void wxDialog::GtkOnSize( int WXUNUSED(x), int WXUNUSED(y), int width, int heigh void wxDialog::Centre( int direction ) { - wxASSERT_MSG( (m_widget != NULL), "invalid dialog" ); + wxASSERT_MSG( (m_widget != NULL), _T("invalid dialog") ); int x = 0; int y = 0; @@ -455,14 +455,14 @@ void wxDialog::SetModal( bool WXUNUSED(flag) ) else if (m_windowStyle & wxDIALOG_MODAL) m_windowStyle -= wxDIALOG_MODAL; */ - wxFAIL_MSG( "wxDialog:SetModal obsolete now" ); + wxFAIL_MSG( _T("wxDialog:SetModal obsolete now") ); } int wxDialog::ShowModal() { if (IsModal()) { - wxFAIL_MSG( "wxDialog:ShowModal called twice" ); + wxFAIL_MSG( _T("wxDialog:ShowModal called twice") ); return GetReturnCode(); } @@ -483,7 +483,7 @@ void wxDialog::EndModal( int retCode ) if (!IsModal()) { - wxFAIL_MSG( "wxDialog:EndModal called twice" ); + wxFAIL_MSG( _T("wxDialog:EndModal called twice") ); return; } diff --git a/src/gtk/filedlg.cpp b/src/gtk/filedlg.cpp index b4d52f4db1..fa6d087c99 100644 --- a/src/gtk/filedlg.cpp +++ b/src/gtk/filedlg.cpp @@ -105,14 +105,14 @@ wxFileDialog::wxFileDialog( wxWindow *parent, const wxString& message, PreCreation( parent, -1, pos, wxDefaultSize, style | wxDIALOG_MODAL, "filedialog" ); m_message = message; - m_path = ""; + m_path = _T(""); m_fileName = defaultFileName; m_dir = defaultDir; m_wildCard = wildCard; m_dialogStyle = style; m_filterIndex = 1; - m_widget = gtk_file_selection_new( m_message ); + m_widget = gtk_file_selection_new( m_message.mbc_str() ); int x = (gdk_screen_width () - 400) / 2; int y = (gdk_screen_height () - 400) / 2; @@ -122,23 +122,23 @@ wxFileDialog::wxFileDialog( wxWindow *parent, const wxString& message, gtk_file_selection_hide_fileop_buttons( sel ); // they don't work anyway m_path.Append(m_dir); - if( ! m_path.IsEmpty() && m_path.Last()!='/' ) + if( ! m_path.IsEmpty() && m_path.Last()!=_T('/') ) m_path.Append('/'); m_path.Append(m_fileName); - if(m_path.Length()>1) gtk_file_selection_set_filename(sel,m_path); + if(m_path.Length()>1) gtk_file_selection_set_filename(sel,m_path.mbc_str()); gtk_signal_connect( GTK_OBJECT(sel->ok_button), "clicked", GTK_SIGNAL_FUNC(gtk_filedialog_ok_callback), (gpointer*)this ); // strange way to internationalize - gtk_label_set( GTK_LABEL( GTK_BUTTON(sel->ok_button)->child ), _("OK") ); + gtk_label_set( GTK_LABEL( GTK_BUTTON(sel->ok_button)->child ), wxConv_current->cWX2MB(_("OK")) ); gtk_signal_connect( GTK_OBJECT(sel->cancel_button), "clicked", GTK_SIGNAL_FUNC(gtk_filedialog_cancel_callback), (gpointer*)this ); // strange way to internationalize - gtk_label_set( GTK_LABEL( GTK_BUTTON(sel->cancel_button)->child ), _("Cancel") ); + gtk_label_set( GTK_LABEL( GTK_BUTTON(sel->cancel_button)->child ), wxConv_current->cWX2MB(_("Cancel")) ); gtk_signal_connect( GTK_OBJECT(m_widget), "delete_event", GTK_SIGNAL_FUNC(gtk_filedialog_delete_callback), (gpointer)this ); @@ -160,14 +160,14 @@ void wxFileDialog::SetPath(const wxString& path) // global functions // ---------------------------------------------------------------------------- -wxString wxFileSelector( const char *title, - const char *defaultDir, const char *defaultFileName, - const char *defaultExtension, const char *filter, int flags, +wxString wxFileSelector( const wxChar *title, + const wxChar *defaultDir, const wxChar *defaultFileName, + const wxChar *defaultExtension, const wxChar *filter, int flags, wxWindow *parent, int x, int y ) { wxString filter2; if ( defaultExtension && !filter ) - filter2 = wxString("*.") + wxString(defaultExtension) ; + filter2 = wxString(_T("*.")) + wxString(defaultExtension) ; else if ( filter ) filter2 = filter; @@ -191,34 +191,34 @@ wxString wxFileSelector( const char *title, } } -wxString wxLoadFileSelector( const char *what, const char *extension, const char *default_name, wxWindow *parent ) +wxString wxLoadFileSelector( const wxChar *what, const wxChar *extension, const wxChar *default_name, wxWindow *parent ) { - char *ext = (char *)extension; + wxChar *ext = (wxChar *)extension; - char prompt[50]; + wxChar prompt[50]; wxString str = _("Load %s file"); - sprintf(prompt, str, what); + wxSprintf(prompt, str, what); - if (*ext == '.') ext++; - char wild[60]; - sprintf(wild, "*.%s", ext); + if (*ext == _T('.')) ext++; + wxChar wild[60]; + wxSprintf(wild, _T("*.%s"), ext); - return wxFileSelector (prompt, (const char *) NULL, default_name, ext, wild, 0, parent); + return wxFileSelector (prompt, (const wxChar *) NULL, default_name, ext, wild, 0, parent); } -wxString wxSaveFileSelector(const char *what, const char *extension, const char *default_name, +wxString wxSaveFileSelector(const wxChar *what, const wxChar *extension, const wxChar *default_name, wxWindow *parent ) { - char *ext = (char *)extension; + wxChar *ext = (wxChar *)extension; - char prompt[50]; + wxChar prompt[50]; wxString str = _("Save %s file"); - sprintf(prompt, str, what); + wxSprintf(prompt, str, what); - if (*ext == '.') ext++; - char wild[60]; - sprintf(wild, "*.%s", ext); + if (*ext == _T('.')) ext++; + wxChar wild[60]; + wxSprintf(wild, _T("*.%s"), ext); - return wxFileSelector (prompt, (const char *) NULL, default_name, ext, wild, 0, parent); + return wxFileSelector (prompt, (const wxChar *) NULL, default_name, ext, wild, 0, parent); } diff --git a/src/gtk/font.cpp b/src/gtk/font.cpp index 59b5734012..c521e7b3b3 100644 --- a/src/gtk/font.cpp +++ b/src/gtk/font.cpp @@ -176,38 +176,38 @@ bool wxFont::Ok() const int wxFont::GetPointSize() const { - wxCHECK_MSG( Ok(), 0, "invalid font" ); + wxCHECK_MSG( Ok(), 0, _T("invalid font") ); return M_FONTDATA->m_pointSize; } wxString wxFont::GetFaceName() const { - wxCHECK_MSG( Ok(), "", "invalid font" ); + wxCHECK_MSG( Ok(), _T(""), _T("invalid font") ); return M_FONTDATA->m_faceName; } int wxFont::GetFamily() const { - wxCHECK_MSG( Ok(), 0, "invalid font" ); + wxCHECK_MSG( Ok(), 0, _T("invalid font") ); return M_FONTDATA->m_family; } wxString wxFont::GetFamilyString() const { - wxCHECK_MSG( Ok(), "wxDEFAULT", "invalid font" ); + wxCHECK_MSG( Ok(), _T("wxDEFAULT"), _T("invalid font") ); switch (M_FONTDATA->m_family) { - case wxDECORATIVE: return wxString("wxDECORATIVE"); - case wxROMAN: return wxString("wxROMAN"); - case wxSCRIPT: return wxString("wxSCRIPT"); - case wxSWISS: return wxString("wxSWISS"); - case wxMODERN: return wxString("wxMODERN"); - case wxTELETYPE: return wxString("wxTELETYPE"); - default: return "wxDEFAULT"; + case wxDECORATIVE: return wxString(_T("wxDECORATIVE")); + case wxROMAN: return wxString(_T("wxROMAN")); + case wxSCRIPT: return wxString(_T("wxSCRIPT")); + case wxSWISS: return wxString(_T("wxSWISS")); + case wxMODERN: return wxString(_T("wxMODERN")); + case wxTELETYPE: return wxString(_T("wxTELETYPE")); + default: return _T("wxDEFAULT"); } return "wxDEFAULT"; @@ -215,51 +215,51 @@ wxString wxFont::GetFamilyString() const int wxFont::GetStyle() const { - wxCHECK_MSG( Ok(), 0, "invalid font" ); + wxCHECK_MSG( Ok(), 0, _T("invalid font") ); return M_FONTDATA->m_style; } wxString wxFont::GetStyleString() const { - wxCHECK_MSG( Ok(), "wxDEFAULT", "invalid font" ); + wxCHECK_MSG( Ok(), _T("wxDEFAULT"), _T("invalid font") ); switch (M_FONTDATA->m_style) { - case wxNORMAL: return wxString("wxNORMAL"); - case wxSLANT: return wxString("wxSLANT"); - case wxITALIC: return wxString("wxITALIC"); - default: return wxString("wxDEFAULT"); + case wxNORMAL: return wxString(_T("wxNORMAL")); + case wxSLANT: return wxString(_T("wxSLANT")); + case wxITALIC: return wxString(_T("wxITALIC")); + default: return wxString(_T("wxDEFAULT")); } - return wxString("wxDEFAULT"); + return wxString(_T("wxDEFAULT")); } int wxFont::GetWeight() const { - wxCHECK_MSG( Ok(), 0, "invalid font" ); + wxCHECK_MSG( Ok(), 0, _T("invalid font") ); return M_FONTDATA->m_weight; } wxString wxFont::GetWeightString() const { - wxCHECK_MSG( Ok(), "wxDEFAULT", "invalid font" ); + wxCHECK_MSG( Ok(), _T("wxDEFAULT"), _T("invalid font") ); switch (M_FONTDATA->m_weight) { - case wxNORMAL: return wxString("wxNORMAL"); - case wxBOLD: return wxString("wxBOLD"); - case wxLIGHT: return wxString("wxLIGHT"); - default: return wxString("wxDEFAULT"); + case wxNORMAL: return wxString(_T("wxNORMAL")); + case wxBOLD: return wxString(_T("wxBOLD")); + case wxLIGHT: return wxString(_T("wxLIGHT")); + default: return wxString(_T("wxDEFAULT")); } - return wxString("wxDEFAULT"); + return wxString(_T("wxDEFAULT")); } bool wxFont::GetUnderlined() const { - wxCHECK_MSG( Ok(), FALSE, "invalid font" ); + wxCHECK_MSG( Ok(), FALSE, _T("invalid font") ); return M_FONTDATA->m_underlined; } @@ -331,7 +331,7 @@ GdkFont *wxFont::GetInternalFont( float scale ) const { if (!Ok()) { - wxFAIL_MSG( "invalid font" ); + wxFAIL_MSG( _T("invalid font") ); return (GdkFont*) NULL; } @@ -370,7 +370,7 @@ GdkFont *wxFont::GetInternalFont( float scale ) const if (!font) { - wxLogError("could not load any font"); + wxLogError(_T("could not load any font")); } return font; @@ -383,25 +383,25 @@ GdkFont *wxFont::GetInternalFont( float scale ) const static GdkFont*wxLoadQueryFont( int pointSize, int family, int style, int weight, bool underlined, const wxString &facename ) { - char *xfamily = (char*) NULL; - char *xstyle = (char*) NULL; - char *xweight = (char*) NULL; + wxChar *xfamily = (wxChar*) NULL; + wxChar *xstyle = (wxChar*) NULL; + wxChar *xweight = (wxChar*) NULL; switch (family) { - case wxDECORATIVE: xfamily = "lucida"; break; - case wxROMAN: xfamily = "times"; break; - case wxMODERN: xfamily = "courier"; break; - case wxSWISS: xfamily = "helvetica"; break; - case wxTELETYPE: xfamily = "lucidatypewriter"; break; - case wxSCRIPT: xfamily = "utopia"; break; - default: xfamily = "*"; + case wxDECORATIVE: xfamily = _T("lucida"); break; + case wxROMAN: xfamily = _T("times"); break; + case wxMODERN: xfamily = _T("courier"); break; + case wxSWISS: xfamily = _T("helvetica"); break; + case wxTELETYPE: xfamily = _T("lucidatypewriter"); break; + case wxSCRIPT: xfamily = _T("utopia"); break; + default: xfamily = _T("*"); } if (!facename.IsEmpty()) { - sprintf( wxBuffer, "-*-%s-*-*-normal-*-*-*-*-*-*-*-*-*", facename.c_str() ); - GdkFont *test = gdk_font_load( wxBuffer ); + wxSprintf( wxBuffer, _T("-*-%s-*-*-normal-*-*-*-*-*-*-*-*-*"), facename.c_str() ); + GdkFont *test = gdk_font_load( wxConv_libc.cWX2MB(wxBuffer) ); if (test) { gdk_font_unref( test ); @@ -411,23 +411,23 @@ static GdkFont*wxLoadQueryFont( int pointSize, int family, int style, int weight switch (style) { - case wxITALIC: xstyle = "i"; break; - case wxSLANT: xstyle = "o"; break; - case wxNORMAL: xstyle = "r"; break; - default: xstyle = "*"; break; + case wxITALIC: xstyle = _T("i"); break; + case wxSLANT: xstyle = _T("o"); break; + case wxNORMAL: xstyle = _T("r"); break; + default: xstyle = _T("*"); break; } switch (weight) { - case wxBOLD: xweight = "bold"; break; + case wxBOLD: xweight = _T("bold"); break; case wxLIGHT: - case wxNORMAL: xweight = "medium"; break; - default: xweight = "*"; break; + case wxNORMAL: xweight = _T("medium"); break; + default: xweight = _T("*"); break; } - sprintf( wxBuffer, "-*-%s-%s-%s-normal-*-*-%d-*-*-*-*-*-*", + wxSprintf( wxBuffer, _T("-*-%s-%s-%s-normal-*-*-%d-*-*-*-*-*-*"), xfamily, xweight, xstyle, pointSize); - return gdk_font_load( wxBuffer ); + return gdk_font_load( wxConv_libc.cWX2MB(wxBuffer) ); } static GdkFont *wxLoadQueryNearestFont( int point_size, int family, int style, int weight, diff --git a/src/gtk/frame.cpp b/src/gtk/frame.cpp index 48c3b8f132..dc12772f29 100644 --- a/src/gtk/frame.cpp +++ b/src/gtk/frame.cpp @@ -252,7 +252,7 @@ bool wxFrame::Create( wxWindow *parent, wxWindowID id, const wxString &title, m_widget = gtk_window_new( win_type ); - gtk_window_set_title( GTK_WINDOW(m_widget), title ); + gtk_window_set_title( GTK_WINDOW(m_widget), title.mbc_str() ); GTK_WIDGET_UNSET_FLAGS( m_widget, GTK_CAN_FOCUS ); /* needed ? */ @@ -336,7 +336,7 @@ wxFrame::~wxFrame() bool wxFrame::Show( bool show ) { - wxASSERT_MSG( (m_widget != NULL), "invalid frame" ); + wxASSERT_MSG( (m_widget != NULL), _T("invalid frame") ); if (show && !m_sizeSet) { @@ -353,7 +353,7 @@ bool wxFrame::Show( bool show ) bool wxFrame::Destroy() { - wxASSERT_MSG( (m_widget != NULL), "invalid frame" ); + wxASSERT_MSG( (m_widget != NULL), _T("invalid frame") ); if (!wxPendingDelete.Member(this)) wxPendingDelete.Append(this); @@ -362,10 +362,10 @@ bool wxFrame::Destroy() void wxFrame::DoSetSize( int x, int y, int width, int height, int sizeFlags ) { - wxASSERT_MSG( (m_widget != NULL), "invalid frame" ); + wxASSERT_MSG( (m_widget != NULL), _T("invalid frame") ); /* this shouldn't happen: wxFrame, wxMDIParentFrame and wxMDIChildFrame have m_wxwindow */ - wxASSERT_MSG( (m_wxwindow != NULL), "invalid frame" ); + wxASSERT_MSG( (m_wxwindow != NULL), _T("invalid frame") ); /* avoid recursions */ if (m_resizing) return; @@ -428,7 +428,7 @@ void wxFrame::DoSetSize( int x, int y, int width, int height, int sizeFlags ) void wxFrame::Centre( int direction ) { - wxASSERT_MSG( (m_widget != NULL), "invalid frame" ); + wxASSERT_MSG( (m_widget != NULL), _T("invalid frame") ); int x = 0; int y = 0; @@ -441,7 +441,7 @@ void wxFrame::Centre( int direction ) void wxFrame::GetClientSize( int *width, int *height ) const { - wxASSERT_MSG( (m_widget != NULL), "invalid frame" ); + wxASSERT_MSG( (m_widget != NULL), _T("invalid frame") ); wxWindow::GetClientSize( width, height ); if (height) @@ -464,7 +464,7 @@ void wxFrame::GetClientSize( int *width, int *height ) const void wxFrame::DoSetClientSize( int width, int height ) { - wxASSERT_MSG( (m_widget != NULL), "invalid frame" ); + wxASSERT_MSG( (m_widget != NULL), _T("invalid frame") ); int h = height; if (m_frameMenuBar && !m_menuBarDetached) h += wxMENU_HEIGHT; @@ -489,7 +489,7 @@ void wxFrame::GtkOnSize( int WXUNUSED(x), int WXUNUSED(y), int width, int height m_resizing = TRUE; /* this shouldn't happen: wxFrame, wxMDIParentFrame and wxMDIChildFrame have m_wxwindow */ - wxASSERT_MSG( (m_wxwindow != NULL), "invalid frame" ); + wxASSERT_MSG( (m_wxwindow != NULL), _T("invalid frame") ); m_width = width; m_height = height; @@ -621,7 +621,7 @@ void wxFrame::OnCloseWindow( wxCloseEvent& event ) void wxFrame::OnSize( wxSizeEvent &WXUNUSED(event) ) { - wxASSERT_MSG( (m_widget != NULL), "invalid frame" ); + wxASSERT_MSG( (m_widget != NULL), _T("invalid frame") ); if (GetAutoLayout()) { @@ -672,8 +672,8 @@ static void SetInvokingWindow( wxMenu *menu, wxWindow *win ) void wxFrame::SetMenuBar( wxMenuBar *menuBar ) { - wxASSERT_MSG( (m_widget != NULL), "invalid frame" ); - wxASSERT_MSG( (m_wxwindow != NULL), "invalid frame" ); + wxASSERT_MSG( (m_widget != NULL), _T("invalid frame") ); + wxASSERT_MSG( (m_wxwindow != NULL), _T("invalid frame") ); m_frameMenuBar = menuBar; @@ -735,9 +735,9 @@ void wxFrame::OnMenuHighlight(wxMenuEvent& event) wxToolBar* wxFrame::CreateToolBar(long style, wxWindowID id, const wxString& name) { - wxASSERT_MSG( (m_widget != NULL), "invalid frame" ); + wxASSERT_MSG( (m_widget != NULL), _T("invalid frame") ); - wxCHECK_MSG( m_frameToolBar == NULL, FALSE, "recreating toolbar in wxFrame" ); + wxCHECK_MSG( m_frameToolBar == NULL, FALSE, _T("recreating toolbar in wxFrame") ); m_frameToolBar = OnCreateToolBar( style, id, name ); @@ -760,9 +760,9 @@ wxToolBar *wxFrame::GetToolBar() const wxStatusBar* wxFrame::CreateStatusBar( int number, long style, wxWindowID id, const wxString& name ) { - wxASSERT_MSG( (m_widget != NULL), "invalid frame" ); + wxASSERT_MSG( (m_widget != NULL), _T("invalid frame") ); - wxCHECK_MSG( m_frameStatusBar == NULL, FALSE, "recreating status bar in wxFrame" ); + wxCHECK_MSG( m_frameStatusBar == NULL, FALSE, _T("recreating status bar in wxFrame") ); m_frameStatusBar = OnCreateStatusBar( number, style, id, name ); @@ -814,18 +814,18 @@ void wxFrame::Command( int id ) void wxFrame::SetStatusText(const wxString& text, int number) { - wxASSERT_MSG( (m_widget != NULL), "invalid frame" ); + wxASSERT_MSG( (m_widget != NULL), _T("invalid frame") ); - wxCHECK_RET( m_frameStatusBar != NULL, "no statusbar to set text for" ); + wxCHECK_RET( m_frameStatusBar != NULL, _T("no statusbar to set text for") ); m_frameStatusBar->SetStatusText(text, number); } void wxFrame::SetStatusWidths(int n, const int widths_field[] ) { - wxASSERT_MSG( (m_widget != NULL), "invalid frame" ); + wxASSERT_MSG( (m_widget != NULL), _T("invalid frame") ); - wxCHECK_RET( m_frameStatusBar != NULL, "no statusbar to set widths for" ); + wxCHECK_RET( m_frameStatusBar != NULL, _T("no statusbar to set widths for") ); m_frameStatusBar->SetStatusWidths(n, widths_field); } @@ -837,16 +837,16 @@ wxStatusBar *wxFrame::GetStatusBar() const void wxFrame::SetTitle( const wxString &title ) { - wxASSERT_MSG( (m_widget != NULL), "invalid frame" ); + wxASSERT_MSG( (m_widget != NULL), _T("invalid frame") ); m_title = title; - if (m_title.IsNull()) m_title = ""; - gtk_window_set_title( GTK_WINDOW(m_widget), title ); + if (m_title.IsNull()) m_title = _T(""); + gtk_window_set_title( GTK_WINDOW(m_widget), title.mbc_str() ); } void wxFrame::SetIcon( const wxIcon &icon ) { - wxASSERT_MSG( (m_widget != NULL), "invalid frame" ); + wxASSERT_MSG( (m_widget != NULL), _T("invalid frame") ); m_icon = icon; if (!icon.Ok()) return; diff --git a/src/gtk/listbox.cpp b/src/gtk/listbox.cpp index 8c24f8b811..34139b626c 100644 --- a/src/gtk/listbox.cpp +++ b/src/gtk/listbox.cpp @@ -239,7 +239,7 @@ bool wxListBox::Create( wxWindow *parent, wxWindowID id, str.Prepend(CHECKBOX_STRING); } - list_item = gtk_list_item_new_with_label( str ); + list_item = gtk_list_item_new_with_label( str.mbc_str() ); gtk_container_add( GTK_CONTAINER(m_list), list_item ); @@ -292,11 +292,11 @@ wxListBox::~wxListBox() void wxListBox::InsertItems(int nItems, const wxString items[], int pos) { - wxCHECK_RET( m_list != NULL, "invalid listbox" ); + wxCHECK_RET( m_list != NULL, _T("invalid listbox") ); GList *children = m_list->children; int length = g_list_length(children); - wxCHECK_RET( pos <= length, "invalid index in wxListBox::InsertItems" ); + wxCHECK_RET( pos <= length, _T("invalid index in wxListBox::InsertItems") ); // VZ: it seems that GTK 1.0.6 doesn't has a function to insert an item // into a listbox at the given position, this is why we first delete @@ -390,7 +390,7 @@ void wxListBox::InsertItems(int nItems, const wxString items[], int pos) void wxListBox::AppendCommon( const wxString &item ) { - wxCHECK_RET( m_list != NULL, "invalid listbox" ); + wxCHECK_RET( m_list != NULL, _T("invalid listbox") ); GtkWidget *list_item; @@ -400,7 +400,7 @@ void wxListBox::AppendCommon( const wxString &item ) label.Prepend(CHECKBOX_STRING); } - list_item = gtk_list_item_new_with_label( label ); + list_item = gtk_list_item_new_with_label( label.mbc_str() ); gtk_container_add( GTK_CONTAINER(m_list), list_item ); @@ -467,7 +467,7 @@ void wxListBox::Append( const wxString &item, wxClientData *clientData ) void wxListBox::SetClientData( int n, void* clientData ) { - wxCHECK_RET( m_widget != NULL, "invalid combobox" ); + wxCHECK_RET( m_widget != NULL, _T("invalid combobox") ); wxNode *node = m_clientDataList.Nth( n ); if (!node) return; @@ -477,7 +477,7 @@ void wxListBox::SetClientData( int n, void* clientData ) void* wxListBox::GetClientData( int n ) { - wxCHECK_MSG( m_widget != NULL, NULL, "invalid combobox" ); + wxCHECK_MSG( m_widget != NULL, NULL, _T("invalid combobox") ); wxNode *node = m_clientDataList.Nth( n ); if (!node) return NULL; @@ -487,7 +487,7 @@ void* wxListBox::GetClientData( int n ) void wxListBox::SetClientObject( int n, wxClientData* clientData ) { - wxCHECK_RET( m_widget != NULL, "invalid combobox" ); + wxCHECK_RET( m_widget != NULL, _T("invalid combobox") ); wxNode *node = m_clientObjectList.Nth( n ); if (!node) return; @@ -500,7 +500,7 @@ void wxListBox::SetClientObject( int n, wxClientData* clientData ) wxClientData* wxListBox::GetClientObject( int n ) { - wxCHECK_MSG( m_widget != NULL, (wxClientData*)NULL, "invalid combobox" ); + wxCHECK_MSG( m_widget != NULL, (wxClientData*)NULL, _T("invalid combobox") ); wxNode *node = m_clientObjectList.Nth( n ); if (!node) return (wxClientData*) NULL; @@ -510,7 +510,7 @@ wxClientData* wxListBox::GetClientObject( int n ) void wxListBox::Clear() { - wxCHECK_RET( m_list != NULL, "invalid listbox" ); + wxCHECK_RET( m_list != NULL, _T("invalid listbox") ); gtk_list_clear_items( m_list, 0, Number() ); @@ -528,11 +528,11 @@ void wxListBox::Clear() void wxListBox::Delete( int n ) { - wxCHECK_RET( m_list != NULL, "invalid listbox" ); + wxCHECK_RET( m_list != NULL, _T("invalid listbox") ); GList *child = g_list_nth( m_list->children, n ); - wxCHECK_RET( child, "wrong listbox index" ); + wxCHECK_RET( child, _T("wrong listbox index") ); GList *list = g_list_append( (GList*) NULL, child->data ); gtk_list_remove_items( m_list, list ); @@ -555,14 +555,14 @@ void wxListBox::Delete( int n ) void wxListBox::Deselect( int n ) { - wxCHECK_RET( m_list != NULL, "invalid listbox" ); + wxCHECK_RET( m_list != NULL, _T("invalid listbox") ); gtk_list_unselect_item( m_list, n ); } int wxListBox::FindString( const wxString &item ) const { - wxCHECK_MSG( m_list != NULL, -1, "invalid listbox" ); + wxCHECK_MSG( m_list != NULL, -1, _T("invalid listbox") ); GList *child = m_list->children; int count = 0; @@ -587,7 +587,7 @@ int wxListBox::FindString( const wxString &item ) const int wxListBox::GetSelection() const { - wxCHECK_MSG( m_list != NULL, -1, "invalid listbox" ); + wxCHECK_MSG( m_list != NULL, -1, _T("invalid listbox") ); GList *child = m_list->children; int count = 0; @@ -602,7 +602,7 @@ int wxListBox::GetSelection() const int wxListBox::GetSelections( wxArrayInt& aSelections ) const { - wxCHECK_MSG( m_list != NULL, -1, "invalid listbox" ); + wxCHECK_MSG( m_list != NULL, -1, _T("invalid listbox") ); // get the number of selected items first GList *child = m_list->children; @@ -632,7 +632,7 @@ int wxListBox::GetSelections( wxArrayInt& aSelections ) const wxString wxListBox::GetString( int n ) const { - wxCHECK_MSG( m_list != NULL, "", "invalid listbox" ); + wxCHECK_MSG( m_list != NULL, _T(""), _T("invalid listbox") ); GList *child = g_list_nth( m_list->children, n ); if (child) @@ -645,14 +645,14 @@ wxString wxListBox::GetString( int n ) const return str; } - wxFAIL_MSG("wrong listbox index"); + wxFAIL_MSG(_T("wrong listbox index")); - return ""; + return _T(""); } wxString wxListBox::GetStringSelection() const { - wxCHECK_MSG( m_list != NULL, "", "invalid listbox" ); + wxCHECK_MSG( m_list != NULL, _T(""), _T("invalid listbox") ); GList *selection = m_list->selection; if (selection) @@ -665,13 +665,13 @@ wxString wxListBox::GetStringSelection() const return str; } - wxFAIL_MSG("no listbox selection available"); - return ""; + wxFAIL_MSG(_T("no listbox selection available")); + return _T(""); } int wxListBox::Number() { - wxCHECK_MSG( m_list != NULL, -1, "invalid listbox" ); + wxCHECK_MSG( m_list != NULL, -1, _T("invalid listbox") ); GList *child = m_list->children; int count = 0; @@ -681,7 +681,7 @@ int wxListBox::Number() bool wxListBox::Selected( int n ) { - wxCHECK_MSG( m_list != NULL, FALSE, "invalid listbox" ); + wxCHECK_MSG( m_list != NULL, FALSE, _T("invalid listbox") ); GList *target = g_list_nth( m_list->children, n ); if (target) @@ -693,28 +693,28 @@ bool wxListBox::Selected( int n ) child = child->next; } } - wxFAIL_MSG("wrong listbox index"); + wxFAIL_MSG(_T("wrong listbox index")); return FALSE; } void wxListBox::Set( int WXUNUSED(n), const wxString *WXUNUSED(choices) ) { - wxFAIL_MSG("wxListBox::Set not implemented"); + wxFAIL_MSG(_T("wxListBox::Set not implemented")); } void wxListBox::SetFirstItem( int WXUNUSED(n) ) { - wxFAIL_MSG("wxListBox::SetFirstItem not implemented"); + wxFAIL_MSG(_T("wxListBox::SetFirstItem not implemented")); } void wxListBox::SetFirstItem( const wxString &WXUNUSED(item) ) { - wxFAIL_MSG("wxListBox::SetFirstItem not implemented"); + wxFAIL_MSG(_T("wxListBox::SetFirstItem not implemented")); } void wxListBox::SetSelection( int n, bool select ) { - wxCHECK_RET( m_list != NULL, "invalid listbox" ); + wxCHECK_RET( m_list != NULL, _T("invalid listbox") ); if (select) gtk_list_select_item( m_list, n ); @@ -724,7 +724,7 @@ void wxListBox::SetSelection( int n, bool select ) void wxListBox::SetString( int n, const wxString &string ) { - wxCHECK_RET( m_list != NULL, "invalid listbox" ); + wxCHECK_RET( m_list != NULL, _T("invalid listbox") ); GList *child = g_list_nth( m_list->children, n ); if (child) @@ -737,17 +737,17 @@ void wxListBox::SetString( int n, const wxString &string ) str += CHECKBOX_STRING; str += string; - gtk_label_set( label, str ); + gtk_label_set( label, str.mbc_str() ); } else { - wxFAIL_MSG("wrong listbox index"); + wxFAIL_MSG(_T("wrong listbox index")); } } void wxListBox::SetStringSelection( const wxString &string, bool select ) { - wxCHECK_RET( m_list != NULL, "invalid listbox" ); + wxCHECK_RET( m_list != NULL, _T("invalid listbox") ); SetSelection( FindString(string), select ); } @@ -783,7 +783,7 @@ void wxListBox::ApplyToolTip( GtkTooltips *tips, const char *tip ) #if wxUSE_DRAG_AND_DROP void wxListBox::SetDropTarget( wxDropTarget *dropTarget ) { - wxCHECK_RET( m_list != NULL, "invalid listbox" ); + wxCHECK_RET( m_list != NULL, _T("invalid listbox") ); #ifndef NEW_GTK_DND_CODE if (m_dropTarget) @@ -857,4 +857,3 @@ void wxListBox::ApplyWidgetStyle() child = child->next; } } - diff --git a/src/gtk/mdi.cpp b/src/gtk/mdi.cpp index 3eb711da9d..85eb0270c7 100644 --- a/src/gtk/mdi.cpp +++ b/src/gtk/mdi.cpp @@ -335,7 +335,7 @@ static void wxInsertChildInMDI( wxMDIClientWindow* parent, wxMDIChildFrame* chil wxString s = child->m_title; if (s.IsNull()) s = _("MDI child"); - GtkWidget *label_widget = gtk_label_new( s ); + GtkWidget *label_widget = gtk_label_new( s.mbc_str() ); gtk_misc_set_alignment( GTK_MISC(label_widget), 0.0, 0.5 ); gtk_signal_connect( GTK_OBJECT(child->m_widget), "size_allocate", diff --git a/src/gtk1/dialog.cpp b/src/gtk1/dialog.cpp index 2bb5127425..deab62ab69 100644 --- a/src/gtk1/dialog.cpp +++ b/src/gtk1/dialog.cpp @@ -195,8 +195,8 @@ wxDialog::~wxDialog() void wxDialog::SetTitle( const wxString& title ) { m_title = title; - if (m_title.IsNull()) m_title = ""; - gtk_window_set_title( GTK_WINDOW(m_widget), m_title ); + if (m_title.IsNull()) m_title = _T(""); + gtk_window_set_title( GTK_WINDOW(m_widget), m_title.mbc_str() ); } wxString wxDialog::GetTitle() const @@ -281,7 +281,7 @@ bool wxDialog::Destroy() void wxDialog::OnSize( wxSizeEvent &WXUNUSED(event) ) { - wxASSERT_MSG( (m_widget != NULL), "invalid dialog" ); + wxASSERT_MSG( (m_widget != NULL), _T("invalid dialog") ); if (GetAutoLayout()) { @@ -314,8 +314,8 @@ void wxDialog::OnSize( wxSizeEvent &WXUNUSED(event) ) void wxDialog::DoSetSize( int x, int y, int width, int height, int sizeFlags ) { - wxASSERT_MSG( (m_widget != NULL), "invalid dialog" ); - wxASSERT_MSG( (m_wxwindow != NULL), "invalid dialog" ); + wxASSERT_MSG( (m_widget != NULL), _T("invalid dialog") ); + wxASSERT_MSG( (m_wxwindow != NULL), _T("invalid dialog") ); if (m_resizing) return; /* I don't like recursions */ m_resizing = TRUE; @@ -401,7 +401,7 @@ void wxDialog::GtkOnSize( int WXUNUSED(x), int WXUNUSED(y), int width, int heigh void wxDialog::Centre( int direction ) { - wxASSERT_MSG( (m_widget != NULL), "invalid dialog" ); + wxASSERT_MSG( (m_widget != NULL), _T("invalid dialog") ); int x = 0; int y = 0; @@ -455,14 +455,14 @@ void wxDialog::SetModal( bool WXUNUSED(flag) ) else if (m_windowStyle & wxDIALOG_MODAL) m_windowStyle -= wxDIALOG_MODAL; */ - wxFAIL_MSG( "wxDialog:SetModal obsolete now" ); + wxFAIL_MSG( _T("wxDialog:SetModal obsolete now") ); } int wxDialog::ShowModal() { if (IsModal()) { - wxFAIL_MSG( "wxDialog:ShowModal called twice" ); + wxFAIL_MSG( _T("wxDialog:ShowModal called twice") ); return GetReturnCode(); } @@ -483,7 +483,7 @@ void wxDialog::EndModal( int retCode ) if (!IsModal()) { - wxFAIL_MSG( "wxDialog:EndModal called twice" ); + wxFAIL_MSG( _T("wxDialog:EndModal called twice") ); return; } diff --git a/src/gtk1/filedlg.cpp b/src/gtk1/filedlg.cpp index b4d52f4db1..fa6d087c99 100644 --- a/src/gtk1/filedlg.cpp +++ b/src/gtk1/filedlg.cpp @@ -105,14 +105,14 @@ wxFileDialog::wxFileDialog( wxWindow *parent, const wxString& message, PreCreation( parent, -1, pos, wxDefaultSize, style | wxDIALOG_MODAL, "filedialog" ); m_message = message; - m_path = ""; + m_path = _T(""); m_fileName = defaultFileName; m_dir = defaultDir; m_wildCard = wildCard; m_dialogStyle = style; m_filterIndex = 1; - m_widget = gtk_file_selection_new( m_message ); + m_widget = gtk_file_selection_new( m_message.mbc_str() ); int x = (gdk_screen_width () - 400) / 2; int y = (gdk_screen_height () - 400) / 2; @@ -122,23 +122,23 @@ wxFileDialog::wxFileDialog( wxWindow *parent, const wxString& message, gtk_file_selection_hide_fileop_buttons( sel ); // they don't work anyway m_path.Append(m_dir); - if( ! m_path.IsEmpty() && m_path.Last()!='/' ) + if( ! m_path.IsEmpty() && m_path.Last()!=_T('/') ) m_path.Append('/'); m_path.Append(m_fileName); - if(m_path.Length()>1) gtk_file_selection_set_filename(sel,m_path); + if(m_path.Length()>1) gtk_file_selection_set_filename(sel,m_path.mbc_str()); gtk_signal_connect( GTK_OBJECT(sel->ok_button), "clicked", GTK_SIGNAL_FUNC(gtk_filedialog_ok_callback), (gpointer*)this ); // strange way to internationalize - gtk_label_set( GTK_LABEL( GTK_BUTTON(sel->ok_button)->child ), _("OK") ); + gtk_label_set( GTK_LABEL( GTK_BUTTON(sel->ok_button)->child ), wxConv_current->cWX2MB(_("OK")) ); gtk_signal_connect( GTK_OBJECT(sel->cancel_button), "clicked", GTK_SIGNAL_FUNC(gtk_filedialog_cancel_callback), (gpointer*)this ); // strange way to internationalize - gtk_label_set( GTK_LABEL( GTK_BUTTON(sel->cancel_button)->child ), _("Cancel") ); + gtk_label_set( GTK_LABEL( GTK_BUTTON(sel->cancel_button)->child ), wxConv_current->cWX2MB(_("Cancel")) ); gtk_signal_connect( GTK_OBJECT(m_widget), "delete_event", GTK_SIGNAL_FUNC(gtk_filedialog_delete_callback), (gpointer)this ); @@ -160,14 +160,14 @@ void wxFileDialog::SetPath(const wxString& path) // global functions // ---------------------------------------------------------------------------- -wxString wxFileSelector( const char *title, - const char *defaultDir, const char *defaultFileName, - const char *defaultExtension, const char *filter, int flags, +wxString wxFileSelector( const wxChar *title, + const wxChar *defaultDir, const wxChar *defaultFileName, + const wxChar *defaultExtension, const wxChar *filter, int flags, wxWindow *parent, int x, int y ) { wxString filter2; if ( defaultExtension && !filter ) - filter2 = wxString("*.") + wxString(defaultExtension) ; + filter2 = wxString(_T("*.")) + wxString(defaultExtension) ; else if ( filter ) filter2 = filter; @@ -191,34 +191,34 @@ wxString wxFileSelector( const char *title, } } -wxString wxLoadFileSelector( const char *what, const char *extension, const char *default_name, wxWindow *parent ) +wxString wxLoadFileSelector( const wxChar *what, const wxChar *extension, const wxChar *default_name, wxWindow *parent ) { - char *ext = (char *)extension; + wxChar *ext = (wxChar *)extension; - char prompt[50]; + wxChar prompt[50]; wxString str = _("Load %s file"); - sprintf(prompt, str, what); + wxSprintf(prompt, str, what); - if (*ext == '.') ext++; - char wild[60]; - sprintf(wild, "*.%s", ext); + if (*ext == _T('.')) ext++; + wxChar wild[60]; + wxSprintf(wild, _T("*.%s"), ext); - return wxFileSelector (prompt, (const char *) NULL, default_name, ext, wild, 0, parent); + return wxFileSelector (prompt, (const wxChar *) NULL, default_name, ext, wild, 0, parent); } -wxString wxSaveFileSelector(const char *what, const char *extension, const char *default_name, +wxString wxSaveFileSelector(const wxChar *what, const wxChar *extension, const wxChar *default_name, wxWindow *parent ) { - char *ext = (char *)extension; + wxChar *ext = (wxChar *)extension; - char prompt[50]; + wxChar prompt[50]; wxString str = _("Save %s file"); - sprintf(prompt, str, what); + wxSprintf(prompt, str, what); - if (*ext == '.') ext++; - char wild[60]; - sprintf(wild, "*.%s", ext); + if (*ext == _T('.')) ext++; + wxChar wild[60]; + wxSprintf(wild, _T("*.%s"), ext); - return wxFileSelector (prompt, (const char *) NULL, default_name, ext, wild, 0, parent); + return wxFileSelector (prompt, (const wxChar *) NULL, default_name, ext, wild, 0, parent); } diff --git a/src/gtk1/font.cpp b/src/gtk1/font.cpp index 59b5734012..c521e7b3b3 100644 --- a/src/gtk1/font.cpp +++ b/src/gtk1/font.cpp @@ -176,38 +176,38 @@ bool wxFont::Ok() const int wxFont::GetPointSize() const { - wxCHECK_MSG( Ok(), 0, "invalid font" ); + wxCHECK_MSG( Ok(), 0, _T("invalid font") ); return M_FONTDATA->m_pointSize; } wxString wxFont::GetFaceName() const { - wxCHECK_MSG( Ok(), "", "invalid font" ); + wxCHECK_MSG( Ok(), _T(""), _T("invalid font") ); return M_FONTDATA->m_faceName; } int wxFont::GetFamily() const { - wxCHECK_MSG( Ok(), 0, "invalid font" ); + wxCHECK_MSG( Ok(), 0, _T("invalid font") ); return M_FONTDATA->m_family; } wxString wxFont::GetFamilyString() const { - wxCHECK_MSG( Ok(), "wxDEFAULT", "invalid font" ); + wxCHECK_MSG( Ok(), _T("wxDEFAULT"), _T("invalid font") ); switch (M_FONTDATA->m_family) { - case wxDECORATIVE: return wxString("wxDECORATIVE"); - case wxROMAN: return wxString("wxROMAN"); - case wxSCRIPT: return wxString("wxSCRIPT"); - case wxSWISS: return wxString("wxSWISS"); - case wxMODERN: return wxString("wxMODERN"); - case wxTELETYPE: return wxString("wxTELETYPE"); - default: return "wxDEFAULT"; + case wxDECORATIVE: return wxString(_T("wxDECORATIVE")); + case wxROMAN: return wxString(_T("wxROMAN")); + case wxSCRIPT: return wxString(_T("wxSCRIPT")); + case wxSWISS: return wxString(_T("wxSWISS")); + case wxMODERN: return wxString(_T("wxMODERN")); + case wxTELETYPE: return wxString(_T("wxTELETYPE")); + default: return _T("wxDEFAULT"); } return "wxDEFAULT"; @@ -215,51 +215,51 @@ wxString wxFont::GetFamilyString() const int wxFont::GetStyle() const { - wxCHECK_MSG( Ok(), 0, "invalid font" ); + wxCHECK_MSG( Ok(), 0, _T("invalid font") ); return M_FONTDATA->m_style; } wxString wxFont::GetStyleString() const { - wxCHECK_MSG( Ok(), "wxDEFAULT", "invalid font" ); + wxCHECK_MSG( Ok(), _T("wxDEFAULT"), _T("invalid font") ); switch (M_FONTDATA->m_style) { - case wxNORMAL: return wxString("wxNORMAL"); - case wxSLANT: return wxString("wxSLANT"); - case wxITALIC: return wxString("wxITALIC"); - default: return wxString("wxDEFAULT"); + case wxNORMAL: return wxString(_T("wxNORMAL")); + case wxSLANT: return wxString(_T("wxSLANT")); + case wxITALIC: return wxString(_T("wxITALIC")); + default: return wxString(_T("wxDEFAULT")); } - return wxString("wxDEFAULT"); + return wxString(_T("wxDEFAULT")); } int wxFont::GetWeight() const { - wxCHECK_MSG( Ok(), 0, "invalid font" ); + wxCHECK_MSG( Ok(), 0, _T("invalid font") ); return M_FONTDATA->m_weight; } wxString wxFont::GetWeightString() const { - wxCHECK_MSG( Ok(), "wxDEFAULT", "invalid font" ); + wxCHECK_MSG( Ok(), _T("wxDEFAULT"), _T("invalid font") ); switch (M_FONTDATA->m_weight) { - case wxNORMAL: return wxString("wxNORMAL"); - case wxBOLD: return wxString("wxBOLD"); - case wxLIGHT: return wxString("wxLIGHT"); - default: return wxString("wxDEFAULT"); + case wxNORMAL: return wxString(_T("wxNORMAL")); + case wxBOLD: return wxString(_T("wxBOLD")); + case wxLIGHT: return wxString(_T("wxLIGHT")); + default: return wxString(_T("wxDEFAULT")); } - return wxString("wxDEFAULT"); + return wxString(_T("wxDEFAULT")); } bool wxFont::GetUnderlined() const { - wxCHECK_MSG( Ok(), FALSE, "invalid font" ); + wxCHECK_MSG( Ok(), FALSE, _T("invalid font") ); return M_FONTDATA->m_underlined; } @@ -331,7 +331,7 @@ GdkFont *wxFont::GetInternalFont( float scale ) const { if (!Ok()) { - wxFAIL_MSG( "invalid font" ); + wxFAIL_MSG( _T("invalid font") ); return (GdkFont*) NULL; } @@ -370,7 +370,7 @@ GdkFont *wxFont::GetInternalFont( float scale ) const if (!font) { - wxLogError("could not load any font"); + wxLogError(_T("could not load any font")); } return font; @@ -383,25 +383,25 @@ GdkFont *wxFont::GetInternalFont( float scale ) const static GdkFont*wxLoadQueryFont( int pointSize, int family, int style, int weight, bool underlined, const wxString &facename ) { - char *xfamily = (char*) NULL; - char *xstyle = (char*) NULL; - char *xweight = (char*) NULL; + wxChar *xfamily = (wxChar*) NULL; + wxChar *xstyle = (wxChar*) NULL; + wxChar *xweight = (wxChar*) NULL; switch (family) { - case wxDECORATIVE: xfamily = "lucida"; break; - case wxROMAN: xfamily = "times"; break; - case wxMODERN: xfamily = "courier"; break; - case wxSWISS: xfamily = "helvetica"; break; - case wxTELETYPE: xfamily = "lucidatypewriter"; break; - case wxSCRIPT: xfamily = "utopia"; break; - default: xfamily = "*"; + case wxDECORATIVE: xfamily = _T("lucida"); break; + case wxROMAN: xfamily = _T("times"); break; + case wxMODERN: xfamily = _T("courier"); break; + case wxSWISS: xfamily = _T("helvetica"); break; + case wxTELETYPE: xfamily = _T("lucidatypewriter"); break; + case wxSCRIPT: xfamily = _T("utopia"); break; + default: xfamily = _T("*"); } if (!facename.IsEmpty()) { - sprintf( wxBuffer, "-*-%s-*-*-normal-*-*-*-*-*-*-*-*-*", facename.c_str() ); - GdkFont *test = gdk_font_load( wxBuffer ); + wxSprintf( wxBuffer, _T("-*-%s-*-*-normal-*-*-*-*-*-*-*-*-*"), facename.c_str() ); + GdkFont *test = gdk_font_load( wxConv_libc.cWX2MB(wxBuffer) ); if (test) { gdk_font_unref( test ); @@ -411,23 +411,23 @@ static GdkFont*wxLoadQueryFont( int pointSize, int family, int style, int weight switch (style) { - case wxITALIC: xstyle = "i"; break; - case wxSLANT: xstyle = "o"; break; - case wxNORMAL: xstyle = "r"; break; - default: xstyle = "*"; break; + case wxITALIC: xstyle = _T("i"); break; + case wxSLANT: xstyle = _T("o"); break; + case wxNORMAL: xstyle = _T("r"); break; + default: xstyle = _T("*"); break; } switch (weight) { - case wxBOLD: xweight = "bold"; break; + case wxBOLD: xweight = _T("bold"); break; case wxLIGHT: - case wxNORMAL: xweight = "medium"; break; - default: xweight = "*"; break; + case wxNORMAL: xweight = _T("medium"); break; + default: xweight = _T("*"); break; } - sprintf( wxBuffer, "-*-%s-%s-%s-normal-*-*-%d-*-*-*-*-*-*", + wxSprintf( wxBuffer, _T("-*-%s-%s-%s-normal-*-*-%d-*-*-*-*-*-*"), xfamily, xweight, xstyle, pointSize); - return gdk_font_load( wxBuffer ); + return gdk_font_load( wxConv_libc.cWX2MB(wxBuffer) ); } static GdkFont *wxLoadQueryNearestFont( int point_size, int family, int style, int weight, diff --git a/src/gtk1/frame.cpp b/src/gtk1/frame.cpp index 48c3b8f132..dc12772f29 100644 --- a/src/gtk1/frame.cpp +++ b/src/gtk1/frame.cpp @@ -252,7 +252,7 @@ bool wxFrame::Create( wxWindow *parent, wxWindowID id, const wxString &title, m_widget = gtk_window_new( win_type ); - gtk_window_set_title( GTK_WINDOW(m_widget), title ); + gtk_window_set_title( GTK_WINDOW(m_widget), title.mbc_str() ); GTK_WIDGET_UNSET_FLAGS( m_widget, GTK_CAN_FOCUS ); /* needed ? */ @@ -336,7 +336,7 @@ wxFrame::~wxFrame() bool wxFrame::Show( bool show ) { - wxASSERT_MSG( (m_widget != NULL), "invalid frame" ); + wxASSERT_MSG( (m_widget != NULL), _T("invalid frame") ); if (show && !m_sizeSet) { @@ -353,7 +353,7 @@ bool wxFrame::Show( bool show ) bool wxFrame::Destroy() { - wxASSERT_MSG( (m_widget != NULL), "invalid frame" ); + wxASSERT_MSG( (m_widget != NULL), _T("invalid frame") ); if (!wxPendingDelete.Member(this)) wxPendingDelete.Append(this); @@ -362,10 +362,10 @@ bool wxFrame::Destroy() void wxFrame::DoSetSize( int x, int y, int width, int height, int sizeFlags ) { - wxASSERT_MSG( (m_widget != NULL), "invalid frame" ); + wxASSERT_MSG( (m_widget != NULL), _T("invalid frame") ); /* this shouldn't happen: wxFrame, wxMDIParentFrame and wxMDIChildFrame have m_wxwindow */ - wxASSERT_MSG( (m_wxwindow != NULL), "invalid frame" ); + wxASSERT_MSG( (m_wxwindow != NULL), _T("invalid frame") ); /* avoid recursions */ if (m_resizing) return; @@ -428,7 +428,7 @@ void wxFrame::DoSetSize( int x, int y, int width, int height, int sizeFlags ) void wxFrame::Centre( int direction ) { - wxASSERT_MSG( (m_widget != NULL), "invalid frame" ); + wxASSERT_MSG( (m_widget != NULL), _T("invalid frame") ); int x = 0; int y = 0; @@ -441,7 +441,7 @@ void wxFrame::Centre( int direction ) void wxFrame::GetClientSize( int *width, int *height ) const { - wxASSERT_MSG( (m_widget != NULL), "invalid frame" ); + wxASSERT_MSG( (m_widget != NULL), _T("invalid frame") ); wxWindow::GetClientSize( width, height ); if (height) @@ -464,7 +464,7 @@ void wxFrame::GetClientSize( int *width, int *height ) const void wxFrame::DoSetClientSize( int width, int height ) { - wxASSERT_MSG( (m_widget != NULL), "invalid frame" ); + wxASSERT_MSG( (m_widget != NULL), _T("invalid frame") ); int h = height; if (m_frameMenuBar && !m_menuBarDetached) h += wxMENU_HEIGHT; @@ -489,7 +489,7 @@ void wxFrame::GtkOnSize( int WXUNUSED(x), int WXUNUSED(y), int width, int height m_resizing = TRUE; /* this shouldn't happen: wxFrame, wxMDIParentFrame and wxMDIChildFrame have m_wxwindow */ - wxASSERT_MSG( (m_wxwindow != NULL), "invalid frame" ); + wxASSERT_MSG( (m_wxwindow != NULL), _T("invalid frame") ); m_width = width; m_height = height; @@ -621,7 +621,7 @@ void wxFrame::OnCloseWindow( wxCloseEvent& event ) void wxFrame::OnSize( wxSizeEvent &WXUNUSED(event) ) { - wxASSERT_MSG( (m_widget != NULL), "invalid frame" ); + wxASSERT_MSG( (m_widget != NULL), _T("invalid frame") ); if (GetAutoLayout()) { @@ -672,8 +672,8 @@ static void SetInvokingWindow( wxMenu *menu, wxWindow *win ) void wxFrame::SetMenuBar( wxMenuBar *menuBar ) { - wxASSERT_MSG( (m_widget != NULL), "invalid frame" ); - wxASSERT_MSG( (m_wxwindow != NULL), "invalid frame" ); + wxASSERT_MSG( (m_widget != NULL), _T("invalid frame") ); + wxASSERT_MSG( (m_wxwindow != NULL), _T("invalid frame") ); m_frameMenuBar = menuBar; @@ -735,9 +735,9 @@ void wxFrame::OnMenuHighlight(wxMenuEvent& event) wxToolBar* wxFrame::CreateToolBar(long style, wxWindowID id, const wxString& name) { - wxASSERT_MSG( (m_widget != NULL), "invalid frame" ); + wxASSERT_MSG( (m_widget != NULL), _T("invalid frame") ); - wxCHECK_MSG( m_frameToolBar == NULL, FALSE, "recreating toolbar in wxFrame" ); + wxCHECK_MSG( m_frameToolBar == NULL, FALSE, _T("recreating toolbar in wxFrame") ); m_frameToolBar = OnCreateToolBar( style, id, name ); @@ -760,9 +760,9 @@ wxToolBar *wxFrame::GetToolBar() const wxStatusBar* wxFrame::CreateStatusBar( int number, long style, wxWindowID id, const wxString& name ) { - wxASSERT_MSG( (m_widget != NULL), "invalid frame" ); + wxASSERT_MSG( (m_widget != NULL), _T("invalid frame") ); - wxCHECK_MSG( m_frameStatusBar == NULL, FALSE, "recreating status bar in wxFrame" ); + wxCHECK_MSG( m_frameStatusBar == NULL, FALSE, _T("recreating status bar in wxFrame") ); m_frameStatusBar = OnCreateStatusBar( number, style, id, name ); @@ -814,18 +814,18 @@ void wxFrame::Command( int id ) void wxFrame::SetStatusText(const wxString& text, int number) { - wxASSERT_MSG( (m_widget != NULL), "invalid frame" ); + wxASSERT_MSG( (m_widget != NULL), _T("invalid frame") ); - wxCHECK_RET( m_frameStatusBar != NULL, "no statusbar to set text for" ); + wxCHECK_RET( m_frameStatusBar != NULL, _T("no statusbar to set text for") ); m_frameStatusBar->SetStatusText(text, number); } void wxFrame::SetStatusWidths(int n, const int widths_field[] ) { - wxASSERT_MSG( (m_widget != NULL), "invalid frame" ); + wxASSERT_MSG( (m_widget != NULL), _T("invalid frame") ); - wxCHECK_RET( m_frameStatusBar != NULL, "no statusbar to set widths for" ); + wxCHECK_RET( m_frameStatusBar != NULL, _T("no statusbar to set widths for") ); m_frameStatusBar->SetStatusWidths(n, widths_field); } @@ -837,16 +837,16 @@ wxStatusBar *wxFrame::GetStatusBar() const void wxFrame::SetTitle( const wxString &title ) { - wxASSERT_MSG( (m_widget != NULL), "invalid frame" ); + wxASSERT_MSG( (m_widget != NULL), _T("invalid frame") ); m_title = title; - if (m_title.IsNull()) m_title = ""; - gtk_window_set_title( GTK_WINDOW(m_widget), title ); + if (m_title.IsNull()) m_title = _T(""); + gtk_window_set_title( GTK_WINDOW(m_widget), title.mbc_str() ); } void wxFrame::SetIcon( const wxIcon &icon ) { - wxASSERT_MSG( (m_widget != NULL), "invalid frame" ); + wxASSERT_MSG( (m_widget != NULL), _T("invalid frame") ); m_icon = icon; if (!icon.Ok()) return; diff --git a/src/gtk1/listbox.cpp b/src/gtk1/listbox.cpp index 8c24f8b811..34139b626c 100644 --- a/src/gtk1/listbox.cpp +++ b/src/gtk1/listbox.cpp @@ -239,7 +239,7 @@ bool wxListBox::Create( wxWindow *parent, wxWindowID id, str.Prepend(CHECKBOX_STRING); } - list_item = gtk_list_item_new_with_label( str ); + list_item = gtk_list_item_new_with_label( str.mbc_str() ); gtk_container_add( GTK_CONTAINER(m_list), list_item ); @@ -292,11 +292,11 @@ wxListBox::~wxListBox() void wxListBox::InsertItems(int nItems, const wxString items[], int pos) { - wxCHECK_RET( m_list != NULL, "invalid listbox" ); + wxCHECK_RET( m_list != NULL, _T("invalid listbox") ); GList *children = m_list->children; int length = g_list_length(children); - wxCHECK_RET( pos <= length, "invalid index in wxListBox::InsertItems" ); + wxCHECK_RET( pos <= length, _T("invalid index in wxListBox::InsertItems") ); // VZ: it seems that GTK 1.0.6 doesn't has a function to insert an item // into a listbox at the given position, this is why we first delete @@ -390,7 +390,7 @@ void wxListBox::InsertItems(int nItems, const wxString items[], int pos) void wxListBox::AppendCommon( const wxString &item ) { - wxCHECK_RET( m_list != NULL, "invalid listbox" ); + wxCHECK_RET( m_list != NULL, _T("invalid listbox") ); GtkWidget *list_item; @@ -400,7 +400,7 @@ void wxListBox::AppendCommon( const wxString &item ) label.Prepend(CHECKBOX_STRING); } - list_item = gtk_list_item_new_with_label( label ); + list_item = gtk_list_item_new_with_label( label.mbc_str() ); gtk_container_add( GTK_CONTAINER(m_list), list_item ); @@ -467,7 +467,7 @@ void wxListBox::Append( const wxString &item, wxClientData *clientData ) void wxListBox::SetClientData( int n, void* clientData ) { - wxCHECK_RET( m_widget != NULL, "invalid combobox" ); + wxCHECK_RET( m_widget != NULL, _T("invalid combobox") ); wxNode *node = m_clientDataList.Nth( n ); if (!node) return; @@ -477,7 +477,7 @@ void wxListBox::SetClientData( int n, void* clientData ) void* wxListBox::GetClientData( int n ) { - wxCHECK_MSG( m_widget != NULL, NULL, "invalid combobox" ); + wxCHECK_MSG( m_widget != NULL, NULL, _T("invalid combobox") ); wxNode *node = m_clientDataList.Nth( n ); if (!node) return NULL; @@ -487,7 +487,7 @@ void* wxListBox::GetClientData( int n ) void wxListBox::SetClientObject( int n, wxClientData* clientData ) { - wxCHECK_RET( m_widget != NULL, "invalid combobox" ); + wxCHECK_RET( m_widget != NULL, _T("invalid combobox") ); wxNode *node = m_clientObjectList.Nth( n ); if (!node) return; @@ -500,7 +500,7 @@ void wxListBox::SetClientObject( int n, wxClientData* clientData ) wxClientData* wxListBox::GetClientObject( int n ) { - wxCHECK_MSG( m_widget != NULL, (wxClientData*)NULL, "invalid combobox" ); + wxCHECK_MSG( m_widget != NULL, (wxClientData*)NULL, _T("invalid combobox") ); wxNode *node = m_clientObjectList.Nth( n ); if (!node) return (wxClientData*) NULL; @@ -510,7 +510,7 @@ wxClientData* wxListBox::GetClientObject( int n ) void wxListBox::Clear() { - wxCHECK_RET( m_list != NULL, "invalid listbox" ); + wxCHECK_RET( m_list != NULL, _T("invalid listbox") ); gtk_list_clear_items( m_list, 0, Number() ); @@ -528,11 +528,11 @@ void wxListBox::Clear() void wxListBox::Delete( int n ) { - wxCHECK_RET( m_list != NULL, "invalid listbox" ); + wxCHECK_RET( m_list != NULL, _T("invalid listbox") ); GList *child = g_list_nth( m_list->children, n ); - wxCHECK_RET( child, "wrong listbox index" ); + wxCHECK_RET( child, _T("wrong listbox index") ); GList *list = g_list_append( (GList*) NULL, child->data ); gtk_list_remove_items( m_list, list ); @@ -555,14 +555,14 @@ void wxListBox::Delete( int n ) void wxListBox::Deselect( int n ) { - wxCHECK_RET( m_list != NULL, "invalid listbox" ); + wxCHECK_RET( m_list != NULL, _T("invalid listbox") ); gtk_list_unselect_item( m_list, n ); } int wxListBox::FindString( const wxString &item ) const { - wxCHECK_MSG( m_list != NULL, -1, "invalid listbox" ); + wxCHECK_MSG( m_list != NULL, -1, _T("invalid listbox") ); GList *child = m_list->children; int count = 0; @@ -587,7 +587,7 @@ int wxListBox::FindString( const wxString &item ) const int wxListBox::GetSelection() const { - wxCHECK_MSG( m_list != NULL, -1, "invalid listbox" ); + wxCHECK_MSG( m_list != NULL, -1, _T("invalid listbox") ); GList *child = m_list->children; int count = 0; @@ -602,7 +602,7 @@ int wxListBox::GetSelection() const int wxListBox::GetSelections( wxArrayInt& aSelections ) const { - wxCHECK_MSG( m_list != NULL, -1, "invalid listbox" ); + wxCHECK_MSG( m_list != NULL, -1, _T("invalid listbox") ); // get the number of selected items first GList *child = m_list->children; @@ -632,7 +632,7 @@ int wxListBox::GetSelections( wxArrayInt& aSelections ) const wxString wxListBox::GetString( int n ) const { - wxCHECK_MSG( m_list != NULL, "", "invalid listbox" ); + wxCHECK_MSG( m_list != NULL, _T(""), _T("invalid listbox") ); GList *child = g_list_nth( m_list->children, n ); if (child) @@ -645,14 +645,14 @@ wxString wxListBox::GetString( int n ) const return str; } - wxFAIL_MSG("wrong listbox index"); + wxFAIL_MSG(_T("wrong listbox index")); - return ""; + return _T(""); } wxString wxListBox::GetStringSelection() const { - wxCHECK_MSG( m_list != NULL, "", "invalid listbox" ); + wxCHECK_MSG( m_list != NULL, _T(""), _T("invalid listbox") ); GList *selection = m_list->selection; if (selection) @@ -665,13 +665,13 @@ wxString wxListBox::GetStringSelection() const return str; } - wxFAIL_MSG("no listbox selection available"); - return ""; + wxFAIL_MSG(_T("no listbox selection available")); + return _T(""); } int wxListBox::Number() { - wxCHECK_MSG( m_list != NULL, -1, "invalid listbox" ); + wxCHECK_MSG( m_list != NULL, -1, _T("invalid listbox") ); GList *child = m_list->children; int count = 0; @@ -681,7 +681,7 @@ int wxListBox::Number() bool wxListBox::Selected( int n ) { - wxCHECK_MSG( m_list != NULL, FALSE, "invalid listbox" ); + wxCHECK_MSG( m_list != NULL, FALSE, _T("invalid listbox") ); GList *target = g_list_nth( m_list->children, n ); if (target) @@ -693,28 +693,28 @@ bool wxListBox::Selected( int n ) child = child->next; } } - wxFAIL_MSG("wrong listbox index"); + wxFAIL_MSG(_T("wrong listbox index")); return FALSE; } void wxListBox::Set( int WXUNUSED(n), const wxString *WXUNUSED(choices) ) { - wxFAIL_MSG("wxListBox::Set not implemented"); + wxFAIL_MSG(_T("wxListBox::Set not implemented")); } void wxListBox::SetFirstItem( int WXUNUSED(n) ) { - wxFAIL_MSG("wxListBox::SetFirstItem not implemented"); + wxFAIL_MSG(_T("wxListBox::SetFirstItem not implemented")); } void wxListBox::SetFirstItem( const wxString &WXUNUSED(item) ) { - wxFAIL_MSG("wxListBox::SetFirstItem not implemented"); + wxFAIL_MSG(_T("wxListBox::SetFirstItem not implemented")); } void wxListBox::SetSelection( int n, bool select ) { - wxCHECK_RET( m_list != NULL, "invalid listbox" ); + wxCHECK_RET( m_list != NULL, _T("invalid listbox") ); if (select) gtk_list_select_item( m_list, n ); @@ -724,7 +724,7 @@ void wxListBox::SetSelection( int n, bool select ) void wxListBox::SetString( int n, const wxString &string ) { - wxCHECK_RET( m_list != NULL, "invalid listbox" ); + wxCHECK_RET( m_list != NULL, _T("invalid listbox") ); GList *child = g_list_nth( m_list->children, n ); if (child) @@ -737,17 +737,17 @@ void wxListBox::SetString( int n, const wxString &string ) str += CHECKBOX_STRING; str += string; - gtk_label_set( label, str ); + gtk_label_set( label, str.mbc_str() ); } else { - wxFAIL_MSG("wrong listbox index"); + wxFAIL_MSG(_T("wrong listbox index")); } } void wxListBox::SetStringSelection( const wxString &string, bool select ) { - wxCHECK_RET( m_list != NULL, "invalid listbox" ); + wxCHECK_RET( m_list != NULL, _T("invalid listbox") ); SetSelection( FindString(string), select ); } @@ -783,7 +783,7 @@ void wxListBox::ApplyToolTip( GtkTooltips *tips, const char *tip ) #if wxUSE_DRAG_AND_DROP void wxListBox::SetDropTarget( wxDropTarget *dropTarget ) { - wxCHECK_RET( m_list != NULL, "invalid listbox" ); + wxCHECK_RET( m_list != NULL, _T("invalid listbox") ); #ifndef NEW_GTK_DND_CODE if (m_dropTarget) @@ -857,4 +857,3 @@ void wxListBox::ApplyWidgetStyle() child = child->next; } } - diff --git a/src/gtk1/mdi.cpp b/src/gtk1/mdi.cpp index 3eb711da9d..85eb0270c7 100644 --- a/src/gtk1/mdi.cpp +++ b/src/gtk1/mdi.cpp @@ -335,7 +335,7 @@ static void wxInsertChildInMDI( wxMDIClientWindow* parent, wxMDIChildFrame* chil wxString s = child->m_title; if (s.IsNull()) s = _("MDI child"); - GtkWidget *label_widget = gtk_label_new( s ); + GtkWidget *label_widget = gtk_label_new( s.mbc_str() ); gtk_misc_set_alignment( GTK_MISC(label_widget), 0.0, 0.5 ); gtk_signal_connect( GTK_OBJECT(child->m_widget), "size_allocate",