Skip to content

Commit 3e1d949

Browse files
committed
add style docstring to popup-menu and ensure-gravity
1 parent 08cc7d8 commit 3e1d949

File tree

3 files changed

+46
-7
lines changed

3 files changed

+46
-7
lines changed

src/ext/popup-window.lisp

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,20 @@
5353
(popup-window-source-window window))
5454

5555
(defun ensure-gravity (gravity)
56+
"The possible gravity values are as follow, as keywords. They should be self-explanatory.
57+
58+
:center
59+
:top-display
60+
:bottom-display
61+
:top
62+
:topright
63+
:cursor
64+
:follow-cursor
65+
:mouse-cursor
66+
:vertically-adjacent-window
67+
:vertically-adjacent-window-dynamic
68+
:horizontally-adjacent-window
69+
:horizontally-above-window"
5670
(if (typep gravity 'gravity)
5771
gravity
5872
(ecase gravity

src/interface.lisp

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -134,7 +134,9 @@ PIXEL-X, PIXEL-Y, PIXEL-WIDTH, PIXEL-HEIGHT are in pixels (may be nil for auto-c
134134
&key action-callback
135135
print-spec
136136
style
137-
max-display-items))
137+
max-display-items)
138+
(:documentation "Create a popup-menu and display it. See `display-popup-menu`."))
139+
138140
(defgeneric lem-if:popup-menu-update
139141
(implementation popup-menu items &key print-spec max-display-items keep-focus))
140142
(defgeneric lem-if:popup-menu-quit (implementation popup-menu))

src/popup.lisp

Lines changed: 29 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -38,14 +38,37 @@
3838
print-spec
3939
style
4040
max-display-items)
41-
"Creates a popup-menu at the cursor position and displays it. Used for things
42-
such as completions.
41+
"Create a popup-menu and display it.
4342
44-
- `items`: is a list of anything, but print-spec must be able to turn it into a string.
43+
By default, create it at the cursor position, but obey the :gravity of STYLE.
44+
45+
Used for things such as completions.
46+
47+
- `items`: a list of anything, but PRINT-SPEC must be able to turn it into a string.
4548
- `action-callback`: function taking an item (from `items`) as a parameter. It is run once an item is selected.
46-
- `print-spec`: A function taking an `item` as a paremeter and returns it's string representation.
47-
- `style`: No Documentation
48-
- `max-display-items`: integer limiting the number of items that can be displayed at once."
49+
- `print-spec`: a function taking an `item` as a paremeter and returning its string representation.
50+
- style: a STYLE struct or a plist of args that is applied to MAKE-STYLE. Defaults to *STYLE*: uses borders and has no offset on the Y axis.
51+
52+
Example: '(:use-border t :offset-y 0)
53+
54+
Other properties include: :gravity (default: :cursor), :background-color, :offset-x, :cursor-invisible, :shape.
55+
56+
Other gravity possibilities are (see `ensure-gravity`):
57+
58+
:center
59+
:top-display
60+
:bottom-display
61+
:top
62+
:topright
63+
:cursor
64+
:follow-cursor
65+
:mouse-cursor
66+
:vertically-adjacent-window
67+
:vertically-adjacent-window-dynamic
68+
:horizontally-adjacent-window
69+
:horizontally-above-window
70+
71+
- `max-display-items`: an integer limiting the number of items that can be displayed at once."
4972
(declare (ignore action-callback print-spec style max-display-items))
5073
(apply #'lem-if:display-popup-menu (implementation)
5174
items

0 commit comments

Comments
 (0)