Generates a popup menu or menu-component.
capi
make-pane-popup-menu pane interface &key title menu-name component-p => menu
pane⇩ |
A pane in an interface. |
interface⇩ |
An interface or nil . |
title⇩ |
A string or nil . |
menu-name⇩ |
A string or nil . |
component-p⇩ |
A boolean. |
menu⇩ |
A menu or a menu-component. |
The generic function make-pane-popup-menu
generates a popup menu for pane.
interface can be nil
if pane has already been created, in which case the interface of pane is used (obtained by the element accessor element-interface).
title and menu-name provide a title and name for menu. title and menu-name both default to nil
.
If component-p is true, then make-pane-popup-menu
creates a menu-component rather than a menu. The default value of component-p is nil
.
This code makes an interface with two graph-panes. The initialize-instance method uses make-pane-popup-menu
to add a menu to the menu bar from which the user can perform operations on the graphs.
Note that, because make-pane-popup-menu
calls make-menu-for-pane to make each menu, the callbacks in the menus are automatically done on the appropriate graph.
(capi:define-interface gg () () (:panes (g1 capi:graph-pane) (g2 capi:graph-pane)) (:layouts (main-layout capi:column-layout '(g1 g2))) (:menu-bar) (:default-initargs :visible-min-width 200 :visible-min-height 300)) (defmethod initialize-instance :after ((self gg) &key) (with-slots (g1 g2) self (setf (capi:interface-menu-bar-items self) (append (capi:interface-menu-bar-items self) (list (make-instance 'capi:menu :title "Graphs" :items (list (capi:make-pane-popup-menu g1 self :title "graph1") (capi:make-pane-popup-menu g2 self :title "graph2")))))))) (capi:display (make-instance 'gg))
CAPI User Guide and Reference Manual (Macintosh version) - 01 Dec 2021 19:31:27