Hello Michael, > Here are a few modifications for NSMenuView.m. > > ===== > First: menus without items have a titlebar sized to just the title of > the menu. However, when you tear such a menu off the close button gets > plopped on there. This first fix adds some space in the NSMenuView > -sizeToFit to account for our button. > ===== > > (once again, I can't reach the CVS server so this is ugly, sorry.) > > In NSMenuView sizeToFit (around line 511): > > >>>>> > // the close button is 15 pixels, 4 for padding. > float neededImageAndTitleWidth = [_font widthOfString: [_menu > title]] + 15.0+ 4.0; > <<<<< > > This is based on the formula for the close button placement later in > the code.
This is wrong also. See below.
> Issues: this makes even the toplevel menu somewhat wider in certain
> cases... was that the case in OS?
This makes all menus wider because 15+4 pixels _always_ added.
Attached patch (NSMenuView.m.patch) makes adding 10 pixels (why 10?
got it in empiric way) only if neededImageAndTitleWidth not changed
after cycling through the menu items (menu title string is wider
than any menu items or there is no menu items at all).
> ======
> Second: the menu close button really sucks. It is a relic from the
> days of no transparency so I made a few changes.
> ======
>
> In NSMenuView.m createButton (around line 1531):
>
> >>>>>
> - (void) createButton
> {
[createButton code stripped]
> <<<<
> (the rest of the method can stay)
>
> Attached is common_closeX.tiff.
I've attached common_Close.tiff and common_CloseH.tiff. No changes
needed to createButton at this point. My approach is to make images
that looks like a bezeled and pushed hilghlighted button.
> Issues:
>
> * NSButton does not honor (NSControl) setRefusesFirstResponder:. I'm
> not sure if thats correct or a bug. However, it does cause the
> dottedRect to appear in the close button -- ugly.
As I can understand NeXT and Apple documentation, control have to
override acceptsFirstResponder and return NO when no need to draw
dotted rectangle. I've done it by creating CloseButton, subclass of
NSButton class and ovverriding acceptsFirstResponder
(NSMenuView.m.patch).
> * MomentaryLight is not quite the correct effect and
> NSMomentaryPushButton looks weird (the button recesses very deep.)
With my images it looks exactly like WindowMaker's close button.
> * common_CloseBroke.tiff?
For menus? ;)
PS: I've also attached common_3DArrowDown.tiff with corrected position
of light and dark sides of triangle.
--
Serg Stoyan
NSMenuView.m.patch
Description: Binary data
<<attachment: common_3DArrowDown.tiff>>
<<attachment: common_Close.tiff>>
<<attachment: common_CloseH.tiff>>
_______________________________________________ Bug-gnustep mailing list [EMAIL PROTECTED] http://mail.gnu.org/mailman/listinfo/bug-gnustep
