From: Tay R. C. <rc...@us...> - 2005-06-30 09:42:19
|
Update of /cvsroot/actionstep/actionstep/src/org/actionstep/test In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv28968/actionstep/org/actionstep/test Modified Files: ASTestModal.as Log Message: changed class name Index: ASTestModal.as =================================================================== RCS file: /cvsroot/actionstep/actionstep/src/org/actionstep/test/ASTestModal.as,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** ASTestModal.as 24 Jun 2005 02:06:03 -0000 1.2 --- ASTestModal.as 30 Jun 2005 09:42:10 -0000 1.3 *************** *** 1,118 **** ! /* ! * Copyright (c) 2005, InfoEther, Inc. ! * All rights reserved. ! * ! * Redistribution and use in source and binary forms, with or without modification, ! * are permitted provided that the following conditions are met: ! * ! * 1) Redistributions of source code must retain the above copyright notice, ! * this list of conditions and the following disclaimer. ! * ! * 2) Redistributions in binary form must reproduce the above copyright notice, ! * this list of conditions and the following disclaimer in the documentation ! * and/or other materials provided with the distribution. ! * ! * 3) The name InfoEther, Inc. may not be used to endorse or promote products ! * derived from this software without specific prior written permission. ! * ! * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" ! * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE ! * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ! * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE ! * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR ! * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF ! * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS ! * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN ! * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ! * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE ! * POSSIBILITY OF SUCH DAMAGE. ! */ ! ! import org.actionstep.*; ! import org.actionstep.test.*; ! import org.actionstep.constants.* ! ! class org.actionstep.test.ASTestPanel { ! public static var ! self = ASTestPanel, ! app:NSApplication = NSApplication.sharedApplication(), ! window1:NSWindow, window2:NSWindow, ! view1, view2, ! begin:NSButton, end:NSButton, ! textField:NSTextField, textField2:NSTextField ! ! public static function test() { ! TRACE("app: "+app); ! window1= (new NSWindow()).initWithContentRect(new NSRect(0,0,500,500)); ! window2 = (new NSWindow()).initWithContentRect(new NSRect(125,100,250,250)); ! ! view1 = (new ASTestView()).initWithFrame(new NSRect(0,0,500,500)); ! view1.setBorderColor(new NSColor(0xFFF000)); ! view2 = (new ASTestView()).initWithFrame(new NSRect(0,0,250,250)); ! view2.setBorderColor(new NSColor(0xFF0000)); ! ! begin = (new NSButton()).initWithFrame(new NSRect(10,80,70,30)); ! begin.setTitle("Error..."); ! begin.sendActionOn(NSEvent.NSLeftMouseUpMask); ! begin.setBezelStyle(NSBezelStyle.NSShadowlessSquareBezelStyle); ! ! end = (new NSButton()).initWithFrame(new NSRect(10,80,70,30)); ! end.setTitle("OK"); ! end.sendActionOn(NSEvent.NSLeftMouseUpMask); ! end.setBezelStyle(NSBezelStyle.NSShadowlessSquareBezelStyle); ! ! textField = (new NSTextField()).initWithFrame(new NSRect(10,160,120,30)); ! textField2 = (new NSTextField()).initWithFrame(new NSRect(10,160,120,30)); ! ! view1.addSubview(begin); ! view1.addSubview(textField); ! ! view2.addSubview(end); ! view2.addSubview(textField2); ! ! begin.setTarget(self); ! begin.setAction("trigger"); ! ! end.setTarget(self); ! end.setAction("stop"); ! ! window1.setContentView(view1); ! window2.setContentView(view2); ! view2.setHidden(true); ! ! app.run(); ! } ! ! //tracking starts before modal can start posing! ! public static function trigger(button) { ! TRACE("Starting modal loop..."); ! window1.resignKeyWindow(); ! view2.setHidden(false); ! ! app.runModalForWindow(window2, self, "modal"); ! } ! ! public static function modal (ret:Number) { ! if(ret!=NSApplication.NSRunContinuesResponse) { ! ASUtils.findMatch([NSApplication], ret); ! } ! } ! ! //this func will be called twice ! public static function stop (btn) { ! TRACE("Ending modal loop..."); ! var mask; ! end.sendActionOn(mask = end.sendActionOn(0)); ! if(mask & NSEvent.NSLeftMouseUpMask) { ! view2.setNeedsDisplay(true); ! view2.displayIfNeeded(); ! } ! view2.setHidden(true); ! ! app.stopModal(); ! } ! ! public static function toString():String { ! return "Test::ASTestPanel" ! } } \ No newline at end of file --- 1,121 ---- ! /* ! * Copyright (c) 2005, InfoEther, Inc. ! * All rights reserved. ! * ! * Redistribution and use in source and binary forms, with or without modification, ! * are permitted provided that the following conditions are met: ! * ! * 1) Redistributions of source code must retain the above copyright notice, ! * this list of conditions and the following disclaimer. ! * ! * 2) Redistributions in binary form must reproduce the above copyright notice, ! * this list of conditions and the following disclaimer in the documentation ! * and/or other materials provided with the distribution. ! * ! * 3) The name InfoEther, Inc. may not be used to endorse or promote products ! * derived from this software without specific prior written permission. ! * ! * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" ! * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE ! * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ! * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE ! * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR ! * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF ! * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS ! * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN ! * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ! * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE ! * POSSIBILITY OF SUCH DAMAGE. ! */ ! ! import org.actionstep.*; ! import org.actionstep.test.*; ! import org.actionstep.constants.* ! ! class org.actionstep.test.ASTestModal { ! public static var ! self = ASTestModal, ! app:NSApplication = NSApplication.sharedApplication(), ! window1:NSWindow, window2:NSWindow, ! view1, view2, ! begin:NSButton, end:NSButton, ! textField:NSTextField, textField2:NSTextField ! ! public static function test() { ! TRACE("app: "+app); ! window1= (new NSWindow()).initWithContentRect(new NSRect(50,50,250,250)); ! window2 = (new NSWindow()).initWithContentRect(new NSRect(125,100,250,250)); ! ! window1.orderFront(); ! window2.orderBack(); ! ! view1 = (new ASTestView()).initWithFrame(new NSRect(0,0,250,250)); ! view1.setBorderColor(new NSColor(0xFFF000)); ! view2 = (new ASTestView()).initWithFrame(new NSRect(0,0,250,250)); ! view2.setBorderColor(new NSColor(0xFF0000)); ! ! begin = (new NSButton()).initWithFrame(new NSRect(10,80,70,30)); ! begin.setTitle("Error..."); ! begin.sendActionOn(NSEvent.NSLeftMouseUpMask); ! begin.setBezelStyle(NSBezelStyle.NSShadowlessSquareBezelStyle); ! ! end = (new NSButton()).initWithFrame(new NSRect(10,80,70,30)); ! end.setTitle("OK"); ! end.sendActionOn(NSEvent.NSLeftMouseUpMask); ! end.setBezelStyle(NSBezelStyle.NSShadowlessSquareBezelStyle); ! ! textField = (new NSTextField()).initWithFrame(new NSRect(10,160,120,30)); ! textField2 = (new NSTextField()).initWithFrame(new NSRect(10,160,120,30)); ! ! view1.addSubview(begin); ! view1.addSubview(textField); ! ! view2.addSubview(end); ! view2.addSubview(textField2); ! ! begin.setTarget(self); ! begin.setAction("trigger"); ! ! end.setTarget(self); ! end.setAction("stop"); ! ! window1.setContentView(view1); ! window2.setContentView(view2); ! //view2.setHidden(true); ! ! app.run(); ! } ! ! //tracking starts before modal can start posing! ! public static function trigger(button) { ! TRACE("Starting modal loop..."); ! window1.resignKeyWindow(); ! view2.setHidden(false); ! ! app.runModalForWindow(window2, self, "modal"); ! } ! ! public static function modal (ret:Number) { ! if(ret!=NSApplication.NSRunContinuesResponse) { ! ASUtils.findMatch([NSApplication], ret); ! } ! } ! ! //this func will be called twice ! public static function stop (btn) { ! TRACE("Ending modal loop..."); ! var mask; ! end.sendActionOn(mask = end.sendActionOn(0)); ! if(mask & NSEvent.NSLeftMouseUpMask) { ! view2.setNeedsDisplay(true); ! view2.displayIfNeeded(); ! } ! view2.setHidden(true); ! ! app.stopModal(); ! } ! ! public static function toString():String { ! return "Test::ASTestPanel" ! } } \ No newline at end of file |