mirror of
https://github.com/rabbibotton/clog.git
synced 2025-12-06 02:30:42 -08:00
clog-gui-template
This commit is contained in:
parent
5213080e83
commit
1f17d30c46
3 changed files with 53 additions and 2 deletions
|
|
@ -6,9 +6,15 @@
|
||||||
;;;; clog-gui.lisp ;;;;
|
;;;; clog-gui.lisp ;;;;
|
||||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||||
|
|
||||||
|
;;; Like clog-web, clog-gui uses w3.css as the underlying framework. w3.css is
|
||||||
|
;;; a public domain css only framework for layouts, is cast and efficient and
|
||||||
|
;;; does not require additional components by the css file. In addition
|
||||||
|
;;; clog-gui uses jQueryUI and its default css file to provide client side
|
||||||
|
;;; movement when needed, if clien side movement is not used it is possible
|
||||||
|
;;; to pass nil to the initilization function for both.
|
||||||
|
|
||||||
(mgl-pax:define-package :clog-gui
|
(mgl-pax:define-package :clog-gui
|
||||||
(:documentation "CLOG-GUI a desktop GUI abstraction for CLOG")
|
(:documentation "CLOG-GUI a desktop GUI abstraction for CLOG")
|
||||||
(:local-nicknames (:cc :clog-connection))
|
|
||||||
(:use #:cl #:parse-float #:clog #:mgl-pax))
|
(:use #:cl #:parse-float #:clog #:mgl-pax))
|
||||||
|
|
||||||
(cl:in-package :clog-gui)
|
(cl:in-package :clog-gui)
|
||||||
|
|
|
||||||
45
templates/clog-gui-template.lisp
Normal file
45
templates/clog-gui-template.lisp
Normal file
|
|
@ -0,0 +1,45 @@
|
||||||
|
;;; This is a template to help jump start a CLOG-GUI App
|
||||||
|
|
||||||
|
(defpackage #:clog-user
|
||||||
|
(:use #:cl #:clog #:clog-gui)
|
||||||
|
(:export start-tutorial))
|
||||||
|
|
||||||
|
(in-package :clog-user)
|
||||||
|
|
||||||
|
(defun on-file-new (obj)
|
||||||
|
(let* ((win (create-gui-window obj :title "New Window")))
|
||||||
|
))
|
||||||
|
|
||||||
|
(defun on-help-about (obj)
|
||||||
|
(let* ((about (create-gui-window obj
|
||||||
|
:title "About"
|
||||||
|
:content "<div class='w3-black'>
|
||||||
|
<center><img src='/img/clogwicon.png'></center>
|
||||||
|
<center>CLOG</center>
|
||||||
|
<center>The Common Lisp Omnificent GUI</center></div>
|
||||||
|
<div><p><center>A New App</center>
|
||||||
|
<center>(c) 2021 - David Botton</center></p></div>"
|
||||||
|
:hidden t
|
||||||
|
:width 200
|
||||||
|
:height 200)))
|
||||||
|
(window-center about)
|
||||||
|
(setf (visiblep about) t)
|
||||||
|
(set-on-window-can-size about (lambda (obj)
|
||||||
|
(declare (ignore obj))()))))
|
||||||
|
|
||||||
|
(defun on-new-window (body)
|
||||||
|
(setf (title (html-document body)) "New App")
|
||||||
|
(clog-gui-initialize body)
|
||||||
|
(add-class body "w3-teal")
|
||||||
|
(let* ((menu (create-gui-menu-bar body))
|
||||||
|
(tmp (create-gui-menu-icon menu :on-click #'on-help-about))
|
||||||
|
(file (create-gui-menu-drop-down menu :content "File"))
|
||||||
|
(tmp (create-gui-menu-item file :content "New Window" :on-click #'on-file-new))
|
||||||
|
(help (create-gui-menu-drop-down menu :content "Help"))
|
||||||
|
(tmp (create-gui-menu-item help :content "About" :on-click #'on-help-about))
|
||||||
|
(tmp (create-gui-menu-full-screen menu)))
|
||||||
|
(run body)))
|
||||||
|
|
||||||
|
(defun start-app ()
|
||||||
|
(initialize #'on-new-window)
|
||||||
|
(open-browser))
|
||||||
|
|
@ -15,7 +15,7 @@
|
||||||
(create-div (window-content win) :content n))))
|
(create-div (window-content win) :content n))))
|
||||||
|
|
||||||
(defun on-file-browse (obj)
|
(defun on-file-browse (obj)
|
||||||
(let* ((win (create-gui-window obj :title "Browse")))
|
(let ((win (create-gui-window obj :title "Browse")))
|
||||||
(create-child (window-content win)
|
(create-child (window-content win)
|
||||||
"<iframe style='width:100%;height:98%;' src='https://common-lisp.net/'></iframe>")))
|
"<iframe style='width:100%;height:98%;' src='https://common-lisp.net/'></iframe>")))
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue