unofficial mirror of help-gnu-emacs@gnu.org
 help / color / mirror / Atom feed
* how to determine menu-bar dimensions?
@ 2005-07-08 15:31 Drew Adams
  0 siblings, 0 replies; 2+ messages in thread
From: Drew Adams @ 2005-07-08 15:31 UTC (permalink / raw)


How to determine the menu-bar dimensions: width and height, say in pixels?

In some cases, such as Windows, the menu-bar characters seem to be set by
the window manager; in other cases they are governed by the Emacs `menu'
face or the .Xdefaults file. Anyone have an idea how to calculate the
overall dimensions of the menu-bar? (Similarly for the tool-bar.)

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: how to determine menu-bar dimensions?
       [not found] <mailman.2560.1120839129.2857.help-gnu-emacs@gnu.org>
@ 2005-07-09  6:52 ` rgb
  0 siblings, 0 replies; 2+ messages in thread
From: rgb @ 2005-07-09  6:52 UTC (permalink / raw)


Drew Adams wrote:
> How to determine the menu-bar dimensions: width and height, say in pixels?
>
> In some cases, such as Windows, the menu-bar characters seem to be set by
> the window manager; in other cases they are governed by the Emacs `menu'
> face or the .Xdefaults file. Anyone have an idea how to calculate the
> overall dimensions of the menu-bar? (Similarly for the tool-bar.)

I messed with this for a very long time.  I don't know why. I don't
actually care.  I guess I thought it should be easy and got caught up
in it after a while.

This works for the toolbar provided there is only 1 window in the
frame.

(progn (tool-bar-mode 0)
       (sit-for 0)
       (let ((fph (frame-pixel-height))
             (wh (window-height)))
         (tool-bar-mode 1)
         (sit-for 0)
         (+ (* (- wh (window-height))
               (frame-char-height))
            (- (frame-pixel-height) fph))))

But there seems to be a bug (cvs) that prevents similar code from
working for the menu bar.  Apparently (frame-char-height) doesn't
count the menu bar and for that matter neither does (frame-height).
I'll try to write it up in the morning.  If you're working on a non MS
Windows system the bug may not apply and the above may work for
toggling menu-bar-mode too.

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2005-07-09  6:52 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
     [not found] <mailman.2560.1120839129.2857.help-gnu-emacs@gnu.org>
2005-07-09  6:52 ` how to determine menu-bar dimensions? rgb
2005-07-08 15:31 Drew Adams

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).