Fixes for the menus and additions to NSTabView.

git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/gui/trunk@4660 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
Michael Silva 1999-07-27 10:24:59 +00:00
parent 873548a922
commit 9a2bf35f6c
14 changed files with 170 additions and 8 deletions

View file

@ -1,3 +1,25 @@
1999-07-27 Michael Hanni <mhanni@sprintmail.com>
* Source/NSTabView.m: added code to allow tabs on the bottom of a
tabview. Also made the space that the tabs themselves are draw in
from 20 pixels to 16 (which is the exact space needed.)
* Images/common_TabDownSelectedLeft.tiff
common_TabDownSelectedRight.tiff
common_TabDownSelectedToUnSelectedJunction.tiff
common_TabDownUnSelectedJunction.tiff
common_TabDownUnSelectedLeft.tiff
common_TabDownUnSelectedRight.tiff
common_TabDownUnSelectedToSelectedJunction.tiff:
place keeper images for bottom tabs. These really need to be
redrawn.
* Source/NSMenu.m: removed isTornOff: from frontend and it is in
the backend where it should be.
* Source/NSMenuView.m: added code that does quite a bit of the
transient menu code.
The event code needs to be finessed so that the transient menu is
not allowed to remain on screen unless the mouse button stays down.
1999-07-26 Michael Hanni <mhanni@sprintmail.com>
* Source/NSTableView.m: added much more code to this

View file

@ -52,6 +52,9 @@
BOOL menu_changed;
BOOL menu_is_tornoff;
// Private.
BOOL menu_follow_transient;
// Reserved for back-end use
void *be_menu_reserved;
}

View file

@ -31,6 +31,7 @@
typedef enum {
NSTopTabsBezelBorder,
NSBottomTabsBezelBorder,
NSNoTabsBezelBorder,
NSNoTabsLineBorder,
NSNoTabsNoBorder

View file

@ -58,6 +58,13 @@ common_SwitchOn.tiff \
common_SwitchOff.tiff \
common_SliderHoriz.tiff \
common_SliderVert.tiff \
common_TabDownSelectedLeft.tiff \
common_TabDownSelectedRight.tiff \
common_TabDownSelectedToUnSelectedJunction.tiff \
common_TabDownUnSelectedJunction.tiff \
common_TabDownUnSelectedLeft.tiff \
common_TabDownUnSelectedRight.tiff \
common_TabDownUnSelectedToSelectedJunction.tiff \
common_TabSelectedLeft.tiff \
common_TabSelectedRight.tiff \
common_TabSelectedToUnSelectedJunction.tiff \

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

View file

@ -354,10 +354,12 @@ static NSZone *menuZone = NULL;
return menu_supermenu && [menu_supermenu attachedMenu] == self;
}
/*
- (BOOL) isTornOff
{
return menu_is_tornoff;
}
*/
- (NSPoint) locationForSubmenu: (NSMenu *)aSubmenu
{

View file

@ -153,6 +153,8 @@ static float GSMenuBarHeight = 25.0; // a guess.
if ([anItem hasSubmenu] && ![[anItem target] isTornOff])
[[anItem target] close];
else if ([anItem hasSubmenu] && [[anItem target] isTornOff])
[[anItem target] closeTransient];
[anItem setState: 0];
menuv_highlightedItemIndex = -1;
@ -167,6 +169,8 @@ static float GSMenuBarHeight = 25.0; // a guess.
if ([anItem hasSubmenu] && ![[anItem target] isTornOff])
[[anItem target] close];
else if ([anItem hasSubmenu] && [[anItem target] isTornOff])
[[anItem target] closeTransient];
[anItem setState: 0];
}
@ -185,6 +189,8 @@ static float GSMenuBarHeight = 25.0; // a guess.
if ([anItem hasSubmenu] && ![[anItem target] isTornOff])
[[anItem target] display];
else if ([anItem hasSubmenu] && [[anItem target] isTornOff])
[[anItem target] displayTransient];
}
// set ivar to new index
@ -688,7 +694,8 @@ cell do the following */
while (!finished)
{ // Recursive menu close & deselect.
if ([aMenu supermenu] && ![aMenu isTornOff])
// if ([aMenu supermenu] && ![aMenu isTornOff])
if ([aMenu supermenu])
{
[[[aMenu supermenu] menuView] setHighlightedItemIndex: -1];
aMenu = [aMenu supermenu];
@ -712,7 +719,7 @@ cell do the following */
/* If the mouse is released and there is no highlighted cell */
else if (menuv_highlightedItemIndex == -1)
else if (menuv_highlightedItemIndex == -1 && menuv_popb)
{
NSLog(@"This is the popupbutton close if not selected test.\n");

View file

@ -235,15 +235,24 @@
- (NSRect)contentRect
{
NSRect cRect = [self bounds];
NSRect cRect = [self frame];
cRect.origin.x = 0;
cRect.origin.y = 0;
cRect.size.height += 1;
cRect.size.width += 1;
// cRect.size.height += 1;
// cRect.size.width += 1;
if (tab_type == NSTopTabsBezelBorder)
cRect.size.height -= 21;
{
cRect.origin.y = 0;
cRect.size.height -= 16;
}
if (tab_type == NSBottomTabsBezelBorder)
{
NSLog(@"hehehe. %f", cRect.origin.y);
cRect.size.height -= 8;
cRect.origin.y = 8;
}
return cRect;
}
@ -265,10 +274,17 @@
switch (tab_type) {
case NSTopTabsBezelBorder:
rect.size.height -= 20;
rect.size.height -= 16;
NSDrawButton(rect, rect);
borderThickness = 2;
break;
case NSBottomTabsBezelBorder:
rect.size.height -= 16;
rect.origin.y += 16;
NSDrawButton(rect, rect);
rect.origin.y -= 16;
borderThickness = 2;
break;
case NSNoTabsBezelBorder:
NSDrawButton(rect, rect);
borderThickness = 2;
@ -291,6 +307,110 @@
return;
}
if (tab_type == NSBottomTabsBezelBorder)
{
for (i=0;i<howMany;i++) {
// where da tab be at?
NSSize s;
NSRect r;
NSPoint iP;
NSTabViewItem *anItem = [tab_items objectAtIndex:i];
NSTabState itemState;
itemState = [anItem tabState];
s = [anItem sizeOfLabel:NO];
if (i == 0) {
iP.x = rect.origin.x;
iP.y = rect.origin.y;
if (itemState == NSSelectedTab) {
iP.y += 1;
[[NSImage imageNamed:@"common_TabDownSelectedLeft.tiff"]
compositeToPoint:iP operation: NSCompositeSourceOver];
}
else if (itemState == NSBackgroundTab)
[[NSImage imageNamed:@"common_TabDownUnSelectedLeft.tiff"]
compositeToPoint:iP operation: NSCompositeSourceOver];
else
NSLog(@"Not finished yet. Luff ya.\n");
r.origin.x = rect.origin.x + 13;
r.origin.y = rect.origin.y + 2;
r.size.width = s.width;
r.size.height = 15;
DPSsetlinewidth(ctxt,1);
DPSsetgray(ctxt,1);
DPSmoveto(ctxt, r.origin.x, r.origin.y-1);
DPSrlineto(ctxt, r.size.width, 0);
DPSstroke(ctxt);
[anItem drawLabel:NO inRect:r];
previousRect = r;
previousState = itemState;
} else {
iP.x = previousRect.origin.x + previousRect.size.width;
iP.y = rect.origin.y;
if (itemState == NSSelectedTab) {
iP.y += 1;
[[NSImage
imageNamed:@"common_TabDownUnSelectedToSelectedJunction.tiff"]
compositeToPoint:iP operation: NSCompositeSourceOver];
}
else if (itemState == NSBackgroundTab) {
if (previousState == NSSelectedTab) {
iP.y += 1;
[[NSImage
imageNamed:@"common_TabDownSelectedToUnSelectedJunction.tiff"]
compositeToPoint:iP operation: NSCompositeSourceOver];
iP.y -= 1;
} else {
[[NSImage
imageNamed:@"common_TabDownUnSelectedJunction.tiff"]
compositeToPoint:iP operation: NSCompositeSourceOver];
}
}
else
NSLog(@"Not finished yet. Luff ya.\n");
r.origin.x = iP.x + 13;
r.origin.y = rect.origin.y + 2;
r.size.width = s.width;
r.size.height = 15;
DPSsetlinewidth(ctxt,1);
DPSsetgray(ctxt,1);
DPSmoveto(ctxt, r.origin.x, r.origin.y - 1);
DPSrlineto(ctxt, r.size.width, 0);
DPSstroke(ctxt);
[anItem drawLabel:NO inRect:r];
previousRect = r;
previousState = itemState;
}
if (i == howMany-1) {
iP.x += s.width + 13;
if ([anItem tabState] == NSSelectedTab)
[[NSImage imageNamed:@"common_TabDownSelectedRight.tiff"]
compositeToPoint:iP operation: NSCompositeSourceOver];
else if ([anItem tabState] == NSBackgroundTab)
[[NSImage imageNamed:@"common_TabDownUnSelectedRight.tiff"]
compositeToPoint:iP operation: NSCompositeSourceOver];
else
NSLog(@"Not finished yet. Luff ya.\n");
}
}
return;
}
for (i=0;i<howMany;i++) {
// where da tab be at?
NSSize s;