comparison lisp/tooltip.el @ 40173:c4955867228d

(tooltip-x-offset, tooltip-y-offset): Mention in the doc string the effect of `left' and `top' parameters in tooltip-frame-parameters, the default values, and the units. (tooltip-frame-parameters): Mention `top' and `left' in the doc string. (tooltip-show): Mention in the doc string the `top' and `left' parameters in tooltip-frame-parameters, and x-max-tooltip-size.
author Eli Zaretskii <eliz@gnu.org>
date Mon, 22 Oct 2001 08:53:17 +0000
parents cf803b8f08ad
children 1dab42ecd751
comparison
equal deleted inserted replaced
40172:0476068f3921 40173:c4955867228d
82 :type 'number 82 :type 'number
83 :group 'tooltip) 83 :group 'tooltip)
84 84
85 85
86 (defcustom tooltip-x-offset nil 86 (defcustom tooltip-x-offset nil
87 "Specify an X offset for the display of tooltips. 87 "Specify an X offset, in pixels, for the display of tooltips.
88 The offset is relative to the position of the mouse. It must 88 The offset is relative to the position of the mouse. It must
89 be chosen so that the tooltip window doesn't contain the mouse 89 be chosen so that the tooltip window doesn't contain the mouse
90 when it pops up." 90 when it pops up. If the value is nil, the default offset is 5
91 pixels.
92
93 If `tooltip-frame-parameters' includes the `left' parameter,
94 the value of `tooltip-x-offset' is ignored."
91 :tag "X offset" 95 :tag "X offset"
92 :type '(choice (const :tag "Default" nil) 96 :type '(choice (const :tag "Default" nil)
93 (integer :tag "Offset" :value 1)) 97 (integer :tag "Offset" :value 1))
94 :group 'tooltip) 98 :group 'tooltip)
95 99
96 100
97 (defcustom tooltip-y-offset nil 101 (defcustom tooltip-y-offset nil
98 "Specify an Y offset for the display of tooltips. 102 "Specify a Y offset, in pixels, for the display of tooltips.
99 The offset is relative to the position of the mouse. It must 103 The offset is relative to the position of the mouse. It must
100 be chosen so that the tooltip window doesn't contain the mouse 104 be chosen so that the tooltip window doesn't contain the mouse
101 when it pops up." 105 when it pops up. If the value is nil, the default offset is -10
106 pixels.
107
108 If `tooltip-frame-parameters' includes the `top' parameter,
109 the value of `tooltip-y-offset' is ignored."
102 :tag "Y offset" 110 :tag "Y offset"
103 :type '(choice (const :tag "Default" nil) 111 :type '(choice (const :tag "Default" nil)
104 (integer :tag "Offset" :value 1)) 112 (integer :tag "Offset" :value 1))
105 :group 'tooltip) 113 :group 'tooltip)
106 114
107 115
108 (defcustom tooltip-frame-parameters 116 (defcustom tooltip-frame-parameters
109 '((name . "tooltip") 117 '((name . "tooltip")
110 (internal-border-width . 5) 118 (internal-border-width . 5)
111 (border-width . 1)) 119 (border-width . 1))
112 "Frame parameters used for tooltips." 120 "Frame parameters used for tooltips.
121
122 If `left' or `top' parameters are included, they specify the absolute
123 position to pop up the tooltip."
113 :type 'sexp 124 :type 'sexp
114 :tag "Frame Parameters" 125 :tag "Frame Parameters"
115 :group 'tooltip) 126 :group 'tooltip)
116 127
117 128
328 (push (cons key value) alist)) 339 (push (cons key value) alist))
329 alist)) 340 alist))
330 341
331 342
332 (defun tooltip-show (text) 343 (defun tooltip-show (text)
333 "Show a tooltip window at the current mouse position displaying TEXT." 344 "Show a tooltip window displaying TEXT.
345
346 Text larger than `x-max-tooltip-size' (which see) is clipped.
347
348 If the alist in `tooltip-frame-parameters' includes `left' and `top'
349 parameters, they determine the x and y position where the tooltip
350 is displayed. Otherwise, the tooltip pops at offsets specified by
351 `tooltip-x-offset' and `tooltip-y-offset' from the current mouse
352 position."
334 (if tooltip-use-echo-area 353 (if tooltip-use-echo-area
335 (message "%s" text) 354 (message "%s" text)
336 (condition-case error 355 (condition-case error
337 (let ((params (copy-sequence tooltip-frame-parameters)) 356 (let ((params (copy-sequence tooltip-frame-parameters))
338 (fg (face-attribute 'tooltip :foreground)) 357 (fg (face-attribute 'tooltip :foreground))