mirror of
https://github.com/gnustep/libs-gui.git
synced 2025-05-31 19:00:47 +00:00
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:
parent
4673165a3b
commit
d86555ef4c
14 changed files with 170 additions and 8 deletions
22
ChangeLog
22
ChangeLog
|
@ -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>
|
1999-07-26 Michael Hanni <mhanni@sprintmail.com>
|
||||||
|
|
||||||
* Source/NSTableView.m: added much more code to this
|
* Source/NSTableView.m: added much more code to this
|
||||||
|
|
|
@ -52,6 +52,9 @@
|
||||||
BOOL menu_changed;
|
BOOL menu_changed;
|
||||||
BOOL menu_is_tornoff;
|
BOOL menu_is_tornoff;
|
||||||
|
|
||||||
|
// Private.
|
||||||
|
BOOL menu_follow_transient;
|
||||||
|
|
||||||
// Reserved for back-end use
|
// Reserved for back-end use
|
||||||
void *be_menu_reserved;
|
void *be_menu_reserved;
|
||||||
}
|
}
|
||||||
|
|
|
@ -31,6 +31,7 @@
|
||||||
|
|
||||||
typedef enum {
|
typedef enum {
|
||||||
NSTopTabsBezelBorder,
|
NSTopTabsBezelBorder,
|
||||||
|
NSBottomTabsBezelBorder,
|
||||||
NSNoTabsBezelBorder,
|
NSNoTabsBezelBorder,
|
||||||
NSNoTabsLineBorder,
|
NSNoTabsLineBorder,
|
||||||
NSNoTabsNoBorder
|
NSNoTabsNoBorder
|
||||||
|
|
|
@ -58,6 +58,13 @@ common_SwitchOn.tiff \
|
||||||
common_SwitchOff.tiff \
|
common_SwitchOff.tiff \
|
||||||
common_SliderHoriz.tiff \
|
common_SliderHoriz.tiff \
|
||||||
common_SliderVert.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_TabSelectedLeft.tiff \
|
||||||
common_TabSelectedRight.tiff \
|
common_TabSelectedRight.tiff \
|
||||||
common_TabSelectedToUnSelectedJunction.tiff \
|
common_TabSelectedToUnSelectedJunction.tiff \
|
||||||
|
|
BIN
Images/common_TabDownSelectedLeft.tiff
Normal file
BIN
Images/common_TabDownSelectedLeft.tiff
Normal file
Binary file not shown.
BIN
Images/common_TabDownSelectedRight.tiff
Normal file
BIN
Images/common_TabDownSelectedRight.tiff
Normal file
Binary file not shown.
BIN
Images/common_TabDownSelectedToUnSelectedJunction.tiff
Normal file
BIN
Images/common_TabDownSelectedToUnSelectedJunction.tiff
Normal file
Binary file not shown.
BIN
Images/common_TabDownUnSelectedJunction.tiff
Normal file
BIN
Images/common_TabDownUnSelectedJunction.tiff
Normal file
Binary file not shown.
BIN
Images/common_TabDownUnSelectedLeft.tiff
Normal file
BIN
Images/common_TabDownUnSelectedLeft.tiff
Normal file
Binary file not shown.
BIN
Images/common_TabDownUnSelectedRight.tiff
Normal file
BIN
Images/common_TabDownUnSelectedRight.tiff
Normal file
Binary file not shown.
BIN
Images/common_TabDownUnSelectedToSelectedJunction.tiff
Normal file
BIN
Images/common_TabDownUnSelectedToSelectedJunction.tiff
Normal file
Binary file not shown.
|
@ -354,10 +354,12 @@ static NSZone *menuZone = NULL;
|
||||||
return menu_supermenu && [menu_supermenu attachedMenu] == self;
|
return menu_supermenu && [menu_supermenu attachedMenu] == self;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
- (BOOL) isTornOff
|
- (BOOL) isTornOff
|
||||||
{
|
{
|
||||||
return menu_is_tornoff;
|
return menu_is_tornoff;
|
||||||
}
|
}
|
||||||
|
*/
|
||||||
|
|
||||||
- (NSPoint) locationForSubmenu: (NSMenu *)aSubmenu
|
- (NSPoint) locationForSubmenu: (NSMenu *)aSubmenu
|
||||||
{
|
{
|
||||||
|
|
|
@ -153,6 +153,8 @@ static float GSMenuBarHeight = 25.0; // a guess.
|
||||||
|
|
||||||
if ([anItem hasSubmenu] && ![[anItem target] isTornOff])
|
if ([anItem hasSubmenu] && ![[anItem target] isTornOff])
|
||||||
[[anItem target] close];
|
[[anItem target] close];
|
||||||
|
else if ([anItem hasSubmenu] && [[anItem target] isTornOff])
|
||||||
|
[[anItem target] closeTransient];
|
||||||
|
|
||||||
[anItem setState: 0];
|
[anItem setState: 0];
|
||||||
menuv_highlightedItemIndex = -1;
|
menuv_highlightedItemIndex = -1;
|
||||||
|
@ -167,6 +169,8 @@ static float GSMenuBarHeight = 25.0; // a guess.
|
||||||
|
|
||||||
if ([anItem hasSubmenu] && ![[anItem target] isTornOff])
|
if ([anItem hasSubmenu] && ![[anItem target] isTornOff])
|
||||||
[[anItem target] close];
|
[[anItem target] close];
|
||||||
|
else if ([anItem hasSubmenu] && [[anItem target] isTornOff])
|
||||||
|
[[anItem target] closeTransient];
|
||||||
|
|
||||||
[anItem setState: 0];
|
[anItem setState: 0];
|
||||||
}
|
}
|
||||||
|
@ -185,6 +189,8 @@ static float GSMenuBarHeight = 25.0; // a guess.
|
||||||
|
|
||||||
if ([anItem hasSubmenu] && ![[anItem target] isTornOff])
|
if ([anItem hasSubmenu] && ![[anItem target] isTornOff])
|
||||||
[[anItem target] display];
|
[[anItem target] display];
|
||||||
|
else if ([anItem hasSubmenu] && [[anItem target] isTornOff])
|
||||||
|
[[anItem target] displayTransient];
|
||||||
}
|
}
|
||||||
|
|
||||||
// set ivar to new index
|
// set ivar to new index
|
||||||
|
@ -688,7 +694,8 @@ cell do the following */
|
||||||
|
|
||||||
while (!finished)
|
while (!finished)
|
||||||
{ // Recursive menu close & deselect.
|
{ // Recursive menu close & deselect.
|
||||||
if ([aMenu supermenu] && ![aMenu isTornOff])
|
// if ([aMenu supermenu] && ![aMenu isTornOff])
|
||||||
|
if ([aMenu supermenu])
|
||||||
{
|
{
|
||||||
[[[aMenu supermenu] menuView] setHighlightedItemIndex: -1];
|
[[[aMenu supermenu] menuView] setHighlightedItemIndex: -1];
|
||||||
aMenu = [aMenu supermenu];
|
aMenu = [aMenu supermenu];
|
||||||
|
@ -712,7 +719,7 @@ cell do the following */
|
||||||
|
|
||||||
/* If the mouse is released and there is no highlighted cell */
|
/* 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");
|
NSLog(@"This is the popupbutton close if not selected test.\n");
|
||||||
|
|
||||||
|
|
|
@ -235,15 +235,24 @@
|
||||||
|
|
||||||
- (NSRect)contentRect
|
- (NSRect)contentRect
|
||||||
{
|
{
|
||||||
NSRect cRect = [self bounds];
|
NSRect cRect = [self frame];
|
||||||
|
|
||||||
cRect.origin.x = 0;
|
cRect.origin.x = 0;
|
||||||
cRect.origin.y = 0;
|
// cRect.size.height += 1;
|
||||||
cRect.size.height += 1;
|
// cRect.size.width += 1;
|
||||||
cRect.size.width += 1;
|
|
||||||
|
|
||||||
if (tab_type == NSTopTabsBezelBorder)
|
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;
|
return cRect;
|
||||||
}
|
}
|
||||||
|
@ -265,10 +274,17 @@
|
||||||
|
|
||||||
switch (tab_type) {
|
switch (tab_type) {
|
||||||
case NSTopTabsBezelBorder:
|
case NSTopTabsBezelBorder:
|
||||||
rect.size.height -= 20;
|
rect.size.height -= 16;
|
||||||
NSDrawButton(rect, rect);
|
NSDrawButton(rect, rect);
|
||||||
borderThickness = 2;
|
borderThickness = 2;
|
||||||
break;
|
break;
|
||||||
|
case NSBottomTabsBezelBorder:
|
||||||
|
rect.size.height -= 16;
|
||||||
|
rect.origin.y += 16;
|
||||||
|
NSDrawButton(rect, rect);
|
||||||
|
rect.origin.y -= 16;
|
||||||
|
borderThickness = 2;
|
||||||
|
break;
|
||||||
case NSNoTabsBezelBorder:
|
case NSNoTabsBezelBorder:
|
||||||
NSDrawButton(rect, rect);
|
NSDrawButton(rect, rect);
|
||||||
borderThickness = 2;
|
borderThickness = 2;
|
||||||
|
@ -291,6 +307,110 @@
|
||||||
return;
|
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++) {
|
for (i=0;i<howMany;i++) {
|
||||||
// where da tab be at?
|
// where da tab be at?
|
||||||
NSSize s;
|
NSSize s;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue