mirror of
https://github.com/gnustep/libs-gui.git
synced 2025-04-27 02:51:01 +00:00
Tidyups an implememnted missing method
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/gui/trunk@6587 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
parent
a1b4750227
commit
a8fa7b8478
2 changed files with 285 additions and 194 deletions
11
ChangeLog
11
ChangeLog
|
@ -1,3 +1,14 @@
|
||||||
|
2000-05-09 Richard Frith-Macdonald <rfm@gnu.org>
|
||||||
|
|
||||||
|
* gui/Source/NSTabView.m: General tidyup, minro fixes, and implemented
|
||||||
|
([-takeSelectedTabViewItemFromSender:])
|
||||||
|
|
||||||
|
2000-05-09 Georg Fleischmann
|
||||||
|
|
||||||
|
* gui/Source/NSTabView.m
|
||||||
|
([-initWithFram:]): retain tab_font
|
||||||
|
([-dealloc]): new method
|
||||||
|
|
||||||
2000-05-07 Fred Kiefer <FredKiefer@gmx.de>
|
2000-05-07 Fred Kiefer <FredKiefer@gmx.de>
|
||||||
|
|
||||||
* Source/NSAttributedString.m:
|
* Source/NSAttributedString.m:
|
||||||
|
|
|
@ -1,8 +1,38 @@
|
||||||
|
/*
|
||||||
|
NSTabView.m
|
||||||
|
|
||||||
|
The tabular view class
|
||||||
|
|
||||||
|
Copyright (C) 1999,2000 Free Software Foundation, Inc.
|
||||||
|
|
||||||
|
Author: Michael Hanni <mhanni@sprintmail.com>
|
||||||
|
Date: 1999
|
||||||
|
|
||||||
|
This file is part of the GNUstep GUI Library.
|
||||||
|
|
||||||
|
This library is free software; you can redistribute it and/or
|
||||||
|
modify it under the terms of the GNU Library General Public
|
||||||
|
License as published by the Free Software Foundation; either
|
||||||
|
version 2 of the License, or (at your option) any later version.
|
||||||
|
|
||||||
|
This library is distributed in the hope that it will be useful,
|
||||||
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||||
|
Library General Public License for more details.
|
||||||
|
|
||||||
|
You should have received a copy of the GNU Library General Public
|
||||||
|
License along with this library; see the file COPYING.LIB.
|
||||||
|
If not, write to the Free Software Foundation,
|
||||||
|
59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
#include <AppKit/NSColor.h>
|
#include <AppKit/NSColor.h>
|
||||||
#include <AppKit/NSFont.h>
|
#include <AppKit/NSFont.h>
|
||||||
#include <AppKit/NSGraphics.h>
|
#include <AppKit/NSGraphics.h>
|
||||||
#include <AppKit/NSImage.h>
|
#include <AppKit/NSImage.h>
|
||||||
|
#include <AppKit/NSForm.h>
|
||||||
|
#include <AppKit/NSMatrix.h>
|
||||||
#include <AppKit/NSTabView.h>
|
#include <AppKit/NSTabView.h>
|
||||||
#include <AppKit/NSTabViewItem.h>
|
#include <AppKit/NSTabViewItem.h>
|
||||||
#include <AppKit/PSOperators.h>
|
#include <AppKit/PSOperators.h>
|
||||||
|
@ -15,7 +45,7 @@
|
||||||
// setup variables
|
// setup variables
|
||||||
|
|
||||||
tab_items = [NSMutableArray new];
|
tab_items = [NSMutableArray new];
|
||||||
tab_font = [NSFont systemFontOfSize:12];
|
tab_font = RETAIN([NSFont systemFontOfSize: 12]);
|
||||||
tab_selected = nil;
|
tab_selected = nil;
|
||||||
|
|
||||||
return self;
|
return self;
|
||||||
|
@ -50,9 +80,9 @@
|
||||||
|
|
||||||
- (void) removeTabViewItem: (NSTabViewItem*)tabViewItem
|
- (void) removeTabViewItem: (NSTabViewItem*)tabViewItem
|
||||||
{
|
{
|
||||||
int i = [tab_items indexOfObject:tabViewItem];
|
unsigned i = [tab_items indexOfObject: tabViewItem];
|
||||||
|
|
||||||
if (i == -1)
|
if (i == NSNotFound)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
[tab_items removeObjectAtIndex: i];
|
[tab_items removeObjectAtIndex: i];
|
||||||
|
@ -71,8 +101,8 @@
|
||||||
|
|
||||||
- (int) indexOfTabViewItemWithIdentifier: (id)identifier
|
- (int) indexOfTabViewItemWithIdentifier: (id)identifier
|
||||||
{
|
{
|
||||||
int howMany = [tab_items count];
|
unsigned howMany = [tab_items count];
|
||||||
int i;
|
unsigned i;
|
||||||
|
|
||||||
for (i = 0; i < howMany; i++)
|
for (i = 0; i < howMany; i++)
|
||||||
{
|
{
|
||||||
|
@ -170,11 +200,32 @@
|
||||||
|
|
||||||
- (void) selectTabViewItemAtIndex: (int)index
|
- (void) selectTabViewItemAtIndex: (int)index
|
||||||
{
|
{
|
||||||
|
if (index < 0)
|
||||||
|
[self selectTabViewItem: nil];
|
||||||
|
else
|
||||||
[self selectTabViewItem: [tab_items objectAtIndex: index]];
|
[self selectTabViewItem: [tab_items objectAtIndex: index]];
|
||||||
}
|
}
|
||||||
|
|
||||||
- (void) takeSelectedTabViewItemFromSender: (id)sender
|
- (void) takeSelectedTabViewItemFromSender: (id)sender
|
||||||
{
|
{
|
||||||
|
int index = -1;
|
||||||
|
|
||||||
|
if ([sender respondsToSelector: @selector(indexOfSelectedItem)] == YES)
|
||||||
|
{
|
||||||
|
index = [sender indexOfSelectedItem];
|
||||||
|
}
|
||||||
|
else if ([sender isKindOfClass: [NSMatrix class]] == YES)
|
||||||
|
{
|
||||||
|
int cols = [sender numberOfColumns];
|
||||||
|
int row = [sender selectedRow];
|
||||||
|
int col = [sender selectedColumn];
|
||||||
|
|
||||||
|
if (row >= 0 && col >= 0)
|
||||||
|
{
|
||||||
|
index = row * cols + col;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
[self selectTabViewItem: [tab_items objectAtIndex: index]];
|
||||||
}
|
}
|
||||||
|
|
||||||
- (void) setFont: (NSFont*)font
|
- (void) setFont: (NSFont*)font
|
||||||
|
@ -272,12 +323,14 @@
|
||||||
|
|
||||||
DPSgsave(ctxt);
|
DPSgsave(ctxt);
|
||||||
|
|
||||||
switch (tab_type) {
|
switch (tab_type)
|
||||||
|
{
|
||||||
case NSTopTabsBezelBorder:
|
case NSTopTabsBezelBorder:
|
||||||
rect.size.height -= 16;
|
rect.size.height -= 16;
|
||||||
NSDrawButton(rect, rect);
|
NSDrawButton(rect, rect);
|
||||||
borderThickness = 2;
|
borderThickness = 2;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case NSBottomTabsBezelBorder:
|
case NSBottomTabsBezelBorder:
|
||||||
rect.size.height -= 16;
|
rect.size.height -= 16;
|
||||||
rect.origin.y += 16;
|
rect.origin.y += 16;
|
||||||
|
@ -285,15 +338,18 @@
|
||||||
rect.origin.y -= 16;
|
rect.origin.y -= 16;
|
||||||
borderThickness = 2;
|
borderThickness = 2;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case NSNoTabsBezelBorder:
|
case NSNoTabsBezelBorder:
|
||||||
NSDrawButton(rect, rect);
|
NSDrawButton(rect, rect);
|
||||||
borderThickness = 2;
|
borderThickness = 2;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case NSNoTabsLineBorder:
|
case NSNoTabsLineBorder:
|
||||||
[[NSColor controlDarkShadowColor] set];
|
[[NSColor controlDarkShadowColor] set];
|
||||||
NSFrameRect(rect);
|
NSFrameRect(rect);
|
||||||
borderThickness = 1;
|
borderThickness = 1;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case NSNoTabsNoBorder:
|
case NSNoTabsNoBorder:
|
||||||
borderThickness = 0;
|
borderThickness = 0;
|
||||||
break;
|
break;
|
||||||
|
@ -362,8 +418,11 @@
|
||||||
|
|
||||||
previousRect = r;
|
previousRect = r;
|
||||||
previousState = itemState;
|
previousState = itemState;
|
||||||
} else {
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
int iFlex = 0;
|
int iFlex = 0;
|
||||||
|
|
||||||
iP.x = previousRect.origin.x + previousRect.size.width;
|
iP.x = previousRect.origin.x + previousRect.size.width;
|
||||||
iP.y = rect.origin.y;
|
iP.y = rect.origin.y;
|
||||||
|
|
||||||
|
@ -371,7 +430,8 @@
|
||||||
{
|
{
|
||||||
iP.y += 1;
|
iP.y += 1;
|
||||||
iFlex = 1;
|
iFlex = 1;
|
||||||
[[NSImage imageNamed:@"common_TabDownUnSelectedToSelectedJunction.tiff"]
|
[[NSImage imageNamed:
|
||||||
|
@"common_TabDownUnSelectedToSelectedJunction.tiff"]
|
||||||
compositeToPoint: iP operation: NSCompositeSourceOver];
|
compositeToPoint: iP operation: NSCompositeSourceOver];
|
||||||
iP.y -= 1;
|
iP.y -= 1;
|
||||||
}
|
}
|
||||||
|
@ -380,13 +440,17 @@
|
||||||
if (previousState == NSSelectedTab)
|
if (previousState == NSSelectedTab)
|
||||||
{
|
{
|
||||||
iP.y += 1;
|
iP.y += 1;
|
||||||
[[NSImage imageNamed:@"common_TabDownSelectedToUnSelectedJunction.tiff"]
|
[[NSImage imageNamed:
|
||||||
|
@"common_TabDownSelectedToUnSelectedJunction.tiff"]
|
||||||
compositeToPoint: iP operation: NSCompositeSourceOver];
|
compositeToPoint: iP operation: NSCompositeSourceOver];
|
||||||
iP.y -= 1;
|
iP.y -= 1;
|
||||||
iFlex = -1;
|
iFlex = -1;
|
||||||
} else {
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
// iP.y += 1;
|
// iP.y += 1;
|
||||||
[[NSImage imageNamed:@"common_TabDownUnSelectedJunction.tiff"]
|
[[NSImage imageNamed:
|
||||||
|
@"common_TabDownUnSelectedJunction.tiff"]
|
||||||
compositeToPoint: iP operation: NSCompositeSourceOver];
|
compositeToPoint: iP operation: NSCompositeSourceOver];
|
||||||
//iP.y -= 1;
|
//iP.y -= 1;
|
||||||
iFlex = -1;
|
iFlex = -1;
|
||||||
|
@ -480,14 +544,17 @@
|
||||||
|
|
||||||
previousRect = r;
|
previousRect = r;
|
||||||
previousState = itemState;
|
previousState = itemState;
|
||||||
} else {
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
iP.x = previousRect.origin.x + previousRect.size.width;
|
iP.x = previousRect.origin.x + previousRect.size.width;
|
||||||
iP.y = rect.size.height;
|
iP.y = rect.size.height;
|
||||||
|
|
||||||
if (itemState == NSSelectedTab)
|
if (itemState == NSSelectedTab)
|
||||||
{
|
{
|
||||||
iP.y -= 1;
|
iP.y -= 1;
|
||||||
[[NSImage imageNamed:@"common_TabUnSelectToSelectedJunction.tiff"]
|
[[NSImage imageNamed:
|
||||||
|
@"common_TabUnSelectToSelectedJunction.tiff"]
|
||||||
compositeToPoint: iP operation: NSCompositeSourceOver];
|
compositeToPoint: iP operation: NSCompositeSourceOver];
|
||||||
}
|
}
|
||||||
else if (itemState == NSBackgroundTab)
|
else if (itemState == NSBackgroundTab)
|
||||||
|
@ -495,11 +562,15 @@
|
||||||
if (previousState == NSSelectedTab)
|
if (previousState == NSSelectedTab)
|
||||||
{
|
{
|
||||||
iP.y -= 1;
|
iP.y -= 1;
|
||||||
[[NSImage imageNamed:@"common_TabSelectedToUnSelectedJunction.tiff"]
|
[[NSImage imageNamed:
|
||||||
|
@"common_TabSelectedToUnSelectedJunction.tiff"]
|
||||||
compositeToPoint: iP operation: NSCompositeSourceOver];
|
compositeToPoint: iP operation: NSCompositeSourceOver];
|
||||||
iP.y += 1;
|
iP.y += 1;
|
||||||
} else {
|
}
|
||||||
[[NSImage imageNamed:@"common_TabUnSelectedJunction.tiff"]
|
else
|
||||||
|
{
|
||||||
|
[[NSImage imageNamed:
|
||||||
|
@"common_TabUnSelectedJunction.tiff"]
|
||||||
compositeToPoint: iP operation: NSCompositeSourceOver];
|
compositeToPoint: iP operation: NSCompositeSourceOver];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -556,7 +627,8 @@
|
||||||
|
|
||||||
point = [self convertPoint: point fromView: nil];
|
point = [self convertPoint: point fromView: nil];
|
||||||
|
|
||||||
for (i=0;i<howMany;i++) {
|
for (i = 0; i < howMany; i++)
|
||||||
|
{
|
||||||
NSTabViewItem *anItem = [tab_items objectAtIndex: i];
|
NSTabViewItem *anItem = [tab_items objectAtIndex: i];
|
||||||
|
|
||||||
if(NSPointInRect(point,[anItem _tabRect]))
|
if(NSPointInRect(point,[anItem _tabRect]))
|
||||||
|
@ -611,4 +683,12 @@
|
||||||
|
|
||||||
return self;
|
return self;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
- (void) dealloc
|
||||||
|
{
|
||||||
|
RELEASE(tab_items);
|
||||||
|
RELEASE(tab_font);
|
||||||
|
[super dealloc];
|
||||||
|
}
|
||||||
|
|
||||||
@end
|
@end
|
||||||
|
|
Loading…
Reference in a new issue