diff options
| -rw-r--r-- | README.xwidget | 34 |
1 files changed, 32 insertions, 2 deletions
diff --git a/README.xwidget b/README.xwidget index 62aa530481d..ca10f7ee546 100644 --- a/README.xwidget +++ b/README.xwidget | |||
| @@ -1577,8 +1577,38 @@ https://live.gnome.org/GObjectIntrospection/HowToWriteALanguageBinding | |||
| 1577 | http://developer.gnome.org/gi/unstable/gi-girepository.html | 1577 | http://developer.gnome.org/gi/unstable/gi-girepository.html |
| 1578 | http://developer.gnome.org/gi/unstable/gi-overview.html | 1578 | http://developer.gnome.org/gi/unstable/gi-overview.html |
| 1579 | 1579 | ||
| 1580 | tentative testcase: | ||
| 1581 | (xwgir-require-namespace "WebKit" "3.0") | ||
| 1582 | 1580 | ||
| 1581 | In order for GIR to work, it needs the namespace and class of a | ||
| 1582 | widget. This is used to access the typelib file, which contains the | ||
| 1583 | introspection data. The namespace and class is stored as a property | ||
| 1584 | on the lisp symbol handle used by xwidgets to identify the widget | ||
| 1585 | class. | ||
| 1586 | |||
| 1587 | This snippet sets the needed :xwgir-class property, and calls the | ||
| 1588 | set_zoom_level method: | ||
| 1589 | |||
| 1590 | M-x xwidget-webkit-browse-url RET www.emacswiki.org RET | ||
| 1591 | |||
| 1592 | Then eval the following: | ||
| 1593 | |||
| 1594 | ;;load the webkit typelib | ||
| 1595 | (xwgir-require-namespace "WebKit" "2.0") | ||
| 1596 | |||
| 1597 | ;;provide the metadata needed so xwgir can work with the webkit-osr xwidget | ||
| 1583 | (put 'webkit-osr :xwgir-class '("WebKit" "WebView")) | 1598 | (put 'webkit-osr :xwgir-class '("WebKit" "WebView")) |
| 1599 | ;;call the method | ||
| 1584 | (xwgir-call-method (xwidget-at 1) "set_zoom_level" '(3.0)) | 1600 | (xwgir-call-method (xwidget-at 1) "set_zoom_level" '(3.0)) |
| 1601 | |||
| 1602 | It's also possible to create widgets dynamically, by using | ||
| 1603 | introspection to call a widget constructor(from xwidget-test.el): | ||
| 1604 | |||
| 1605 | |||
| 1606 | (defun xwgir-test () | ||
| 1607 | (interactive) | ||
| 1608 | (xwgir-require-namespace "Gtk" "3.0") | ||
| 1609 | (put 'color-selection :xwgir-class '("Gtk" "ColorSelection")) | ||
| 1610 | |||
| 1611 | (xwgir-demo-a-xwgir-button) | ||
| 1612 | (xwgir-call-method (xwidget-at 1) "set_label" '( "xwgir set label!")) | ||
| 1613 | ) | ||
| 1614 | |||