mirror of
https://github.com/rabbibotton/clog.git
synced 2026-01-01 06:41:11 -08:00
Better handling of maximizing windows and reorientation of browser
This commit is contained in:
parent
dc5693a6d4
commit
57c153f292
4 changed files with 56 additions and 24 deletions
|
|
@ -578,7 +578,8 @@ option passed from javascript calling the jQuery custom event mechanism
|
|||
|
||||
(defgeneric set-on-resize (clog-obj on-resize-handler)
|
||||
(:documentation "Set the ON-RESIZE-HANDLER for CLOG-OBJ. If ON-RESIZE-HANDLER
|
||||
is nil unbind the event."))
|
||||
is nil unbind the event. In most modern browser this only works on the clog-window
|
||||
object"))
|
||||
|
||||
(defmethod set-on-resize ((obj clog-obj) handler)
|
||||
(set-on-event obj "resize" handler))
|
||||
|
|
|
|||
|
|
@ -43,6 +43,7 @@
|
|||
(window-to-top-by-param generic-function)
|
||||
(window-by-title generic-function)
|
||||
(window-by-param generic-function)
|
||||
(reorient-all-windows generic-function)
|
||||
(maximize-all-windows generic-function)
|
||||
(normalize-all-windows generic-function)
|
||||
(set-on-window-change generic-function)
|
||||
|
|
@ -187,18 +188,9 @@ BODY-LEFT-OFFSET and BODY-RIGHT-OFFSET limit width on maximize."
|
|||
(let ((app (create-clog-gui clog-body)))
|
||||
(setf (body-left-offset app) body-left-offset)
|
||||
(setf (body-right-offset app) body-right-offset))
|
||||
(set-on-full-screen-change (html-document clog-body)
|
||||
(lambda (obj)
|
||||
(when (current-window obj)
|
||||
(when (window-maximized-p (current-window obj))
|
||||
(window-normalize (current-window obj))
|
||||
(window-maximize (current-window obj))))))
|
||||
(set-on-orientation-change (window clog-body)
|
||||
(lambda (obj)
|
||||
(when (current-window obj)
|
||||
(when (window-maximized-p (current-window obj))
|
||||
(window-normalize (current-window obj))
|
||||
(window-maximize (current-window obj))))))
|
||||
(set-on-full-screen-change (html-document clog-body) 'reorient-all-windows)
|
||||
(set-on-orientation-change (window clog-body) 'reorient-all-windows)
|
||||
(set-on-resize (window clog-body) 'reorient-all-windows)
|
||||
(unless (connection-data-item clog-body "w3-css")
|
||||
(when w3-css-url
|
||||
(setf (connection-data-item clog-body "w3-css") t)
|
||||
|
|
@ -357,6 +349,27 @@ window or nil if not found"))
|
|||
(window-normalize value))
|
||||
(windows app))))
|
||||
|
||||
;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
;; reorient-all-windows ;;
|
||||
;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
|
||||
(defgeneric reorient-all-windows (clog-obj)
|
||||
(:documentation "Reorient all windows. Remaximized any maximize windows
|
||||
and leave any normalized windows as normalized. This is called by default
|
||||
in on-resize, on-full-screen-change and on-orientation-change events."))
|
||||
|
||||
(defmethod reorient-all-windows ((obj clog-obj))
|
||||
(let ((app (connection-data-item obj "clog-gui"))
|
||||
(cur (current-window obj)))
|
||||
(maphash (lambda (key value)
|
||||
(declare (ignore key))
|
||||
(when (window-maximized-p value)
|
||||
(window-normalize value :focus nil)
|
||||
(window-maximize value :focus nil)))
|
||||
(windows app))
|
||||
(when cur
|
||||
(window-focus cur))))
|
||||
|
||||
;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
;; create-gui-menu-bar ;;
|
||||
;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
|
|
@ -1011,13 +1024,15 @@ the browser."))
|
|||
;; window-maximize ;;
|
||||
;;;;;;;;;;;;;;;;;;;;;
|
||||
|
||||
(defgeneric window-maximize (clog-gui-window)
|
||||
(:documentation "Set CLOG-GUI-WINDOW as maximized window."))
|
||||
(defgeneric window-maximize (clog-gui-window &key focus)
|
||||
(:documentation "Set CLOG-GUI-WINDOW as maximized window and
|
||||
:focus (default t)."))
|
||||
|
||||
(defmethod window-maximize ((obj clog-gui-window))
|
||||
(defmethod window-maximize ((obj clog-gui-window) &key (focus t))
|
||||
(let ((app (connection-data-item obj "clog-gui")))
|
||||
(when focus
|
||||
(unless (keep-on-top obj)
|
||||
(window-focus obj))
|
||||
(window-focus obj)))
|
||||
(when (fire-on-window-can-maximize obj)
|
||||
(unless (window-maximized-p obj)
|
||||
(setf (last-x obj) (left obj))
|
||||
|
|
@ -1039,12 +1054,14 @@ the browser."))
|
|||
;; window-normalize ;;
|
||||
;;;;;;;;;;;;;;;;;;;;;;
|
||||
|
||||
(defgeneric window-normalize (clog-gui-window)
|
||||
(:documentation "Set CLOG-GUI-WINDOW as normalized window."))
|
||||
(defgeneric window-normalize (clog-gui-window &key focus)
|
||||
(:documentation "Set CLOG-GUI-WINDOW as normalized window an
|
||||
:focus (default t)."))
|
||||
|
||||
(defmethod window-normalize ((obj clog-gui-window))
|
||||
(defmethod window-normalize ((obj clog-gui-window) &key (focus t))
|
||||
(when focus
|
||||
(unless (keep-on-top obj)
|
||||
(window-focus obj))
|
||||
(window-focus obj)))
|
||||
(when (fire-on-window-can-normalize obj)
|
||||
(when (window-maximized-p obj)
|
||||
(setf (width obj) (last-width obj))
|
||||
|
|
|
|||
|
|
@ -2906,7 +2906,13 @@ It parse the string TEXT without using READ functions."
|
|||
(lambda (obj)
|
||||
(declare (ignore obj))
|
||||
(open-window (window body) "/dbadmin")))
|
||||
(Create-gui-menu-item win :content "Maximize All" :on-click #'maximize-all-windows)
|
||||
(create-gui-menu-item win :content "Maximize" :on-click
|
||||
(lambda (obj)
|
||||
(window-maximize (current-window obj))))
|
||||
(create-gui-menu-item win :content "Normalize" :on-click
|
||||
(lambda (obj)
|
||||
(window-normalize (current-window obj))))
|
||||
(create-gui-menu-item win :content "Maximize All" :on-click #'maximize-all-windows)
|
||||
(create-gui-menu-item win :content "Normalize All" :on-click #'normalize-all-windows)
|
||||
(create-gui-menu-window-select win)
|
||||
(create-gui-menu-item help :content "CLOG Quick Start" :on-click 'on-quick-start)
|
||||
|
|
|
|||
|
|
@ -118,6 +118,12 @@
|
|||
(set-on-window-can-size about (lambda (obj)
|
||||
(declare (ignore obj))()))))
|
||||
|
||||
(defun on-maximize-window (obj)
|
||||
(window-maximize (current-window obj)))
|
||||
|
||||
(defun on-normalize-window (obj)
|
||||
(window-normalize (current-window obj)))
|
||||
|
||||
(defun on-new-window (body)
|
||||
(setf (title (html-document body)) "Tutorial 22")
|
||||
;; For web oriented apps consider using the :client-movement option.
|
||||
|
|
@ -133,6 +139,8 @@
|
|||
(tmp (create-gui-menu-item file :content "Movie" :on-click 'on-file-movies))
|
||||
(tmp (create-gui-menu-item file :content "Pinned" :on-click 'on-file-pinned))
|
||||
(win (create-gui-menu-drop-down menu :content "Window"))
|
||||
(tmp (create-gui-menu-item win :content "Maximize" :on-click 'on-maximize-window))
|
||||
(tmp (create-gui-menu-item win :content "Normalize" :on-click 'on-normalize-window))
|
||||
(tmp (create-gui-menu-item win :content "Maximize All" :on-click 'maximize-all-windows))
|
||||
(tmp (create-gui-menu-item win :content "Normalize All" :on-click 'normalize-all-windows))
|
||||
(tmp (create-gui-menu-window-select win))
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue