// global data
//-----------------------------------------------------------------------------
-extern const char *wxButtonNameStr;
+extern const wxChar *wxButtonNameStr;
//-----------------------------------------------------------------------------
// wxBitmapButton
// global data
//-----------------------------------------------------------------------------
-extern const char *wxButtonNameStr;
+extern const wxChar *wxButtonNameStr;
//-----------------------------------------------------------------------------
// wxButton
// global data
//-----------------------------------------------------------------------------
-extern const char *wxStaticTextNameStr;
+extern const wxChar *wxStaticTextNameStr;
//-----------------------------------------------------------------------------
// wxStaticText
// global data
//-----------------------------------------------------------------------------
-extern const char *wxButtonNameStr;
+extern const wxChar *wxButtonNameStr;
//-----------------------------------------------------------------------------
// wxBitmapButton
// global data
//-----------------------------------------------------------------------------
-extern const char *wxButtonNameStr;
+extern const wxChar *wxButtonNameStr;
//-----------------------------------------------------------------------------
// wxButton
// global data
//-----------------------------------------------------------------------------
-extern const char *wxStaticTextNameStr;
+extern const wxChar *wxStaticTextNameStr;
//-----------------------------------------------------------------------------
// wxStaticText
virtual size_t StreamSize() const { return m_length; }
char Peek();
+
+ protected:
+ wxStreamBuffer *m_i_streambuf;
+
+ protected:
+ size_t OnSysRead(void *buffer, size_t nbytes);
+ off_t OnSysSeek(off_t pos, wxSeekMode mode);
+ off_t OnSysTell() const;
};
class wxMemoryOutputStream: public wxOutputStream {
public:
wxMemoryOutputStream(char *data = NULL, size_t length = 0);
virtual ~wxMemoryOutputStream();
+
+ protected:
+ wxStreamBuffer *m_o_streambuf;
+
+ protected:
+ size_t OnSysWrite(const void *buffer, size_t nbytes);
+ off_t OnSysSeek(off_t pos, wxSeekMode mode);
+ off_t OnSysTell() const;
};
#endif
wxTextCtrl& textCtrl = * GetTextCtrl();
textCtrl.Clear();
- textCtrl << "\nTest fstream vs. wxFileStream:\n\n";
+ textCtrl << _T("\nTest fstream vs. wxFileStream:\n\n");
textCtrl.WriteText( "Writing to ofstream and wxFileOutputStream:\n" );
wxString tmp;
signed int si = 0xFFFFFFFF;
- tmp.Printf( "Signed int: %d\n", si );
+ tmp.Printf( _T("Signed int: %d\n"), si );
textCtrl.WriteText( tmp );
text_output << si << "\n";
std_file_output << si << "\n";
unsigned int ui = 0xFFFFFFFF;
- tmp.Printf( "Unsigned int: %u\n", ui );
+ tmp.Printf( _T("Unsigned int: %u\n"), ui );
textCtrl.WriteText( tmp );
text_output << ui << "\n";
std_file_output << ui << "\n";
double d = 2.01234567890123456789;
- tmp.Printf( "Double: %f\n", d );
+ tmp.Printf( _T("Double: %f\n"), d );
textCtrl.WriteText( tmp );
text_output << d << "\n";
std_file_output << d << "\n";
float f = 0.00001;
- tmp.Printf( "Float: %f\n", f );
+ tmp.Printf( _T("Float: %f\n"), f );
textCtrl.WriteText( tmp );
text_output << f << "\n";
std_file_output << f << "\n";
- wxString str( "Hello!" );
- tmp.Printf( "String: %s\n", str.c_str() );
+ wxString str( _T("Hello!") );
+ tmp.Printf( _T("String: %s\n"), str.c_str() );
textCtrl.WriteText( tmp );
text_output << str << "\n";
std_file_output << str.c_str() << "\n";
ifstream std_file_input( "test_std.dat" );
std_file_input >> si;
- tmp.Printf( "Signed int: %d\n", si );
+ tmp.Printf( _T("Signed int: %d\n"), si );
textCtrl.WriteText( tmp );
std_file_input >> ui;
- tmp.Printf( "Unsigned int: %u\n", ui );
+ tmp.Printf( _T("Unsigned int: %u\n"), ui );
textCtrl.WriteText( tmp );
std_file_input >> d;
- tmp.Printf( "Double: %f\n", d );
+ tmp.Printf( _T("Double: %f\n"), d );
textCtrl.WriteText( tmp );
std_file_input >> f;
- tmp.Printf( "Float: %f\n", f );
+ tmp.Printf( _T("Float: %f\n"), f );
textCtrl.WriteText( tmp );
std_file_input >> str;
- tmp.Printf( "String: %s\n", str.c_str() );
+ tmp.Printf( _T("String: %s\n"), str.c_str() );
textCtrl.WriteText( tmp );
textCtrl.WriteText( "\nReading from wxFileInputStream:\n" );
wxTextInputStream text_input( buf_input );
text_input >> si;
- tmp.Printf( "Signed int: %d\n", si );
+ tmp.Printf( _T("Signed int: %d\n"), si );
textCtrl.WriteText( tmp );
text_input >> ui;
- tmp.Printf( "Unsigned int: %u\n", ui );
+ tmp.Printf( _T("Unsigned int: %u\n"), ui );
textCtrl.WriteText( tmp );
text_input >> d;
- tmp.Printf( "Double: %f\n", d );
+ tmp.Printf( _T("Double: %f\n"), d );
textCtrl.WriteText( tmp );
text_input >> f;
- tmp.Printf( "Float: %f\n", f );
+ tmp.Printf( _T("Float: %f\n"), f );
textCtrl.WriteText( tmp );
text_input >> str;
- tmp.Printf( "String: %s\n", str.c_str() );
+ tmp.Printf( _T("String: %s\n"), str.c_str() );
textCtrl.WriteText( tmp );
wxDataOutputStream data_output( buf_output );
wxInt16 i16 = 0xFFFF;
- tmp.Printf( "Signed int16: %d\n", (int)i16 );
+ tmp.Printf( _T("Signed int16: %d\n"), (int)i16 );
textCtrl.WriteText( tmp );
data_output.Write16( i16 );
wxUint16 ui16 = 0xFFFF;
- tmp.Printf( "Unsigned int16: %u\n", (unsigned int) ui16 );
+ tmp.Printf( _T("Unsigned int16: %u\n"), (unsigned int) ui16 );
textCtrl.WriteText( tmp );
data_output.Write16( ui16 );
d = 2.01234567890123456789;
- tmp.Printf( "Double: %f\n", d );
+ tmp.Printf( _T("Double: %f\n"), d );
textCtrl.WriteText( tmp );
data_output.WriteDouble( d );
str = "Hello!";
- tmp.Printf( "String: %s\n", str.c_str() );
+ tmp.Printf( _T("String: %s\n"), str.c_str() );
textCtrl.WriteText( tmp );
data_output.WriteString( str );
wxDataInputStream data_input( buf_input );
i16 = data_input.Read16();
- tmp.Printf( "Signed int16: %d\n", (int)i16 );
+ tmp.Printf( _T("Signed int16: %d\n"), (int)i16 );
textCtrl.WriteText( tmp );
ui16 = data_input.Read16();
- tmp.Printf( "Unsigned int16: %u\n", (unsigned int) ui16 );
+ tmp.Printf( _T("Unsigned int16: %u\n"), (unsigned int) ui16 );
textCtrl.WriteText( tmp );
d = data_input.ReadDouble();
- tmp.Printf( "Double: %f\n", d );
+ tmp.Printf( _T("Double: %f\n"), d );
textCtrl.WriteText( tmp );
str = data_input.ReadString();
- tmp.Printf( "String: %s\n", str.c_str() );
+ tmp.Printf( _T("String: %s\n"), str.c_str() );
textCtrl.WriteText( tmp );
}
void wxDataOutputStream::WriteString(const wxString& string)
{
+ const wxWX2MBbuf buf = string.mb_str();
Write32(string.Length());
- m_output->Write((const wxChar *) string, string.Length()*sizeof(wxChar));
+ m_output->Write(buf, string.Len());
}
// Must be at global scope for VC++ 5
}
wxDocTemplate *theTemplate = (wxDocTemplate *)wxGetSingleChoiceData(_("Select a document template"), _("Templates"), n,
- strings, data);
+ strings, (char **)data);
delete[] strings;
delete[] data;
return theTemplate;
}
}
wxDocTemplate *theTemplate = (wxDocTemplate *)wxGetSingleChoiceData(_("Select a document view"), _("Views"), n,
- strings, data);
+ strings, (char **)data);
delete[] strings;
delete[] data;
return theTemplate;
{
wxChar *tmp_buf;
wxChar buf[200];
- const wxWX2MBbuf pathbuf;
+ wxWX2MBbuf pathbuf(200);
wxString tmp_str;
switch (req) {
wxMemoryInputStream::wxMemoryInputStream(const char *data, size_t len)
: wxInputStream()
{
-/*
+ m_i_streambuf = new wxStreamBuffer(wxStreamBuffer::read);
m_i_streambuf->SetBufferIO((char*) data, (char*) (data+len));
m_i_streambuf->SetIntPosition(0); // seek to start pos
m_i_streambuf->Fixed(TRUE);
-*/
+
m_length = len;
}
wxMemoryInputStream::~wxMemoryInputStream()
{
+ delete m_i_streambuf;
}
char wxMemoryInputStream::Peek()
{
-/*
return m_i_streambuf->GetBufferStart()[m_i_streambuf->GetIntPosition()];
-*/
- return 0;
+}
+
+size_t wxMemoryInputStream::OnSysRead(void *buffer, size_t nbytes)
+{
+ return m_i_streambuf->Read(buffer, nbytes);
+}
+
+off_t wxMemoryInputStream::OnSysSeek(off_t pos, wxSeekMode mode)
+{
+ return m_i_streambuf->Seek(pos, mode);
+}
+
+off_t wxMemoryInputStream::OnSysTell() const
+{
+ return m_i_streambuf->Tell();
}
// ----------------------------------------------------------------------------
wxMemoryOutputStream::wxMemoryOutputStream(char *data, size_t len)
: wxOutputStream()
{
-/*
+ m_o_streambuf = new wxStreamBuffer(wxStreamBuffer::write);
if (data)
m_o_streambuf->SetBufferIO(data, data+len);
m_o_streambuf->Fixed(TRUE);
-*/
}
wxMemoryOutputStream::~wxMemoryOutputStream()
{
+ delete m_o_streambuf;
}
+size_t wxMemoryOutputStream::OnSysWrite(const void *buffer, size_t nbytes)
+{
+ return m_o_streambuf->Write(buffer, nbytes);
+}
+
+off_t wxMemoryOutputStream::OnSysSeek(off_t pos, wxSeekMode mode)
+{
+ return m_o_streambuf->Seek(pos, mode);
+}
+
+off_t wxMemoryOutputStream::OnSysTell() const
+{
+ return m_o_streambuf->Tell();
+}
+
+
#endif
#if wxUSE_STREAMS
#include "wx/txtstrm.h"
+#include <ctype.h>
wxTextInputStream::wxTextInputStream(wxInputStream& s)
: m_input(&s)
wxTextOutputStream& wxTextOutputStream::operator<<(wxChar c)
{
wxString tmp_str;
- tmp_str.Printf("%c", c);
+ tmp_str.Printf(_T("%c"), c);
WriteString(tmp_str);
return *this;
}
if (m_elapsed)
{
- s.Printf("%i:%02i:%02i", diff.GetHour(), diff.GetMinute(), diff.GetSecond());
+ s.Printf(_T("%i:%02i:%02i"), diff.GetHour(), diff.GetMinute(), diff.GetSecond());
if (s != m_elapsed->GetLabel()) m_elapsed->SetLabel(s);
}
if (m_estimated)
{
- s.Printf("%i:%02i:%02i", estim / (60 * 60), (estim / 60) % 60, estim % 60);
+ s.Printf(_T("%i:%02i:%02i"), estim / (60 * 60), (estim / 60) % 60, estim % 60);
if (s != m_estimated->GetLabel()) m_estimated->SetLabel(s);
}
if (m_remaining)
{
- s.Printf("%i:%02i:%02i", remai / (60 * 60), (remai / 60) % 60, remai % 60);
+ s.Printf(_T("%i:%02i:%02i"), remai / (60 * 60), (remai / 60) % 60, remai % 60);
if (s != m_remaining->GetLabel()) m_remaining->SetLabel(s);
}
}
{
wxSingleChoiceDialog dialog(parent, message, caption, n, choices, client_data);
if ( dialog.ShowModal() == wxID_OK )
- return dialog.GetSelectionClientData();
+ return (wxChar *)dialog.GetSelectionClientData();
else
return NULL;
}
/* local buffer in multibyte form */
wxString buf;
- buf << '/' << str.mb_str();
+ buf << _T('/') << str.c_str();
+
char *cbuf = new char[buf.Length()];
+ strcpy(cbuf, buf.mbc_str());
+
GtkItemFactoryEntry entry;
- entry.path = (gchar *)buf.c_str(); // const_cast
+ entry.path = (gchar *)cbuf; // const_cast
entry.accelerator = (gchar*) NULL;
entry.callback = (GtkItemFactoryCallback) NULL;
entry.callback_action = 0;
m_font.GetInternalFont(),
m_foregroundColour.GetColor(),
m_backgroundColour.GetColor(),
- text, text.length());
+ text.mbc_str(), text.length());
}
else
{
wxSingleChoiceDialog dialog(parent, message, caption, n, choices, client_data);
if ( dialog.ShowModal() == wxID_OK )
- return dialog.GetSelectionClientData();
+ return (wxChar *)dialog.GetSelectionClientData();
else
return NULL;
}
/* local buffer in multibyte form */
wxString buf;
- buf << '/' << str.mb_str();
+ buf << _T('/') << str.c_str();
+
char *cbuf = new char[buf.Length()];
+ strcpy(cbuf, buf.mbc_str());
+
GtkItemFactoryEntry entry;
- entry.path = (gchar *)buf.c_str(); // const_cast
+ entry.path = (gchar *)cbuf; // const_cast
entry.accelerator = (gchar*) NULL;
entry.callback = (GtkItemFactoryCallback) NULL;
entry.callback_action = 0;
m_font.GetInternalFont(),
m_foregroundColour.GetColor(),
m_backgroundColour.GetColor(),
- text, text.length());
+ text.mbc_str(), text.length());
}
else