mirror of
https://github.com/gnustep/libs-gui.git
synced 2025-05-31 12:00:48 +00:00
NSPopUpButton now works. NSTabView taking shape.
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/gui/trunk@4436 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
parent
a9cce23dbb
commit
5e64d4f6cb
7 changed files with 101 additions and 11 deletions
|
@ -1,4 +1,8 @@
|
|||
|
||||
#include <AppKit/NSColor.h>
|
||||
#include <AppKit/NSImage.h>
|
||||
#include <AppKit/NSTabView.h>
|
||||
#include <AppKit/PSOperators.h>
|
||||
|
||||
@implementation NSTabView
|
||||
- (id)initWithFrame:(NSRect)rect
|
||||
|
@ -8,6 +12,7 @@
|
|||
// setup variables
|
||||
|
||||
tab_items = [NSMutableArray new];
|
||||
tab_font = [NSFont systemFontOfSize:12];
|
||||
|
||||
return self;
|
||||
}
|
||||
|
@ -16,12 +21,14 @@
|
|||
|
||||
- (void)addTabViewItem:(NSTabViewItem *)tabViewItem
|
||||
{
|
||||
[tabViewItem _setTabView:self];
|
||||
[tab_items insertObject:tabViewItem atIndex:[tab_items count]];
|
||||
}
|
||||
|
||||
- (void)insertTabViewItem:(NSTabViewItem *)tabViewItem
|
||||
atIndex:(int)index
|
||||
{
|
||||
[tabViewItem _setTabView:self];
|
||||
[tab_items insertObject:tabViewItem atIndex:index];
|
||||
}
|
||||
|
||||
|
@ -155,6 +162,38 @@
|
|||
return NSZeroRect;
|
||||
}
|
||||
|
||||
// Drawing.
|
||||
|
||||
- (void)drawRect:(NSRect)rect
|
||||
{
|
||||
NSGraphicsContext *ctxt = GSCurrentContext();
|
||||
float borderThickness;
|
||||
int howMany = [tab_items count];
|
||||
|
||||
DPSgsave(ctxt);
|
||||
|
||||
switch (tab_type) {
|
||||
case NSTopTabsBezelBorder:
|
||||
rect.size.height -= 20;
|
||||
NSDrawButton(rect, rect);
|
||||
borderThickness = 2;
|
||||
break;
|
||||
case NSNoTabsBezelBorder:
|
||||
NSDrawButton(rect, rect);
|
||||
borderThickness = 2;
|
||||
break;
|
||||
case NSNoTabsLineBorder:
|
||||
NSFrameRect(rect);
|
||||
borderThickness = 1;
|
||||
break;
|
||||
case NSNoTabsNoBorder:
|
||||
borderThickness = 0;
|
||||
break;
|
||||
}
|
||||
|
||||
DPSgrestore(ctxt);
|
||||
}
|
||||
|
||||
// Event handling.
|
||||
|
||||
- (NSTabViewItem *)tabViewItemAtPoint:(NSPoint)point
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue