Module: Scarpe::Webview

Defined in:
lib/scarpe/wv/web_wrangler.rb,
lib/scarpe/wv/app.rb,
lib/scarpe/wv/arc.rb,
lib/scarpe/wv/flow.rb,
lib/scarpe/wv/line.rb,
lib/scarpe/wv/link.rb,
lib/scarpe/wv/oval.rb,
lib/scarpe/wv/para.rb,
lib/scarpe/wv/rect.rb,
lib/scarpe/wv/slot.rb,
lib/scarpe/wv/star.rb,
lib/scarpe/wv/arrow.rb,
lib/scarpe/wv/check.rb,
lib/scarpe/wv/image.rb,
lib/scarpe/wv/radio.rb,
lib/scarpe/wv/shape.rb,
lib/scarpe/wv/stack.rb,
lib/scarpe/wv/video.rb,
lib/scarpe/wv/border.rb,
lib/scarpe/wv/button.rb,
lib/scarpe/wv/drawable.rb,
lib/scarpe/wv/edit_box.rb,
lib/scarpe/wv/list_box.rb,
lib/scarpe/wv/progress.rb,
lib/scarpe/wv/edit_line.rb,
lib/scarpe/wv/document_root.rb,
lib/scarpe/wv/text_drawable.rb,
lib/scarpe/wv/control_interface.rb,
lib/scarpe/assets.rb,
lib/scarpe/wv.rb

Overview

Module to contain the various Scarpe Webview classes

Defined Under Namespace

Classes: App, Arc, Arrow, Border, Button, Check, ContainedService, ControlInterface, DisplayService, DocumentRoot, Drawable, EditBox, EditLine, Flow, Image, Line, Link, ListBox, Oval, Para, Progress, Radio, Rect, RelayDisplayService, Shape, Slot, Stack, Star, SubscriptionItem, TextDrawable, Video, WebWrangler

Constant Summary collapse

HTML =
Scarpe::Components::HTML

Class Method Summary collapse

Class Method Details

.asset_serverObject



6
7
8
9
10
11
12
13
14
15
16
17
18
# File 'lib/scarpe/assets.rb', line 6

def self.asset_server
  return @asset_server if @asset_server

  # A Scarpe Webview application can have only a single Shoes::App instance.
  @asset_server = Scarpe::Components::AssetServer.new app_dir: Shoes.APPS[0].dir

  # at_exit doesn't work reliably under webview. Give this a try.
  ::Scarpe::Webview::DisplayService.instance.control_interface.on_event(:shutdown) do
    @asset_server&.kill_server
  end

  @asset_server
end

.default_wv_text_drawable_with_tag(shoes_tag, html_tag = nil) ⇒ Object



63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
# File 'lib/scarpe/wv/text_drawable.rb', line 63

def default_wv_text_drawable_with_tag(shoes_tag, html_tag = nil)
  html_tag ||= shoes_tag
  webview_class_name = shoes_tag.capitalize
  webview_drawable_class = Class.new(Scarpe::Webview::TextDrawable) do
    class << self
      attr_accessor :html_tag
    end

    def to_calzini_hash
      h = super
      h[:tag] = self.class.html_tag
      h
    end
  end
  Scarpe::Webview.const_set webview_class_name, webview_drawable_class
  webview_drawable_class.html_tag = html_tag
end