From: Richard K. <ric...@us...> - 2005-05-17 15:59:46
|
Update of /cvsroot/actionstep/actionstep/src/org/actionstep In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv15094 Modified Files: ASTheme.as ASThemeProtocol.as NSTextFieldCell.as NSButtonCell.as Log Message: moved textfield drawing into ASTheme Index: ASThemeProtocol.as =================================================================== RCS file: /cvsroot/actionstep/actionstep/src/org/actionstep/ASThemeProtocol.as,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** ASThemeProtocol.as 17 May 2005 15:43:18 -0000 1.3 --- ASThemeProtocol.as 17 May 2005 15:59:36 -0000 1.4 *************** *** 59,62 **** --- 59,67 ---- */ public function drawButtonBorderedWithRectColorsetInView(rect:NSRect, colorSet:String, view:NSView); + + /** + * Draws an NSTextFieldCell with the supplied colorset ("defaultTextfield") in the view. + */ + public function drawTextFieldWithRectColorsetInView(rect:NSRect, colorSet:String, view:NSView); /** Index: NSButtonCell.as =================================================================== RCS file: /cvsroot/actionstep/actionstep/src/org/actionstep/NSButtonCell.as,v retrieving revision 1.13 retrieving revision 1.14 diff -C2 -d -r1.13 -r1.14 *** NSButtonCell.as 17 May 2005 15:31:40 -0000 1.13 --- NSButtonCell.as 17 May 2005 15:59:36 -0000 1.14 *************** *** 54,102 **** class org.actionstep.NSButtonCell extends NSActionCell { - - private static var g_buttonColors = { - up: { - top: 0x82858E, - top1: 0xDFE2E9, - top2: 0xEEF2F5, - top3: 0xD4D8D9, - bottom: 0xD3D6DB, - bottom1: 0x858992, - bottom2: 0x9599A2, - bottom3: 0xACB1B7, - left: 0x82858E, - left1: 0xDFE2E9, - right: 0xD3D6DB, - right1: 0x858992, - middle: 0xC7CAD1}, - down: { - top: 0x6A6E79, - top1: 0x747883, - top2: 0x7C838B, - top3: 0x939AA2, - bottom: 0xBEC1C6, - bottom1: 0xCACED1, - bottom2: 0xDADDE2, - bottom3: 0xBEC1C6, - left: 0x6A6E79, - left1: 0x747883, - right: 0xBEC1C6, - right1: 0xCACED1, - middle: 0xB0B4BD}, - disabled: { - top: 0x81858E, - top1: 0x858992, - top2: 0x9599A2, - top3: 0xABAFB6, - bottom: 0xD3D6DB, - bottom1: 0xDDE0E4, - bottom2: 0xEFF2F6, - bottom3: 0xD2D5DA, - left: 0x82858C, - left1: undefined, - right: 0x82858A, - right1: 0xE9ECF1, - middle: 0xC7CACF} - }; private var m_textField:TextField; --- 54,57 ---- Index: NSTextFieldCell.as =================================================================== RCS file: /cvsroot/actionstep/actionstep/src/org/actionstep/NSTextFieldCell.as,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -d -r1.8 -r1.9 *** NSTextFieldCell.as 12 May 2005 19:38:26 -0000 1.8 --- NSTextFieldCell.as 17 May 2005 15:59:36 -0000 1.9 *************** *** 37,41 **** import org.actionstep.NSEvent; ! import org.actionstep.ASDraw; import org.actionstep.ASFieldEditor; --- 37,41 ---- import org.actionstep.NSEvent; ! import org.actionstep.ASTheme; import org.actionstep.ASFieldEditor; *************** *** 44,92 **** class org.actionstep.NSTextFieldCell extends NSActionCell { - private static var g_textFieldColors = { - up: { - top: 0x82858E, - top1: 0xDFE2E9, - top2: 0xEEF2F5, - top3: 0xD4D8D9, - bottom: 0xD3D6DB, - bottom1: 0x858992, - bottom2: 0x9599A2, - bottom3: 0xACB1B7, - left: 0x82858E, - left1: 0xDFE2E9, - right: 0xD3D6DB, - right1: 0x858992, - middle: 0xC7CAD1}, - down: { - top: 0x6A6E79, - top1: 0x747883, - top2: 0x7C838B, - top3: 0x939AA2, - bottom: 0xBEC1C6, - bottom1: 0xCACED1, - bottom2: 0xDADDE2, - bottom3: 0xBEC1C6, - left: 0x6A6E79, - left1: 0x747883, - right: 0xBEC1C6, - right1: 0xCACED1, - middle: 0xB0B4BD}, - disabled: { - top: 0x81858E, - top1: 0x858992, - top2: 0x9599A2, - top3: 0xABAFB6, - bottom: 0xD3D6DB, - bottom1: 0xDDE0E4, - bottom2: 0xEFF2F6, - bottom3: 0xD2D5DA, - left: 0x82858C, - left1: undefined, - right: 0x82858A, - right1: 0xE9ECF1, - middle: 0xC7CACF} - }; - private var m_bezelStyle:NSBezelStyle; private var m_textColor:NSColor; --- 44,47 ---- *************** *** 205,215 **** var mc:MovieClip = m_controlView.mcBounds(); ! var colors; ! if (m_enabled) { ! colors = g_textFieldColors.disabled; ! } else { ! colors = g_textFieldColors.down; ! } ! var width = cellFrame.size.width - 1; var height = cellFrame.size.height - 1; --- 160,164 ---- var mc:MovieClip = m_controlView.mcBounds(); ! var width = cellFrame.size.width - 1; var height = cellFrame.size.height - 1; *************** *** 217,244 **** var y = cellFrame.origin.y; ! if (m_drawsBackground) ! { ! ASDraw.drawFill(mc, colors.middle, 0, 0, width, height); ! ! //draw top lines ! ASDraw.drawHLine(mc, colors.top , x, width, y); ! ASDraw.drawHLine(mc, colors.top1, x, width, y+1); ! ASDraw.drawHLine(mc, colors.top2, x, width, y+2); ! ASDraw.drawHLine(mc, colors.top3, x, width, y+3); ! ! //draw bottom lines ! ASDraw.drawHLine(mc, colors.bottom , x, width, height ); ! ASDraw.drawHLine(mc, colors.bottom1, x, width, height-1); ! ASDraw.drawHLine(mc, colors.bottom2, x, width, height-2); ! ASDraw.drawHLine(mc, colors.bottom3, x, width, height-3); ! ! //draw left lines ! ASDraw.drawVLine(mc, colors.left , y, height, x ); ! ASDraw.drawVLineEdgeFade(mc, colors.left1, y, height, x+1, 5); ! ! //draw right lines ! ASDraw.drawVLine(mc, colors.right , y, height, width ); ! ASDraw.drawVLineEdgeFade(mc, colors.right1, y, height, width-1, 5); ! } if (m_textField == null || m_textField._parent == undefined) { --- 166,172 ---- var y = cellFrame.origin.y; ! if (m_drawsBackground) { ! ASTheme.current().drawTextFieldWithRectColorsetInView(cellFrame, "defaultTextfield", inView); ! } if (m_textField == null || m_textField._parent == undefined) { Index: ASTheme.as =================================================================== RCS file: /cvsroot/actionstep/actionstep/src/org/actionstep/ASTheme.as,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** ASTheme.as 17 May 2005 15:43:18 -0000 1.3 --- ASTheme.as 17 May 2005 15:59:36 -0000 1.4 *************** *** 48,52 **** private static var g_current:ASThemeProtocol; ! private static var g_buttonColors = { up: { top: 0x82858E, --- 48,52 ---- private static var g_current:ASThemeProtocol; ! private static var g_colorSets = { up: { top: 0x82858E, *************** *** 90,94 **** right: 0x82858A, right1: 0xE9ECF1, ! middle: 0xC7CACF} }; --- 90,108 ---- right: 0x82858A, right1: 0xE9ECF1, ! middle: 0xC7CACF}, ! defaultTextfield: { ! top: 0x81858E, ! top1: 0x858992, ! top2: 0x9599A2, ! top3: 0xABAFB6, ! bottom: 0xD3D6DB, ! bottom1: 0xDDE0E4, ! bottom2: 0xEFF2F6, ! bottom3: 0xD2D5DA, ! left: 0x82858C, ! left1: undefined, ! right: 0x82858A, ! right1: 0xE9ECF1, ! middle: 0xC7CACF} }; *************** *** 120,127 **** var x = rect.origin.x; var y = rect.origin.y; ! var width = rect.size.width; ! var height = rect.size.height; var mc = view.mcBounds(); ! var colors = g_buttonColors[colorSet]; ASDraw.drawFill(mc, colors.middle, x, y, width, height); ASDraw.drawRect(mc, 1, 0, x, y, width, height); --- 134,141 ---- var x = rect.origin.x; var y = rect.origin.y; ! var width = rect.size.width-1; ! var height = rect.size.height-1; var mc = view.mcBounds(); ! var colors = g_colorSets[colorSet]; ASDraw.drawFill(mc, colors.middle, x, y, width, height); ASDraw.drawRect(mc, 1, 0, x, y, width, height); *************** *** 132,139 **** var x = rect.origin.x; var y = rect.origin.y; ! var width = rect.size.width; ! var height = rect.size.height; var mc = view.mcBounds(); ! var colors = g_buttonColors[colorSet]; //draw top lines --- 146,153 ---- var x = rect.origin.x; var y = rect.origin.y; ! var width = rect.size.width-1; ! var height = rect.size.height-1; var mc = view.mcBounds(); ! var colors = g_colorSets[colorSet]; //draw top lines *************** *** 158,161 **** --- 172,206 ---- ASDraw.drawVLineEdgeFade(mc, colors.right1, y, y+height, x+width-1, 5); } + + public function drawTextFieldWithRectColorsetInView(rect:NSRect, colorSet:String, view:NSView) { + var x = rect.origin.x; + var y = rect.origin.y; + var width = rect.size.width-1; + var height = rect.size.height-1; + var mc = view.mcBounds(); + var colors = g_colorSets[colorSet]; + + ASDraw.drawFill(mc, colors.middle, 0, 0, width, height); + + //draw top lines + ASDraw.drawHLine(mc, colors.top , x, width, y); + ASDraw.drawHLine(mc, colors.top1, x, width, y+1); + ASDraw.drawHLine(mc, colors.top2, x, width, y+2); + ASDraw.drawHLine(mc, colors.top3, x, width, y+3); + + //draw bottom lines + ASDraw.drawHLine(mc, colors.bottom , x, width, height ); + ASDraw.drawHLine(mc, colors.bottom1, x, width, height-1); + ASDraw.drawHLine(mc, colors.bottom2, x, width, height-2); + ASDraw.drawHLine(mc, colors.bottom3, x, width, height-3); + + //draw left lines + ASDraw.drawVLine(mc, colors.left , y, height, x ); + ASDraw.drawVLineEdgeFade(mc, colors.left1, y, height, x+1, 5); + + //draw right lines + ASDraw.drawVLine(mc, colors.right , y, height, width ); + ASDraw.drawVLineEdgeFade(mc, colors.right1, y, height, width-1, 5); + } public function registerDefaultImages() { |