From 1f17d30c4600d132ceb87bac659cbb143607aa06 Mon Sep 17 00:00:00 2001 From: David Botton Date: Sun, 28 Feb 2021 09:01:56 -0500 Subject: [PATCH] clog-gui-template --- source/clog-gui.lisp | 8 +++++- templates/clog-gui-template.lisp | 45 ++++++++++++++++++++++++++++++++ tutorial/22-tutorial.lisp | 2 +- 3 files changed, 53 insertions(+), 2 deletions(-) create mode 100644 templates/clog-gui-template.lisp diff --git a/source/clog-gui.lisp b/source/clog-gui.lisp index b3d7970..8adcccc 100644 --- a/source/clog-gui.lisp +++ b/source/clog-gui.lisp @@ -6,9 +6,15 @@ ;;;; 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 (:documentation "CLOG-GUI a desktop GUI abstraction for CLOG") - (:local-nicknames (:cc :clog-connection)) (:use #:cl #:parse-float #:clog #:mgl-pax)) (cl:in-package :clog-gui) diff --git a/templates/clog-gui-template.lisp b/templates/clog-gui-template.lisp new file mode 100644 index 0000000..1d34b96 --- /dev/null +++ b/templates/clog-gui-template.lisp @@ -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 "
+
+
CLOG
+
The Common Lisp Omnificent GUI
+

A New App
+
(c) 2021 - David Botton

" + :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)) diff --git a/tutorial/22-tutorial.lisp b/tutorial/22-tutorial.lisp index ccee38e..e6cb09d 100644 --- a/tutorial/22-tutorial.lisp +++ b/tutorial/22-tutorial.lisp @@ -15,7 +15,7 @@ (create-div (window-content win) :content n)))) (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) "")))