mirror of
https://github.com/gnustep/libs-gui.git
synced 2025-06-04 06:50:41 +00:00
Fixed title view height to be at least 23 pixels.mouseDown: make submenu torn off after mouse released.
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/gui/trunk@18379 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
parent
ff1af3e385
commit
821e7513c0
1 changed files with 38 additions and 26 deletions
|
@ -46,8 +46,12 @@
|
||||||
{
|
{
|
||||||
NSFont *font = [NSFont menuFontOfSize: 0.0];
|
NSFont *font = [NSFont menuFontOfSize: 0.0];
|
||||||
|
|
||||||
/* Should make up 23 for the default font */
|
/* Minimum title height is 23 */
|
||||||
height = ([font boundingRectForFont].size.height) + 8;
|
height = ([font boundingRectForFont].size.height) + 9;
|
||||||
|
if (height < 23)
|
||||||
|
{
|
||||||
|
height = 23;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return height;
|
return height;
|
||||||
|
@ -142,16 +146,20 @@
|
||||||
unsigned eventMask = NSLeftMouseUpMask | NSPeriodicMask;
|
unsigned eventMask = NSLeftMouseUpMask | NSPeriodicMask;
|
||||||
BOOL done = NO;
|
BOOL done = NO;
|
||||||
NSDate *theDistantFuture = [NSDate distantFuture];
|
NSDate *theDistantFuture = [NSDate distantFuture];
|
||||||
|
NSPoint startWindowOrigin;
|
||||||
|
NSPoint endWindowOrigin;
|
||||||
|
|
||||||
NSDebugLLog (@"NSMenu", @"Mouse down in title!");
|
NSDebugLLog (@"NSMenu", @"Mouse down in title!");
|
||||||
|
|
||||||
lastLocation = [theEvent locationInWindow];
|
// Remember start position of window
|
||||||
|
if (_ownedByMenu)
|
||||||
if (_ownedByMenu && ![_owner isTornOff] && [_owner supermenu])
|
|
||||||
{
|
{
|
||||||
[_owner setTornOff: YES];
|
startWindowOrigin = [_window frame].origin;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Remember start location of cursor in window
|
||||||
|
lastLocation = [theEvent locationInWindow];
|
||||||
|
|
||||||
[_window _captureMouse: nil];
|
[_window _captureMouse: nil];
|
||||||
|
|
||||||
[NSEvent startPeriodicEventsAfterDelay: 0.02 withPeriod: 0.02];
|
[NSEvent startPeriodicEventsAfterDelay: 0.02 withPeriod: 0.02];
|
||||||
|
@ -162,7 +170,6 @@
|
||||||
untilDate: theDistantFuture
|
untilDate: theDistantFuture
|
||||||
inMode: NSEventTrackingRunLoopMode
|
inMode: NSEventTrackingRunLoopMode
|
||||||
dequeue: YES];
|
dequeue: YES];
|
||||||
|
|
||||||
switch ([theEvent type])
|
switch ([theEvent type])
|
||||||
{
|
{
|
||||||
case NSRightMouseUp:
|
case NSRightMouseUp:
|
||||||
|
@ -178,7 +185,7 @@
|
||||||
|
|
||||||
origin.x += (location.x - lastLocation.x);
|
origin.x += (location.x - lastLocation.x);
|
||||||
origin.y += (location.y - lastLocation.y);
|
origin.y += (location.y - lastLocation.y);
|
||||||
if ([_owner class] == [NSMenu class])
|
if (_ownedByMenu)
|
||||||
{
|
{
|
||||||
[_owner nestedSetFrameOrigin: origin];
|
[_owner nestedSetFrameOrigin: origin];
|
||||||
}
|
}
|
||||||
|
@ -193,6 +200,18 @@
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Make menu torn off
|
||||||
|
if (_ownedByMenu && ![_owner isTornOff] && [_owner supermenu])
|
||||||
|
{
|
||||||
|
endWindowOrigin = [_window frame].origin;
|
||||||
|
if ((startWindowOrigin.x != endWindowOrigin.x
|
||||||
|
|| startWindowOrigin.y != endWindowOrigin.y))
|
||||||
|
{
|
||||||
|
[_owner setTornOff: YES];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
[NSEvent stopPeriodicEvents];
|
[NSEvent stopPeriodicEvents];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -235,14 +254,6 @@
|
||||||
[self setNeedsDisplay: YES];
|
[self setNeedsDisplay: YES];
|
||||||
}
|
}
|
||||||
|
|
||||||
/*- (void) windowBecomeMain
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
- (void) windowResignMain
|
|
||||||
{
|
|
||||||
}*/
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Buttons
|
* Buttons
|
||||||
*/
|
*/
|
||||||
|
@ -356,6 +367,7 @@
|
||||||
{
|
{
|
||||||
_owner = owner;
|
_owner = owner;
|
||||||
_ownedByMenu = YES;
|
_ownedByMenu = YES;
|
||||||
|
|
||||||
RELEASE (titleColor);
|
RELEASE (titleColor);
|
||||||
titleColor = RETAIN ([NSColor blackColor]);
|
titleColor = RETAIN ([NSColor blackColor]);
|
||||||
[textAttributes setObject: [NSColor whiteColor]
|
[textAttributes setObject: [NSColor whiteColor]
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue