aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJoakim Verona2012-07-23 08:39:17 +0200
committerJoakim Verona2012-07-23 08:39:17 +0200
commitf8dd0eebf5ab472db2d9387c2b0f34b2ed594a15 (patch)
tree1c74e94cddcf85f41b6e2945e530a33acdb2f87e
parent9b022dc31cc92c0890eb142f8c9f120aab479f5e (diff)
downloademacs-f8dd0eebf5ab472db2d9387c2b0f34b2ed594a15.tar.gz
emacs-f8dd0eebf5ab472db2d9387c2b0f34b2ed594a15.zip
some xwgir docs
-rw-r--r--README.xwidget34
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
1577http://developer.gnome.org/gi/unstable/gi-girepository.html 1577http://developer.gnome.org/gi/unstable/gi-girepository.html
1578http://developer.gnome.org/gi/unstable/gi-overview.html 1578http://developer.gnome.org/gi/unstable/gi-overview.html
1579 1579
1580tentative testcase:
1581(xwgir-require-namespace "WebKit" "3.0")
1582 1580
1581In 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
1587This snippet sets the needed :xwgir-class property, and calls the
1588set_zoom_level method:
1589
1590M-x xwidget-webkit-browse-url RET www.emacswiki.org RET
1591
1592Then 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
1602It's also possible to create widgets dynamically, by using
1603introspection 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