• Home
  • History
  • Annotate
  • Raw
  • Download
  • only in /macosx-10.10.1/emacs-93/emacs/lisp/

Lines Matching +defs:horizontal +defs:bar

1 ;;; scroll-bar.el --- window system-independent scroll bar support
28 ;; Window-system-independent bindings of mouse clicks on the scroll bar.
29 ;; Presently emulates the scroll-bar behavior of xterm.
39 (defun scroll-bar-event-ratio (event)
40 "Given a scroll bar event EVENT, return the scroll bar position as a ratio.
42 whose ratio gives the event's vertical position in the scroll bar, with 0
46 (defun scroll-bar-scale (num-denom whole)
48 This is handy for scaling a position on a scroll bar into real units,
50 from a scroll bar event, then (scroll-bar-scale SCROLL-BAR-POS
52 that scroll bar position."
55 ;; with a large scroll bar portion can easily overflow a lisp int.
58 (defun scroll-bar-columns (side)
69 ;; nil means it's a non-toolkit scroll bar, and its width in
71 (ceiling (or (frame-parameter nil 'scroll-bar-width) 14)
79 (defvar scroll-bar-mode)
80 (defvar previous-scroll-bar-mode nil)
82 (defvar scroll-bar-mode-explicit nil
83 "Non-nil means `set-scroll-bar-mode' should really do something.
84 This is nil while loading `scroll-bar.el', and t afterward.")
86 (defun set-scroll-bar-mode-1 (ignore value)
87 (set-scroll-bar-mode value))
89 (defun set-scroll-bar-mode (value)
90 "Set `scroll-bar-mode' to VALUE and put the new value into effect."
91 (if scroll-bar-mode
92 (setq previous-scroll-bar-mode scroll-bar-mode))
94 (setq scroll-bar-mode value)
96 (when scroll-bar-mode-explicit
100 (setcdr parameter scroll-bar-mode)
102 (cons (cons 'vertical-scroll-bars scroll-bar-mode)
110 (list (cons 'vertical-scroll-bars scroll-bar-mode)))
113 (defcustom scroll-bar-mode default-frame-scroll-bars
117 To set this variable in a Lisp program, use `set-scroll-bar-mode'
127 :set 'set-scroll-bar-mode-1)
129 ;; We just set scroll-bar-mode, but that was the default.
131 (setq scroll-bar-mode-explicit t)
133 (defun scroll-bar-mode (&optional flag)
142 (set-scroll-bar-mode (if (if (null flag)
143 (not scroll-bar-mode)
146 (or previous-scroll-bar-mode
149 (defun toggle-scroll-bar (arg)
152 The variable `scroll-bar-mode' controls which side the scroll bars are on
165 (or scroll-bar-mode default-frame-scroll-bars))))))
167 (defun toggle-horizontal-scroll-bar (arg)
168 "Toggle whether or not the selected frame has horizontal scroll bars.
169 With arg, turn horizontal scroll bars on if and only if arg is positive.
175 ;;;; Buffer navigation using the scroll bar.
178 (defun scroll-bar-set-window-start (event)
179 "Set the window start according to where the scroll bar is dragged.
180 EVENT should be a scroll bar click or drag event."
189 (scroll-bar-scale portion-whole
194 (defun scroll-bar-drag-position (portion-whole)
198 (scroll-bar-scale portion-whole
203 (defun scroll-bar-maybe-set-window-start (event)
204 "Set the window start according to where the scroll bar is dragged.
206 EVENT should be a scroll bar click or drag event."
218 (setq portion-start (scroll-bar-drag-position portion-whole))
220 (scroll-bar-drag-position next-portion-whole)
225 ;; Always set window start, to ensure scroll bar position is updated.
229 (defun scroll-bar-drag-1 (event)
237 (scroll-bar-scale portion-whole
242 (defun scroll-bar-drag (event)
243 "Scroll the window by dragging the scroll bar slider.
257 (scroll-bar-drag-1 event)
263 (cond ((eq (car-safe event) 'scroll-bar-movement)
264 (scroll-bar-drag-1 event))
272 (defun scroll-bar-scroll-down (event)
273 "Scroll the window's top line down to the location of the scroll bar click.
274 EVENT should be a scroll bar click."
288 (scroll-bar-scale portion-whole (1- (window-height)))))
293 (defun scroll-bar-scroll-up (event)
294 "Scroll the line next to the scroll bar click to the top of the window.
295 EVENT should be a scroll bar click."
309 (scroll-bar-scale portion-whole (1- (window-height)))))
318 (defun scroll-bar-toolkit-scroll (event)
337 (lines (scroll-bar-scale portion-whole
352 (scroll-bar-drag-1 event))))
364 (global-set-key [vertical-scroll-bar mouse-1]
365 'scroll-bar-toolkit-scroll))
367 (global-set-key [vertical-scroll-bar mouse-1]
368 'scroll-bar-scroll-up)
369 (global-set-key [vertical-scroll-bar drag-mouse-1]
370 'scroll-bar-scroll-up)
371 (global-set-key [vertical-scroll-bar down-mouse-2]
372 'scroll-bar-drag)
373 (global-set-key [vertical-scroll-bar mouse-3]
374 'scroll-bar-scroll-down)
375 (global-set-key [vertical-scroll-bar drag-mouse-3]
376 'scroll-bar-scroll-down)))
380 (provide 'scroll-bar)
383 ;;; scroll-bar.el ends here