diff --git a/lib/wx/core/dataformat.rb b/lib/wx/core/dataformat.rb index 9a393a5d..3b0e59ef 100644 --- a/lib/wx/core/dataformat.rb +++ b/lib/wx/core/dataformat.rb @@ -22,5 +22,7 @@ module Wx end DF_FILENAME = DataFormat.new( Wx::DataFormatId::DF_FILENAME ) DF_UNICODETEXT = DataFormat.new( Wx::DataFormatId::DF_UNICODETEXT ) - # DF_HTML is only supported on Windows + MSVC, so don't offer it + if Wx.has_feature?(:USE_HTML) && Wx::WXWIDGETS_VERSION >= '3.3' + DF_HTML = DataFormat.new( Wx::DataFormatId::DF_HTML ) + end end diff --git a/rakelib/lib/director/data_object.rb b/rakelib/lib/director/data_object.rb index e0311ca8..ce22cdc5 100644 --- a/rakelib/lib/director/data_object.rb +++ b/rakelib/lib/director/data_object.rb @@ -138,8 +138,7 @@ class WxRuby_DataObjectComposite : public wxDataObjectComposite { return SWIG_NewPointerObj(do_ptr, SWIGTYPE_p_wxTextDataObject, 0); } - /** Leave these for now. Something fishy going on with HTML and RichText has special needs - #if wxUSE_HTML + #if wxUSE_HTML && (wxVERSION_NUMBER >= 3300) if ((do_ptr = dynamic_cast (d_obj))) { VALUE r_class = rb_eval_string("Wx::HTML::HTMLDataObject"); @@ -147,6 +146,7 @@ class WxRuby_DataObjectComposite : public wxDataObjectComposite return SWIG_NewPointerObj(do_ptr, swig_type, 0); } #endif + /** Leave these for now. RichText has special needs #if wxUSE_RICHTEXT if ((do_ptr = dynamic_cast (d_obj))) { diff --git a/rakelib/lib/generate/doc.rb b/rakelib/lib/generate/doc.rb index 17067967..3b250950 100644 --- a/rakelib/lib/generate/doc.rb +++ b/rakelib/lib/generate/doc.rb @@ -421,10 +421,12 @@ def para_to_doc(node) para = node_to_doc(node) # loose specific notes paragraphs case para - when /\A\s*wxPerl Note:/, # wxPerl note - /\A\s*Library:/ # Library note + when /\A(\)?wxPerl Note:/, # wxPerl note + /\A\s*Library:/, # Library note + /\A\s*Include\s+file:/ # Include file note '' else + para.sub!(/Include\s+file:\s+\#include\s+\<[^>]+\>\s*\Z/, '') if event_section? case para when /The following event handler macros redirect.*(\{.*})/ diff --git a/rakelib/lib/specs/interfaces.rb b/rakelib/lib/specs/interfaces.rb index 635f0e26..19d57ba6 100644 --- a/rakelib/lib/specs/interfaces.rb +++ b/rakelib/lib/specs/interfaces.rb @@ -274,8 +274,7 @@ module WXRuby3 Director.Spec(pkg, 'wxHtmlEasyPrinting', requirements: %w[wxUSE_PRINTING_ARCHITECTURE]) Director.Spec(pkg, 'wxHtmlPrintout', requirements: %w[wxUSE_PRINTING_ARCHITECTURE]) Director.Spec(pkg, 'wxHtmlListBox') - # defer; something not right here - # Director.Spec(pkg, 'wxHTMLDataObject') + Director.Spec(pkg, 'wxHTMLDataObject') if Config.instance.wx_version >= '3.3' } Director.Package('Wx::AUI', 'wxUSE_AUI') { |pkg| diff --git a/tests/test_clipboard.rb b/tests/test_clipboard.rb index e338c14b..63996af4 100644 --- a/tests/test_clipboard.rb +++ b/tests/test_clipboard.rb @@ -34,6 +34,41 @@ def test_text_data end end +if Wx.has_feature?(:USE_HTML) && Wx::WXWIDGETS_VERSION >= '3.3' + class TestHtmlData < Test::Unit::TestCase + # Using an in-built class + def test_text_data + td = Wx::HTMLDataObject.new('

Header

') + assert_equal('

Header

', td.html) + + Wx::Clipboard.open do | clip | + assert clip.opened? + clip.clear + assert !clip.supported?(Wx::DF_BITMAP) + clip.place td + assert clip.supported?(Wx::DF_HTML) + assert !clip.supported?(Wx::DF_BITMAP) + end + + td_2 = Wx::HTMLDataObject.new + Wx::Clipboard.open do | clip | + clip.fetch td_2 + end + assert_equal('

Header

', td_2.html) + + Wx::Clipboard.open do | clip | + clip.clear + end + + td_3 = Wx::HTMLDataObject.new + Wx::Clipboard.open do | clip | + clip.fetch td_3 + end + assert_equal('', td_3.get_data_here) + end + end +end + class TestBitmapData < Test::Unit::TestCase def test_bitmap_data bmp = Wx::Bitmap.new(File.join(__dir__, '../samples/minimal/mondrian.png'))