From: Richard K. <ric...@us...> - 2005-07-20 18:07:28
|
Update of /cvsroot/actionstep/actionstep/src/org/actionstep In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv30586 Modified Files: ASFieldEditor.as ASTheme.as ASThemeProtocol.as NSButtonCell.as NSTextField.as NSTextFieldCell.as Log Message: working on getting responder stuff all right, centered text (vertically) in textfield, refactored drawing first responder Index: ASThemeProtocol.as =================================================================== RCS file: /cvsroot/actionstep/actionstep/src/org/actionstep/ASThemeProtocol.as,v retrieving revision 1.12 retrieving revision 1.13 diff -C2 -d -r1.12 -r1.13 *** ASThemeProtocol.as 20 Jul 2005 00:16:14 -0000 1.12 --- ASThemeProtocol.as 20 Jul 2005 18:07:11 -0000 1.13 *************** *** 87,91 **** * Draws the border around the button when it has key focus */ ! public function drawFirstResponderButtonWithRectInView(rect:NSRect, view:NSView); /** --- 87,91 ---- * Draws the border around the button when it has key focus */ ! public function drawFirstResponderWithRectInView(rect:NSRect, view:NSView); /** Index: ASFieldEditor.as =================================================================== RCS file: /cvsroot/actionstep/actionstep/src/org/actionstep/ASFieldEditor.as,v retrieving revision 1.13 retrieving revision 1.14 diff -C2 -d -r1.13 -r1.14 *** ASFieldEditor.as 20 Jul 2005 00:16:15 -0000 1.13 --- ASFieldEditor.as 20 Jul 2005 18:07:10 -0000 1.14 *************** *** 33,37 **** import org.actionstep.NSNotificationCenter; import org.actionstep.ASUtils; - import org.actionstep.ASTheme; import org.actionstep.constants.NSTextMovement; --- 33,36 ---- *************** *** 238,242 **** m_textField.onKillFocus = null; m_textField.onSetFocus = null; - m_textField.border = false; m_textField.onScroller = null; m_textField.onChanged = null; --- 237,240 ---- *************** *** 254,259 **** m_textField.type = m_cell.isEditable() ? "input" : "dynamic"; m_textField.tabEnabled = false; - m_textField.border = true; - m_textField.borderColor = ASTheme.current().firstResponderColor().value; var tform:TextFormat; --- 252,255 ---- Index: NSTextFieldCell.as =================================================================== RCS file: /cvsroot/actionstep/actionstep/src/org/actionstep/NSTextFieldCell.as,v retrieving revision 1.18 retrieving revision 1.19 diff -C2 -d -r1.18 -r1.19 *** NSTextFieldCell.as 19 Jul 2005 21:58:38 -0000 1.18 --- NSTextFieldCell.as 20 Jul 2005 18:07:11 -0000 1.19 *************** *** 206,209 **** --- 206,211 ---- var x = cellFrame.origin.x; var y = cellFrame.origin.y; + var text = stringValue(); + var fontHeight = m_font.getTextExtent("Why").height; if (m_drawsBackground) { *************** *** 217,229 **** if (tf.text != stringValue()) { ! tf.text = stringValue(); tf.setTextFormat(m_textFormat); } tf._x = x; ! tf._y = y; tf._width = width-1; ! tf._height = height-1; } - } --- 219,234 ---- if (tf.text != stringValue()) { ! tf.text = text; tf.setTextFormat(m_textFormat); } tf._x = x; ! tf._y = y + (height - fontHeight)/2; tf._width = width-1; ! tf._height = fontHeight; ! ! if (m_showsFirstResponder) { ! ASTheme.current().drawFirstResponderWithRectInView(cellFrame, inView); ! } } } Index: ASTheme.as =================================================================== RCS file: /cvsroot/actionstep/actionstep/src/org/actionstep/ASTheme.as,v retrieving revision 1.19 retrieving revision 1.20 diff -C2 -d -r1.19 -r1.20 *** ASTheme.as 20 Jul 2005 00:16:14 -0000 1.19 --- ASTheme.as 20 Jul 2005 18:07:10 -0000 1.20 *************** *** 103,107 **** } ! public function drawFirstResponderButtonWithRectInView(rect:NSRect, view:NSView) { ASDraw.outlineRectWithRect(view.mcBounds(), rect, [firstResponderColor().value]); } --- 103,107 ---- } ! public function drawFirstResponderWithRectInView(rect:NSRect, view:NSView) { ASDraw.outlineRectWithRect(view.mcBounds(), rect, [firstResponderColor().value]); } Index: NSButtonCell.as =================================================================== RCS file: /cvsroot/actionstep/actionstep/src/org/actionstep/NSButtonCell.as,v retrieving revision 1.24 retrieving revision 1.25 diff -C2 -d -r1.24 -r1.25 *** NSButtonCell.as 19 Jul 2005 22:13:17 -0000 1.24 --- NSButtonCell.as 20 Jul 2005 18:07:11 -0000 1.25 *************** *** 660,664 **** } if (m_showsFirstResponder) { ! ASTheme.current().drawFirstResponderButtonWithRectInView(cellFrame, inView); } } --- 660,664 ---- } if (m_showsFirstResponder) { ! ASTheme.current().drawFirstResponderWithRectInView(cellFrame, inView); } } Index: NSTextField.as =================================================================== RCS file: /cvsroot/actionstep/actionstep/src/org/actionstep/NSTextField.as,v retrieving revision 1.10 retrieving revision 1.11 diff -C2 -d -r1.10 -r1.11 *** NSTextField.as 19 Jul 2005 21:58:38 -0000 1.10 --- NSTextField.as 20 Jul 2005 18:07:11 -0000 1.11 *************** *** 200,203 **** --- 200,205 ---- public function becomeFirstResponder():Boolean { if (acceptsFirstResponder()) { + m_cell.setShowsFirstResponder(true); + setNeedsDisplay(true); selectText(this); return true; *************** *** 207,210 **** --- 209,231 ---- } + public function resignKeyWindow() { + if (m_cell.showsFirstResponder()) { + m_cell.setShowsFirstResponder(false); + setNeedsDisplay(true); + ASFieldEditor.endEditing(); + m_editor = null; + } + } + + public function resignFirstResponder():Boolean { + if (m_cell.showsFirstResponder()) { + m_cell.setShowsFirstResponder(false); + setNeedsDisplay(true); + ASFieldEditor.endEditing(); + m_editor = null; + } + return super.resignFirstResponder(); + } + public function mouseDown(event:NSEvent) { if (!isSelectable()) { *************** *** 303,307 **** break; case NSTextMovement.NSBacktabTextMovement: - TRACE("here"); m_window.selectKeyViewPrecedingView(this); if (m_window.firstResponder() == m_window) { --- 324,327 ---- |