5 Commits

Author SHA1 Message Date
hans cee2f452aa index 2026-08-09 19:56:06 +02:00
hans 37468d4fa0 Diverse aanpassingen ivm foutgedrag. 2026-08-06 17:42:14 +02:00
hans 963fec5df5 Added select support. 2026-08-06 00:08:24 +02:00
hans 3d4deed94a display statements removed. 2026-08-04 14:05:43 +02:00
hans d6f555d43f version to 0.3.1 2026-08-04 13:12:05 +02:00
22 changed files with 193 additions and 86 deletions
+1
View File
@@ -25,3 +25,4 @@ rktwebview/build/
/scrbl/*.js
*.bak
/scrbl/*.html
/doc
+11
View File
@@ -235,6 +235,17 @@
(send this update-counter)
(send this set-folder my-dir)
(when (eq? my-page 'first)
(let ((language-select
(send this element 'sel-lang)))
(send language-select
on-change!
(λ (value)
(displayln
(format
"Selected language: ~a"
(send language-select get)))))))
(ww-debug "CONNECTING BUTTONS")
(send this bind! 'dialog-button 'click (λ (el evt data)
(send this prefs)))
+2 -2
View File
@@ -25,8 +25,8 @@
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
(define rkt-qt-version-major 0)
(define rkt-qt-version-minor 2)
(define rkt-qt-version-patch (if (eq? (system-type 'os) 'windows) 2 1))
(define rkt-qt-version-minor (if (eq? (system-type 'os) 'windows) 3 2))
(define rkt-qt-version-patch (if (eq? (system-type 'os) 'windows) 1 1))
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; Internal functions
+15 -6
View File
@@ -729,7 +729,11 @@
'oke))
(define/contract (webview-bind! wv selector event no-prevent-default)
(-> wv-win? (or/c symbol? string?) (or/c symbol? list-of-symbol?) boolean? list?)
(-> wv-win?
(or/c symbol? string?)
(or/c symbol? list-of-symbol?)
boolean?
(or/c #f list?))
(let* ((sel (if (symbol? selector)
(format "#~a" selector)
selector))
@@ -909,7 +913,12 @@
(wvv webview-value/number number? string->number)
(wvv webview-value/symbol symbol? string->symbol)
(wvv webview-value/color rgba? hex->rgba)
(wvv webview-value/boolean boolean? (λ (e) (if (string=? e "true") #t #f)))
(wvv webview-value/boolean
boolean?
(λ (e)
(if (boolean? e)
e
(string-ci=? e "true"))))
(define/contract (webview-add-class! wv id-or-selector class)
@@ -1042,7 +1051,7 @@
(return (list (list 'id id)
(list 'style (send Object entries r))))))))
)
(displayln js-code)
;(displayln js-code)
(let ((r (webview-call-js wv js-code)))
; (format
; (js-code
@@ -1056,7 +1065,7 @@
; " return { id: id, style: r };"
; "}") cl))
; )))
(display "Result: ") (write r) (newline)
;(display "Result: ") (write r) (newline)
(if (eq? r #f)
#f
(let ((h (hash-ref r 'with-ids)))
@@ -1067,8 +1076,8 @@
(make-hash (map (λ (e) (cons (to-symbol (car e)) (cadr e))) (cadr style-rec)))
)
)) h)))
(displayln (format "l = ~a" l))
(write l)(newline)
;(displayln (format "l = ~a" l))
;(write l)(newline)
; l = ((volume-meter . #hash((display . none))))
; ((volume-meter . #hash(("display" . "none"))))
(if (symbol? selector)
+1 -1
View File
@@ -306,7 +306,7 @@ The value is converted to JavaScript source text before the generated JavaScript
is returned.
}
@section{Example}
@section[#:tag "js-transform-example"]{Example}
The following example combines function definition, method calls, list
construction, sequential bindings and a lambda expression passed to a JavaScript
+3 -3
View File
@@ -18,7 +18,7 @@ Menu data structures used by the webview library.
This module provides constructors, predicates, traversal helpers, mutation
operations, and JSON conversion for menu trees.
@section{Overview}
@section[#:tag "menu-overview"]{Overview}
A menu is represented as a tree. A menu consists of menu items, and a menu item
may optionally contain a submenu.
@@ -36,7 +36,7 @@ structure constructors and predicates are not exported directly. The public API
uses constructor procedures and helper functions operating on those internal
values.
@section{Predicates}
@section[#:tag "menu-predicates"]{Predicates}
@defproc[(is-wv-menu? [mnu any/c]) boolean?]{
@@ -154,7 +154,7 @@ Sets the callback of the menu item identified by @racket[id].
@racket[menu] value.
}
@section{Conversion}
@section[#:tag "menu-conversion"]{Conversion}
@defproc[(wv-menu->json [menu any/c]) string?]{
+1 -1
View File
@@ -5,7 +5,7 @@
scribble/core
)
@title{@elem{racket-webview}}
@title[#:tag "racket-webview-manual"]{@elem{racket-webview}}
@table-of-contents[]
+2 -2
View File
@@ -26,9 +26,9 @@
@title{Racket Webview - v@version - Introduction}
@author[@author+email["Hans Dijkema" "hans@dijkewijk.nl"]]
@defmodule{racket-webview}
@defmodule[racket-webview]
@section{Overview}
@section[#:tag "racket-webview-intro-overview"]{Overview}
This documentation is provided for version @bold{@version} of racket webview.
+5 -4
View File
@@ -1,11 +1,12 @@
#lang scribble/manual
@defmodule{racket-webview/racket-webview-qt}
@title{Racket FFI Interface for @tt{rktwebview_qt}}
@defmodule[racket-webview/racket-webview-qt]
@author[@author+email["Hans Dijkema" "hans@dijkewijk.nl"]]
@section{Overview}
@section[#:tag "racket-webview-qt-overview"]{Overview}
The module @tt{racket-webview-qt.rkt} provides a Racket FFI wrapper around the
native @tt{rktwebview_qt} library. It loads the shared library, initializes the
@@ -413,7 +414,7 @@ Requests a file-save dialog.
Shows a native message box.
}
@section{Event Delivery}
@section[#:tag "racket-webview-qt-event-delivery"]{Event Delivery}
Each webview has an associated event callback.
@@ -461,7 +462,7 @@ Example result:
]
}
@section{Example}
@section[#:tag "racket-webview-qt-example"]{Example}
@racketblock[
(define ctx
+3 -3
View File
@@ -3,7 +3,7 @@
@(require racket/base
scribble/core)
@title{racket-webview}
@title[#:tag "racket-webview-functional"]{racket-webview}
@author[@author+email["Hans Dijkema" "hans@dijkewijk.nl"]]
@defmodule[racket-webview/racket-webview]
@@ -31,7 +31,7 @@ JavaScript calls. When an HTML file is
served, the context's CSS boilerplate is injected immediately before the
closing @tt{</head>} tag.
@section{Contexts}
@section[#:tag "racket-webview-contexts"]{Contexts}
@defproc[(webview-new-context
@@ -196,7 +196,7 @@ structure, an exception is raised.
}
@section{Dialogs}
@section[#:tag "racket-webview-dialogs"]{Dialogs}
Dialog functions return immediately. Results are delivered asynchronously via
events.
+3 -3
View File
@@ -16,7 +16,7 @@ RGBA color support used by the webview library.
This module exports a transparent @racket[rgba] structure together with
predicates and conversion procedures for working with CSS-style color values.
@section{Overview}
@section[#:tag "rgba-overview"]{Overview}
An @racket[rgba] value represents a color using red, green, blue, and alpha
components.
@@ -35,7 +35,7 @@ The intended external representation is the CSS form:
"rgba(r,g,b,a)"
]
@section{Predicates}
@section[#:tag "rgba-predicates"]{Predicates}
@defproc[(rgba/color? [v any/c]) boolean?]{
@@ -68,7 +68,7 @@ components. The field @racket[a] is the alpha component.
The structure is transparent.
}
@section{Conversion}
@section[#:tag "rgba-conversion"]{Conversion}
@defproc[(rgba->string [c rgba?]) string?]{
+36 -36
View File
@@ -1,6 +1,6 @@
#lang scribble/manual
@defmodule[racket-webview/c-api]
@bold{Interface:} @tt{racket-webview/c-api}
@author[@author+email["Hans Dijkema" "hans@dijkewijk.nl"]]
@@ -106,7 +106,7 @@ This applies to values returned by @tt{rkt_webview_info()},
@section{Environment and Runtime Control}
@defproc[(rkt_webview_env [env_cmds any/c]) void?]{
@defproc[#:link-target? #f (rkt_webview_env [env_cmds any/c]) void?]{
C signature:
@verbatim{
@@ -120,7 +120,7 @@ form @tt{"NAME=value"}.
Return value: none.
}
@defproc[(rkt_webview_init) void?]{
@defproc[#:link-target? #f (rkt_webview_init) void?]{
C signature:
@verbatim{
@@ -133,7 +133,7 @@ helper process.
Return value: none.
}
@defproc[(rkt_webview_cleanup) void?]{
@defproc[#:link-target? #f (rkt_webview_cleanup) void?]{
C signature:
@verbatim{
@@ -146,7 +146,7 @@ previously returned context and webview handles are invalid.
Return value: none.
}
@defproc[(rkt_webview_set_loglevel [l any/c]) void?]{
@defproc[#:link-target? #f (rkt_webview_set_loglevel [l any/c]) void?]{
C signature:
@verbatim{
@@ -158,7 +158,7 @@ Sets the backend log level.
Return value: none.
}
@defproc[(rkt_webview_info) any/c]{
@defproc[#:link-target? #f (rkt_webview_info) any/c]{
C signature:
@verbatim{
@@ -171,7 +171,7 @@ Returns a pointer to @tt{rkt_data_t}. The returned object has
Return value: @tt{rkt_data_t *}, caller-owned.
}
@defproc[(rkt_webview_version) any/c]{
@defproc[#:link-target? #f (rkt_webview_version) any/c]{
C signature:
@verbatim{
@@ -184,9 +184,9 @@ Returns a pointer to @tt{rkt_data_t}. The returned object has
Return value: @tt{rkt_data_t *}, caller-owned.
}
@subsection{Events}
@subsection[#:tag "rktwebview-c-api-events"]{Events}
@defproc[(rkt_webview_events_waiting) exact-integer?]{
@defproc[#:link-target? #f (rkt_webview_events_waiting) exact-integer?]{
C signature:
@verbatim{
@@ -198,7 +198,7 @@ Returns the number of events currently waiting in the event queue.
Return value: @tt{int}.
}
@defproc[(rkt_webview_get_event) any/c]{
@defproc[#:link-target? #f (rkt_webview_get_event) any/c]{
C signature:
@verbatim{
@@ -221,9 +221,9 @@ This keeps the event queue flowing, allows asynchronous operations such as
dialogs to complete in a timely manner, and avoids the impression that the system
has stalled while the Racket side is simply not looking.
@section{Contexts}
@section[#:tag "rktwebview-c-api-contexts"]{Contexts}
@defproc[(rkt_webview_new_context [boilerplate_js string?]
@defproc[#:link-target? #f (rkt_webview_new_context [boilerplate_js string?]
[optional_server_cert_pem string?])
exact-integer?]{
C signature:
@@ -241,7 +241,7 @@ Return value: @tt{rkt_wv_context_t}.
@section{Webviews}
@defproc[(rkt_webview_create [context exact-integer?]
@defproc[#:link-target? #f (rkt_webview_create [context exact-integer?]
[parent exact-integer?])
exact-integer?]{
C signature:
@@ -257,7 +257,7 @@ otherwise it is created as a top-level window.
Return value: webview handle as @tt{int}.
}
@defproc[(rkt_webview_close [wv exact-integer?]) void?]{
@defproc[#:link-target? #f (rkt_webview_close [wv exact-integer?]) void?]{
C signature:
@verbatim{
@@ -269,7 +269,7 @@ Closes the specified webview.
Return value: none.
}
@defproc[(rkt_webview_valid [wv exact-integer?]) boolean?]{
@defproc[#:link-target? #f (rkt_webview_valid [wv exact-integer?]) boolean?]{
C signature:
@verbatim{
@@ -281,7 +281,7 @@ Checks whether @tt{wv} is a valid webview handle.
Return value: @tt{bool}.
}
@defproc[(rkt_webview_set_title [wv exact-integer?] [title string?])
@defproc[#:link-target? #f (rkt_webview_set_title [wv exact-integer?] [title string?])
exact-integer?]{
C signature:
@@ -294,7 +294,7 @@ Sets the window title of the specified webview.
Return value: @tt{result_t}.
}
@defproc[(rkt_webview_set_ou_token [wv exact-integer?] [token string?]) void?]{
@defproc[#:link-target? #f (rkt_webview_set_ou_token [wv exact-integer?] [token string?]) void?]{
C signature:
@verbatim{
@@ -309,7 +309,7 @@ Return value: none.
@section{Navigation and JavaScript}
@defproc[(rkt_webview_set_url [wv exact-integer?] [url string?]) exact-integer?]{
@defproc[#:link-target? #f (rkt_webview_set_url [wv exact-integer?] [url string?]) exact-integer?]{
C signature:
@verbatim{
@@ -321,7 +321,7 @@ Navigates the specified webview to the given URL.
Return value: @tt{result_t}.
}
@defproc[(rkt_webview_set_html [wv exact-integer?] [html string?]) exact-integer?]{
@defproc[#:link-target? #f (rkt_webview_set_html [wv exact-integer?] [html string?]) exact-integer?]{
C signature:
@verbatim{
@@ -333,7 +333,7 @@ Loads raw HTML into the specified webview.
Return value: @tt{result_t}.
}
@defproc[(rkt_webview_run_js [wv exact-integer?] [js string?]) exact-integer?]{
@defproc[#:link-target? #f (rkt_webview_run_js [wv exact-integer?] [js string?]) exact-integer?]{
C signature:
@verbatim{
@@ -345,7 +345,7 @@ Executes JavaScript asynchronously in the specified webview.
Return value: @tt{result_t}.
}
@defproc[(rkt_webview_call_js [wv exact-integer?] [js string?]) any/c]{
@defproc[#:link-target? #f (rkt_webview_call_js [wv exact-integer?] [js string?]) any/c]{
C signature:
@verbatim{
@@ -365,7 +365,7 @@ result string.
Return value: @tt{rkt_data_t *}, caller-owned.
}
@defproc[(rkt_webview_open_devtools [wv exact-integer?]) exact-integer?]{
@defproc[#:link-target? #f (rkt_webview_open_devtools [wv exact-integer?]) exact-integer?]{
C signature:
@verbatim{
@@ -379,7 +379,7 @@ Return value: @tt{result_t}.
@section{Window Management}
@defproc[(rkt_webview_move [w exact-integer?] [x exact-integer?] [y exact-integer?])
@defproc[#:link-target? #f (rkt_webview_move [w exact-integer?] [x exact-integer?] [y exact-integer?])
exact-integer?]{
C signature:
@@ -392,7 +392,7 @@ Moves the specified window to the given screen coordinates.
Return value: @tt{result_t}.
}
@defproc[(rkt_webview_resize [w exact-integer?]
@defproc[#:link-target? #f (rkt_webview_resize [w exact-integer?]
[width exact-integer?]
[height exact-integer?])
exact-integer?]{
@@ -407,7 +407,7 @@ Resizes the specified window.
Return value: @tt{result_t}.
}
@defproc[(rkt_webview_hide [w exact-integer?]) exact-integer?]{
@defproc[#:link-target? #f (rkt_webview_hide [w exact-integer?]) exact-integer?]{
C signature:
@verbatim{
@@ -419,7 +419,7 @@ Hides the specified window.
Return value: @tt{result_t}.
}
@defproc[(rkt_webview_show [w exact-integer?]) exact-integer?]{
@defproc[#:link-target? #f (rkt_webview_show [w exact-integer?]) exact-integer?]{
C signature:
@verbatim{
@@ -431,7 +431,7 @@ Shows the specified window.
Return value: @tt{result_t}.
}
@defproc[(rkt_webview_show_normal [w exact-integer?]) exact-integer?]{
@defproc[#:link-target? #f (rkt_webview_show_normal [w exact-integer?]) exact-integer?]{
C signature:
@verbatim{
@@ -443,7 +443,7 @@ Restores the specified window to its normal state.
Return value: @tt{result_t}.
}
@defproc[(rkt_webview_present [w exact-integer?]) exact-integer?]{
@defproc[#:link-target? #f (rkt_webview_present [w exact-integer?]) exact-integer?]{
C signature:
@verbatim{
@@ -455,7 +455,7 @@ Presents the specified window to the user.
Return value: @tt{result_t}.
}
@defproc[(rkt_webview_maximize [w exact-integer?]) exact-integer?]{
@defproc[#:link-target? #f (rkt_webview_maximize [w exact-integer?]) exact-integer?]{
C signature:
@verbatim{
@@ -467,7 +467,7 @@ Maximizes the specified window.
Return value: @tt{result_t}.
}
@defproc[(rkt_webview_minimize [w exact-integer?]) exact-integer?]{
@defproc[#:link-target? #f (rkt_webview_minimize [w exact-integer?]) exact-integer?]{
C signature:
@verbatim{
@@ -479,7 +479,7 @@ Minimizes the specified window.
Return value: @tt{result_t}.
}
@defproc[(rkt_webview_window_state [w exact-integer?]) exact-integer?]{
@defproc[#:link-target? #f (rkt_webview_window_state [w exact-integer?]) exact-integer?]{
C signature:
@verbatim{
@@ -491,7 +491,7 @@ Returns the current state of the specified window.
Return value: @tt{window_state_t}.
}
@section{Dialogs}
@section[#:tag "rktwebview-c-api-dialogs"]{Dialogs}
The dialog functions are asynchronous. They request that the dialog be opened on
the Qt side, but do not block the Racket side while the dialog is shown. This is
@@ -502,7 +502,7 @@ Completion of a dialog is therefore observed through events, not by blocking the
calling thread.
@defproc[(rkt_webview_choose_dir [w exact-integer?]
@defproc[#:link-target? #f (rkt_webview_choose_dir [w exact-integer?]
[title string?]
[base_dir string?])
exact-integer?]{
@@ -519,7 +519,7 @@ reported through events.
Return value: @tt{result_t}.
}
@defproc[(rkt_webview_file_open [w exact-integer?]
@defproc[#:link-target? #f (rkt_webview_file_open [w exact-integer?]
[title string?]
[base_dir string?]
[permitted_exts string?])
@@ -537,7 +537,7 @@ reported through events.
Return value: @tt{result_t}.
}
@defproc[(rkt_webview_file_save [w exact-integer?]
@defproc[#:link-target? #f (rkt_webview_file_save [w exact-integer?]
[title string?]
[base_dir string?]
[permitted_exts string?])
@@ -555,7 +555,7 @@ reported through events.
Return value: @tt{result_t}.
}
@defproc[(rkt_webview_message_box [w exact-integer?]
@defproc[#:link-target? #f (rkt_webview_message_box [w exact-integer?]
[title string?]
[message string?]
[submessage string?]
+3 -3
View File
@@ -1,7 +1,7 @@
#lang scribble/manual
@(require racket/runtime-path)
@defmodule{racket-webview/internals}
@bold{Internal component:} @tt{racket-webview/internals}
@title{Qt WebView Backend Architecture}
@author[@author+email["Hans Dijkema" "hans@dijkewijk.nl"]]
@@ -44,7 +44,7 @@ reconfigure the organ. No attempt is made to unify the instruments. Such efforts
From the outside, one hears only a simple exchange: a call, a response. Internally, the balance is carefully maintained. For now, this is sufficient. And it holds.
@section{Overview}
@section[#:tag "rktwebview-qt-internals-overview"]{Overview}
This backend provides a webview implementation by delegating all GUI and browser
functionality to a separate Qt process.
@@ -93,7 +93,7 @@ thread.
From the callers perspective, a synchronous call returns only after the GUI
thread has completed the action.
@section{Event Delivery}
@section[#:tag "rktwebview-qt-internals-event-delivery"]{Event Delivery}
Many relevant events are not tied to a specific command. Page loading, navigation
attempts, window movement, and JavaScript-originated events are delivered through
+2 -2
View File
@@ -15,14 +15,14 @@
@defmodule[racket-webview/wv-context]
@section{Overview}
@section[#:tag "wv-context-overview"]{Overview}
The library is organized around two main concepts: contexts and windows.
A context represents the shared runtime environment for one or more webview
windows. It owns the underlying webview context, provides the base URL used by
those windows, and gives access to persistent settings through
@racketmodname[wv-settings].
@racketmodname[racket-webview/wv-settings].
A context stores both JavaScript and CSS boilerplate. The JavaScript boilerplate
is passed to the native runtime, while the CSS boilerplate is injected into HTML
+1 -1
View File
@@ -18,7 +18,7 @@ Dialog-window wrapper built on top of @racket[wv-window%].
This module exports the @racket[wv-dialog%] class. It is a specialized window
class whose initial size and position are derived from its parent window.
@section{Overview}
@section[#:tag "wv-dialog-overview"]{Overview}
A @racket[wv-dialog%] object is a @racket[wv-window%] that initializes itself as
a dialog relative to its parent window.
+1 -1
View File
@@ -22,7 +22,7 @@ represent one DOM element within a @racket[wv-window%] and provide a small
object-oriented interface for event dispatch, content replacement, CSS class
manipulation, style access, and attribute access.
@section{Overview}
@section[#:tag "wv-element-overview"]{Overview}
A @racket[wv-element%] object is associated with:
+44 -2
View File
@@ -22,7 +22,7 @@ This module exports a family of classes derived from @racket[wv-element%]. Each
class represents one DOM input element and provides a typed @racket[get] method
together with a @racket[set!] method.
@section{Overview}
@section[#:tag "wv-input-overview"]{Overview}
All classes in this module inherit from @racket[wv-element%].
@@ -384,4 +384,46 @@ Writes @racket[v] by delegating to:
(webview-set-value! wv element-id v)
]
}
}
}
@section{Class: wv-input/select%}
@defclass[wv-input/select% wv-element% ()]{
Wrapper for an HTML select element.
@defconstructor[([window (is-a?/c wv-window%)]
[element-id symbol?])]{
Creates a select-element wrapper.
}
@defmethod[(get) (or/c string? boolean?)]{
Returns the value of the selected option by delegating to
@racket[webview-value].
}
@defmethod[(set! [v (or/c symbol? string? number? boolean?
g:date? g:time? g:datetime? rgba?)])
any/c]{
Selects the option whose value equals @racket[v] by delegating to
@racket[webview-set-value!].
}
@defmethod[(set-options! [options list?]
[selected any/c #f])
any/c]{
Replaces the option elements. Each entry in @racket[options] is a list
containing a value and a label. When @racket[selected] is not @racket[#f],
the option with that value is selected.
}
@defmethod[(on-change! [callback-func procedure?]) any/c]{
Binds @racket[callback-func] to the HTML @tt{change} event. The callback
receives the newly selected value.
}
}
+1 -1
View File
@@ -20,7 +20,7 @@ This module exports the @racket[wv-settings%] class, which provides a small
object-oriented interface over an @racket[ini] settings backend. Settings are
accessed relative to a context.
@section{Overview}
@section[#:tag "wv-settings-overview"]{Overview}
A @racket[wv-settings%] object combines:
+10 -9
View File
@@ -23,10 +23,10 @@
Window abstraction built on top of @racketmodname[racket-webview].
This module exports the @racket[wv-window%] class and re-exports the APIs from
@racketmodname[wv-element], @racketmodname[wv-input], @racketmodname[rgba], and
@racketmodname[wv-settings].
@racketmodname[racket-webview/wv-element], @racketmodname[racket-webview/wv-input], @racketmodname[racket-webview/rgba], and
@racketmodname[racket-webview/wv-settings].
@section{Overview}
@section[#:tag "wv-window-overview"]{Overview}
A @racket[wv-window%] object represents one webview window.
@@ -133,6 +133,7 @@ following classes is instantiated:
@item{@racket[wv-input/check%] for @racket['checkbox]}
@item{@racket[wv-input/radio%] for @racket['radio]}
@item{@racket[wv-input/color%] for @racket['color]}
@item{@racket[wv-input/select%] for an HTML @tt{select} element}
@item{@racket[wv-element%] otherwise}]
Newly created wrappers receive this window through the @racket[window] init
@@ -478,7 +479,7 @@ The resulting geometry is then applied through @racket[move] and @racket[resize]
}
}
@section{Events}
@section[#:tag "wv-window-events"]{Events}
The window installs an internal event handler when it is created.
@@ -532,9 +533,9 @@ Only the first optional @racket[not-found-handler] is used.
This module also re-exports the public APIs from:
@itemlist[#:style 'compact
@item{@racketmodname[wv-element]}
@item{@racketmodname[wv-input]}
@item{@racketmodname[rgba]}
@item{@racketmodname[wv-settings]}]
@item{@racketmodname[racket-webview/wv-element]}
@item{@racketmodname[racket-webview/wv-input]}
@item{@racketmodname[racket-webview/rgba]}
@item{@racketmodname[racket-webview/wv-settings]}]
It also re-exports @racket[webview-version].
It also re-exports @racket[webview-version].
+2 -2
View File
@@ -53,11 +53,11 @@
(let ((d* (string->symbol (format "~a" (car d)))))
(webview-set-style! wv element-id (list 'display d*))))
(let ((style-hash (webview-get-style wv element-id 'display)))
(displ "style-hash: ") (write style-hash) (newline)
;(displ "style-hash: ") (write style-hash) (newline)
(let ((display-style (hash-ref (if (eq? style-hash #f)
(make-hash)
style-hash) 'display #f)))
(displayln display-style)
;(displayln display-style)
(if (eq? display-style #f)
#f
(string->symbol display-style)))))
+41 -1
View File
@@ -1,6 +1,7 @@
#lang racket/base
(require racket/class
xml
"wv-element.rkt"
"racket-webview.rkt"
)
@@ -14,7 +15,8 @@
wv-input/range%
wv-input/check%
wv-input/radio%
wv-input/color%)
wv-input/color%
wv-input/select%)
(define-syntax mk-cl
@@ -55,3 +57,41 @@
(mk-cl wv-input/check% webview-set-value! webview-value/boolean)
(mk-cl wv-input/radio% webview-set-value! webview-value/boolean)
(mk-cl wv-input/color% webview-set-value! webview-value/color)
(define wv-input/select%
(class wv-element%
(inherit-field window
element-id)
(super-new)
(define wv (hash-ref (send window info) 'wv))
(define/public (get)
(webview-value wv element-id))
(define/public (set! value)
(webview-set-value! wv element-id value))
(define/public (set-options! options [selected #f])
(send this
set-innerHTML!
(apply
string-append
(for/list ((option (in-list options)))
(let ((value (car option))
(label (cadr option)))
(xexpr->string
(list 'option
(list
(list 'value
(format "~a" value)))
(format "~a" label)))))))
(when selected
(send this set! selected)))
(define/public (on-change! callback-func)
(send window bind! element-id 'change
(λ (element event data)
(callback-func (send this get)))))
))
+5 -3
View File
@@ -100,7 +100,7 @@
" return a;\n"
" } else { \n"
" if (a === null) {\n"
" return false;\n"
" return el.tagName;\n"
" } else {\n"
" return a;\n"
" }"
@@ -124,6 +124,7 @@
((eq? type 'checkbox) wv-input/check%)
((eq? type 'radio) wv-input/radio%)
((eq? type 'color) wv-input/color%)
((eq? type 'select) wv-input/select%)
((eq? type 'unknown) (begin
(err-webview "Element with id '~a' not found"
id)
@@ -383,7 +384,9 @@
(define/public (bind! selector events callback . no-prevent-default)
(let* ((npd (if (null? no-prevent-default) #f (car no-prevent-default)))
(items (webview-bind! wv selector events npd))
(items (or (webview-bind!
wv selector events npd)
'()))
(events* (if (symbol? events) (list events) events))
)
;(dbg-webview "No-prevent-default = ~a" npd)
@@ -602,4 +605,3 @@
handler)
)