Class: Wx::WEB::WebViewWindowFeatures
- Inherits:
-
Object
- Object
- Wx::WEB::WebViewWindowFeatures
- Defined in:
- lib/wx/doc/gen/web/web_view_event.rb
Overview
This class is untracked and should not be derived from nor instances extended!
A class describing the window information for a new child window.
An object of this class can be obtained using Wx::WEB::WebViewEvent#get_target_window_features while handling EVT_WEBVIEW_NEWWINDOW_FEATURES. If a EVT_WEBVIEW_NEWWINDOW is not vetoed, a EVT_WEBVIEW_NEWWINDOW_FEATURES event will be sent to the application. The application can then create a new window and call Wx::WEB::WebViewEvent#get_target_window_info to get this class providing information about the new window. A new child web view will be available via #get_child_web_view. The application can then place the child web view into the new window by calling Wx::WEB::WebView#create on the child web view. Sample JavaScript opening a new window:
window.open("https://www.wxwidgets.org", "newWindow", "width=400,height=400");
Sample code handling a new window request:
# Bind new window handler
@webView.evt_webview_newwindow(Wx::ID_ANY) { |evt|
if evt.get_url == "http://badwebsite.com"
evt.veto # Disallow new window for badwebsite.com
else
evt.skip # Allow new window for all other websites
end
}
# Bind new window features handler
@webView.evt_webview_newwindow_features(Wx::ID_ANY) { |evt|
# Get target window features
features = evt.get_target_window_features
# Create a top level window for the child web view
win = Wx::Frame.new(nil, Wx::ID_ANY, features.get_position, features.get_size)
sizer = Wx::VBoxSizer.new
win.set_sizer(sizer)
# Get the child web view
childWebView = features.get_child_web_view
# Place the child web view into the window
childWebView.create(win, Wx::ID_ANY)
sizer.add(childWebView, Wx::SizerFlags.new.proportion(1).)
}
Instance Method Summary collapse
-
#get_child_web_view ⇒ Wx::WEB::WebView
(also: #child_web_view)
Get the child web view for the target window.
-
#get_position ⇒ Wx::Point
(also: #position)
Returns the position of the new window if specified by a
window.open()call. -
#get_size ⇒ Wx::Size
(also: #size)
Returns the size of the new window if specified by a
window.open()call. -
#should_display_menu_bar ⇒ Boolean
Returns true if the target window is expected to display a menu bar as specified by a
window.open()call. -
#should_display_scroll_bars ⇒ Boolean
Returns true if the target window is expected to display scroll bars as specified by a
window.open()call. -
#should_display_status_bar ⇒ Boolean
Returns true if the target window is expected to display a status bar as specified by a
window.open()call. -
#should_display_tool_bar ⇒ Boolean
Returns true if the target window is expected to display a tool bar as specified by a
window.open()call.
Instance Method Details
#get_child_web_view ⇒ Wx::WEB::WebView Also known as: child_web_view
Get the child web view for the target window.
This is available in the event handler for EVT_WEBVIEW_NEWWINDOW_FEATURES and Wx::WEB::WebView#create must be called on the child web view directly. The requested URL will be loaded automatically in the child web view.
173 |
# File 'lib/wx/doc/gen/web/web_view_event.rb', line 173 def get_child_web_view; end |
#get_position ⇒ Wx::Point Also known as: position
Returns the position of the new window if specified by a window.open() call.
178 |
# File 'lib/wx/doc/gen/web/web_view_event.rb', line 178 def get_position; end |
#get_size ⇒ Wx::Size Also known as: size
Returns the size of the new window if specified by a window.open() call.
183 |
# File 'lib/wx/doc/gen/web/web_view_event.rb', line 183 def get_size; end |
#should_display_menu_bar ⇒ Boolean
Returns true if the target window is expected to display a menu bar as specified by a window.open() call.
188 |
# File 'lib/wx/doc/gen/web/web_view_event.rb', line 188 def ; end |
#should_display_scroll_bars ⇒ Boolean
Returns true if the target window is expected to display scroll bars as specified by a window.open() call.
200 |
# File 'lib/wx/doc/gen/web/web_view_event.rb', line 200 def ; end |
#should_display_status_bar ⇒ Boolean
Returns true if the target window is expected to display a status bar as specified by a window.open() call.
192 |
# File 'lib/wx/doc/gen/web/web_view_event.rb', line 192 def ; end |
#should_display_tool_bar ⇒ Boolean
Returns true if the target window is expected to display a tool bar as specified by a window.open() call.
196 |
# File 'lib/wx/doc/gen/web/web_view_event.rb', line 196 def ; end |