mirror of
https://github.com/rabbibotton/clog.git
synced 2025-12-07 11:10:18 -08:00
Focus and Blur events for windows
This commit is contained in:
parent
bfdd90d42e
commit
c1b6da0b5d
3 changed files with 50 additions and 2 deletions
|
|
@ -376,6 +376,8 @@ The on-window-change clog-obj received is the new window"))
|
|||
|
||||
(defmethod fire-on-window-change (obj app)
|
||||
"Fire handler if set. Change the value of current-win to clog-obj (Private)"
|
||||
(when (current-win app)
|
||||
(fire-on-window-blurred (current-win app)))
|
||||
(unless obj
|
||||
(let (new-order
|
||||
(order -9999))
|
||||
|
|
@ -388,7 +390,8 @@ The on-window-change clog-obj received is the new window"))
|
|||
(windows app))))
|
||||
(setf (current-win app) obj)
|
||||
(when (on-window-change app)
|
||||
(funcall (on-window-change app) obj)))
|
||||
(funcall (on-window-change app) obj))
|
||||
(fire-on-window-focused obj))
|
||||
|
||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
;; Implementation - Individual Windows
|
||||
|
|
@ -446,6 +449,14 @@ The on-window-change clog-obj received is the new window"))
|
|||
:accessor on-window-can-size
|
||||
:initform nil
|
||||
:documentation "Return t to allow close of window")
|
||||
(on-window-focused
|
||||
:accessor on-window-focused
|
||||
:initform nil
|
||||
:documentation "Fired on window focused")
|
||||
(on-window-blurred
|
||||
:accessor on-window-blurred
|
||||
:initform nil
|
||||
:documentation "Fired on window blurred")
|
||||
(on-window-close
|
||||
:accessor on-window-close
|
||||
:initform nil
|
||||
|
|
@ -840,6 +851,40 @@ interactions. Use window-end-modal to undo."))
|
|||
(- (inner-height (window (body app))) (menu-bar-height obj)))))
|
||||
(fire-on-window-size-done obj)))
|
||||
|
||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
;; set-on-window-focused ;;
|
||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
|
||||
(defgeneric set-on-window-focused (clog-gui-window handler)
|
||||
(:documentation "Set the on-window-focused HANDLER"))
|
||||
|
||||
(defmethod set-on-window-focused ((obj clog-gui-window) handler)
|
||||
(setf (on-window-focused obj) handler))
|
||||
|
||||
(defgeneric fire-on-window-focused (clog-gui-window)
|
||||
(:documentation "Fire handler if set. (Private)"))
|
||||
|
||||
(defmethod fire-on-window-focused ((obj clog-gui-window))
|
||||
(when (on-window-focused obj)
|
||||
(funcall (on-window-focused obj) obj)))
|
||||
|
||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
;; set-on-window-blurred ;;
|
||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
|
||||
(defgeneric set-on-window-blurred (clog-gui-window handler)
|
||||
(:documentation "Set the on-window-blurred HANDLER"))
|
||||
|
||||
(defmethod set-on-window-blurred ((obj clog-gui-window) handler)
|
||||
(setf (on-window-blurred obj) handler))
|
||||
|
||||
(defgeneric fire-on-window-blurred (clog-gui-window)
|
||||
(:documentation "Fire handler if set. (Private)"))
|
||||
|
||||
(defmethod fire-on-window-blurred ((obj clog-gui-window))
|
||||
(when (on-window-blurred obj)
|
||||
(funcall (on-window-blurred obj) obj)))
|
||||
|
||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
;; set-on-window-can-close ;;
|
||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
|
|
|
|||
|
|
@ -689,6 +689,8 @@ embedded in a native template application.)"
|
|||
(window-keep-on-top generic-function)
|
||||
(window-make-modal generic-function)
|
||||
(window-end-modal generic-function)
|
||||
(set-on-window-focused generic-function)
|
||||
(set-on-window-blurred generic-function)
|
||||
(set-on-window-can-close generic-function)
|
||||
(set-on-window-close generic-function)
|
||||
(set-on-window-can-move generic-function)
|
||||
|
|
|
|||
|
|
@ -37,6 +37,7 @@
|
|||
(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-drop-down menu :content "Open Database Connection"))
|
||||
(win (create-gui-menu-drop-down menu :content "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))
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue