Class: RubyMVC::Toolkit::WxRuby::WebView

Inherits:
Wx::HtmlWindow
  • Object
show all
Includes:
SignalHandler, Common
Defined in:
lib/ruby_mvc/toolkit/peers/wxruby/web_view.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from Common

#title, #title=

Methods included from SignalHandler

#signal_connect, #signal_disconnect, #signal_emit

Constructor Details

#initialize(options = {}, &block) ⇒ WebView

Returns a new instance of WebView.



34
35
36
37
# File 'lib/ruby_mvc/toolkit/peers/wxruby/web_view.rb', line 34

def initialize(options = {}, &block)
  super(WxRuby.parent(options))
  set_background_colour(Wx::WHITE)
end

Instance Attribute Details

#locationObject (readonly)

Returns the value of attribute location.



39
40
41
# File 'lib/ruby_mvc/toolkit/peers/wxruby/web_view.rb', line 39

def location
  @location
end

Instance Method Details

#can_go_back?Boolean

Returns:

  • (Boolean)


41
42
43
# File 'lib/ruby_mvc/toolkit/peers/wxruby/web_view.rb', line 41

def can_go_back?
  history_can_back
end

#can_go_forward?Boolean

Returns:

  • (Boolean)


45
46
47
# File 'lib/ruby_mvc/toolkit/peers/wxruby/web_view.rb', line 45

def can_go_forward?
  history_can_forward
end

#go_backObject



49
50
51
# File 'lib/ruby_mvc/toolkit/peers/wxruby/web_view.rb', line 49

def go_back
  history_back
end

#go_forwardObject



53
54
55
# File 'lib/ruby_mvc/toolkit/peers/wxruby/web_view.rb', line 53

def go_forward
  history_forward
end

#load_html(html, base_uri = nil) ⇒ Object



70
71
72
73
74
# File 'lib/ruby_mvc/toolkit/peers/wxruby/web_view.rb', line 70

def load_html(html, base_uri = nil)
  # FIXME: this isn't quite right...
  set_page(html)
  @location = base_uri
end

– wxRuby event handlers ++



80
81
82
# File 'lib/ruby_mvc/toolkit/peers/wxruby/web_view.rb', line 80

def on_link_clicked(link)
  signal_emit("navigation-requested", self, link.href, link.target)
end

#open(uri) ⇒ Object



57
58
59
60
# File 'lib/ruby_mvc/toolkit/peers/wxruby/web_view.rb', line 57

def open(uri)
  @location = uri
  load_page(uri)
end

#reloadObject



66
67
68
# File 'lib/ruby_mvc/toolkit/peers/wxruby/web_view.rb', line 66

def reload
  open(location)
end

#stop_loadingObject



62
63
64
# File 'lib/ruby_mvc/toolkit/peers/wxruby/web_view.rb', line 62

def stop_loading
  # apparently, we can't do this
end