File: dframe.el.html
This code was developed and maintained as a part of speedbar since 1996. It became its own support utility in Aug 2000.
Dedicated frame mode is an Emacs independent library for supporting a program/buffer combination that resides in a dedicated frame. Support of this nature requires several complex interactions with the user which this library will provide, including:
* Creation of a frame. Positioned relatively.
Includes a frame cache for User position caching.
* Switching between frames.
* Timed activities using idle-timers
* Frame/buffer killing hooks
* Mouse-3 position relative menu
* Mouse motion, help-echo hacks
* Mouse clicking & double clicking
* Mode line hacking
* Utilities for use in a program covering:
o keymap massage for some actions
o working with an associated buffer
o shift-click
o detaching a frame
o focus-shifting & optional frame jumping
o currently active frame.
o message/y-or-n-p
o mouse set point
To Use:
1) (require 'dframe)
2) Variable Setup:
-frame-parameters -- Frame parameters for Emacs.
-- Not on parameter lists: They can optionally include width
and height. If width or height is not included, then it will
be provided to match the originating frame. In general,
turning off the menu bar, mode line, and minibuffer can
provide a smaller window, or more display area.
-track-mouse-flag -- mouse tracking on/off specific to your tool.
-update-flag -- app toggle for timer use. Init from
dframe-have-timer-flag. This is nil for terminals, since
updating a frame in a terminal is not useful to the user.
-key-map -- Your keymap. Call dframe-update-keymap on it.
-buffer, -frame, -cached-frame -- Variables used to track your
applications buffer, frame, or frame cache (when hidden). See
dframe-frame-mode for details.
-before-delete-hook, -before-popup-hook, -after-create-hook --
Hooks to have called. The -after-create-hook probably wants
to call a function which calls dframe-reposition-frame in an
appropriate manner.
3) Function Setup:
your-frame-mode -- function to toggle your app frame on and off.
its tasks are:
a) create a buffer
b) Call dframe-frame-mode. (See its doc)
c) If successful (your -frame variable has a value), call
timer setup if applicable.
your-frame-reposition- -- Function to call from after-create-hook to
reposition your frame with dframe-reposition-frame.
your-mode -- Set up the major mode of the buffer for your app.
Set these variables: dframe-track-mouse-function,
dframe-help-echo-function,
dframe-mouse-click-function,
dframe-mouse-position-function.
See speedbar's implementation of these functions.
speedbar-current-frame, speedbar-get-focus, speedbar-message,
speedbar-y-or-n-p, speedbar-set-timer, speedbar-click,
speedbar-position-cursor-on-line
4) Handling mouse clicks, and help text:
dframe-track-mouse, dframe-help-echo-function --
These variables need to be set to functions that display info
based on the mouse's position.
Text property 'help-echo, set to dframe-help-echo, which will
call dframe-help-echo-function.
Have a -click function, it can call dframe-quick-mouse for
positioning. If the variable dframe-power-click(var)/dframe-power-click(fun) is non-nil,
then shift was held down during the click.
; Bugs
* The timer managers doesn't handle multiple different timeouts.
* You can't specify continuous timeouts (as opposed to just idle timers.)
Defined variables (19)
dframe-activity-change-focus-flag | Non-nil means the selected frame will change based on activity. |
dframe-after-select-attached-frame-hook | Hook run after dframe has selected the attached frame. |
dframe-attached-frame | The frame which started a frame mode. |
dframe-client-functions | List of client functions using the dframe timer. |
dframe-controlled | Is this buffer controlled by a dedicated frame. |
dframe-delete-frame-function | Function used when a frame attached to a dframe frame is deleted. |
dframe-have-timer-flag | Non-nil means that timers are available for this Emacs. |
dframe-help-echo-function | A function to call when help-echo is used in newer versions of Emacs. |
dframe-iconify-frame-function | Function used when a dframe controlled frame is iconified. |
dframe-make-frame-visible-function | Function used when a dframe controlled frame is de-iconified. |
dframe-mouse-click-function | A function to call when the mouse is clicked. |
dframe-mouse-position-function | A function to call to position the cursor for a mouse click. |
dframe-power-click | Never set this by hand. Value is t when S-mouse activity occurs. |
dframe-setup-hook | Used for setting frame special event bindings. |
dframe-suppress-message-flag | Non-nil means that ‘dframe-message’ should just return a string. |
dframe-timer | The dframe timer used for updating the buffer. |
dframe-track-mouse-function | A function to call when the mouse is moved in the given frame. |
dframe-update-speed | Idle time in seconds needed before dframe will update itself. |
dframe-version | The current version of the dedicated frame library. |