mirror of
https://github.com/rabbibotton/clog.git
synced 2025-12-06 02:30:42 -08:00
Menu bars can be added to windows in clog-gui
This commit is contained in:
parent
dfc8d60c2d
commit
b63ecf2c26
2 changed files with 21 additions and 6 deletions
|
|
@ -399,17 +399,20 @@ in on-resize, on-full-screen-change and on-orientation-change events."))
|
|||
(defclass clog-gui-menu-bar (clog-div)()
|
||||
(:documentation "Menu bar"))
|
||||
|
||||
(defgeneric create-gui-menu-bar (clog-obj &key class html-id)
|
||||
(defgeneric create-gui-menu-bar (clog-obj &key class html-id main-menu)
|
||||
(:documentation "Attached a menu bar to a CLOG-OBJ in general a
|
||||
clog-body."))
|
||||
clog-body. If main-menu add as main menu bar."))
|
||||
|
||||
(defmethod create-gui-menu-bar ((obj clog-obj)
|
||||
&key (class "w3-bar w3-black w3-card-4")
|
||||
(html-id nil))
|
||||
(let ((div (create-div obj :class class :html-id html-id))
|
||||
(app (connection-data-item obj "clog-gui")))
|
||||
(html-id nil)
|
||||
(main-menu t))
|
||||
(let* ((div (create-div obj :class class :html-id html-id))
|
||||
(blank (create-a div))
|
||||
(app (connection-data-item obj "clog-gui")))
|
||||
(change-class div 'clog-gui-menu-bar)
|
||||
(setf (menu app) div)
|
||||
(when main-menu
|
||||
(setf (menu app) div))
|
||||
div))
|
||||
|
||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
|
|
|
|||
|
|
@ -12,6 +12,17 @@
|
|||
;; windows
|
||||
(create-div (window-content win) :content n))))
|
||||
|
||||
(defun on-file-with-menu (obj)
|
||||
(let ((win (create-gui-window obj :title "Window With Menu")))
|
||||
(let* ((menu (create-gui-menu-bar (window-content win)))
|
||||
(file (create-gui-menu-drop-down menu :content "Menu 1"))
|
||||
(tmp (create-gui-menu-item file :content "Count" :on-click 'on-file-count))
|
||||
(file (create-gui-menu-drop-down menu :content "Menu 2"))
|
||||
(tmp (create-gui-menu-item file :content "Count" :on-click 'on-file-count)))
|
||||
(declare (ignore tmp))
|
||||
(add-class menu "w3-small")
|
||||
(create-div (window-content win) :content "Some Text"))))
|
||||
|
||||
(defun on-file-browse (obj)
|
||||
(let ((win (create-gui-window obj :title "Browse")))
|
||||
(create-child (window-content win)
|
||||
|
|
@ -155,6 +166,7 @@
|
|||
(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 "Count" :on-click 'on-file-count))
|
||||
(tmp (create-gui-menu-item file :content "Window With Menu" :on-click 'on-file-with-menu))
|
||||
(tmp (create-gui-menu-item file :content "Browse" :on-click 'on-file-browse))
|
||||
(tmp (create-gui-menu-item file :content "Drawing" :on-click 'on-file-drawing))
|
||||
(tmp (create-gui-menu-item file :content "Movie" :on-click 'on-file-movies))
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue