Sha256: 4f3c367fd07286d7ad60d9167d4e14d5b3879820c3c22601b2bc5211faaf6854

Contents?: true

Size: 1.09 KB

Versions: 4

Compression:

Stored size: 1.09 KB

Contents

module Redcar
  class ApplicationSWT
    class HtmlTab < Tab
      attr_reader :browser
      
      def initialize(model, notebook)
        super
        @model.add_listener(:changed_title) { |title| @item.text = title }
      end
      
      def create_tab_widget
        Swt::Graphics::Device.DEBUG = true
        if Redcar.platform == :windows
          java.lang.System.setProperty('org.eclipse.swt.browser.XULRunnerPath',
                                      (Redcar.root + "/vendor/xulrunner").gsub("/", "\\"))
          @browser = Swt::Browser.new(notebook.tab_folder, Swt::SWT::MOZILLA)
        else
          @browser = Swt::Browser.new(notebook.tab_folder, Swt::SWT::NONE)
        end
        @widget = @browser
        @item.control = @widget
      end
      
      # Focuses the Browser tab within the CTabFolder, and gives the keyboard
      # focus to the EditViewSWT.
      def focus
        super
        browser.set_focus
      end
      
      # Close the HtmlTab, disposing of any resources along the way.
      def close
        @browser.dispose
        super
      end
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
redcar-0.3.4.3 plugins/application_swt/lib/application_swt/html_tab.rb
redcar-0.3.4.2 plugins/application_swt/lib/application_swt/html_tab.rb
redcar-0.3.4.1 plugins/application_swt/lib/application_swt/html_tab.rb
redcar-0.3.4 plugins/application_swt/lib/application_swt/html_tab.rb