From: Richard K. <ric...@us...> - 2005-05-15 18:30:23
|
Update of /cvsroot/actionstep/actionstep/src/org/actionstep In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv5536 Modified Files: NSTabView.as NSTabViewItem.as Log Message: Tab views are fully functional although they do not clip the text right now Index: NSTabView.as =================================================================== RCS file: /cvsroot/actionstep/actionstep/src/org/actionstep/NSTabView.as,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** NSTabView.as 15 May 2005 04:28:16 -0000 1.2 --- NSTabView.as 15 May 2005 18:30:13 -0000 1.3 *************** *** 60,63 **** --- 60,64 ---- public function NSTabView() { m_items = new NSArray(); + m_font = NSFont.systemFontOfSize(-1); m_drawsBackground = true; m_controlSize = NSControlSize.NSRegularControlSize; *************** *** 200,203 **** --- 201,205 ---- public function setTabViewType(type:NSTabViewType) { m_tabViewType = type; + setNeedsDisplay(true); } *************** *** 235,239 **** var rect:NSRect = bounds(); switch(m_tabViewType) { ! case NSTabViewType.NSTopTabsBezelBorder: rect.origin.y+=TAB_HEIGHT+5; rect.size.height-=(TAB_HEIGHT+10); --- 237,241 ---- var rect:NSRect = bounds(); switch(m_tabViewType) { ! case NSTabViewType.NSTopTabsBezelBorder: rect.origin.y+=TAB_HEIGHT+5; rect.size.height-=(TAB_HEIGHT+10); *************** *** 241,247 **** rect.size.width-=10; break; ! case NSTabViewType.NSNoTabsBezelBorder: break; ! case NSTabViewType.NSBottomTabsBezelBorder: break; } --- 243,259 ---- rect.size.width-=10; break; ! case NSTabViewType.NSNoTabsBezelBorder: ! rect.origin.y+=5; ! rect.size.height-=10; ! rect.origin.x+=5; ! rect.size.width-=10; break; ! case NSTabViewType.NSBottomTabsBezelBorder: ! rect.origin.y+=TAB_HEIGHT+5; ! rect.size.height-=(TAB_HEIGHT+10); ! rect.origin.x+=5; ! rect.size.width-=10; ! break; ! case NSTabViewType.NSNoTabsNoBorder: break; } *************** *** 295,309 **** } - /* - (void) mouseDown: (NSEvent *)theEvent - { - NSPoint location = [theEvent locationInWindow]; - NSTabViewItem *anItem = [self tabViewItemAtPoint: location]; - - if (anItem != nil && ![anItem isEqual: _selected]) - { - [self selectTabViewItem: anItem]; - } - }*/ - public function mouseDown(event:NSEvent) { var location:NSPoint = event.mouseLocation.clone(); --- 307,310 ---- *************** *** 318,321 **** --- 319,328 ---- public function drawRect(rect:NSRect) { + + if (m_tabViewType == NSTabViewType.NSNoTabsNoBorder) { + m_mcBounds.clear(); + return; + } + var i = 0; var tabViewItem; *************** *** 324,328 **** var selectedRect; var tabRect:NSRect = null; ! var fillColor = 0xdddddd; var x = rect.origin.x; var y = rect.origin.y; --- 331,335 ---- var selectedRect; var tabRect:NSRect = null; ! var fillColor = 0xC6C6C6; var x = rect.origin.x; var y = rect.origin.y; *************** *** 339,348 **** } drawTabViewItemInRect(tabViewItem, tabRect); ! tx += labelSize.width+16 i++; } with (m_mcBounds) { beginFill(fillColor, 100); ! lineStyle(1, 0, 100); moveTo(x, y+TAB_HEIGHT); if (selectedRect != null) { --- 346,355 ---- } drawTabViewItemInRect(tabViewItem, tabRect); ! tx += labelSize.width+17 i++; } with (m_mcBounds) { beginFill(fillColor, 100); ! lineStyle(1, 0x8E8E8E, 100); moveTo(x, y+TAB_HEIGHT); if (selectedRect != null) { *************** *** 350,354 **** lineStyle(undefined, 0, 100); lineTo(selectedRect.origin.x+selectedRect.size.width, y+TAB_HEIGHT); ! lineStyle(1, 0, 100); } lineTo(x+width, y+TAB_HEIGHT); --- 357,361 ---- lineStyle(undefined, 0, 100); lineTo(selectedRect.origin.x+selectedRect.size.width, y+TAB_HEIGHT); ! lineStyle(1, 0x8E8E8E, 100); } lineTo(x+width, y+TAB_HEIGHT); *************** *** 366,373 **** var fillColor:Number; var fillAlpha:Number = 100; if (item.tabState() == NSTabState.NSBackgroundTab) { fillColor = 0xaaaaaa; } else { ! fillColor = 0xdddddd; } var x = rect.origin.x; --- 373,381 ---- var fillColor:Number; var fillAlpha:Number = 100; + var cornerRadius:Number = 3; if (item.tabState() == NSTabState.NSBackgroundTab) { fillColor = 0xaaaaaa; } else { ! fillColor = 0xC6C6C6; } var x = rect.origin.x; *************** *** 376,413 **** var height = rect.size.height; with (m_mcBounds) { ! lineStyle(1, 0, 100); ! beginFill(fillColor, fillAlpha); ! moveTo(x,y); ! lineTo(x+width, y); lineTo(x+width, y+height); ! lineStyle(undefined, 0, 100); lineTo(x, y+height); ! lineStyle(1, 0, 100); ! lineTo(x,y); endFill(); } item.drawLabelInRect(m_allowsTruncatedLabels, rect); ! ! /* ! var cornerRadius = 5; ! ! with (m_mcBounds) { ! beginFill(fillColor, fillAlpha); ! moveTo(x+cornerRadius, y); ! lineTo(x+width-cornerRadius, y); ! curveTo(boxWidth, 0, boxWidth, cornerRadius); ! lineTo(boxWidth, cornerRadius); ! lineTo(boxWidth, boxHeight-cornerRadius); ! curveTo(boxWidth, boxHeight, boxWidth-cornerRadius, boxHeight); ! lineTo(boxWidth-cornerRadius, boxHeight); ! lineTo(cornerRadius, boxHeight); ! curveTo(0, boxHeight, 0, boxHeight-cornerRadius); ! lineTo(0, boxHeight-cornerRadius); ! lineTo(0, cornerRadius); ! curveTo(0, 0, cornerRadius, 0); ! lineTo(cornerRadius, 0); ! endFill(); ! } ! */ } --- 384,403 ---- var height = rect.size.height; with (m_mcBounds) { ! lineStyle(1.5, 0x8E8E8E, 100); ! beginGradientFill("linear", [0xDEDEDE, 0xC6C6C6], [100,100], [0, 0xff], ! {matrixType:"box", x:x,y:y,w:width,h:height,r:(.5*Math.PI)}); ! moveTo(x+cornerRadius, y); ! lineTo(x+width-cornerRadius, y); ! lineTo(x+width, y+cornerRadius); //Angle lineTo(x+width, y+height); ! lineStyle(undefined, 0, 100); lineTo(x, y+height); ! lineStyle(1.5, 0x8E8E8E, 100); ! lineTo(x, y+cornerRadius); ! lineTo(x+cornerRadius, y); //Angle endFill(); } item.drawLabelInRect(m_allowsTruncatedLabels, rect); ! } Index: NSTabViewItem.as =================================================================== RCS file: /cvsroot/actionstep/actionstep/src/org/actionstep/NSTabViewItem.as,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** NSTabViewItem.as 15 May 2005 04:28:16 -0000 1.2 --- NSTabViewItem.as 15 May 2005 18:30:13 -0000 1.3 *************** *** 56,59 **** --- 56,63 ---- } + public function description():String { + return "NSTabViewItem(label="+m_label+")"; + } + // Working with labels *************** *** 66,69 **** --- 70,74 ---- m_textFormat = m_tabView.font().textFormat(); m_textField.text = tlabel; + m_textField.autoSize = true; m_textField.selectable = false; m_textField.type = "dynamic"; *************** *** 75,80 **** m_textField.setTextFormat(m_textFormat); } m_textField._x = (rect.size.width - size.width)/2 + rect.origin.x; ! m_textField._y = 12;//(rect.size.height - size.height)/2 + rect.origin.y; } --- 80,90 ---- m_textField.setTextFormat(m_textFormat); } + + var x = rect.origin.x; + var y = rect.origin.y; + var width = rect.size.width; + var height = rect.size.height; m_textField._x = (rect.size.width - size.width)/2 + rect.origin.x; ! m_textField._y = (rect.size.height - size.height)/2 + rect.origin.y; } *************** *** 136,140 **** public function pointInTabItem(point:NSPoint) { ! return m_rect.pointInRect(point); } --- 146,150 ---- public function pointInTabItem(point:NSPoint) { ! return m_rect == null ? false : m_rect.pointInRect(point); } |