OK, while I wait for the non-Unicode build to compile, I can report

that now all files in gtk/ compiles in Unicode mode. unix/ is still
missing, but that probably wouldn't take too long.


git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@2178 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Ove Kaaven
1999-04-15 14:36:04 +00:00
parent 95dee6514a
commit 05939a8140
10 changed files with 446 additions and 358 deletions

View File

@@ -204,13 +204,13 @@ wxToolBarTool *wxToolBar::AddTool( int toolIndex, const wxBitmap& bitmap,
m_hasToolAlready = TRUE; m_hasToolAlready = TRUE;
wxCHECK_MSG( bitmap.Ok(), (wxToolBarTool *)NULL, wxCHECK_MSG( bitmap.Ok(), (wxToolBarTool *)NULL,
"invalid bitmap for wxToolBar icon" ); _T("invalid bitmap for wxToolBar icon") );
wxCHECK_MSG( bitmap.GetBitmap() == NULL, (wxToolBarTool *)NULL, wxCHECK_MSG( bitmap.GetBitmap() == NULL, (wxToolBarTool *)NULL,
"wxToolBar doesn't support GdkBitmap" ); _T("wxToolBar doesn't support GdkBitmap") );
wxCHECK_MSG( bitmap.GetPixmap() != NULL, (wxToolBarTool *)NULL, wxCHECK_MSG( bitmap.GetPixmap() != NULL, (wxToolBarTool *)NULL,
"wxToolBar::Add needs a wxBitmap" ); _T("wxToolBar::Add needs a wxBitmap") );
GtkWidget *tool_pixmap = (GtkWidget *)NULL; GtkWidget *tool_pixmap = (GtkWidget *)NULL;
@@ -238,7 +238,7 @@ wxToolBarTool *wxToolBar::AddTool( int toolIndex, const wxBitmap& bitmap,
ctype, ctype,
(GtkWidget *)NULL, (GtkWidget *)NULL,
(const char *)NULL, (const char *)NULL,
helpString1, helpString1.mbc_str(),
"", "",
tool_pixmap, tool_pixmap,
(GtkSignalFunc)gtk_toolbar_callback, (GtkSignalFunc)gtk_toolbar_callback,
@@ -264,7 +264,7 @@ void wxToolBar::AddSeparator()
void wxToolBar::ClearTools() void wxToolBar::ClearTools()
{ {
wxFAIL_MSG( "wxToolBar::ClearTools not implemented" ); wxFAIL_MSG( _T("wxToolBar::ClearTools not implemented") );
} }
bool wxToolBar::Realize() bool wxToolBar::Realize()
@@ -314,7 +314,7 @@ void wxToolBar::EnableTool(int toolIndex, bool enable)
node = node->Next(); node = node->Next();
} }
wxFAIL_MSG( "wrong toolbar index" ); wxFAIL_MSG( _T("wrong toolbar index") );
} }
void wxToolBar::ToggleTool( int toolIndex, bool toggle ) void wxToolBar::ToggleTool( int toolIndex, bool toggle )
@@ -333,7 +333,7 @@ void wxToolBar::ToggleTool( int toolIndex, bool toggle )
node = node->Next(); node = node->Next();
} }
wxFAIL_MSG( "wrong toolbar index" ); wxFAIL_MSG( _T("wrong toolbar index") );
} }
wxObject *wxToolBar::GetToolClientData( int index ) const wxObject *wxToolBar::GetToolClientData( int index ) const
@@ -346,7 +346,7 @@ wxObject *wxToolBar::GetToolClientData( int index ) const
node = node->Next(); node = node->Next();
} }
wxFAIL_MSG( "wrong toolbar index" ); wxFAIL_MSG( _T("wrong toolbar index") );
return (wxObject*)NULL; return (wxObject*)NULL;
} }
@@ -361,7 +361,7 @@ bool wxToolBar::GetToolState(int toolIndex) const
node = node->Next(); node = node->Next();
} }
wxFAIL_MSG( "wrong toolbar index" ); wxFAIL_MSG( _T("wrong toolbar index") );
return FALSE; return FALSE;
} }
@@ -376,14 +376,14 @@ bool wxToolBar::GetToolEnabled(int toolIndex) const
node = node->Next(); node = node->Next();
} }
wxFAIL_MSG( "wrong toolbar index" ); wxFAIL_MSG( _T("wrong toolbar index") );
return FALSE; return FALSE;
} }
void wxToolBar::SetMargins( int x, int y ) void wxToolBar::SetMargins( int x, int y )
{ {
wxCHECK_RET( !m_hasToolAlready, "wxToolBar::SetMargins must be called before adding tool." ); wxCHECK_RET( !m_hasToolAlready, _T("wxToolBar::SetMargins must be called before adding tool.") );
if (x > 2) gtk_toolbar_append_space( m_toolbar ); // oh well if (x > 2) gtk_toolbar_append_space( m_toolbar ); // oh well
@@ -393,7 +393,7 @@ void wxToolBar::SetMargins( int x, int y )
void wxToolBar::SetToolPacking( int WXUNUSED(packing) ) void wxToolBar::SetToolPacking( int WXUNUSED(packing) )
{ {
wxFAIL_MSG( "wxToolBar::SetToolPacking not implemented" ); wxFAIL_MSG( _T("wxToolBar::SetToolPacking not implemented") );
} }
void wxToolBar::SetToolSeparation( int separation ) void wxToolBar::SetToolSeparation( int separation )
@@ -425,9 +425,9 @@ wxString wxToolBar::GetToolLongHelp(int toolIndex)
node = node->Next(); node = node->Next();
} }
wxFAIL_MSG( "wrong toolbar index" ); wxFAIL_MSG( _T("wrong toolbar index") );
return ""; return _T("");
} }
wxString wxToolBar::GetToolShortHelp(int toolIndex) wxString wxToolBar::GetToolShortHelp(int toolIndex)
@@ -443,9 +443,9 @@ wxString wxToolBar::GetToolShortHelp(int toolIndex)
node = node->Next(); node = node->Next();
} }
wxFAIL_MSG( "wrong toolbar index" ); wxFAIL_MSG( _T("wrong toolbar index") );
return ""; return _T("");
} }
void wxToolBar::SetToolLongHelp(int toolIndex, const wxString& helpString) void wxToolBar::SetToolLongHelp(int toolIndex, const wxString& helpString)
@@ -462,7 +462,7 @@ void wxToolBar::SetToolLongHelp(int toolIndex, const wxString& helpString)
node = node->Next(); node = node->Next();
} }
wxFAIL_MSG( "wrong toolbar index" ); wxFAIL_MSG( _T("wrong toolbar index") );
return; return;
} }
@@ -481,7 +481,7 @@ void wxToolBar::SetToolShortHelp(int toolIndex, const wxString& helpString)
node = node->Next(); node = node->Next();
} }
wxFAIL_MSG( "wrong toolbar index" ); wxFAIL_MSG( _T("wrong toolbar index") );
return; return;
} }

View File

