Class: Wx::WEB::WebViewWindowFeatures

Inherits:
Object
  • Object
show all
Defined in:
lib/wx/doc/gen/web/web_view_event.rb

Overview

Note:

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).expand)
  }

Requires:

  • USE_WEBVIEW

Instance Method Summary collapse

Instance Method Details

#get_child_web_viewWx::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.

Returns:



173
# File 'lib/wx/doc/gen/web/web_view_event.rb', line 173

def get_child_web_view; end

#get_positionWx::Point Also known as: position

Returns the position of the new window if specified by a window.open() call.

Returns:



178
# File 'lib/wx/doc/gen/web/web_view_event.rb', line 178

def get_position; end

#get_sizeWx::Size Also known as: size

Returns the size of the new window if specified by a window.open() call.

Returns:



183
# File 'lib/wx/doc/gen/web/web_view_event.rb', line 183

def get_size; end

#should_display_menu_barBoolean

Returns true if the target window is expected to display a menu bar as specified by a window.open() call.

Returns:

  • (Boolean)


188
# File 'lib/wx/doc/gen/web/web_view_event.rb', line 188

def should_display_menu_bar; end

#should_display_scroll_barsBoolean

Returns true if the target window is expected to display scroll bars as specified by a window.open() call.

Returns:

  • (Boolean)


200
# File 'lib/wx/doc/gen/web/web_view_event.rb', line 200

def should_display_scroll_bars; end

#should_display_status_barBoolean

Returns true if the target window is expected to display a status bar as specified by a window.open() call.

Returns:

  • (Boolean)


192
# File 'lib/wx/doc/gen/web/web_view_event.rb', line 192

def should_display_status_bar; end

#should_display_tool_barBoolean

Returns true if the target window is expected to display a tool bar as specified by a window.open() call.

Returns:

  • (Boolean)


196
# File 'lib/wx/doc/gen/web/web_view_event.rb', line 196

def should_display_tool_bar; end