select on window now displays the currently focused win

This commit is contained in:
David Botton 2024-03-24 18:11:36 -04:00
parent 06fdabf759
commit 83c36a9582
2 changed files with 13 additions and 9 deletions

View file

@ -491,21 +491,21 @@ clog-body. If main-menu add as main menu bar."))
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
(defclass clog-gui-menu-window-select (clog-select)()
(:documentation "Drop down containing windows. Selecting a window
will maximize it on top."))
(:documentation "Drop down containing existing windows."))
(defgeneric create-gui-menu-window-select (clog-obj
&key class
html-id)
(:documentation "Attached a clog-select as a menu item that auto updates
with open windows and maximizes them unless is a keep-on-top window or
on-window-can-maximize returns nil. Only one instance allowed."))
(:documentation "Attaches a clog-select as a menu item that auto updates
with open windows and focuses them unless is a keep-on-top window.
Only one instance allowed."))
(defmethod create-gui-menu-window-select
((obj clog-obj)
&key (class "w3-select")
&key (class "w3-bar-item w3-button")
content
(html-id nil))
(let ((window-select (create-select obj :class class :html-id html-id))
(let ((window-select (create-select obj :html-id html-id :class class))
(app (connection-data-item obj "clog-gui")))
(change-class window-select 'clog-gui-menu-window-select)
(setf (window-select app) window-select)
@ -515,7 +515,8 @@ on-window-can-maximize returns nil. Only one instance allowed."))
(unless (keep-on-top win)
(setf (hiddenp win) nil)
(window-focus win))))))
(create-option window-select :content "Select Window")
(when content
(create-option window-select :content content))
window-select))
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
@ -923,6 +924,7 @@ window-to-top-by-param or window-by-param."))
(when (window-select app)
(setf (window-select-item win) (create-option (window-select app)
:content title
:selected t
:value html-id)))
(set-on-double-click (win-title win) (lambda (obj)
(declare (ignore obj))
@ -1029,6 +1031,8 @@ window-to-top-by-param or window-by-param."))
(let ((app (connection-data-item obj "clog-gui")))
(unless (keep-on-top obj)
(setf (z-index obj) (incf (last-z app))))
(when (window-select app)
(setf (selectedp (window-select-item obj)) t))
(fire-on-window-change obj app)))
;;;;;;;;;;;;;;;;;;

View file

@ -380,7 +380,6 @@ clog-builder window.")
(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)
(create-gui-menu-item help :content "CLOG Manual" :on-click
(lambda (obj)
@ -415,6 +414,7 @@ clog-builder window.")
(declare (ignore obj))
(open-window (window body) "https://www.w3schools.com/w3css/")))
(create-gui-menu-item help :content "About CLOG Builder" :on-click #'on-help-about-builder)
(create-gui-menu-window-select menu :class "w3-bar-item w3-button w3-dark-grey")
(create-gui-menu-full-screen menu))
(on-show-copy-history-win body)
(cond