@@ -195,7 +195,12 @@ bool wxTextCtrl::Create( wxWindow *parent, wxWindowID id, const wxString &value,
if (!value.IsEmpty()) if (!value.IsEmpty())
{ {
gint tmp = 0; gint tmp = 0;
#if wxUSE_UNICODE
wxWX2MBbuf val = value.mbc_str();
gtk_editable_insert_text( GTK_EDITABLE(m_text), val, strlen(val), &tmp );
#else
gtk_editable_insert_text( GTK_EDITABLE(m_text), value, value.Length(), &tmp ); gtk_editable_insert_text( GTK_EDITABLE(m_text), value, value.Length(), &tmp );
#endif
if (multi_line) if (multi_line)
{ {
@@ -276,14 +281,14 @@ void wxTextCtrl::CalculateScrollbar()
wxString wxTextCtrl::GetValue() const wxString wxTextCtrl::GetValue() const
{ {
wxCHECK_MSG( m_text != NULL, "", "invalid text ctrl" ); wxCHECK_MSG( m_text != NULL, _T(""), _T("invalid text ctrl") );
wxString tmp; wxString tmp;
if (m_windowStyle & wxTE_MULTILINE) if (m_windowStyle & wxTE_MULTILINE)
{ {
gint len = gtk_text_get_length( GTK_TEXT(m_text) ); gint len = gtk_text_get_length( GTK_TEXT(m_text) );
char *text = gtk_editable_get_chars( GTK_EDITABLE(m_text), 0, len ); char *text = gtk_editable_get_chars( GTK_EDITABLE(m_text), 0, len );
tmp = text; tmp = wxString(text,*wxConv_current);
g_free( text ); g_free( text );
} }
else else
@@ -295,26 +300,31 @@ wxString wxTextCtrl::GetValue() const
void wxTextCtrl::SetValue( const wxString &value ) void wxTextCtrl::SetValue( const wxString &value )
{ {
wxCHECK_RET( m_text != NULL, "invalid text ctrl" ); wxCHECK_RET( m_text != NULL, _T("invalid text ctrl") );
wxString tmp = ""; wxString tmp = _T("");
if (!value.IsNull()) tmp = value; if (!value.IsNull()) tmp = value;
if (m_windowStyle & wxTE_MULTILINE) if (m_windowStyle & wxTE_MULTILINE)
{ {
gint len = gtk_text_get_length( GTK_TEXT(m_text) ); gint len = gtk_text_get_length( GTK_TEXT(m_text) );
gtk_editable_delete_text( GTK_EDITABLE(m_text), 0, len ); gtk_editable_delete_text( GTK_EDITABLE(m_text), 0, len );
len = 0; len = 0;
gtk_editable_insert_text( GTK_EDITABLE(m_text), tmp, tmp.Length(), &len ); #if wxUSE_UNICODE
wxWX2MBbuf tmpbuf = tmp.mbc_str();
gtk_editable_insert_text( GTK_EDITABLE(m_text), tmpbuf, strlen(tmpbuf), &len );
#else
gtk_editable_insert_text( GTK_EDITABLE(m_text), tmp.mbc_str(), tmp.Length(), &len );
#endif
} }
else else
{ {
gtk_entry_set_text( GTK_ENTRY(m_text), tmp ); gtk_entry_set_text( GTK_ENTRY(m_text), tmp.mbc_str() );
} }
} }
void wxTextCtrl::WriteText( const wxString &text ) void wxTextCtrl::WriteText( const wxString &text )
{ {
wxCHECK_RET( m_text != NULL, "invalid text ctrl" ); wxCHECK_RET( m_text != NULL, _T("invalid text ctrl") );
if (text.IsNull()) return; if (text.IsNull()) return;
@@ -323,7 +333,12 @@ void wxTextCtrl::WriteText( const wxString &text )
/* this moves the cursor pos to behind the inserted text */ /* this moves the cursor pos to behind the inserted text */
gint len = GTK_EDITABLE(m_text)->current_pos; gint len = GTK_EDITABLE(m_text)->current_pos;
#if wxUSE_UNICODE
wxWX2MBbuf buf = text.mbc_str();
gtk_editable_insert_text( GTK_EDITABLE(m_text), buf, strlen(buf), &len );
#else
gtk_editable_insert_text( GTK_EDITABLE(m_text), text, text.Length(), &len ); gtk_editable_insert_text( GTK_EDITABLE(m_text), text, text.Length(), &len );
#endif
/* bring editable's cursor uptodate. bug in GTK. */ /* bring editable's cursor uptodate. bug in GTK. */
GTK_EDITABLE(m_text)->current_pos = gtk_text_get_point( GTK_TEXT(m_text) ); GTK_EDITABLE(m_text)->current_pos = gtk_text_get_point( GTK_TEXT(m_text) );
@@ -332,7 +347,12 @@ void wxTextCtrl::WriteText( const wxString &text )
{ {
/* this moves the cursor pos to behind the inserted text */ /* this moves the cursor pos to behind the inserted text */
gint len = GTK_EDITABLE(m_text)->current_pos; gint len = GTK_EDITABLE(m_text)->current_pos;
#if wxUSE_UNICODE
wxWX2MBbuf buf = text.mbc_str();
gtk_editable_insert_text( GTK_EDITABLE(m_text), buf, strlen(buf), &len );
#else
gtk_editable_insert_text( GTK_EDITABLE(m_text), text, text.Length(), &len ); gtk_editable_insert_text( GTK_EDITABLE(m_text), text, text.Length(), &len );
#endif
/* bring editable's cursor uptodate. bug in GTK. */ /* bring editable's cursor uptodate. bug in GTK. */
GTK_EDITABLE(m_text)->current_pos += text.Len(); GTK_EDITABLE(m_text)->current_pos += text.Len();
@@ -344,26 +364,31 @@ void wxTextCtrl::WriteText( const wxString &text )
void wxTextCtrl::AppendText( const wxString &text ) void wxTextCtrl::AppendText( const wxString &text )
{ {
wxCHECK_RET( m_text != NULL, "invalid text ctrl" ); wxCHECK_RET( m_text != NULL, _T("invalid text ctrl") );
if (m_windowStyle & wxTE_MULTILINE) if (m_windowStyle & wxTE_MULTILINE)
{ {
/* we'll insert at the last position */ /* we'll insert at the last position */
gint len = gtk_text_get_length( GTK_TEXT(m_text) ); gint len = gtk_text_get_length( GTK_TEXT(m_text) );
#if wxUSE_UNICODE
wxWX2MBbuf buf = text.mbc_str();
gtk_editable_insert_text( GTK_EDITABLE(m_text), buf, strlen(buf), &len );
#else
gtk_editable_insert_text( GTK_EDITABLE(m_text), text, text.Length(), &len ); gtk_editable_insert_text( GTK_EDITABLE(m_text), text, text.Length(), &len );
#endif
/* bring editable's cursor uptodate. bug in GTK. */ /* bring editable's cursor uptodate. bug in GTK. */
GTK_EDITABLE(m_text)->current_pos = gtk_text_get_point( GTK_TEXT(m_text) ); GTK_EDITABLE(m_text)->current_pos = gtk_text_get_point( GTK_TEXT(m_text) );
} }
else else
{ {
gtk_entry_append_text( GTK_ENTRY(m_text), text ); gtk_entry_append_text( GTK_ENTRY(m_text), text.mbc_str() );
} }
} }
bool wxTextCtrl::LoadFile( const wxString &file ) bool wxTextCtrl::LoadFile( const wxString &file )
{ {
wxCHECK_MSG( m_text != NULL, FALSE, "invalid text ctrl" ); wxCHECK_MSG( m_text != NULL, FALSE, _T("invalid text ctrl") );
if (!wxFileExists(file)) return FALSE; if (!wxFileExists(file)) return FALSE;
@@ -372,8 +397,8 @@ bool wxTextCtrl::LoadFile( const wxString &file )
FILE *fp = (FILE*) NULL; FILE *fp = (FILE*) NULL;
struct stat statb; struct stat statb;
if ((stat ((char*) (const char*) file, &statb) == -1) || (statb.st_mode & S_IFMT) != S_IFREG || if ((stat (FNSTRINGCAST file.fn_str(), &statb) == -1) || (statb.st_mode & S_IFMT) != S_IFREG ||
!(fp = fopen ((char*) (const char*) file, "r"))) !(fp = fopen (FNSTRINGCAST file.fn_str(), "r")))
{ {
return FALSE; return FALSE;
} }
@@ -412,13 +437,13 @@ bool wxTextCtrl::LoadFile( const wxString &file )
bool wxTextCtrl::SaveFile( const wxString &file ) bool wxTextCtrl::SaveFile( const wxString &file )
{ {
wxCHECK_MSG( m_text != NULL, FALSE, "invalid text ctrl" ); wxCHECK_MSG( m_text != NULL, FALSE, _T("invalid text ctrl") );
if (file == "") return FALSE; if (file == _T("")) return FALSE;
FILE *fp; FILE *fp;
if (!(fp = fopen ((char*) (const char*) file, "w"))) if (!(fp = fopen (FNSTRINGCAST file.fn_str(), "w")))
{ {
return FALSE; return FALSE;
} }
@@ -466,7 +491,7 @@ wxString wxTextCtrl::GetLineText( long lineNo ) const
if (text) if (text)
{ {
wxString buf(""); wxString buf(_T(""));
long i; long i;
int currentLine = 0; int currentLine = 0;
for (i = 0; currentLine != lineNo && text[i]; i++ ) for (i = 0; currentLine != lineNo && text[i]; i++ )
@@ -494,7 +519,7 @@ void wxTextCtrl::OnDropFiles( wxDropFilesEvent &WXUNUSED(event) )
{ {
/* If you implement this, don't forget to update the documentation! /* If you implement this, don't forget to update the documentation!
* (file docs/latex/wx/text.tex) */ * (file docs/latex/wx/text.tex) */
wxFAIL_MSG( "wxTextCtrl::OnDropFiles not implemented" ); wxFAIL_MSG( _T("wxTextCtrl::OnDropFiles not implemented") );
} }
long wxTextCtrl::PositionToXY(long pos, long *x, long *y ) const long wxTextCtrl::PositionToXY(long pos, long *x, long *y ) const
@@ -510,10 +535,10 @@ long wxTextCtrl::PositionToXY(long pos, long *x, long *y ) const
*x=0; // First Col *x=0; // First Col
*y=0; // First Line *y=0; // First Line
const char* stop = text.c_str() + pos; const wxChar* stop = text.c_str() + pos;
for ( const char *p = text.c_str(); p < stop; p++ ) for ( const wxChar *p = text.c_str(); p < stop; p++ )
{ {
if (*p == '\n') if (*p == _T('\n'))
{ {
(*y)++; (*y)++;
*x=0; *x=0;
@@ -589,7 +614,7 @@ int wxTextCtrl::GetNumberOfLines() const
void wxTextCtrl::SetInsertionPoint( long pos ) void wxTextCtrl::SetInsertionPoint( long pos )
{ {
wxCHECK_RET( m_text != NULL, "invalid text ctrl" ); wxCHECK_RET( m_text != NULL, _T("invalid text ctrl") );
if (m_windowStyle & wxTE_MULTILINE) if (m_windowStyle & wxTE_MULTILINE)
{ {
@@ -626,7 +651,7 @@ void wxTextCtrl::SetInsertionPoint( long pos )
void wxTextCtrl::SetInsertionPointEnd() void wxTextCtrl::SetInsertionPointEnd()
{ {
wxCHECK_RET( m_text != NULL, "invalid text ctrl" ); wxCHECK_RET( m_text != NULL, _T("invalid text ctrl") );
if (m_windowStyle & wxTE_MULTILINE) if (m_windowStyle & wxTE_MULTILINE)
SetInsertionPoint(gtk_text_get_length(GTK_TEXT(m_text))); SetInsertionPoint(gtk_text_get_length(GTK_TEXT(m_text)));
@@ -636,7 +661,7 @@ void wxTextCtrl::SetInsertionPointEnd()
void wxTextCtrl::SetEditable( bool editable ) void wxTextCtrl::SetEditable( bool editable )
{ {
wxCHECK_RET( m_text != NULL, "invalid text ctrl" ); wxCHECK_RET( m_text != NULL, _T("invalid text ctrl") );
if (m_windowStyle & wxTE_MULTILINE) if (m_windowStyle & wxTE_MULTILINE)
gtk_text_set_editable( GTK_TEXT(m_text), editable ); gtk_text_set_editable( GTK_TEXT(m_text), editable );
@@ -646,26 +671,26 @@ void wxTextCtrl::SetEditable( bool editable )
void wxTextCtrl::SetSelection( long from, long to ) void wxTextCtrl::SetSelection( long from, long to )
{ {
wxCHECK_RET( m_text != NULL, "invalid text ctrl" ); wxCHECK_RET( m_text != NULL, _T("invalid text ctrl") );
gtk_editable_select_region( GTK_EDITABLE(m_text), (gint)from, (gint)to ); gtk_editable_select_region( GTK_EDITABLE(m_text), (gint)from, (gint)to );
} }
void wxTextCtrl::ShowPosition( long WXUNUSED(pos) ) void wxTextCtrl::ShowPosition( long WXUNUSED(pos) )
{ {
wxFAIL_MSG( "wxTextCtrl::ShowPosition not implemented" ); wxFAIL_MSG( _T("wxTextCtrl::ShowPosition not implemented") );
} }
long wxTextCtrl::GetInsertionPoint() const long wxTextCtrl::GetInsertionPoint() const
{ {
wxCHECK_MSG( m_text != NULL, 0, "invalid text ctrl" ); wxCHECK_MSG( m_text != NULL, 0, _T("invalid text ctrl") );
return (long) GTK_EDITABLE(m_text)->current_pos; return (long) GTK_EDITABLE(m_text)->current_pos;
} }
long wxTextCtrl::GetLastPosition() const long wxTextCtrl::GetLastPosition() const
{ {
wxCHECK_MSG( m_text != NULL, 0, "invalid text ctrl" ); wxCHECK_MSG( m_text != NULL, 0, _T("invalid text ctrl") );
int pos = 0; int pos = 0;
if (m_windowStyle & wxTE_MULTILINE) if (m_windowStyle & wxTE_MULTILINE)
@@ -678,24 +703,29 @@ long wxTextCtrl::GetLastPosition() const
void wxTextCtrl::Remove( long from, long to ) void wxTextCtrl::Remove( long from, long to )
{ {
wxCHECK_RET( m_text != NULL, "invalid text ctrl" ); wxCHECK_RET( m_text != NULL, _T("invalid text ctrl") );
gtk_editable_delete_text( GTK_EDITABLE(m_text), (gint)from, (gint)to ); gtk_editable_delete_text( GTK_EDITABLE(m_text), (gint)from, (gint)to );
} }
void wxTextCtrl::Replace( long from, long to, const wxString &value ) void wxTextCtrl::Replace( long from, long to, const wxString &value )
{ {
wxCHECK_RET( m_text != NULL, "invalid text ctrl" ); wxCHECK_RET( m_text != NULL, _T("invalid text ctrl") );
gtk_editable_delete_text( GTK_EDITABLE(m_text), (gint)from, (gint)to ); gtk_editable_delete_text( GTK_EDITABLE(m_text), (gint)from, (gint)to );
if (value.IsNull()) return; if (value.IsNull()) return;
gint pos = (gint)from; gint pos = (gint)from;
#if wxUSE_UNICODE
wxWX2MBbuf buf = value.mbc_str();
gtk_editable_insert_text( GTK_EDITABLE(m_text), buf, strlen(buf), &pos );
#else
gtk_editable_insert_text( GTK_EDITABLE(m_text), value, value.Length(), &pos ); gtk_editable_insert_text( GTK_EDITABLE(m_text), value, value.Length(), &pos );
#endif
} }
void wxTextCtrl::Cut() void wxTextCtrl::Cut()
{ {
wxCHECK_RET( m_text != NULL, "invalid text ctrl" ); wxCHECK_RET( m_text != NULL, _T("invalid text ctrl") );
#if (GTK_MINOR_VERSION > 0) #if (GTK_MINOR_VERSION > 0)
gtk_editable_cut_clipboard( GTK_EDITABLE(m_text) ); gtk_editable_cut_clipboard( GTK_EDITABLE(m_text) );
@@ -706,7 +736,7 @@ void wxTextCtrl::Cut()
void wxTextCtrl::Copy() void wxTextCtrl::Copy()
{ {
wxCHECK_RET( m_text != NULL, "invalid text ctrl" ); wxCHECK_RET( m_text != NULL, _T("invalid text ctrl") );
#if (GTK_MINOR_VERSION > 0) #if (GTK_MINOR_VERSION > 0)
gtk_editable_copy_clipboard( GTK_EDITABLE(m_text) ); gtk_editable_copy_clipboard( GTK_EDITABLE(m_text) );
@@ -717,7 +747,7 @@ void wxTextCtrl::Copy()
void wxTextCtrl::Paste() void wxTextCtrl::Paste()
{ {
wxCHECK_RET( m_text != NULL, "invalid text ctrl" ); wxCHECK_RET( m_text != NULL, _T("invalid text ctrl") );
#if (GTK_MINOR_VERSION > 0) #if (GTK_MINOR_VERSION > 0)
gtk_editable_paste_clipboard( GTK_EDITABLE(m_text) ); gtk_editable_paste_clipboard( GTK_EDITABLE(m_text) );
@@ -751,26 +781,26 @@ bool wxTextCtrl::CanPaste() const
void wxTextCtrl::Undo() void wxTextCtrl::Undo()
{ {
// TODO // TODO
wxFAIL_MSG( "wxTextCtrl::Undo not implemented" ); wxFAIL_MSG( _T("wxTextCtrl::Undo not implemented") );
} }
void wxTextCtrl::Redo() void wxTextCtrl::Redo()
{ {
// TODO // TODO
wxFAIL_MSG( "wxTextCtrl::Redo not implemented" ); wxFAIL_MSG( _T("wxTextCtrl::Redo not implemented") );
} }
bool wxTextCtrl::CanUndo() const bool wxTextCtrl::CanUndo() const
{ {
// TODO // TODO
wxFAIL_MSG( "wxTextCtrl::CanUndo not implemented" ); wxFAIL_MSG( _T("wxTextCtrl::CanUndo not implemented") );
return FALSE; return FALSE;
} }
bool wxTextCtrl::CanRedo() const bool wxTextCtrl::CanRedo() const
{ {
// TODO // TODO
wxFAIL_MSG( "wxTextCtrl::CanRedo not implemented" ); wxFAIL_MSG( _T("wxTextCtrl::CanRedo not implemented") );
return FALSE; return FALSE;
} }
@@ -781,24 +811,24 @@ void wxTextCtrl::GetSelection(long* from, long* to) const
// TODO // TODO
*from = 0; *from = 0;
*to = 0; *to = 0;
wxFAIL_MSG( "wxTextCtrl::GetSelection not implemented" ); wxFAIL_MSG( _T("wxTextCtrl::GetSelection not implemented") );
} }
bool wxTextCtrl::IsEditable() const bool wxTextCtrl::IsEditable() const
{ {
// TODO // TODO
wxFAIL_MSG( "wxTextCtrl::IsEditable not implemented" ); wxFAIL_MSG( _T("wxTextCtrl::IsEditable not implemented") );
return FALSE; return FALSE;
} }
void wxTextCtrl::Clear() void wxTextCtrl::Clear()
{ {
SetValue( "" ); SetValue( _T("") );
} }
void wxTextCtrl::OnChar( wxKeyEvent &key_event ) void wxTextCtrl::OnChar( wxKeyEvent &key_event )
{ {
wxCHECK_RET( m_text != NULL, "invalid text ctrl" ); wxCHECK_RET( m_text != NULL, _T("invalid text ctrl") );
if ((key_event.KeyCode() == WXK_RETURN) && (m_windowStyle & wxPROCESS_ENTER)) if ((key_event.KeyCode() == WXK_RETURN) && (m_windowStyle & wxPROCESS_ENTER))
{ {
@@ -904,21 +934,21 @@ bool wxTextCtrl::IsOwnGtkWindow( GdkWindow *window )
void wxTextCtrl::SetFont( const wxFont &WXUNUSED(font) ) void wxTextCtrl::SetFont( const wxFont &WXUNUSED(font) )
{ {
wxCHECK_RET( m_text != NULL, "invalid text ctrl" ); wxCHECK_RET( m_text != NULL, _T("invalid text ctrl") );
// doesn't work // doesn't work
} }
void wxTextCtrl::SetForegroundColour( const wxColour &WXUNUSED(colour) ) void wxTextCtrl::SetForegroundColour( const wxColour &WXUNUSED(colour) )
{ {
wxCHECK_RET( m_text != NULL, "invalid text ctrl" ); wxCHECK_RET( m_text != NULL, _T("invalid text ctrl") );
// doesn't work // doesn't work
} }
void wxTextCtrl::SetBackgroundColour( const wxColour &colour ) void wxTextCtrl::SetBackgroundColour( const wxColour &colour )
{ {
wxCHECK_RET( m_text != NULL, "invalid text ctrl" ); wxCHECK_RET( m_text != NULL, _T("invalid text ctrl") );
wxControl::SetBackgroundColour( colour ); wxControl::SetBackgroundColour( colour );

View File

@@ -69,7 +69,7 @@ void wxToolTip::Apply( wxWindow *win )
m_window = win; m_window = win;
if (m_text.IsEmpty()) if (m_text.IsEmpty())
m_window->ApplyToolTip( ss_tooltips, (char*) NULL ); m_window->ApplyToolTip( ss_tooltips, (wxChar*) NULL );
else else
m_window->ApplyToolTip( ss_tooltips, m_text ); m_window->ApplyToolTip( ss_tooltips, m_text );
} }

View File

@@ -39,9 +39,9 @@
// Yuck this is really BOTH site and platform dependent // Yuck this is really BOTH site and platform dependent
// so we should use some other strategy! // so we should use some other strategy!
#ifdef __SUN__ #ifdef __SUN__
#define DEFAULT_XRESOURCE_DIR "/usr/openwin/lib/app-defaults" #define DEFAULT_XRESOURCE_DIR _T("/usr/openwin/lib/app-defaults")
#else #else
#define DEFAULT_XRESOURCE_DIR "/usr/lib/X11/app-defaults" #define DEFAULT_XRESOURCE_DIR _T("/usr/lib/X11/app-defaults")
#endif #endif
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
@@ -55,26 +55,26 @@ extern XrmDatabase wxResourceDatabase;
// utility functions for get/write resources // utility functions for get/write resources
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
static char *GetResourcePath(char *buf, char *name, bool create) static wxChar *GetResourcePath(wxChar *buf, wxChar *name, bool create)
{ {
if (create && FileExists(name)) if (create && FileExists(name))
{ {
strcpy(buf, name); wxStrcpy(buf, name);
return buf; // Exists so ... return buf; // Exists so ...
} }
if (*name == '/') if (*name == _T('/'))
strcpy(buf, name); wxStrcpy(buf, name);
else else
{ {
// Put in standard place for resource files if not absolute // Put in standard place for resource files if not absolute
strcpy(buf, DEFAULT_XRESOURCE_DIR); wxStrcpy(buf, DEFAULT_XRESOURCE_DIR);
strcat(buf, "/"); wxStrcat(buf, _T("/"));
strcat(buf, FileNameFromPath(name)); wxStrcat(buf, FileNameFromPath(name));
} }
if (create) if (create)
{ {
// Touch the file to create it // Touch the file to create it
FILE *fd = fopen(buf, "w"); FILE *fd = fopen(wxConv_file.cWX2MB(buf), "w");
if (fd) fclose(fd); if (fd) fclose(fd);
} }
return buf; return buf;
@@ -83,30 +83,30 @@ static char *GetResourcePath(char *buf, char *name, bool create)
// Read $HOME for what it says is home, if not // Read $HOME for what it says is home, if not
// read $USER or $LOGNAME for user name else determine // read $USER or $LOGNAME for user name else determine
// the Real User, then determine the Real home dir. // the Real User, then determine the Real home dir.
static char *GetIniFile(char *dest, const char *filename) static wxChar *GetIniFile(wxChar *dest, const wxChar *filename)
{ {
char *home = (char *) NULL; wxChar *home = (wxChar *) NULL;
if (filename && wxIsAbsolutePath(filename)) if (filename && wxIsAbsolutePath(filename))
{ {
strcpy(dest, filename); wxStrcpy(dest, filename);
} }
else else
{ {
if ((home = wxGetUserHome(wxString())) != NULL) if ((home = wxGetUserHome(wxString())) != NULL)
{ {
strcpy(dest, home); wxStrcpy(dest, home);
if (dest[strlen(dest) - 1] != '/') strcat(dest, "/"); if (dest[wxStrlen(dest) - 1] != _T('/')) wxStrcat(dest, _T("/"));
if (filename == NULL) if (filename == NULL)
{ {
if ((filename = getenv("XENVIRONMENT")) == NULL) filename = ".Xdefaults"; if ((filename = wxGetenv(_T("XENVIRONMENT"))) == NULL) filename = _T(".Xdefaults");
} }
else else
if (*filename != '.') strcat(dest, "."); if (*filename != _T('.')) wxStrcat(dest, _T("."));
strcat(dest, filename); wxStrcat(dest, filename);
} }
else else
{ {
dest[0] = '\0'; dest[0] = _T('\0');
} }
} }
return dest; return dest;
@@ -115,10 +115,10 @@ static char *GetIniFile(char *dest, const char *filename)
static void wxXMergeDatabases() static void wxXMergeDatabases()
{ {
XrmDatabase homeDB, serverDB, applicationDB; XrmDatabase homeDB, serverDB, applicationDB;
char filenamebuf[1024]; wxChar filenamebuf[1024];
char *filename = &filenamebuf[0]; wxChar *filename = &filenamebuf[0];
char *environment; wxChar *environment;
char *classname = gdk_progclass; // Robert Roebling ?? char *classname = gdk_progclass; // Robert Roebling ??
char name[256]; char name[256];
(void)strcpy(name, "/usr/lib/X11/app-defaults/"); (void)strcpy(name, "/usr/lib/X11/app-defaults/");
@@ -138,8 +138,8 @@ static void wxXMergeDatabases()
} }
else else
{ {
(void)GetIniFile(filename, (char *) NULL); (void)GetIniFile(filename, (wxChar *) NULL);
serverDB = XrmGetFileDatabase(filename); serverDB = XrmGetFileDatabase(wxConv_file.cWX2MB(filename));
} }
if (serverDB) if (serverDB)
XrmMergeDatabases(serverDB, &wxResourceDatabase); XrmMergeDatabases(serverDB, &wxResourceDatabase);
@@ -147,18 +147,32 @@ static void wxXMergeDatabases()
// Open XENVIRONMENT file, or if not defined, the .Xdefaults, // Open XENVIRONMENT file, or if not defined, the .Xdefaults,
// and merge into existing database // and merge into existing database
if ((environment = getenv("XENVIRONMENT")) == NULL) if ((environment = wxGetenv(_T("XENVIRONMENT"))) == NULL)
{ {
size_t len; size_t len;
environment = GetIniFile(filename, (const char *) NULL); #if wxUSE_UNICODE
len = strlen(environment); char hostbuf[1024];
#endif
environment = GetIniFile(filename, (const wxChar *) NULL);
len = wxStrlen(environment);
#if !defined(SVR4) || defined(__sgi) #if !defined(SVR4) || defined(__sgi)
#if wxUSE_UNICODE
(void)gethostname(hostbuf, 1024 - len);
#else
(void)gethostname(environment + len, 1024 - len); (void)gethostname(environment + len, 1024 - len);
#endif
#else
#if wxUSE_UNICODE
(void)sysinfo(SI_HOSTNAME, hostbuf, 1024 - len);
#else #else
(void)sysinfo(SI_HOSTNAME, environment + len, 1024 - len); (void)sysinfo(SI_HOSTNAME, environment + len, 1024 - len);
#endif
#endif
#if wxUSE_UNICODE
wxStrcat(environment, wxConv_libc.cMB2WX(hostbuf));
#endif #endif
} }
if ((homeDB = XrmGetFileDatabase(environment))) if ((homeDB = XrmGetFileDatabase(wxConv_file.cWX2MB(environment))))
XrmMergeDatabases(homeDB, &wxResourceDatabase); XrmMergeDatabases(homeDB, &wxResourceDatabase);
} }
@@ -168,17 +182,17 @@ static void wxXMergeDatabases()
void wxFlushResources() void wxFlushResources()
{ {
char nameBuffer[512]; wxChar nameBuffer[512];
wxNode *node = wxTheResourceCache->First(); wxNode *node = wxTheResourceCache->First();
while (node) { while (node) {
wxString str = node->GetKeyString(); wxString str = node->GetKeyString();
char *file = WXSTRINGCAST str; wxChar *file = WXSTRINGCAST str;
// If file doesn't exist, create it first. // If file doesn't exist, create it first.
(void)GetResourcePath(nameBuffer, file, TRUE); (void)GetResourcePath(nameBuffer, file, TRUE);
XrmDatabase database = (XrmDatabase)node->Data(); XrmDatabase database = (XrmDatabase)node->Data();
XrmPutFileDatabase(database, nameBuffer); XrmPutFileDatabase(database, wxConv_file.cWX2MB(nameBuffer));
XrmDestroyDatabase(database); XrmDestroyDatabase(database);
wxNode *next = node->Next(); wxNode *next = node->Next();
// delete node; // delete node;
@@ -186,10 +200,10 @@ void wxFlushResources()
} }
} }
void wxDeleteResources(const char *file) void wxDeleteResources(const wxChar *file)
{ {
wxLogTrace(wxTraceResAlloc, "Delete: Number = %d", wxTheResourceCache->Number()); wxLogTrace(wxTraceResAlloc, _T("Delete: Number = %d"), wxTheResourceCache->Number());
char buffer[500]; wxChar buffer[500];
(void)GetIniFile(buffer, file); (void)GetIniFile(buffer, file);
wxNode *node = wxTheResourceCache->Find(buffer); wxNode *node = wxTheResourceCache->Find(buffer);
@@ -206,7 +220,7 @@ void wxDeleteResources(const char *file)
bool wxWriteResource(const wxString& section, const wxString& entry, const wxString& value, const wxString& file ) bool wxWriteResource(const wxString& section, const wxString& entry, const wxString& value, const wxString& file )
{ {
char buffer[500]; wxChar buffer[500];
if (!entry) return FALSE; if (!entry) return FALSE;
@@ -217,15 +231,15 @@ bool wxWriteResource(const wxString& section, const wxString& entry, const wxStr
if (node) if (node)
database = (XrmDatabase)node->Data(); database = (XrmDatabase)node->Data();
else { else {
database = XrmGetFileDatabase(buffer); database = XrmGetFileDatabase(wxConv_file.cWX2MB(buffer));
wxLogTrace(wxTraceResAlloc, "Write: Number = %d", wxTheResourceCache->Number()); wxLogTrace(wxTraceResAlloc, _T("Write: Number = %d"), wxTheResourceCache->Number());
wxTheResourceCache->Append(buffer, (wxObject *)database); wxTheResourceCache->Append(buffer, (wxObject *)database);
} }
char resName[300]; char resName[300];
strcpy(resName, !section.IsNull() ? WXSTRINGCAST section : "wxWindows"); strcpy(resName, !section.IsNull() ? MBSTRINGCAST section.mb_str() : "wxWindows");
strcat(resName, "."); strcat(resName, ".");
strcat(resName, entry); strcat(resName, entry.mb_str());
XrmPutStringResource(&database, resName, value); XrmPutStringResource(&database, resName, value.mb_str());
return TRUE; return TRUE;
}; };
@@ -258,7 +272,7 @@ bool wxGetResource(const wxString& section, const wxString& entry, char **value,
XrmDatabase database; XrmDatabase database;
if (!file.IsEmpty()) if (!file.IsEmpty())
{ {
char buffer[500]; wxChar buffer[500];
// Is this right? Trying to get it to look in the user's // Is this right? Trying to get it to look in the user's
// home directory instead of current directory -- JACS // home directory instead of current directory -- JACS
(void)GetIniFile(buffer, file); (void)GetIniFile(buffer, file);
@@ -271,8 +285,8 @@ bool wxGetResource(const wxString& section, const wxString& entry, char **value,
} }
else else
{ {
database = XrmGetFileDatabase(buffer); database = XrmGetFileDatabase(wxConv_file.cWX2MB(buffer));
wxLogTrace(wxTraceResAlloc, "Get: Number = %d", wxTheResourceCache->Number()); wxLogTrace(wxTraceResAlloc, _T("Get: Number = %d"), wxTheResourceCache->Number());
wxTheResourceCache->Append(buffer, (wxObject *)database); wxTheResourceCache->Append(buffer, (wxObject *)database);
} }
} else } else
@@ -281,9 +295,9 @@ bool wxGetResource(const wxString& section, const wxString& entry, char **value,
XrmValue xvalue; XrmValue xvalue;
char *str_type[20]; char *str_type[20];
char buf[150]; char buf[150];
strcpy(buf, section); strcpy(buf, section.mb_str());
strcat(buf, "."); strcat(buf, ".");
strcat(buf, entry); strcat(buf, entry.mb_str());
bool success = XrmGetResource(database, buf, "*", str_type, &xvalue); bool success = XrmGetResource(database, buf, "*", str_type, &xvalue);
// Try different combinations of upper/lower case, just in case... // Try different combinations of upper/lower case, just in case...

View File

@@ -1434,7 +1434,7 @@ bool wxWindow::Create( wxWindow *parent, wxWindowID id,
const wxPoint &pos, const wxSize &size, const wxPoint &pos, const wxSize &size,
long style, const wxString &name ) long style, const wxString &name )
{ {
wxASSERT_MSG( m_isWindow, "Init() must have been called before!" ); wxASSERT_MSG( m_isWindow, _T("Init() must have been called before!") );
PreCreation( parent, id, pos, size, style, name ); PreCreation( parent, id, pos, size, style, name );
@@ -1641,7 +1641,7 @@ void wxWindow::PreCreation( wxWindow *parent, wxWindowID id,
const wxPoint &pos, const wxSize &size, const wxPoint &pos, const wxSize &size,
long style, const wxString &name ) long style, const wxString &name )
{ {
wxASSERT_MSG( (!m_needParent) || (parent), "Need complete parent." ); wxASSERT_MSG( (!m_needParent) || (parent), _T("Need complete parent.") );
m_widget = (GtkWidget*) NULL; m_widget = (GtkWidget*) NULL;
m_wxwindow = (GtkWidget*) NULL; m_wxwindow = (GtkWidget*) NULL;
@@ -1727,7 +1727,7 @@ void wxWindow::PreCreation( wxWindow *parent, wxWindowID id,
void wxWindow::PostCreation() void wxWindow::PostCreation()
{ {
wxASSERT_MSG( (m_widget != NULL), "invalid window" ); wxASSERT_MSG( (m_widget != NULL), _T("invalid window") );
if (m_wxwindow) if (m_wxwindow)
{ {
@@ -1797,7 +1797,7 @@ bool wxWindow::HasVMT()
bool wxWindow::Close( bool force ) bool wxWindow::Close( bool force )
{ {
wxASSERT_MSG( (m_widget != NULL), "invalid window" ); wxASSERT_MSG( (m_widget != NULL), _T("invalid window") );
wxCloseEvent event(wxEVT_CLOSE_WINDOW, m_windowId); wxCloseEvent event(wxEVT_CLOSE_WINDOW, m_windowId);
event.SetEventObject(this); event.SetEventObject(this);
@@ -1810,7 +1810,7 @@ bool wxWindow::Close( bool force )
bool wxWindow::Destroy() bool wxWindow::Destroy()
{ {
wxASSERT_MSG( (m_widget != NULL), "invalid window" ); wxASSERT_MSG( (m_widget != NULL), _T("invalid window") );
m_hasVMT = FALSE; m_hasVMT = FALSE;
delete this; delete this;
@@ -1839,8 +1839,8 @@ void wxWindow::PrepareDC( wxDC &WXUNUSED(dc) )
void wxWindow::DoSetSize( int x, int y, int width, int height, int sizeFlags ) void wxWindow::DoSetSize( int x, int y, int width, int height, int sizeFlags )
{ {
wxASSERT_MSG( (m_widget != NULL), "invalid window" ); wxASSERT_MSG( (m_widget != NULL), _T("invalid window") );
wxASSERT_MSG( (m_parent != NULL), "wxWindow::SetSize requires parent.\n" ); wxASSERT_MSG( (m_parent != NULL), _T("wxWindow::SetSize requires parent.\n") );
if (m_resizing) return; /* I don't like recursions */ if (m_resizing) return; /* I don't like recursions */
m_resizing = TRUE; m_resizing = TRUE;
@@ -1922,7 +1922,7 @@ void wxWindow::OnInternalIdle()
void wxWindow::GetSize( int *width, int *height ) const void wxWindow::GetSize( int *width, int *height ) const
{ {
wxCHECK_RET( (m_widget != NULL), "invalid window" ); wxCHECK_RET( (m_widget != NULL), _T("invalid window") );
if (width) (*width) = m_width; if (width) (*width) = m_width;
if (height) (*height) = m_height; if (height) (*height) = m_height;
@@ -1930,7 +1930,7 @@ void wxWindow::GetSize( int *width, int *height ) const
void wxWindow::DoSetClientSize( int width, int height ) void wxWindow::DoSetClientSize( int width, int height )
{ {
wxCHECK_RET( (m_widget != NULL), "invalid window" ); wxCHECK_RET( (m_widget != NULL), _T("invalid window") );
if (!m_wxwindow) if (!m_wxwindow)
{ {
@@ -1995,7 +1995,7 @@ void wxWindow::DoSetClientSize( int width, int height )
void wxWindow::GetClientSize( int *width, int *height ) const void wxWindow::GetClientSize( int *width, int *height ) const
{ {
wxCHECK_RET( (m_widget != NULL), "invalid window" ); wxCHECK_RET( (m_widget != NULL), _T("invalid window") );
if (!m_wxwindow) if (!m_wxwindow)
{ {
@@ -2061,7 +2061,7 @@ void wxWindow::GetClientSize( int *width, int *height ) const
void wxWindow::GetPosition( int *x, int *y ) const void wxWindow::GetPosition( int *x, int *y ) const
{ {
wxCHECK_RET( (m_widget != NULL), "invalid window" ); wxCHECK_RET( (m_widget != NULL), _T("invalid window") );
if (x) (*x) = m_x; if (x) (*x) = m_x;
if (y) (*y) = m_y; if (y) (*y) = m_y;
@@ -2069,7 +2069,7 @@ void wxWindow::GetPosition( int *x, int *y ) const
void wxWindow::ClientToScreen( int *x, int *y ) void wxWindow::ClientToScreen( int *x, int *y )
{ {
wxCHECK_RET( (m_widget != NULL), "invalid window" ); wxCHECK_RET( (m_widget != NULL), _T("invalid window") );
GdkWindow *source = (GdkWindow *) NULL; GdkWindow *source = (GdkWindow *) NULL;
if (m_wxwindow) if (m_wxwindow)
@@ -2096,7 +2096,7 @@ void wxWindow::ClientToScreen( int *x, int *y )
void wxWindow::ScreenToClient( int *x, int *y ) void wxWindow::ScreenToClient( int *x, int *y )
{ {
wxCHECK_RET( (m_widget != NULL), "invalid window" ); wxCHECK_RET( (m_widget != NULL), _T("invalid window") );
GdkWindow *source = (GdkWindow *) NULL; GdkWindow *source = (GdkWindow *) NULL;
if (m_wxwindow) if (m_wxwindow)
@@ -2123,7 +2123,7 @@ void wxWindow::ScreenToClient( int *x, int *y )
void wxWindow::Centre( int direction ) void wxWindow::Centre( int direction )
{ {
wxCHECK_RET( (m_widget != NULL), "invalid window" ); wxCHECK_RET( (m_widget != NULL), _T("invalid window") );
int x = m_x; int x = m_x;
int y = m_y; int y = m_y;
@@ -2147,7 +2147,7 @@ void wxWindow::Centre( int direction )
void wxWindow::Fit() void wxWindow::Fit()
{ {
wxCHECK_RET( (m_widget != NULL), "invalid window" ); wxCHECK_RET( (m_widget != NULL), _T("invalid window") );
int maxX = 0; int maxX = 0;
int maxY = 0; int maxY = 0;
@@ -2169,7 +2169,7 @@ void wxWindow::Fit()
void wxWindow::SetSizeHints( int minW, int minH, int maxW, int maxH, int WXUNUSED(incW), int WXUNUSED(incH) ) void wxWindow::SetSizeHints( int minW, int minH, int maxW, int maxH, int WXUNUSED(incW), int WXUNUSED(incH) )
{ {
wxCHECK_RET( (m_widget != NULL), "invalid window" ); wxCHECK_RET( (m_widget != NULL), _T("invalid window") );
m_minWidth = minW; m_minWidth = minW;
m_minHeight = minH; m_minHeight = minH;
@@ -2184,7 +2184,7 @@ void wxWindow::OnSize( wxSizeEvent &WXUNUSED(event) )
bool wxWindow::Show( bool show ) bool wxWindow::Show( bool show )
{ {
wxCHECK_MSG( (m_widget != NULL), FALSE, "invalid window" ); wxCHECK_MSG( (m_widget != NULL), FALSE, _T("invalid window") );
if (show == m_isShown) return TRUE; if (show == m_isShown) return TRUE;
@@ -2200,7 +2200,7 @@ bool wxWindow::Show( bool show )
void wxWindow::Enable( bool enable ) void wxWindow::Enable( bool enable )
{ {
wxCHECK_RET( (m_widget != NULL), "invalid window" ); wxCHECK_RET( (m_widget != NULL), _T("invalid window") );
m_isEnabled = enable; m_isEnabled = enable;
@@ -2210,9 +2210,9 @@ void wxWindow::Enable( bool enable )
int wxWindow::GetCharHeight() const int wxWindow::GetCharHeight() const
{ {
wxCHECK_MSG( (m_widget != NULL), 12, "invalid window" ); wxCHECK_MSG( (m_widget != NULL), 12, _T("invalid window") );
wxCHECK_MSG( m_font.Ok(), 12, "invalid font" ); wxCHECK_MSG( m_font.Ok(), 12, _T("invalid font") );
GdkFont *font = m_font.GetInternalFont( 1.0 ); GdkFont *font = m_font.GetInternalFont( 1.0 );
@@ -2221,9 +2221,9 @@ int wxWindow::GetCharHeight() const
int wxWindow::GetCharWidth() const int wxWindow::GetCharWidth() const
{ {
wxCHECK_MSG( (m_widget != NULL), 8, "invalid window" ); wxCHECK_MSG( (m_widget != NULL), 8, _T("invalid window") );
wxCHECK_MSG( m_font.Ok(), 8, "invalid font" ); wxCHECK_MSG( m_font.Ok(), 8, _T("invalid font") );
GdkFont *font = m_font.GetInternalFont( 1.0 ); GdkFont *font = m_font.GetInternalFont( 1.0 );
@@ -2236,10 +2236,10 @@ void wxWindow::GetTextExtent( const wxString& string, int *x, int *y,
wxFont fontToUse = m_font; wxFont fontToUse = m_font;
if (theFont) fontToUse = *theFont; if (theFont) fontToUse = *theFont;
wxCHECK_RET( fontToUse.Ok(), "invalid font" ); wxCHECK_RET( fontToUse.Ok(), _T("invalid font") );
GdkFont *font = fontToUse.GetInternalFont( 1.0 ); GdkFont *font = fontToUse.GetInternalFont( 1.0 );
if (x) (*x) = gdk_string_width( font, string ); if (x) (*x) = gdk_string_width( font, string.mbc_str() );
if (y) (*y) = font->ascent + font->descent; if (y) (*y) = font->ascent + font->descent;
if (descent) (*descent) = font->descent; if (descent) (*descent) = font->descent;
if (externalLeading) (*externalLeading) = 0; // ?? if (externalLeading) (*externalLeading) = 0; // ??
@@ -2275,7 +2275,7 @@ void wxWindow::OnKeyDown( wxKeyEvent &event )
void wxWindow::SetFocus() void wxWindow::SetFocus()
{ {
wxCHECK_RET( (m_widget != NULL), "invalid window" ); wxCHECK_RET( (m_widget != NULL), _T("invalid window") );
GtkWidget *connect_widget = GetConnectWidget(); GtkWidget *connect_widget = GetConnectWidget();
if (connect_widget) if (connect_widget)
@@ -2306,15 +2306,15 @@ bool wxWindow::AcceptsFocus() const
void wxWindow::AddChild( wxWindow *child ) void wxWindow::AddChild( wxWindow *child )
{ {
wxCHECK_RET( (m_widget != NULL), "invalid window" ); wxCHECK_RET( (m_widget != NULL), _T("invalid window") );
wxCHECK_RET( (child != NULL), "invalid child" ); wxCHECK_RET( (child != NULL), _T("invalid child") );
m_children.Append( child ); m_children.Append( child );
} }
wxWindow *wxWindow::ReParent( wxWindow *newParent ) wxWindow *wxWindow::ReParent( wxWindow *newParent )
{ {
wxCHECK_MSG( (m_widget != NULL), (wxWindow*) NULL, "invalid window" ); wxCHECK_MSG( (m_widget != NULL), (wxWindow*) NULL, _T("invalid window") );
wxWindow *oldParent = GetParent(); wxWindow *oldParent = GetParent();
@@ -2349,14 +2349,14 @@ int wxWindow::GetReturnCode()
void wxWindow::Raise() void wxWindow::Raise()
{ {
wxCHECK_RET( (m_widget != NULL), "invalid window" ); wxCHECK_RET( (m_widget != NULL), _T("invalid window") );
if (m_widget) gdk_window_raise( m_widget->window ); if (m_widget) gdk_window_raise( m_widget->window );
} }
void wxWindow::Lower() void wxWindow::Lower()
{ {
wxCHECK_RET( (m_widget != NULL), "invalid window" ); wxCHECK_RET( (m_widget != NULL), _T("invalid window") );
if (m_widget) gdk_window_lower( m_widget->window ); if (m_widget) gdk_window_lower( m_widget->window );
} }
@@ -2447,7 +2447,7 @@ wxWindowID wxWindow::GetId() const
void wxWindow::SetCursor( const wxCursor &cursor ) void wxWindow::SetCursor( const wxCursor &cursor )
{ {
wxCHECK_RET( (m_widget != NULL), "invalid window" ); wxCHECK_RET( (m_widget != NULL), _T("invalid window") );
if (cursor.Ok()) if (cursor.Ok())
{ {
@@ -2473,7 +2473,7 @@ void wxWindow::WarpPointer( int WXUNUSED(x), int WXUNUSED(y) )
void wxWindow::Refresh( bool eraseBackground, const wxRect *rect ) void wxWindow::Refresh( bool eraseBackground, const wxRect *rect )
{ {
wxCHECK_RET( (m_widget != NULL), "invalid window" ); wxCHECK_RET( (m_widget != NULL), _T("invalid window") );
if (eraseBackground && m_wxwindow && m_wxwindow->window) if (eraseBackground && m_wxwindow && m_wxwindow->window)
{ {
@@ -2538,7 +2538,7 @@ bool wxWindow::IsExposed( const wxRect& rect ) const
void wxWindow::Clear() void wxWindow::Clear()
{ {
wxCHECK_RET( m_widget != NULL, "invalid window" ); wxCHECK_RET( m_widget != NULL, _T("invalid window") );
if (m_wxwindow && m_wxwindow->window) if (m_wxwindow && m_wxwindow->window)
{ {
@@ -2576,9 +2576,9 @@ void wxWindow::SetToolTip( wxToolTip *tip )
m_toolTip->Apply( this ); m_toolTip->Apply( this );
} }
void wxWindow::ApplyToolTip( GtkTooltips *tips, const char *tip ) void wxWindow::ApplyToolTip( GtkTooltips *tips, const wxChar *tip )
{ {
gtk_tooltips_set_tip( tips, GetConnectWidget(), tip, (gchar*) NULL ); gtk_tooltips_set_tip( tips, GetConnectWidget(), wxConv_current->cWX2MB(tip), (gchar*) NULL );
} }
#endif // wxUSE_TOOLTIPS #endif // wxUSE_TOOLTIPS
@@ -2589,7 +2589,7 @@ wxColour wxWindow::GetBackgroundColour() const
void wxWindow::SetBackgroundColour( const wxColour &colour ) void wxWindow::SetBackgroundColour( const wxColour &colour )
{ {
wxCHECK_RET( m_widget != NULL, "invalid window" ); wxCHECK_RET( m_widget != NULL, _T("invalid window") );
if (m_backgroundColour == colour) return; if (m_backgroundColour == colour) return;
@@ -2629,7 +2629,7 @@ wxColour wxWindow::GetForegroundColour() const
void wxWindow::SetForegroundColour( const wxColour &colour ) void wxWindow::SetForegroundColour( const wxColour &colour )
{ {
wxCHECK_RET( m_widget != NULL, "invalid window" ); wxCHECK_RET( m_widget != NULL, _T("invalid window") );
if (m_foregroundColour == colour) return; if (m_foregroundColour == colour) return;
@@ -2697,7 +2697,7 @@ void wxWindow::ApplyWidgetStyle()
bool wxWindow::Validate() bool wxWindow::Validate()
{ {
wxCHECK_MSG( m_widget != NULL, FALSE, "invalid window" ); wxCHECK_MSG( m_widget != NULL, FALSE, _T("invalid window") );
wxNode *node = m_children.First(); wxNode *node = m_children.First();
while (node) while (node)
@@ -2714,7 +2714,7 @@ bool wxWindow::Validate()
bool wxWindow::TransferDataToWindow() bool wxWindow::TransferDataToWindow()
{ {
wxCHECK_MSG( m_widget != NULL, FALSE, "invalid window" ); wxCHECK_MSG( m_widget != NULL, FALSE, _T("invalid window") );
wxNode *node = m_children.First(); wxNode *node = m_children.First();
while (node) while (node)
@@ -2733,7 +2733,7 @@ bool wxWindow::TransferDataToWindow()
bool wxWindow::TransferDataFromWindow() bool wxWindow::TransferDataFromWindow()
{ {
wxCHECK_MSG( m_widget != NULL, FALSE, "invalid window" ); wxCHECK_MSG( m_widget != NULL, FALSE, _T("invalid window") );
wxNode *node = m_children.First(); wxNode *node = m_children.First();
while (node) while (node)
@@ -2760,7 +2760,7 @@ void wxWindow::OnInitDialog( wxInitDialogEvent &WXUNUSED(event) )
void wxWindow::InitDialog() void wxWindow::InitDialog()
{ {
wxCHECK_RET( m_widget != NULL, "invalid window" ); wxCHECK_RET( m_widget != NULL, _T("invalid window") );
wxInitDialogEvent event(GetId()); wxInitDialogEvent event(GetId());
event.SetEventObject( this ); event.SetEventObject( this );
@@ -2794,9 +2794,9 @@ static void pop_pos_callback( GtkMenu *menu, gint *x, gint *y, wxWindow *win )
bool wxWindow::PopupMenu( wxMenu *menu, int x, int y ) bool wxWindow::PopupMenu( wxMenu *menu, int x, int y )
{ {
wxCHECK_MSG( m_widget != NULL, FALSE, "invalid window" ); wxCHECK_MSG( m_widget != NULL, FALSE, _T("invalid window") );
wxCHECK_MSG( menu != NULL, FALSE, "invalid popup-menu" ); wxCHECK_MSG( menu != NULL, FALSE, _T("invalid popup-menu") );
SetInvokingWindow( menu, this ); SetInvokingWindow( menu, this );
@@ -2821,7 +2821,7 @@ bool wxWindow::PopupMenu( wxMenu *menu, int x, int y )
void wxWindow::SetDropTarget( wxDropTarget *dropTarget ) void wxWindow::SetDropTarget( wxDropTarget *dropTarget )
{ {
wxCHECK_RET( m_widget != NULL, "invalid window" ); wxCHECK_RET( m_widget != NULL, _T("invalid window") );
GtkWidget *dnd_widget = GetConnectWidget(); GtkWidget *dnd_widget = GetConnectWidget();
@@ -2856,7 +2856,7 @@ bool wxWindow::IsOwnGtkWindow( GdkWindow *window )
void wxWindow::SetFont( const wxFont &font ) void wxWindow::SetFont( const wxFont &font )
{ {
wxCHECK_RET( m_widget != NULL, "invalid window" ); wxCHECK_RET( m_widget != NULL, _T("invalid window") );
if (m_font == font) return; if (m_font == font) return;
@@ -2892,9 +2892,9 @@ long wxWindow::GetWindowStyleFlag() const
void wxWindow::CaptureMouse() void wxWindow::CaptureMouse()
{ {
wxCHECK_RET( m_widget != NULL, "invalid window" ); wxCHECK_RET( m_widget != NULL, _T("invalid window") );
wxCHECK_RET( g_capturing == FALSE, "CaptureMouse called twice" ); wxCHECK_RET( g_capturing == FALSE, _T("CaptureMouse called twice") );
GtkWidget *connect_widget = GetConnectWidget(); GtkWidget *connect_widget = GetConnectWidget();
gtk_grab_add( connect_widget ); gtk_grab_add( connect_widget );
@@ -2911,9 +2911,9 @@ void wxWindow::CaptureMouse()
void wxWindow::ReleaseMouse() void wxWindow::ReleaseMouse()
{ {
wxCHECK_RET( m_widget != NULL, "invalid window" ); wxCHECK_RET( m_widget != NULL, _T("invalid window") );
wxCHECK_RET( g_capturing == TRUE, "ReleaseMouse called twice" ); wxCHECK_RET( g_capturing == TRUE, _T("ReleaseMouse called twice") );
GtkWidget *connect_widget = GetConnectWidget(); GtkWidget *connect_widget = GetConnectWidget();
gtk_grab_remove( connect_widget ); gtk_grab_remove( connect_widget );
@@ -2986,9 +2986,9 @@ wxWindow *wxWindow::FindWindow( const wxString& name )
void wxWindow::SetScrollbar( int orient, int pos, int thumbVisible, void wxWindow::SetScrollbar( int orient, int pos, int thumbVisible,
int range, bool refresh ) int range, bool refresh )
{ {
wxCHECK_RET( m_widget != NULL, "invalid window" ); wxCHECK_RET( m_widget != NULL, _T("invalid window") );
wxCHECK_RET( m_wxwindow != NULL, "window needs client area for scrolling" ); wxCHECK_RET( m_wxwindow != NULL, _T("window needs client area for scrolling") );
m_hasScrolling = TRUE; m_hasScrolling = TRUE;
@@ -3054,9 +3054,9 @@ void wxWindow::SetScrollbar( int orient, int pos, int thumbVisible,
void wxWindow::SetScrollPos( int orient, int pos, bool WXUNUSED(refresh) ) void wxWindow::SetScrollPos( int orient, int pos, bool WXUNUSED(refresh) )
{ {
wxCHECK_RET( m_widget != NULL, "invalid window" ); wxCHECK_RET( m_widget != NULL, _T("invalid window") );
wxCHECK_RET( m_wxwindow != NULL, "window needs client area for scrolling" ); wxCHECK_RET( m_wxwindow != NULL, _T("window needs client area for scrolling") );
if (orient == wxHORIZONTAL) if (orient == wxHORIZONTAL)
{ {
@@ -3093,9 +3093,9 @@ void wxWindow::SetScrollPos( int orient, int pos, bool WXUNUSED(refresh) )
int wxWindow::GetScrollThumb( int orient ) const int wxWindow::GetScrollThumb( int orient ) const
{ {
wxCHECK_MSG( m_widget != NULL, 0, "invalid window" ); wxCHECK_MSG( m_widget != NULL, 0, _T("invalid window") );
wxCHECK_MSG( m_wxwindow != NULL, 0, "window needs client area for scrolling" ); wxCHECK_MSG( m_wxwindow != NULL, 0, _T("window needs client area for scrolling") );
if (orient == wxHORIZONTAL) if (orient == wxHORIZONTAL)
return (int)(m_hAdjust->page_size+0.5); return (int)(m_hAdjust->page_size+0.5);
@@ -3105,9 +3105,9 @@ int wxWindow::GetScrollThumb( int orient ) const
int wxWindow::GetScrollPos( int orient ) const int wxWindow::GetScrollPos( int orient ) const
{ {
wxCHECK_MSG( m_widget != NULL, 0, "invalid window" ); wxCHECK_MSG( m_widget != NULL, 0, _T("invalid window") );
wxCHECK_MSG( m_wxwindow != NULL, 0, "window needs client area for scrolling" ); wxCHECK_MSG( m_wxwindow != NULL, 0, _T("window needs client area for scrolling") );
if (orient == wxHORIZONTAL) if (orient == wxHORIZONTAL)
return (int)(m_hAdjust->value+0.5); return (int)(m_hAdjust->value+0.5);
@@ -3117,9 +3117,9 @@ int wxWindow::GetScrollPos( int orient ) const
int wxWindow::GetScrollRange( int orient ) const int wxWindow::GetScrollRange( int orient ) const
{ {
wxCHECK_MSG( m_widget != NULL, 0, "invalid window" ); wxCHECK_MSG( m_widget != NULL, 0, _T("invalid window") );
wxCHECK_MSG( m_wxwindow != NULL, 0, "window needs client area for scrolling" ); wxCHECK_MSG( m_wxwindow != NULL, 0, _T("window needs client area for scrolling") );
if (orient == wxHORIZONTAL) if (orient == wxHORIZONTAL)
return (int)(m_hAdjust->upper+0.5); return (int)(m_hAdjust->upper+0.5);
@@ -3129,9 +3129,9 @@ int wxWindow::GetScrollRange( int orient ) const
void wxWindow::ScrollWindow( int dx, int dy, const wxRect* WXUNUSED(rect) ) void wxWindow::ScrollWindow( int dx, int dy, const wxRect* WXUNUSED(rect) )
{ {
wxCHECK_RET( m_widget != NULL, "invalid window" ); wxCHECK_RET( m_widget != NULL, _T("invalid window") );
wxCHECK_RET( m_wxwindow != NULL, "window needs client area for scrolling" ); wxCHECK_RET( m_wxwindow != NULL, _T("window needs client area for scrolling") );
wxNode *node = m_children.First(); wxNode *node = m_children.First();
while (node) while (node)
@@ -3482,21 +3482,21 @@ void wxWindow::SetConstraintSizes(bool recurse)
} }
else if (constr) else if (constr)
{ {
char *windowClass = this->GetClassInfo()->GetClassName(); wxChar *windowClass = this->GetClassInfo()->GetClassName();
wxString winName; wxString winName;
if (GetName() == "") if (GetName() == _T(""))
winName = "unnamed"; winName = _T("unnamed");
else else
winName = GetName(); winName = GetName();
wxLogDebug( "Constraint(s) not satisfied for window of type %s, name %s:\n", wxLogDebug( _T("Constraint(s) not satisfied for window of type %s, name %s:\n"),
(const char *)windowClass, (const wxChar *)windowClass,
(const char *)winName); (const wxChar *)winName);
if (!constr->left.GetDone()) wxLogDebug( " unsatisfied 'left' constraint.\n" ); if (!constr->left.GetDone()) wxLogDebug( _T(" unsatisfied 'left' constraint.\n") );
if (!constr->right.GetDone()) wxLogDebug( " unsatisfied 'right' constraint.\n" ); if (!constr->right.GetDone()) wxLogDebug( _T(" unsatisfied 'right' constraint.\n") );
if (!constr->width.GetDone()) wxLogDebug( " unsatisfied 'width' constraint.\n" ); if (!constr->width.GetDone()) wxLogDebug( _T(" unsatisfied 'width' constraint.\n") );
if (!constr->height.GetDone()) wxLogDebug( " unsatisfied 'height' constraint.\n" ); if (!constr->height.GetDone()) wxLogDebug( _T(" unsatisfied 'height' constraint.\n") );
wxLogDebug( "Please check constraints: try adding AsIs() constraints.\n" ); wxLogDebug( _T("Please check constraints: try adding AsIs() constraints.\n") );
} }
if (recurse) if (recurse)

View File

@@ -204,13 +204,13 @@ wxToolBarTool *wxToolBar::AddTool( int toolIndex, const wxBitmap& bitmap,
m_hasToolAlready = TRUE; m_hasToolAlready = TRUE;
wxCHECK_MSG( bitmap.Ok(), (wxToolBarTool *)NULL, wxCHECK_MSG( bitmap.Ok(), (wxToolBarTool *)NULL,
"invalid bitmap for wxToolBar icon" ); _T("invalid bitmap for wxToolBar icon") );
wxCHECK_MSG( bitmap.GetBitmap() == NULL, (wxToolBarTool *)NULL, wxCHECK_MSG( bitmap.GetBitmap() == NULL, (wxToolBarTool *)NULL,
"wxToolBar doesn't support GdkBitmap" ); _T("wxToolBar doesn't support GdkBitmap") );
wxCHECK_MSG( bitmap.GetPixmap() != NULL, (wxToolBarTool *)NULL, wxCHECK_MSG( bitmap.GetPixmap() != NULL, (wxToolBarTool *)NULL,
"wxToolBar::Add needs a wxBitmap" ); _T("wxToolBar::Add needs a wxBitmap") );
GtkWidget *tool_pixmap = (GtkWidget *)NULL; GtkWidget *tool_pixmap = (GtkWidget *)NULL;
@@ -238,7 +238,7 @@ wxToolBarTool *wxToolBar::AddTool( int toolIndex, const wxBitmap& bitmap,
ctype, ctype,
(GtkWidget *)NULL, (GtkWidget *)NULL,
(const char *)NULL, (const char *)NULL,
helpString1, helpString1.mbc_str(),
"", "",
tool_pixmap, tool_pixmap,
(GtkSignalFunc)gtk_toolbar_callback, (GtkSignalFunc)gtk_toolbar_callback,
@@ -264,7 +264,7 @@ void wxToolBar::AddSeparator()
void wxToolBar::ClearTools() void wxToolBar::ClearTools()
{ {
wxFAIL_MSG( "wxToolBar::ClearTools not implemented" ); wxFAIL_MSG( _T("wxToolBar::ClearTools not implemented") );
} }
bool wxToolBar::Realize() bool wxToolBar::Realize()
@@ -314,7 +314,7 @@ void wxToolBar::EnableTool(int toolIndex, bool enable)
node = node->Next(); node = node->Next();
} }
wxFAIL_MSG( "wrong toolbar index" ); wxFAIL_MSG( _T("wrong toolbar index") );
} }
void wxToolBar::ToggleTool( int toolIndex, bool toggle ) void wxToolBar::ToggleTool( int toolIndex, bool toggle )
@@ -333,7 +333,7 @@ void wxToolBar::ToggleTool( int toolIndex, bool toggle )
node = node->Next(); node = node->Next();
} }
wxFAIL_MSG( "wrong toolbar index" ); wxFAIL_MSG( _T("wrong toolbar index") );
} }
wxObject *wxToolBar::GetToolClientData( int index ) const wxObject *wxToolBar::GetToolClientData( int index ) const
@@ -346,7 +346,7 @@ wxObject *wxToolBar::GetToolClientData( int index ) const
node = node->Next(); node = node->Next();
} }
wxFAIL_MSG( "wrong toolbar index" ); wxFAIL_MSG( _T("wrong toolbar index") );
return (wxObject*)NULL; return (wxObject*)NULL;
} }
@@ -361,7 +361,7 @@ bool wxToolBar::GetToolState(int toolIndex) const
node = node->Next(); node = node->Next();
} }
wxFAIL_MSG( "wrong toolbar index" ); wxFAIL_MSG( _T("wrong toolbar index") );
return FALSE; return FALSE;
} }
@@ -376,14 +376,14 @@ bool wxToolBar::GetToolEnabled(int toolIndex) const
node = node->Next(); node = node->Next();
} }
wxFAIL_MSG( "wrong toolbar index" ); wxFAIL_MSG( _T("wrong toolbar index") );
return FALSE; return FALSE;
} }
void wxToolBar::SetMargins( int x, int y ) void wxToolBar::SetMargins( int x, int y )
{ {
wxCHECK_RET( !m_hasToolAlready, "wxToolBar::SetMargins must be called before adding tool." ); wxCHECK_RET( !m_hasToolAlready, _T("wxToolBar::SetMargins must be called before adding tool.") );
if (x > 2) gtk_toolbar_append_space( m_toolbar ); // oh well if (x > 2) gtk_toolbar_append_space( m_toolbar ); // oh well
@@ -393,7 +393,7 @@ void wxToolBar::SetMargins( int x, int y )
void wxToolBar::SetToolPacking( int WXUNUSED(packing) ) void wxToolBar::SetToolPacking( int WXUNUSED(packing) )
{ {
wxFAIL_MSG( "wxToolBar::SetToolPacking not implemented" ); wxFAIL_MSG( _T("wxToolBar::SetToolPacking not implemented") );
} }
void wxToolBar::SetToolSeparation( int separation ) void wxToolBar::SetToolSeparation( int separation )
@@ -425,9 +425,9 @@ wxString wxToolBar::GetToolLongHelp(int toolIndex)
node = node->Next(); node = node->Next();
} }
wxFAIL_MSG( "wrong toolbar index" ); wxFAIL_MSG( _T("wrong toolbar index") );
return ""; return _T("");
} }
wxString wxToolBar::GetToolShortHelp(int toolIndex) wxString wxToolBar::GetToolShortHelp(int toolIndex)
@@ -443,9 +443,9 @@ wxString wxToolBar::GetToolShortHelp(int toolIndex)
node = node->Next(); node = node->Next();
} }
wxFAIL_MSG( "wrong toolbar index" ); wxFAIL_MSG( _T("wrong toolbar index") );
return ""; return _T("");
} }
void wxToolBar::SetToolLongHelp(int toolIndex, const wxString& helpString) void wxToolBar::SetToolLongHelp(int toolIndex, const wxString& helpString)
@@ -462,7 +462,7 @@ void wxToolBar::SetToolLongHelp(int toolIndex, const wxString& helpString)
node = node->Next(); node = node->Next();
} }
wxFAIL_MSG( "wrong toolbar index" ); wxFAIL_MSG( _T("wrong toolbar index") );
return; return;
} }
@@ -481,7 +481,7 @@ void wxToolBar::SetToolShortHelp(int toolIndex, const wxString& helpString)
node = node->Next(); node = node->Next();
} }
wxFAIL_MSG( "wrong toolbar index" ); wxFAIL_MSG( _T("wrong toolbar index") );
return; return;
} }

View File

@@ -195,7 +195,12 @@ bool wxTextCtrl::Create( wxWindow *parent, wxWindowID id, const wxString &value,
if (!value.IsEmpty()) if (!value.IsEmpty())
{ {
gint tmp = 0; gint tmp = 0;
#if wxUSE_UNICODE
wxWX2MBbuf val = value.mbc_str();
gtk_editable_insert_text( GTK_EDITABLE(m_text), val, strlen(val), &tmp );
#else
gtk_editable_insert_text( GTK_EDITABLE(m_text), value, value.Length(), &tmp ); gtk_editable_insert_text( GTK_EDITABLE(m_text), value, value.Length(), &tmp );
#endif
if (multi_line) if (multi_line)
{ {
@@ -276,14 +281,14 @@ void wxTextCtrl::CalculateScrollbar()
wxString wxTextCtrl::GetValue() const wxString wxTextCtrl::GetValue() const
{ {
wxCHECK_MSG( m_text != NULL, "", "invalid text ctrl" ); wxCHECK_MSG( m_text != NULL, _T(""), _T("invalid text ctrl") );
wxString tmp; wxString tmp;
if (m_windowStyle & wxTE_MULTILINE) if (m_windowStyle & wxTE_MULTILINE)
{ {
gint len = gtk_text_get_length( GTK_TEXT(m_text) ); gint len = gtk_text_get_length( GTK_TEXT(m_text) );
char *text = gtk_editable_get_chars( GTK_EDITABLE(m_text), 0, len ); char *text = gtk_editable_get_chars( GTK_EDITABLE(m_text), 0, len );
tmp = text; tmp = wxString(text,*wxConv_current);
g_free( text ); g_free( text );
} }
else else
@@ -295,26 +300,31 @@ wxString wxTextCtrl::GetValue() const
void wxTextCtrl::SetValue( const wxString &value ) void wxTextCtrl::SetValue( const wxString &value )
{ {
wxCHECK_RET( m_text != NULL, "invalid text ctrl" ); wxCHECK_RET( m_text != NULL, _T("invalid text ctrl") );
wxString tmp = ""; wxString tmp = _T("");
if (!value.IsNull()) tmp = value; if (!value.IsNull()) tmp = value;
if (m_windowStyle & wxTE_MULTILINE) if (m_windowStyle & wxTE_MULTILINE)
{ {
gint len = gtk_text_get_length( GTK_TEXT(m_text) ); gint len = gtk_text_get_length( GTK_TEXT(m_text) );
gtk_editable_delete_text( GTK_EDITABLE(m_text), 0, len ); gtk_editable_delete_text( GTK_EDITABLE(m_text), 0, len );
len = 0; len = 0;
gtk_editable_insert_text( GTK_EDITABLE(m_text), tmp, tmp.Length(), &len ); #if wxUSE_UNICODE
wxWX2MBbuf tmpbuf = tmp.mbc_str();
gtk_editable_insert_text( GTK_EDITABLE(m_text), tmpbuf, strlen(tmpbuf), &len );
#else
gtk_editable_insert_text( GTK_EDITABLE(m_text), tmp.mbc_str(), tmp.Length(), &len );
#endif
} }
else else
{ {
gtk_entry_set_text( GTK_ENTRY(m_text), tmp ); gtk_entry_set_text( GTK_ENTRY(m_text), tmp.mbc_str() );
} }
} }
void wxTextCtrl::WriteText( const wxString &text ) void wxTextCtrl::WriteText( const wxString &text )
{ {
wxCHECK_RET( m_text != NULL, "invalid text ctrl" ); wxCHECK_RET( m_text != NULL, _T("invalid text ctrl") );
if (text.IsNull()) return; if (text.IsNull()) return;
@@ -323,7 +333,12 @@ void wxTextCtrl::WriteText( const wxString &text )
/* this moves the cursor pos to behind the inserted text */ /* this moves the cursor pos to behind the inserted text */
gint len = GTK_EDITABLE(m_text)->current_pos; gint len = GTK_EDITABLE(m_text)->current_pos;
#if wxUSE_UNICODE
wxWX2MBbuf buf = text.mbc_str();
gtk_editable_insert_text( GTK_EDITABLE(m_text), buf, strlen(buf), &len );
#else
gtk_editable_insert_text( GTK_EDITABLE(m_text), text, text.Length(), &len ); gtk_editable_insert_text( GTK_EDITABLE(m_text), text, text.Length(), &len );
#endif
/* bring editable's cursor uptodate. bug in GTK. */ /* bring editable's cursor uptodate. bug in GTK. */
GTK_EDITABLE(m_text)->current_pos = gtk_text_get_point( GTK_TEXT(m_text) ); GTK_EDITABLE(m_text)->current_pos = gtk_text_get_point( GTK_TEXT(m_text) );
@@ -332,7 +347,12 @@ void wxTextCtrl::WriteText( const wxString &text )
{ {
/* this moves the cursor pos to behind the inserted text */ /* this moves the cursor pos to behind the inserted text */
gint len = GTK_EDITABLE(m_text)->current_pos; gint len = GTK_EDITABLE(m_text)->current_pos;
#if wxUSE_UNICODE
wxWX2MBbuf buf = text.mbc_str();
gtk_editable_insert_text( GTK_EDITABLE(m_text), buf, strlen(buf), &len );
#else
gtk_editable_insert_text( GTK_EDITABLE(m_text), text, text.Length(), &len ); gtk_editable_insert_text( GTK_EDITABLE(m_text), text, text.Length(), &len );
#endif
/* bring editable's cursor uptodate. bug in GTK. */ /* bring editable's cursor uptodate. bug in GTK. */
GTK_EDITABLE(m_text)->current_pos += text.Len(); GTK_EDITABLE(m_text)->current_pos += text.Len();
@@ -344,26 +364,31 @@ void wxTextCtrl::WriteText( const wxString &text )
void wxTextCtrl::AppendText( const wxString &text ) void wxTextCtrl::AppendText( const wxString &text )
{ {
wxCHECK_RET( m_text != NULL, "invalid text ctrl" ); wxCHECK_RET( m_text != NULL, _T("invalid text ctrl") );
if (m_windowStyle & wxTE_MULTILINE) if (m_windowStyle & wxTE_MULTILINE)
{ {
/* we'll insert at the last position */ /* we'll insert at the last position */
gint len = gtk_text_get_length( GTK_TEXT(m_text) ); gint len = gtk_text_get_length( GTK_TEXT(m_text) );
#if wxUSE_UNICODE
wxWX2MBbuf buf = text.mbc_str();
gtk_editable_insert_text( GTK_EDITABLE(m_text), buf, strlen(buf), &len );
#else
gtk_editable_insert_text( GTK_EDITABLE(m_text), text, text.Length(), &len ); gtk_editable_insert_text( GTK_EDITABLE(m_text), text, text.Length(), &len );
#endif
/* bring editable's cursor uptodate. bug in GTK. */ /* bring editable's cursor uptodate. bug in GTK. */
GTK_EDITABLE(m_text)->current_pos = gtk_text_get_point( GTK_TEXT(m_text) ); GTK_EDITABLE(m_text)->current_pos = gtk_text_get_point( GTK_TEXT(m_text) );
} }
else else
{ {
gtk_entry_append_text( GTK_ENTRY(m_text), text ); gtk_entry_append_text( GTK_ENTRY(m_text), text.mbc_str() );
} }
} }
bool wxTextCtrl::LoadFile( const wxString &file ) bool wxTextCtrl::LoadFile( const wxString &file )
{ {
wxCHECK_MSG( m_text != NULL, FALSE, "invalid text ctrl" ); wxCHECK_MSG( m_text != NULL, FALSE, _T("invalid text ctrl") );
if (!wxFileExists(file)) return FALSE; if (!wxFileExists(file)) return FALSE;
@@ -372,8 +397,8 @@ bool wxTextCtrl::LoadFile( const wxString &file )
FILE *fp = (FILE*) NULL; FILE *fp = (FILE*) NULL;
struct stat statb; struct stat statb;
if ((stat ((char*) (const char*) file, &statb) == -1) || (statb.st_mode & S_IFMT) != S_IFREG || if ((stat (FNSTRINGCAST file.fn_str(), &statb) == -1) || (statb.st_mode & S_IFMT) != S_IFREG ||
!(fp = fopen ((char*) (const char*) file, "r"))) !(fp = fopen (FNSTRINGCAST file.fn_str(), "r")))
{ {
return FALSE; return FALSE;
} }
@@ -412,13 +437,13 @@ bool wxTextCtrl::LoadFile( const wxString &file )
bool wxTextCtrl::SaveFile( const wxString &file ) bool wxTextCtrl::SaveFile( const wxString &file )
{ {
wxCHECK_MSG( m_text != NULL, FALSE, "invalid text ctrl" ); wxCHECK_MSG( m_text != NULL, FALSE, _T("invalid text ctrl") );
if (file == "") return FALSE; if (file == _T("")) return FALSE;
FILE *fp; FILE *fp;
if (!(fp = fopen ((char*) (const char*) file, "w"))) if (!(fp = fopen (FNSTRINGCAST file.fn_str(), "w")))
{ {
return FALSE; return FALSE;
} }
@@ -466,7 +491,7 @@ wxString wxTextCtrl::GetLineText( long lineNo ) const
if (text) if (text)
{ {
wxString buf(""); wxString buf(_T(""));
long i; long i;
int currentLine = 0; int currentLine = 0;
for (i = 0; currentLine != lineNo && text[i]; i++ ) for (i = 0; currentLine != lineNo && text[i]; i++ )
@@ -494,7 +519,7 @@ void wxTextCtrl::OnDropFiles( wxDropFilesEvent &WXUNUSED(event) )
{ {
/* If you implement this, don't forget to update the documentation! /* If you implement this, don't forget to update the documentation!
* (file docs/latex/wx/text.tex) */ * (file docs/latex/wx/text.tex) */
wxFAIL_MSG( "wxTextCtrl::OnDropFiles not implemented" ); wxFAIL_MSG( _T("wxTextCtrl::OnDropFiles not implemented") );
} }
long wxTextCtrl::PositionToXY(long pos, long *x, long *y ) const long wxTextCtrl::PositionToXY(long pos, long *x, long *y ) const
@@ -510,10 +535,10 @@ long wxTextCtrl::PositionToXY(long pos, long *x, long *y ) const
*x=0; // First Col *x=0; // First Col
*y=0; // First Line *y=0; // First Line
const char* stop = text.c_str() + pos; const wxChar* stop = text.c_str() + pos;
for ( const char *p = text.c_str(); p < stop; p++ ) for ( const wxChar *p = text.c_str(); p < stop; p++ )
{ {
if (*p == '\n') if (*p == _T('\n'))
{ {
(*y)++; (*y)++;
*x=0; *x=0;
@@ -589,7 +614,7 @@ int wxTextCtrl::GetNumberOfLines() const
void wxTextCtrl::SetInsertionPoint( long pos ) void wxTextCtrl::SetInsertionPoint( long pos )
{ {
wxCHECK_RET( m_text != NULL, "invalid text ctrl" ); wxCHECK_RET( m_text != NULL, _T("invalid text ctrl") );
if (m_windowStyle & wxTE_MULTILINE) if (m_windowStyle & wxTE_MULTILINE)
{ {
@@ -626,7 +651,7 @@ void wxTextCtrl::SetInsertionPoint( long pos )
void wxTextCtrl::SetInsertionPointEnd() void wxTextCtrl::SetInsertionPointEnd()
{ {
wxCHECK_RET( m_text != NULL, "invalid text ctrl" ); wxCHECK_RET( m_text != NULL, _T("invalid text ctrl") );
if (m_windowStyle & wxTE_MULTILINE) if (m_windowStyle & wxTE_MULTILINE)
SetInsertionPoint(gtk_text_get_length(GTK_TEXT(m_text))); SetInsertionPoint(gtk_text_get_length(GTK_TEXT(m_text)));
@@ -636,7 +661,7 @@ void wxTextCtrl::SetInsertionPointEnd()
void wxTextCtrl::SetEditable( bool editable ) void wxTextCtrl::SetEditable( bool editable )
{ {
wxCHECK_RET( m_text != NULL, "invalid text ctrl" ); wxCHECK_RET( m_text != NULL, _T("invalid text ctrl") );
if (m_windowStyle & wxTE_MULTILINE) if (m_windowStyle & wxTE_MULTILINE)
gtk_text_set_editable( GTK_TEXT(m_text), editable ); gtk_text_set_editable( GTK_TEXT(m_text), editable );
@@ -646,26 +671,26 @@ void wxTextCtrl::SetEditable( bool editable )
void wxTextCtrl::SetSelection( long from, long to ) void wxTextCtrl::SetSelection( long from, long to )
{ {
wxCHECK_RET( m_text != NULL, "invalid text ctrl" ); wxCHECK_RET( m_text != NULL, _T("invalid text ctrl") );
gtk_editable_select_region( GTK_EDITABLE(m_text), (gint)from, (gint)to ); gtk_editable_select_region( GTK_EDITABLE(m_text), (gint)from, (gint)to );
} }
void wxTextCtrl::ShowPosition( long WXUNUSED(pos) ) void wxTextCtrl::ShowPosition( long WXUNUSED(pos) )
{ {
wxFAIL_MSG( "wxTextCtrl::ShowPosition not implemented" ); wxFAIL_MSG( _T("wxTextCtrl::ShowPosition not implemented") );
} }
long wxTextCtrl::GetInsertionPoint() const long wxTextCtrl::GetInsertionPoint() const
{ {
wxCHECK_MSG( m_text != NULL, 0, "invalid text ctrl" ); wxCHECK_MSG( m_text != NULL, 0, _T("invalid text ctrl") );
return (long) GTK_EDITABLE(m_text)->current_pos; return (long) GTK_EDITABLE(m_text)->current_pos;
} }
long wxTextCtrl::GetLastPosition() const long wxTextCtrl::GetLastPosition() const
{ {
wxCHECK_MSG( m_text != NULL, 0, "invalid text ctrl" ); wxCHECK_MSG( m_text != NULL, 0, _T("invalid text ctrl") );
int pos = 0; int pos = 0;
if (m_windowStyle & wxTE_MULTILINE) if (m_windowStyle & wxTE_MULTILINE)
@@ -678,24 +703,29 @@ long wxTextCtrl::GetLastPosition() const
void wxTextCtrl::Remove( long from, long to ) void wxTextCtrl::Remove( long from, long to )
{ {
wxCHECK_RET( m_text != NULL, "invalid text ctrl" ); wxCHECK_RET( m_text != NULL, _T("invalid text ctrl") );
gtk_editable_delete_text( GTK_EDITABLE(m_text), (gint)from, (gint)to ); gtk_editable_delete_text( GTK_EDITABLE(m_text), (gint)from, (gint)to );
} }
void wxTextCtrl::Replace( long from, long to, const wxString &value ) void wxTextCtrl::Replace( long from, long to, const wxString &value )
{ {
wxCHECK_RET( m_text != NULL, "invalid text ctrl" ); wxCHECK_RET( m_text != NULL, _T("invalid text ctrl") );
gtk_editable_delete_text( GTK_EDITABLE(m_text), (gint)from, (gint)to ); gtk_editable_delete_text( GTK_EDITABLE(m_text), (gint)from, (gint)to );
if (value.IsNull()) return; if (value.IsNull()) return;
gint pos = (gint)from; gint pos = (gint)from;
#if wxUSE_UNICODE
wxWX2MBbuf buf = value.mbc_str();
gtk_editable_insert_text( GTK_EDITABLE(m_text), buf, strlen(buf), &pos );
#else
gtk_editable_insert_text( GTK_EDITABLE(m_text), value, value.Length(), &pos ); gtk_editable_insert_text( GTK_EDITABLE(m_text), value, value.Length(), &pos );
#endif
} }
void wxTextCtrl::Cut() void wxTextCtrl::Cut()
{ {
wxCHECK_RET( m_text != NULL, "invalid text ctrl" ); wxCHECK_RET( m_text != NULL, _T("invalid text ctrl") );
#if (GTK_MINOR_VERSION > 0) #if (GTK_MINOR_VERSION > 0)
gtk_editable_cut_clipboard( GTK_EDITABLE(m_text) ); gtk_editable_cut_clipboard( GTK_EDITABLE(m_text) );
@@ -706,7 +736,7 @@ void wxTextCtrl::Cut()
void wxTextCtrl::Copy() void wxTextCtrl::Copy()
{ {
wxCHECK_RET( m_text != NULL, "invalid text ctrl" ); wxCHECK_RET( m_text != NULL, _T("invalid text ctrl") );
#if (GTK_MINOR_VERSION > 0) #if (GTK_MINOR_VERSION > 0)
gtk_editable_copy_clipboard( GTK_EDITABLE(m_text) ); gtk_editable_copy_clipboard( GTK_EDITABLE(m_text) );
@@ -717,7 +747,7 @@ void wxTextCtrl::Copy()
void wxTextCtrl::Paste() void wxTextCtrl::Paste()
{ {
wxCHECK_RET( m_text != NULL, "invalid text ctrl" ); wxCHECK_RET( m_text != NULL, _T("invalid text ctrl") );
#if (GTK_MINOR_VERSION > 0) #if (GTK_MINOR_VERSION > 0)
gtk_editable_paste_clipboard( GTK_EDITABLE(m_text) ); gtk_editable_paste_clipboard( GTK_EDITABLE(m_text) );
@@ -751,26 +781,26 @@ bool wxTextCtrl::CanPaste() const
void wxTextCtrl::Undo() void wxTextCtrl::Undo()
{ {
// TODO // TODO
wxFAIL_MSG( "wxTextCtrl::Undo not implemented" ); wxFAIL_MSG( _T("wxTextCtrl::Undo not implemented") );
} }
void wxTextCtrl::Redo() void wxTextCtrl::Redo()
{ {
// TODO // TODO
wxFAIL_MSG( "wxTextCtrl::Redo not implemented" ); wxFAIL_MSG( _T("wxTextCtrl::Redo not implemented") );
} }
bool wxTextCtrl::CanUndo() const bool wxTextCtrl::CanUndo() const
{ {
// TODO // TODO
wxFAIL_MSG( "wxTextCtrl::CanUndo not implemented" ); wxFAIL_MSG( _T("wxTextCtrl::CanUndo not implemented") );
return FALSE; return FALSE;
} }
bool wxTextCtrl::CanRedo() const bool wxTextCtrl::CanRedo() const
{ {
// TODO // TODO
wxFAIL_MSG( "wxTextCtrl::CanRedo not implemented" ); wxFAIL_MSG( _T("wxTextCtrl::CanRedo not implemented") );
return FALSE; return FALSE;
} }
@@ -781,24 +811,24 @@ void wxTextCtrl::GetSelection(long* from, long* to) const
// TODO // TODO
*from = 0; *from = 0;
*to = 0; *to = 0;
wxFAIL_MSG( "wxTextCtrl::GetSelection not implemented" ); wxFAIL_MSG( _T("wxTextCtrl::GetSelection not implemented") );
} }
bool wxTextCtrl::IsEditable() const bool wxTextCtrl::IsEditable() const
{ {
// TODO // TODO
wxFAIL_MSG( "wxTextCtrl::IsEditable not implemented" ); wxFAIL_MSG( _T("wxTextCtrl::IsEditable not implemented") );
return FALSE; return FALSE;
} }
void wxTextCtrl::Clear() void wxTextCtrl::Clear()
{ {
SetValue( "" ); SetValue( _T("") );
} }
void wxTextCtrl::OnChar( wxKeyEvent &key_event ) void wxTextCtrl::OnChar( wxKeyEvent &key_event )
{ {
wxCHECK_RET( m_text != NULL, "invalid text ctrl" ); wxCHECK_RET( m_text != NULL, _T("invalid text ctrl") );
if ((key_event.KeyCode() == WXK_RETURN) && (m_windowStyle & wxPROCESS_ENTER)) if ((key_event.KeyCode() == WXK_RETURN) && (m_windowStyle & wxPROCESS_ENTER))
{ {
@@ -904,21 +934,21 @@ bool wxTextCtrl::IsOwnGtkWindow( GdkWindow *window )
void wxTextCtrl::SetFont( const wxFont &WXUNUSED(font) ) void wxTextCtrl::SetFont( const wxFont &WXUNUSED(font) )
{ {
wxCHECK_RET( m_text != NULL, "invalid text ctrl" ); wxCHECK_RET( m_text != NULL, _T("invalid text ctrl") );
// doesn't work // doesn't work
} }
void wxTextCtrl::SetForegroundColour( const wxColour &WXUNUSED(colour) ) void wxTextCtrl::SetForegroundColour( const wxColour &WXUNUSED(colour) )
{ {
wxCHECK_RET( m_text != NULL, "invalid text ctrl" ); wxCHECK_RET( m_text != NULL, _T("invalid text ctrl") );
// doesn't work // doesn't work
} }
void wxTextCtrl::SetBackgroundColour( const wxColour &colour ) void wxTextCtrl::SetBackgroundColour( const wxColour &colour )
{ {
wxCHECK_RET( m_text != NULL, "invalid text ctrl" ); wxCHECK_RET( m_text != NULL, _T("invalid text ctrl") );
wxControl::SetBackgroundColour( colour ); wxControl::SetBackgroundColour( colour );

View File

@@ -69,7 +69,7 @@ void wxToolTip::Apply( wxWindow *win )
m_window = win; m_window = win;
if (m_text.IsEmpty()) if (m_text.IsEmpty())
m_window->ApplyToolTip( ss_tooltips, (char*) NULL ); m_window->ApplyToolTip( ss_tooltips, (wxChar*) NULL );
else else
m_window->ApplyToolTip( ss_tooltips, m_text ); m_window->ApplyToolTip( ss_tooltips, m_text );
} }

View File

@@ -39,9 +39,9 @@
// Yuck this is really BOTH site and platform dependent // Yuck this is really BOTH site and platform dependent
// so we should use some other strategy! // so we should use some other strategy!
#ifdef __SUN__ #ifdef __SUN__
#define DEFAULT_XRESOURCE_DIR "/usr/openwin/lib/app-defaults" #define DEFAULT_XRESOURCE_DIR _T("/usr/openwin/lib/app-defaults")
#else #else
#define DEFAULT_XRESOURCE_DIR "/usr/lib/X11/app-defaults" #define DEFAULT_XRESOURCE_DIR _T("/usr/lib/X11/app-defaults")
#endif #endif
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
@@ -55,26 +55,26 @@ extern XrmDatabase wxResourceDatabase;
// utility functions for get/write resources // utility functions for get/write resources
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
static char *GetResourcePath(char *buf, char *name, bool create) static wxChar *GetResourcePath(wxChar *buf, wxChar *name, bool create)
{ {
if (create && FileExists(name)) if (create && FileExists(name))
{ {
strcpy(buf, name); wxStrcpy(buf, name);
return buf; // Exists so ... return buf; // Exists so ...
} }
if (*name == '/') if (*name == _T('/'))
strcpy(buf, name); wxStrcpy(buf, name);
else else
{ {
// Put in standard place for resource files if not absolute // Put in standard place for resource files if not absolute
strcpy(buf, DEFAULT_XRESOURCE_DIR); wxStrcpy(buf, DEFAULT_XRESOURCE_DIR);
strcat(buf, "/"); wxStrcat(buf, _T("/"));
strcat(buf, FileNameFromPath(name)); wxStrcat(buf, FileNameFromPath(name));
} }
if (create) if (create)
{ {
// Touch the file to create it // Touch the file to create it
FILE *fd = fopen(buf, "w"); FILE *fd = fopen(wxConv_file.cWX2MB(buf), "w");
if (fd) fclose(fd); if (fd) fclose(fd);
} }
return buf; return buf;
@@ -83,30 +83,30 @@ static char *GetResourcePath(char *buf, char *name, bool create)
// Read $HOME for what it says is home, if not // Read $HOME for what it says is home, if not
// read $USER or $LOGNAME for user name else determine // read $USER or $LOGNAME for user name else determine
// the Real User, then determine the Real home dir. // the Real User, then determine the Real home dir.
static char *GetIniFile(char *dest, const char *filename) static wxChar *GetIniFile(wxChar *dest, const wxChar *filename)
{ {
char *home = (char *) NULL; wxChar *home = (wxChar *) NULL;
if (filename && wxIsAbsolutePath(filename)) if (filename && wxIsAbsolutePath(filename))
{ {
strcpy(dest, filename); wxStrcpy(dest, filename);
} }
else else
{ {
if ((home = wxGetUserHome(wxString())) != NULL) if ((home = wxGetUserHome(wxString())) != NULL)
{ {
strcpy(dest, home); wxStrcpy(dest, home);
if (dest[strlen(dest) - 1] != '/') strcat(dest, "/"); if (dest[wxStrlen(dest) - 1] != _T('/')) wxStrcat(dest, _T("/"));
if (filename == NULL) if (filename == NULL)
{ {
if ((filename = getenv("XENVIRONMENT")) == NULL) filename = ".Xdefaults"; if ((filename = wxGetenv(_T("XENVIRONMENT"))) == NULL) filename = _T(".Xdefaults");
} }
else else
if (*filename != '.') strcat(dest, "."); if (*filename != _T('.')) wxStrcat(dest, _T("."));
strcat(dest, filename); wxStrcat(dest, filename);
} }
else else
{ {
dest[0] = '\0'; dest[0] = _T('\0');
} }
} }
return dest; return dest;
@@ -115,10 +115,10 @@ static char *GetIniFile(char *dest, const char *filename)
static void wxXMergeDatabases() static void wxXMergeDatabases()
{ {
XrmDatabase homeDB, serverDB, applicationDB; XrmDatabase homeDB, serverDB, applicationDB;
char filenamebuf[1024]; wxChar filenamebuf[1024];
char *filename = &filenamebuf[0]; wxChar *filename = &filenamebuf[0];
char *environment; wxChar *environment;
char *classname = gdk_progclass; // Robert Roebling ?? char *classname = gdk_progclass; // Robert Roebling ??
char name[256]; char name[256];
(void)strcpy(name, "/usr/lib/X11/app-defaults/"); (void)strcpy(name, "/usr/lib/X11/app-defaults/");
@@ -138,8 +138,8 @@ static void wxXMergeDatabases()
} }
else else
{ {
(void)GetIniFile(filename, (char *) NULL); (void)GetIniFile(filename, (wxChar *) NULL);
serverDB = XrmGetFileDatabase(filename); serverDB = XrmGetFileDatabase(wxConv_file.cWX2MB(filename));
} }
if (serverDB) if (serverDB)
XrmMergeDatabases(serverDB, &wxResourceDatabase); XrmMergeDatabases(serverDB, &wxResourceDatabase);
@@ -147,18 +147,32 @@ static void wxXMergeDatabases()
// Open XENVIRONMENT file, or if not defined, the .Xdefaults, // Open XENVIRONMENT file, or if not defined, the .Xdefaults,
// and merge into existing database // and merge into existing database
if ((environment = getenv("XENVIRONMENT")) == NULL) if ((environment = wxGetenv(_T("XENVIRONMENT"))) == NULL)
{ {
size_t len; size_t len;
environment = GetIniFile(filename, (const char *) NULL); #if wxUSE_UNICODE
len = strlen(environment); char hostbuf[1024];
#endif
environment = GetIniFile(filename, (const wxChar *) NULL);
len = wxStrlen(environment);
#if !defined(SVR4) || defined(__sgi) #if !defined(SVR4) || defined(__sgi)
#if wxUSE_UNICODE
(void)gethostname(hostbuf, 1024 - len);
#else
(void)gethostname(environment + len, 1024 - len); (void)gethostname(environment + len, 1024 - len);
#endif
#else
#if wxUSE_UNICODE
(void)sysinfo(SI_HOSTNAME, hostbuf, 1024 - len);
#else #else
(void)sysinfo(SI_HOSTNAME, environment + len, 1024 - len); (void)sysinfo(SI_HOSTNAME, environment + len, 1024 - len);
#endif
#endif
#if wxUSE_UNICODE
wxStrcat(environment, wxConv_libc.cMB2WX(hostbuf));
#endif #endif
} }
if ((homeDB = XrmGetFileDatabase(environment))) if ((homeDB = XrmGetFileDatabase(wxConv_file.cWX2MB(environment))))
XrmMergeDatabases(homeDB, &wxResourceDatabase); XrmMergeDatabases(homeDB, &wxResourceDatabase);
} }
@@ -168,17 +182,17 @@ static void wxXMergeDatabases()
void wxFlushResources() void wxFlushResources()
{ {
char nameBuffer[512]; wxChar nameBuffer[512];
wxNode *node = wxTheResourceCache->First(); wxNode *node = wxTheResourceCache->First();
while (node) { while (node) {
wxString str = node->GetKeyString(); wxString str = node->GetKeyString();
char *file = WXSTRINGCAST str; wxChar *file = WXSTRINGCAST str;
// If file doesn't exist, create it first. // If file doesn't exist, create it first.
(void)GetResourcePath(nameBuffer, file, TRUE); (void)GetResourcePath(nameBuffer, file, TRUE);
XrmDatabase database = (XrmDatabase)node->Data(); XrmDatabase database = (XrmDatabase)node->Data();
XrmPutFileDatabase(database, nameBuffer); XrmPutFileDatabase(database, wxConv_file.cWX2MB(nameBuffer));
XrmDestroyDatabase(database); XrmDestroyDatabase(database);
wxNode *next = node->Next(); wxNode *next = node->Next();
// delete node; // delete node;
@@ -186,10 +200,10 @@ void wxFlushResources()
} }
} }
void wxDeleteResources(const char *file) void wxDeleteResources(const wxChar *file)
{ {
wxLogTrace(wxTraceResAlloc, "Delete: Number = %d", wxTheResourceCache->Number()); wxLogTrace(wxTraceResAlloc, _T("Delete: Number = %d"), wxTheResourceCache->Number());
char buffer[500]; wxChar buffer[500];
(void)GetIniFile(buffer, file); (void)GetIniFile(buffer, file);
wxNode *node = wxTheResourceCache->Find(buffer); wxNode *node = wxTheResourceCache->Find(buffer);
@@ -206,7 +220,7 @@ void wxDeleteResources(const char *file)
bool wxWriteResource(const wxString& section, const wxString& entry, const wxString& value, const wxString& file ) bool wxWriteResource(const wxString& section, const wxString& entry, const wxString& value, const wxString& file )
{ {
char buffer[500]; wxChar buffer[500];
if (!entry) return FALSE; if (!entry) return FALSE;
@@ -217,15 +231,15 @@ bool wxWriteResource(const wxString& section, const wxString& entry, const wxStr
if (node) if (node)
database = (XrmDatabase)node->Data(); database = (XrmDatabase)node->Data();
else { else {
database = XrmGetFileDatabase(buffer); database = XrmGetFileDatabase(wxConv_file.cWX2MB(buffer));
wxLogTrace(wxTraceResAlloc, "Write: Number = %d", wxTheResourceCache->Number()); wxLogTrace(wxTraceResAlloc, _T("Write: Number = %d"), wxTheResourceCache->Number());
wxTheResourceCache->Append(buffer, (wxObject *)database); wxTheResourceCache->Append(buffer, (wxObject *)database);
} }
char resName[300]; char resName[300];
strcpy(resName, !section.IsNull() ? WXSTRINGCAST section : "wxWindows"); strcpy(resName, !section.IsNull() ? MBSTRINGCAST section.mb_str() : "wxWindows");
strcat(resName, "."); strcat(resName, ".");
strcat(resName, entry); strcat(resName, entry.mb_str());
XrmPutStringResource(&database, resName, value); XrmPutStringResource(&database, resName, value.mb_str());
return TRUE; return TRUE;
}; };
@@ -258,7 +272,7 @@ bool wxGetResource(const wxString& section, const wxString& entry, char **value,
XrmDatabase database; XrmDatabase database;
if (!file.IsEmpty()) if (!file.IsEmpty())
{ {
char buffer[500]; wxChar buffer[500];
// Is this right? Trying to get it to look in the user's // Is this right? Trying to get it to look in the user's
// home directory instead of current directory -- JACS // home directory instead of current directory -- JACS
(void)GetIniFile(buffer, file); (void)GetIniFile(buffer, file);
@@ -271,8 +285,8 @@ bool wxGetResource(const wxString& section, const wxString& entry, char **value,
} }
else else
{ {
database = XrmGetFileDatabase(buffer); database = XrmGetFileDatabase(wxConv_file.cWX2MB(buffer));
wxLogTrace(wxTraceResAlloc, "Get: Number = %d", wxTheResourceCache->Number()); wxLogTrace(wxTraceResAlloc, _T("Get: Number = %d"), wxTheResourceCache->Number());
wxTheResourceCache->Append(buffer, (wxObject *)database); wxTheResourceCache->Append(buffer, (wxObject *)database);
} }
} else } else
@@ -281,9 +295,9 @@ bool wxGetResource(const wxString& section, const wxString& entry, char **value,
XrmValue xvalue; XrmValue xvalue;
char *str_type[20]; char *str_type[20];
char buf[150]; char buf[150];
strcpy(buf, section); strcpy(buf, section.mb_str());
strcat(buf, "."); strcat(buf, ".");
strcat(buf, entry); strcat(buf, entry.mb_str());
bool success = XrmGetResource(database, buf, "*", str_type, &xvalue); bool success = XrmGetResource(database, buf, "*", str_type, &xvalue);
// Try different combinations of upper/lower case, just in case... // Try different combinations of upper/lower case, just in case...

View File

@@ -1434,7 +1434,7 @@ bool wxWindow::Create( wxWindow *parent, wxWindowID id,
const wxPoint &pos, const wxSize &size, const wxPoint &pos, const wxSize &size,
long style, const wxString &name ) long style, const wxString &name )
{ {
wxASSERT_MSG( m_isWindow, "Init() must have been called before!" ); wxASSERT_MSG( m_isWindow, _T("Init() must have been called before!") );
PreCreation( parent, id, pos, size, style, name ); PreCreation( parent, id, pos, size, style, name );
@@ -1641,7 +1641,7 @@ void wxWindow::PreCreation( wxWindow *parent, wxWindowID id,
const wxPoint &pos, const wxSize &size, const wxPoint &pos, const wxSize &size,
long style, const wxString &name ) long style, const wxString &name )
{ {
wxASSERT_MSG( (!m_needParent) || (parent), "Need complete parent." ); wxASSERT_MSG( (!m_needParent) || (parent), _T("Need complete parent.") );
m_widget = (GtkWidget*) NULL; m_widget = (GtkWidget*) NULL;
m_wxwindow = (GtkWidget*) NULL; m_wxwindow = (GtkWidget*) NULL;
@@ -1727,7 +1727,7 @@ void wxWindow::PreCreation( wxWindow *parent, wxWindowID id,
void wxWindow::PostCreation() void wxWindow::PostCreation()
{ {
wxASSERT_MSG( (m_widget != NULL), "invalid window" ); wxASSERT_MSG( (m_widget != NULL), _T("invalid window") );
if (m_wxwindow) if (m_wxwindow)
{ {
@@ -1797,7 +1797,7 @@ bool wxWindow::HasVMT()
bool wxWindow::Close( bool force ) bool wxWindow::Close( bool force )
{ {
wxASSERT_MSG( (m_widget != NULL), "invalid window" ); wxASSERT_MSG( (m_widget != NULL), _T("invalid window") );
wxCloseEvent event(wxEVT_CLOSE_WINDOW, m_windowId); wxCloseEvent event(wxEVT_CLOSE_WINDOW, m_windowId);
event.SetEventObject(this); event.SetEventObject(this);
@@ -1810,7 +1810,7 @@ bool wxWindow::Close( bool force )
bool wxWindow::Destroy() bool wxWindow::Destroy()
{ {
wxASSERT_MSG( (m_widget != NULL), "invalid window" ); wxASSERT_MSG( (m_widget != NULL), _T("invalid window") );
m_hasVMT = FALSE; m_hasVMT = FALSE;
delete this; delete this;
@@ -1839,8 +1839,8 @@ void wxWindow::PrepareDC( wxDC &WXUNUSED(dc) )
void wxWindow::DoSetSize( int x, int y, int width, int height, int sizeFlags ) void wxWindow::DoSetSize( int x, int y, int width, int height, int sizeFlags )
{ {
wxASSERT_MSG( (m_widget != NULL), "invalid window" ); wxASSERT_MSG( (m_widget != NULL), _T("invalid window") );
wxASSERT_MSG( (m_parent != NULL), "wxWindow::SetSize requires parent.\n" ); wxASSERT_MSG( (m_parent != NULL), _T("wxWindow::SetSize requires parent.\n") );
if (m_resizing) return; /* I don't like recursions */ if (m_resizing) return; /* I don't like recursions */
m_resizing = TRUE; m_resizing = TRUE;
@@ -1922,7 +1922,7 @@ void wxWindow::OnInternalIdle()
void wxWindow::GetSize( int *width, int *height ) const void wxWindow::GetSize( int *width, int *height ) const
{ {
wxCHECK_RET( (m_widget != NULL), "invalid window" ); wxCHECK_RET( (m_widget != NULL), _T("invalid window") );
if (width) (*width) = m_width; if (width) (*width) = m_width;
if (height) (*height) = m_height; if (height) (*height) = m_height;
@@ -1930,7 +1930,7 @@ void wxWindow::GetSize( int *width, int *height ) const
void wxWindow::DoSetClientSize( int width, int height ) void wxWindow::DoSetClientSize( int width, int height )
{ {
wxCHECK_RET( (m_widget != NULL), "invalid window" ); wxCHECK_RET( (m_widget != NULL), _T("invalid window") );
if (!m_wxwindow) if (!m_wxwindow)
{ {
@@ -1995,7 +1995,7 @@ void wxWindow::DoSetClientSize( int width, int height )
void wxWindow::GetClientSize( int *width, int *height ) const void wxWindow::GetClientSize( int *width, int *height ) const
{ {
wxCHECK_RET( (m_widget != NULL), "invalid window" ); wxCHECK_RET( (m_widget != NULL), _T("invalid window") );
if (!m_wxwindow) if (!m_wxwindow)
{ {
@@ -2061,7 +2061,7 @@ void wxWindow::GetClientSize( int *width, int *height ) const
void wxWindow::GetPosition( int *x, int *y ) const void wxWindow::GetPosition( int *x, int *y ) const
{ {
wxCHECK_RET( (m_widget != NULL), "invalid window" ); wxCHECK_RET( (m_widget != NULL), _T("invalid window") );
if (x) (*x) = m_x; if (x) (*x) = m_x;
if (y) (*y) = m_y; if (y) (*y) = m_y;
@@ -2069,7 +2069,7 @@ void wxWindow::GetPosition( int *x, int *y ) const
void wxWindow::ClientToScreen( int *x, int *y ) void wxWindow::ClientToScreen( int *x, int *y )
{ {
wxCHECK_RET( (m_widget != NULL), "invalid window" ); wxCHECK_RET( (m_widget != NULL), _T("invalid window") );
GdkWindow *source = (GdkWindow *) NULL; GdkWindow *source = (GdkWindow *) NULL;
if (m_wxwindow) if (m_wxwindow)
@@ -2096,7 +2096,7 @@ void wxWindow::ClientToScreen( int *x, int *y )
void wxWindow::ScreenToClient( int *x, int *y ) void wxWindow::ScreenToClient( int *x, int *y )
{ {
wxCHECK_RET( (m_widget != NULL), "invalid window" ); wxCHECK_RET( (m_widget != NULL), _T("invalid window") );
GdkWindow *source = (GdkWindow *) NULL; GdkWindow *source = (GdkWindow *) NULL;
if (m_wxwindow) if (m_wxwindow)
@@ -2123,7 +2123,7 @@ void wxWindow::ScreenToClient( int *x, int *y )
void wxWindow::Centre( int direction ) void wxWindow::Centre( int direction )
{ {
wxCHECK_RET( (m_widget != NULL), "invalid window" ); wxCHECK_RET( (m_widget != NULL), _T("invalid window") );
int x = m_x; int x = m_x;
int y = m_y; int y = m_y;
@@ -2147,7 +2147,7 @@ void wxWindow::Centre( int direction )
void wxWindow::Fit() void wxWindow::Fit()
{ {
wxCHECK_RET( (m_widget != NULL), "invalid window" ); wxCHECK_RET( (m_widget != NULL), _T("invalid window") );
int maxX = 0; int maxX = 0;
int maxY = 0; int maxY = 0;
@@ -2169,7 +2169,7 @@ void wxWindow::Fit()
void wxWindow::SetSizeHints( int minW, int minH, int maxW, int maxH, int WXUNUSED(incW), int WXUNUSED(incH) ) void wxWindow::SetSizeHints( int minW, int minH, int maxW, int maxH, int WXUNUSED(incW), int WXUNUSED(incH) )
{ {
wxCHECK_RET( (m_widget != NULL), "invalid window" ); wxCHECK_RET( (m_widget != NULL), _T("invalid window") );
m_minWidth = minW; m_minWidth = minW;
m_minHeight = minH; m_minHeight = minH;
@@ -2184,7 +2184,7 @@ void wxWindow::OnSize( wxSizeEvent &WXUNUSED(event) )
bool wxWindow::Show( bool show ) bool wxWindow::Show( bool show )
{ {
wxCHECK_MSG( (m_widget != NULL), FALSE, "invalid window" ); wxCHECK_MSG( (m_widget != NULL), FALSE, _T("invalid window") );
if (show == m_isShown) return TRUE; if (show == m_isShown) return TRUE;
@@ -2200,7 +2200,7 @@ bool wxWindow::Show( bool show )
void wxWindow::Enable( bool enable ) void wxWindow::Enable( bool enable )
{ {
wxCHECK_RET( (m_widget != NULL), "invalid window" ); wxCHECK_RET( (m_widget != NULL), _T("invalid window") );
m_isEnabled = enable; m_isEnabled = enable;
@@ -2210,9 +2210,9 @@ void wxWindow::Enable( bool enable )
int wxWindow::GetCharHeight() const int wxWindow::GetCharHeight() const
{ {
wxCHECK_MSG( (m_widget != NULL), 12, "invalid window" ); wxCHECK_MSG( (m_widget != NULL), 12, _T("invalid window") );
wxCHECK_MSG( m_font.Ok(), 12, "invalid font" ); wxCHECK_MSG( m_font.Ok(), 12, _T("invalid font") );
GdkFont *font = m_font.GetInternalFont( 1.0 ); GdkFont *font = m_font.GetInternalFont( 1.0 );
@@ -2221,9 +2221,9 @@ int wxWindow::GetCharHeight() const
int wxWindow::GetCharWidth() const int wxWindow::GetCharWidth() const
{ {
wxCHECK_MSG( (m_widget != NULL), 8, "invalid window" ); wxCHECK_MSG( (m_widget != NULL), 8, _T("invalid window") );
wxCHECK_MSG( m_font.Ok(), 8, "invalid font" ); wxCHECK_MSG( m_font.Ok(), 8, _T("invalid font") );
GdkFont *font = m_font.GetInternalFont( 1.0 ); GdkFont *font = m_font.GetInternalFont( 1.0 );
@@ -2236,10 +2236,10 @@ void wxWindow::GetTextExtent( const wxString& string, int *x, int *y,
wxFont fontToUse = m_font; wxFont fontToUse = m_font;
if (theFont) fontToUse = *theFont; if (theFont) fontToUse = *theFont;
wxCHECK_RET( fontToUse.Ok(), "invalid font" ); wxCHECK_RET( fontToUse.Ok(), _T("invalid font") );
GdkFont *font = fontToUse.GetInternalFont( 1.0 ); GdkFont *font = fontToUse.GetInternalFont( 1.0 );
if (x) (*x) = gdk_string_width( font, string ); if (x) (*x) = gdk_string_width( font, string.mbc_str() );
if (y) (*y) = font->ascent + font->descent; if (y) (*y) = font->ascent + font->descent;
if (descent) (*descent) = font->descent; if (descent) (*descent) = font->descent;
if (externalLeading) (*externalLeading) = 0; // ?? if (externalLeading) (*externalLeading) = 0; // ??
@@ -2275,7 +2275,7 @@ void wxWindow::OnKeyDown( wxKeyEvent &event )
void wxWindow::SetFocus() void wxWindow::SetFocus()
{ {
wxCHECK_RET( (m_widget != NULL), "invalid window" ); wxCHECK_RET( (m_widget != NULL), _T("invalid window") );
GtkWidget *connect_widget = GetConnectWidget(); GtkWidget *connect_widget = GetConnectWidget();
if (connect_widget) if (connect_widget)
@@ -2306,15 +2306,15 @@ bool wxWindow::AcceptsFocus() const
void wxWindow::AddChild( wxWindow *child ) void wxWindow::AddChild( wxWindow *child )
{ {
wxCHECK_RET( (m_widget != NULL), "invalid window" ); wxCHECK_RET( (m_widget != NULL), _T("invalid window") );
wxCHECK_RET( (child != NULL), "invalid child" ); wxCHECK_RET( (child != NULL), _T("invalid child") );
m_children.Append( child ); m_children.Append( child );
} }
wxWindow *wxWindow::ReParent( wxWindow *newParent ) wxWindow *wxWindow::ReParent( wxWindow *newParent )
{ {
wxCHECK_MSG( (m_widget != NULL), (wxWindow*) NULL, "invalid window" ); wxCHECK_MSG( (m_widget != NULL), (wxWindow*) NULL, _T("invalid window") );
wxWindow *oldParent = GetParent(); wxWindow *oldParent = GetParent();
@@ -2349,14 +2349,14 @@ int wxWindow::GetReturnCode()
void wxWindow::Raise() void wxWindow::Raise()
{ {
wxCHECK_RET( (m_widget != NULL), "invalid window" ); wxCHECK_RET( (m_widget != NULL), _T("invalid window") );
if (m_widget) gdk_window_raise( m_widget->window ); if (m_widget) gdk_window_raise( m_widget->window );
} }
void wxWindow::Lower() void wxWindow::Lower()
{ {
wxCHECK_RET( (m_widget != NULL), "invalid window" ); wxCHECK_RET( (m_widget != NULL), _T("invalid window") );
if (m_widget) gdk_window_lower( m_widget->window ); if (m_widget) gdk_window_lower( m_widget->window );
} }
@@ -2447,7 +2447,7 @@ wxWindowID wxWindow::GetId() const
void wxWindow::SetCursor( const wxCursor &cursor ) void wxWindow::SetCursor( const wxCursor &cursor )
{ {
wxCHECK_RET( (m_widget != NULL), "invalid window" ); wxCHECK_RET( (m_widget != NULL), _T("invalid window") );
if (cursor.Ok()) if (cursor.Ok())
{ {
@@ -2473,7 +2473,7 @@ void wxWindow::WarpPointer( int WXUNUSED(x), int WXUNUSED(y) )
void wxWindow::Refresh( bool eraseBackground, const wxRect *rect ) void wxWindow::Refresh( bool eraseBackground, const wxRect *rect )
{ {
wxCHECK_RET( (m_widget != NULL), "invalid window" ); wxCHECK_RET( (m_widget != NULL), _T("invalid window") );
if (eraseBackground && m_wxwindow && m_wxwindow->window) if (eraseBackground && m_wxwindow && m_wxwindow->window)
{ {
@@ -2538,7 +2538,7 @@ bool wxWindow::IsExposed( const wxRect& rect ) const
void wxWindow::Clear() void wxWindow::Clear()
{ {
wxCHECK_RET( m_widget != NULL, "invalid window" ); wxCHECK_RET( m_widget != NULL, _T("invalid window") );
if (m_wxwindow && m_wxwindow->window) if (m_wxwindow && m_wxwindow->window)
{ {
@@ -2576,9 +2576,9 @@ void wxWindow::SetToolTip( wxToolTip *tip )
m_toolTip->Apply( this ); m_toolTip->Apply( this );
} }
void wxWindow::ApplyToolTip( GtkTooltips *tips, const char *tip ) void wxWindow::ApplyToolTip( GtkTooltips *tips, const wxChar *tip )
{ {
gtk_tooltips_set_tip( tips, GetConnectWidget(), tip, (gchar*) NULL ); gtk_tooltips_set_tip( tips, GetConnectWidget(), wxConv_current->cWX2MB(tip), (gchar*) NULL );
} }
#endif // wxUSE_TOOLTIPS #endif // wxUSE_TOOLTIPS
@@ -2589,7 +2589,7 @@ wxColour wxWindow::GetBackgroundColour() const
void wxWindow::SetBackgroundColour( const wxColour &colour ) void wxWindow::SetBackgroundColour( const wxColour &colour )
{ {
wxCHECK_RET( m_widget != NULL, "invalid window" ); wxCHECK_RET( m_widget != NULL, _T("invalid window") );
if (m_backgroundColour == colour) return; if (m_backgroundColour == colour) return;
@@ -2629,7 +2629,7 @@ wxColour wxWindow::GetForegroundColour() const
void wxWindow::SetForegroundColour( const wxColour &colour ) void wxWindow::SetForegroundColour( const wxColour &colour )
{ {
wxCHECK_RET( m_widget != NULL, "invalid window" ); wxCHECK_RET( m_widget != NULL, _T("invalid window") );
if (m_foregroundColour == colour) return; if (m_foregroundColour == colour) return;
@@ -2697,7 +2697,7 @@ void wxWindow::ApplyWidgetStyle()
bool wxWindow::Validate() bool wxWindow::Validate()
{ {
wxCHECK_MSG( m_widget != NULL, FALSE, "invalid window" ); wxCHECK_MSG( m_widget != NULL, FALSE, _T("invalid window") );
wxNode *node = m_children.First(); wxNode *node = m_children.First();
while (node) while (node)
@@ -2714,7 +2714,7 @@ bool wxWindow::Validate()
bool wxWindow::TransferDataToWindow() bool wxWindow::TransferDataToWindow()
{ {
wxCHECK_MSG( m_widget != NULL, FALSE, "invalid window" ); wxCHECK_MSG( m_widget != NULL, FALSE, _T("invalid window") );
wxNode *node = m_children.First(); wxNode *node = m_children.First();
while (node) while (node)
@@ -2733,7 +2733,7 @@ bool wxWindow::TransferDataToWindow()
bool wxWindow::TransferDataFromWindow() bool wxWindow::TransferDataFromWindow()
{ {
wxCHECK_MSG( m_widget != NULL, FALSE, "invalid window" ); wxCHECK_MSG( m_widget != NULL, FALSE, _T("invalid window") );
wxNode *node = m_children.First(); wxNode *node = m_children.First();
while (node) while (node)
@@ -2760,7 +2760,7 @@ void wxWindow::OnInitDialog( wxInitDialogEvent &WXUNUSED(event) )
void wxWindow::InitDialog() void wxWindow::InitDialog()
{ {
wxCHECK_RET( m_widget != NULL, "invalid window" ); wxCHECK_RET( m_widget != NULL, _T("invalid window") );
wxInitDialogEvent event(GetId()); wxInitDialogEvent event(GetId());
event.SetEventObject( this ); event.SetEventObject( this );
@@ -2794,9 +2794,9 @@ static void pop_pos_callback( GtkMenu *menu, gint *x, gint *y, wxWindow *win )
bool wxWindow::PopupMenu( wxMenu *menu, int x, int y ) bool wxWindow::PopupMenu( wxMenu *menu, int x, int y )
{ {
wxCHECK_MSG( m_widget != NULL, FALSE, "invalid window" ); wxCHECK_MSG( m_widget != NULL, FALSE, _T("invalid window") );
wxCHECK_MSG( menu != NULL, FALSE, "invalid popup-menu" ); wxCHECK_MSG( menu != NULL, FALSE, _T("invalid popup-menu") );
SetInvokingWindow( menu, this ); SetInvokingWindow( menu, this );
@@ -2821,7 +2821,7 @@ bool wxWindow::PopupMenu( wxMenu *menu, int x, int y )
void wxWindow::SetDropTarget( wxDropTarget *dropTarget ) void wxWindow::SetDropTarget( wxDropTarget *dropTarget )
{ {
wxCHECK_RET( m_widget != NULL, "invalid window" ); wxCHECK_RET( m_widget != NULL, _T("invalid window") );
GtkWidget *dnd_widget = GetConnectWidget(); GtkWidget *dnd_widget = GetConnectWidget();
@@ -2856,7 +2856,7 @@ bool wxWindow::IsOwnGtkWindow( GdkWindow *window )
void wxWindow::SetFont( const wxFont &font ) void wxWindow::SetFont( const wxFont &font )
{ {
wxCHECK_RET( m_widget != NULL, "invalid window" ); wxCHECK_RET( m_widget != NULL, _T("invalid window") );
if (m_font == font) return; if (m_font == font) return;
@@ -2892,9 +2892,9 @@ long wxWindow::GetWindowStyleFlag() const
void wxWindow::CaptureMouse() void wxWindow::CaptureMouse()
{ {
wxCHECK_RET( m_widget != NULL, "invalid window" ); wxCHECK_RET( m_widget != NULL, _T("invalid window") );
wxCHECK_RET( g_capturing == FALSE, "CaptureMouse called twice" ); wxCHECK_RET( g_capturing == FALSE, _T("CaptureMouse called twice") );
GtkWidget *connect_widget = GetConnectWidget(); GtkWidget *connect_widget = GetConnectWidget();
gtk_grab_add( connect_widget ); gtk_grab_add( connect_widget );
@@ -2911,9 +2911,9 @@ void wxWindow::CaptureMouse()
void wxWindow::ReleaseMouse() void wxWindow::ReleaseMouse()
{ {
wxCHECK_RET( m_widget != NULL, "invalid window" ); wxCHECK_RET( m_widget != NULL, _T("invalid window") );
wxCHECK_RET( g_capturing == TRUE, "ReleaseMouse called twice" ); wxCHECK_RET( g_capturing == TRUE, _T("ReleaseMouse called twice") );
GtkWidget *connect_widget = GetConnectWidget(); GtkWidget *connect_widget = GetConnectWidget();
gtk_grab_remove( connect_widget ); gtk_grab_remove( connect_widget );
@@ -2986,9 +2986,9 @@ wxWindow *wxWindow::FindWindow( const wxString& name )
void wxWindow::SetScrollbar( int orient, int pos, int thumbVisible, void wxWindow::SetScrollbar( int orient, int pos, int thumbVisible,
int range, bool refresh ) int range, bool refresh )
{ {
wxCHECK_RET( m_widget != NULL, "invalid window" ); wxCHECK_RET( m_widget != NULL, _T("invalid window") );
wxCHECK_RET( m_wxwindow != NULL, "window needs client area for scrolling" ); wxCHECK_RET( m_wxwindow != NULL, _T("window needs client area for scrolling") );
m_hasScrolling = TRUE; m_hasScrolling = TRUE;
@@ -3054,9 +3054,9 @@ void wxWindow::SetScrollbar( int orient, int pos, int thumbVisible,
void wxWindow::SetScrollPos( int orient, int pos, bool WXUNUSED(refresh) ) void wxWindow::SetScrollPos( int orient, int pos, bool WXUNUSED(refresh) )
{ {
wxCHECK_RET( m_widget != NULL, "invalid window" ); wxCHECK_RET( m_widget != NULL, _T("invalid window") );
wxCHECK_RET( m_wxwindow != NULL, "window needs client area for scrolling" ); wxCHECK_RET( m_wxwindow != NULL, _T("window needs client area for scrolling") );
if (orient == wxHORIZONTAL) if (orient == wxHORIZONTAL)
{ {
@@ -3093,9 +3093,9 @@ void wxWindow::SetScrollPos( int orient, int pos, bool WXUNUSED(refresh) )
int wxWindow::GetScrollThumb( int orient ) const int wxWindow::GetScrollThumb( int orient ) const
{ {
wxCHECK_MSG( m_widget != NULL, 0, "invalid window" ); wxCHECK_MSG( m_widget != NULL, 0, _T("invalid window") );
wxCHECK_MSG( m_wxwindow != NULL, 0, "window needs client area for scrolling" ); wxCHECK_MSG( m_wxwindow != NULL, 0, _T("window needs client area for scrolling") );
if (orient == wxHORIZONTAL) if (orient == wxHORIZONTAL)
return (int)(m_hAdjust->page_size+0.5); return (int)(m_hAdjust->page_size+0.5);
@@ -3105,9 +3105,9 @@ int wxWindow::GetScrollThumb( int orient ) const
int wxWindow::GetScrollPos( int orient ) const int wxWindow::GetScrollPos( int orient ) const
{ {
wxCHECK_MSG( m_widget != NULL, 0, "invalid window" ); wxCHECK_MSG( m_widget != NULL, 0, _T("invalid window") );
wxCHECK_MSG( m_wxwindow != NULL, 0, "window needs client area for scrolling" ); wxCHECK_MSG( m_wxwindow != NULL, 0, _T("window needs client area for scrolling") );
if (orient == wxHORIZONTAL) if (orient == wxHORIZONTAL)
return (int)(m_hAdjust->value+0.5); return (int)(m_hAdjust->value+0.5);
@@ -3117,9 +3117,9 @@ int wxWindow::GetScrollPos( int orient ) const
int wxWindow::GetScrollRange( int orient ) const int wxWindow::GetScrollRange( int orient ) const
{ {
wxCHECK_MSG( m_widget != NULL, 0, "invalid window" ); wxCHECK_MSG( m_widget != NULL, 0, _T("invalid window") );
wxCHECK_MSG( m_wxwindow != NULL, 0, "window needs client area for scrolling" ); wxCHECK_MSG( m_wxwindow != NULL, 0, _T("window needs client area for scrolling") );
if (orient == wxHORIZONTAL) if (orient == wxHORIZONTAL)
return (int)(m_hAdjust->upper+0.5); return (int)(m_hAdjust->upper+0.5);
@@ -3129,9 +3129,9 @@ int wxWindow::GetScrollRange( int orient ) const
void wxWindow::ScrollWindow( int dx, int dy, const wxRect* WXUNUSED(rect) ) void wxWindow::ScrollWindow( int dx, int dy, const wxRect* WXUNUSED(rect) )
{ {
wxCHECK_RET( m_widget != NULL, "invalid window" ); wxCHECK_RET( m_widget != NULL, _T("invalid window") );
wxCHECK_RET( m_wxwindow != NULL, "window needs client area for scrolling" ); wxCHECK_RET( m_wxwindow != NULL, _T("window needs client area for scrolling") );
wxNode *node = m_children.First(); wxNode *node = m_children.First();
while (node) while (node)
@@ -3482,21 +3482,21 @@ void wxWindow::SetConstraintSizes(bool recurse)
} }
else if (constr) else if (constr)
{ {
char *windowClass = this->GetClassInfo()->GetClassName(); wxChar *windowClass = this->GetClassInfo()->GetClassName();
wxString winName; wxString winName;
if (GetName() == "") if (GetName() == _T(""))
winName = "unnamed"; winName = _T("unnamed");
else else
winName = GetName(); winName = GetName();
wxLogDebug( "Constraint(s) not satisfied for window of type %s, name %s:\n", wxLogDebug( _T("Constraint(s) not satisfied for window of type %s, name %s:\n"),
(const char *)windowClass, (const wxChar *)windowClass,
(const char *)winName); (const wxChar *)winName);
if (!constr->left.GetDone()) wxLogDebug( " unsatisfied 'left' constraint.\n" ); if (!constr->left.GetDone()) wxLogDebug( _T(" unsatisfied 'left' constraint.\n") );
if (!constr->right.GetDone()) wxLogDebug( " unsatisfied 'right' constraint.\n" ); if (!constr->right.GetDone()) wxLogDebug( _T(" unsatisfied 'right' constraint.\n") );
if (!constr->width.GetDone()) wxLogDebug( " unsatisfied 'width' constraint.\n" ); if (!constr->width.GetDone()) wxLogDebug( _T(" unsatisfied 'width' constraint.\n") );
if (!constr->height.GetDone()) wxLogDebug( " unsatisfied 'height' constraint.\n" ); if (!constr->height.GetDone()) wxLogDebug( _T(" unsatisfied 'height' constraint.\n") );
wxLogDebug( "Please check constraints: try adding AsIs() constraints.\n" ); wxLogDebug( _T("Please check constraints: try adding AsIs() constraints.\n") );
} }
if (recurse) if (recurse)