--- include/wx/generic/calctrl.h.orig Sat Aug 9 21:37:29 2003 +++ include/wx/generic/calctrl.h Wed Dec 3 10:24:15 2003 @@ -242,10 +242,12 @@ // show the correct controls void ShowCurrentControls(); +public: // get the currently shown control for month/year wxControl *GetMonthControl() const; wxControl *GetYearControl() const; +private: // OnPaint helper-methods // Highlight the [fromdate : todate] range using pen and brush --- include/wx/calctrl.h.orig Mon Aug 18 18:30:45 2003 +++ include/wx/calctrl.h Wed Dec 3 10:24:15 2003 @@ -169,6 +169,8 @@ wxCalendarEvent(wxCalendarCtrl *cal, wxEventType type); const wxDateTime& GetDate() const { return m_date; } + void SetDate(const wxDateTime &date) { m_date = date; } + void SetWeekDay(const wxDateTime::WeekDay &wd) { m_wday = wd; } wxDateTime::WeekDay GetWeekDay() const { return m_wday; } protected: --- include/wx/dataobj.h.orig Sat Aug 9 21:37:10 2003 +++ include/wx/dataobj.h Wed Dec 3 10:24:15 2003 @@ -335,20 +335,32 @@ // implement base class pure virtuals // ---------------------------------- - virtual size_t GetDataSize() const; - virtual bool GetDataHere(void *buf) const; - virtual bool SetData(size_t len, const void *buf); + virtual size_t GetDataSize() const { return GetDataSize(GetPreferredFormat()); } + virtual bool GetDataHere(void *buf) const { return GetDataHere(GetPreferredFormat(), buf); } + virtual bool SetData(size_t len, const void *buf) { return SetData(GetPreferredFormat(), len, buf); } + +#if wxUSE_UNICODE +#if defined(__WXGTK20__) + virtual size_t GetFormatCount(Direction WXUNUSED(dir) = Get) const { return 2; } + virtual void GetAllFormats(wxDataFormat *formats, + wxDataObjectBase::Direction WXUNUSED(dir) = Get) const; +#endif + +#if defined(__WXMSW__) + virtual size_t GetFormatCount(Direction WXUNUSED(dir) = Get) const { return 3; }; + virtual void GetAllFormats(wxDataFormat *formats, + wxDataObjectBase::Direction WXUNUSED(dir) = Get) const; +#endif + +#endif private: wxString m_text; // virtual function hiding supression - size_t GetDataSize(const wxDataFormat& format) const - { return(wxDataObjectSimple::GetDataSize(format)); } - bool GetDataHere(const wxDataFormat& format, void *pBuf) const - { return(wxDataObjectSimple::GetDataHere(format, pBuf)); } - bool SetData(const wxDataFormat& format, size_t nLen, const void* pBuf) - { return(wxDataObjectSimple::SetData(format, nLen, pBuf)); } + size_t GetDataSize(const wxDataFormat& format) const; + bool GetDataHere(const wxDataFormat& format, void *pBuf) const; + bool SetData(const wxDataFormat& format, size_t nLen, const void* pBuf); DECLARE_NO_COPY_CLASS(wxTextDataObject) }; --- src/common/dobjcmn.cpp.orig Sat Aug 9 21:45:45 2003 +++ src/common/dobjcmn.cpp Wed Dec 3 10:24:15 2003 @@ -237,9 +237,11 @@ // wxTextDataObject // ---------------------------------------------------------------------------- -size_t wxTextDataObject::GetDataSize() const +size_t wxTextDataObject::GetDataSize(const wxDataFormat& format) const { -#if defined(__WXGTK20__) && wxUSE_UNICODE + if (format == wxDF_UNICODETEXT) + { +#if defined(__WXGTK20__) // Use UTF8 not UCS4 wxCharBuffer buffer = wxConvUTF8.cWX2MB( GetText().c_str() ); return strlen( (const char*) buffer ) + 1; @@ -247,31 +249,51 @@ return GetTextLength() * sizeof(wxChar); #endif } + else + { + wxCharBuffer buffer = wxConvLibc.cWX2MB( GetText().c_str() ); + return strlen( (const char*) buffer ) + 1; + } +} + -bool wxTextDataObject::GetDataHere(void *buf) const +bool wxTextDataObject::GetDataHere(const wxDataFormat& format, void *buf) const { -#if defined(__WXGTK20__) && wxUSE_UNICODE + if (format == wxDF_UNICODETEXT) + { +#if defined(__WXGTK20__) // Use UTF8 not UCS4 wxCharBuffer buffer = wxConvUTF8.cWX2MB( GetText().c_str() ); strcpy( (char*) buf, (const char*) buffer ); #else wxStrcpy((wxChar *)buf, GetText().c_str()); #endif - + } + else + { + wxCharBuffer buffer = wxConvLibc.cWX2MB( GetText().c_str() ); + strcpy( (char*) buf, (const char*) buffer ); + } return TRUE; } -bool wxTextDataObject::SetData(size_t WXUNUSED(len), const void *buf) + +bool wxTextDataObject::SetData(const wxDataFormat& format, + size_t WXUNUSED(len), const void *buf) { -#if defined(__WXGTK20__) && wxUSE_UNICODE - // Use UTF8 not UCS4 + if (format == wxDF_UNICODETEXT) +#ifdef __WXGTK20__ SetText( wxConvUTF8.cMB2WX( (const char*) buf ) ); #else SetText(wxString((const wxChar *)buf)); #endif + else + SetText( wxConvLibc.cMB2WX( (const char*) buf ) ); return TRUE; } + + // ---------------------------------------------------------------------------- // wxFileDataObjectBase --- src/generic/calctrl.cpp.orig Thu Oct 16 19:27:55 2003 +++ src/generic/calctrl.cpp Wed Dec 3 10:24:16 2003 @@ -281,6 +281,7 @@ // needed to get the arrow keys normally used for the dialog navigation SetWindowStyle(style | wxWANTS_CHARS); + SetFont(parent->GetFont()); m_date = date.IsValid() ? date : wxDateTime::Today(); @@ -322,7 +323,6 @@ SetSize(pos.x, pos.y, sizeReal.x, sizeReal.y); SetBackgroundColour(*wxWHITE); - SetFont(*wxSWISS_FONT); SetHolidayAttrs(); @@ -784,13 +784,13 @@ ((wxCalendarCtrl *)this)->RecalcGeometry(); // const_cast wxCoord width = 7*m_widthCol, - height = 7*m_heightRow + m_rowOffset + VERT_MARGIN; + height = 7*m_heightRow + m_rowOffset; if ( !HasFlag(wxCAL_SEQUENTIAL_MONTH_SELECTION) ) { // the combobox doesn't report its height correctly (it returns the // height including the drop down list) so don't use it - height += m_spinYear->GetBestSize().y; + height += GetYearControl()->GetSize().y + VERT_MARGIN; } if ( !HasFlag(wxBORDER_NONE) ) @@ -876,9 +876,9 @@ if ( !(GetWindowStyle() & wxCAL_SEQUENTIAL_MONTH_SELECTION) ) { // our real top corner is not in this position - if ( y ) + if ( y && GetYearControl() ) { - *y -= GetMonthControl()->GetSize().y + VERT_MARGIN; + *y -= GetYearControl()->GetSize().y + VERT_MARGIN; } } } @@ -890,9 +890,9 @@ if ( !(GetWindowStyle() & wxCAL_SEQUENTIAL_MONTH_SELECTION) ) { // our real height is bigger - if ( height && GetMonthControl()) + if ( height && GetYearControl()) { - *height += GetMonthControl()->GetSize().y + VERT_MARGIN; + *height += GetYearControl()->GetSize().y + VERT_MARGIN; } } } --- src/gtk/dataobj.cpp.orig Wed Sep 10 03:04:57 2003 +++ src/gtk/dataobj.cpp Wed Dec 3 10:24:16 2003 @@ -28,6 +28,7 @@ //------------------------------------------------------------------------- GdkAtom g_textAtom = 0; +GdkAtom g_altTextAtom = 0; GdkAtom g_pngAtom = 0; GdkAtom g_fileAtom = 0; @@ -77,12 +78,9 @@ { PrepareFormats(); - if (type == wxDF_UNICODETEXT) - type = wxDF_TEXT; - m_type = type; - if (m_type == wxDF_TEXT) + if (m_type == wxDF_TEXT || m_type == wxDF_UNICODETEXT) m_format = g_textAtom; else if (m_type == wxDF_BITMAP) @@ -143,7 +141,10 @@ // here (with whom?) if (!g_textAtom) #if wxUSE_UNICODE + { g_textAtom = gdk_atom_intern( "UTF8_STRING", FALSE ); + g_altTextAtom = gdk_atom_intern( "STRING", FALSE ); + } #else g_textAtom = gdk_atom_intern( "STRING" /* "text/plain" */, FALSE ); #endif @@ -191,6 +192,21 @@ return n < nFormatCount; } } + + +// ---------------------------------------------------------------------------- +// wxTextDataObject +// ---------------------------------------------------------------------------- + +#if defined(__WXGTK20__) && wxUSE_UNICODE + +void wxTextDataObject::GetAllFormats(wxDataFormat *formats, wxDataObjectBase::Direction dir) const +{ + *formats++ = GetPreferredFormat(); + *formats = g_altTextAtom; +} + +#endif // ---------------------------------------------------------------------------- // wxFileDataObject