Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Add a demo package for usage examples

  • Loading branch information...
commit 75b9d7d112a809ebb587632013d588d6919176e1 1 parent 2185302
joachifm authored
Showing with 66 additions and 0 deletions.
  1. +15 −0 cl-webkit-demo.asd
  2. +51 −0 demo.lisp
15 cl-webkit-demo.asd
View
@@ -0,0 +1,15 @@
+(in-package :cl-user)
+
+(defpackage :cl-webkit-demo-asd
+ (:use :cl :asdf))
+
+(in-package :cl-webkit-demo-asd)
+
+(defsystem :cl-webkit-demo
+ :description "cl-webkit usage examples"
+ :author "Joachim Fasting <joachim.fasting@gmail.com>"
+ :licence "BSD"
+ :version "0.0"
+ :serial t
+ :components ((:file "demo"))
+ :depends-on (:cl-gtk2-gtk :cl-webkit))
51 demo.lisp
View
@@ -0,0 +1,51 @@
+;;; demo.lisp - usage examples
+;; Copyright (C) 2011, Joachim Fasting
+;;
+;; This file is part of cl-webkit
+;;
+;; All rights reserved.
+;;
+;; Redistribution and use in source and binary forms, with or without
+;; modification, are permitted provided that the following conditions are met:
+;;
+;; 1. Redistribution of source code must retain the above copyright
+;; notice, this list of conditions and the following disclaimer.
+;;
+;; 2. Redistribution in binary form must reproduce the above copyright
+;; notice, this list of conditions and the following disclaimer in the
+;; documentation and/or other materials provided with the distribution.
+;;
+;; THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+;; AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+;; IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+;; DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
+;; FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+;; DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
+;; SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
+;; CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+;; OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+;; OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+
+;;; Code:
+
+(in-package :cl-user)
+
+(defpackage :cl-webkit-demo
+ (:use :cl)
+ (:nicknames "webkit-demo")
+ (:export #:simple-browser))
+
+(in-package :cl-webkit-demo)
+
+(defun simple-browser ()
+ "A single-window browser with no keyboard or mouse input.
+Loads and renders a single web page."
+ (gtk:within-main-loop
+ (let ((win (make-instance 'gtk:gtk-window))
+ (scrolled (make-instance 'gtk:scrolled-window))
+ (view (webkit.foreign:webkit-web-view-new)))
+ (gtk:container-add scrolled view)
+ (gtk:container-add win scrolled)
+ (webkit.foreign:webkit-web-view-load-uri view "http://www.example.com")
+ (gtk:widget-show win))))
Please sign in to comment.
Something went wrong with that request. Please try again.