Update of /cvsroot/actionstep/actionstep/src/org/actionstep
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv11718/actionstep/org/actionstep
Modified Files:
NSAlert.as
Log Message:
Code for recalling last position
Index: NSAlert.as
===================================================================
RCS file: /cvsroot/actionstep/actionstep/src/org/actionstep/NSAlert.as,v
retrieving revision 1.3
retrieving revision 1.4
diff -C2 -d -r1.3 -r1.4
*** NSAlert.as 16 Jul 2005 02:59:00 -0000 1.3
--- NSAlert.as 17 Jul 2005 00:49:53 -0000 1.4
***************
*** 35,40 ****
import org.actionstep.NSWindow;
import org.actionstep.NSApplication;
! import org.actionstep.NSRect;
!
import org.actionstep.ASAlertPanel;
import org.actionstep.ASDraw;
--- 35,41 ----
import org.actionstep.NSWindow;
import org.actionstep.NSApplication;
! import org.actionstep.NSRect;
! //for position-recall
! import org.actionstep.NSNotification;
import org.actionstep.NSNotificationCenter;
import org.actionstep.NSPoint;
import org.actionstep.ASAlertPanel;
import org.actionstep.ASDraw;
***************
*** 51,54 ****
--- 52,57 ----
private var m_app:NSApplication;
private var m_sheet:ASAlertPanel;
+ private static var g_pos={};
+
public static function alertWithMessageTextDefaultButtonAlternateButtonOtherButton
(messageTitle:String, defaultButtonTitle:String, alternateButtonTitle:String, otherButtonTitle:String):NSAlert {
***************
*** 187,197 ****
--- 190,218 ----
("", m_msg, list[0].title(), list[1].title(), list[2].title());
+ window.resignKeyWindow();
m_sheet.display();
var content = m_sheet.contentView();
ASDraw.solidRectWithRect(content.mcBounds(), content.bounds(), 0xdddddd);
+ if(g_pos[m_msg]!=null) {
+ m_sheet.rootView().setFrameOrigin(g_pos[m_msg]);
+ }
+
+ NSNotificationCenter.defaultCenter().addObserverSelectorNameObject
+ (this, "windowHasClosed", NSWindow.NSWindowWillCloseNotification, m_sheet);
+
//add it to arg array
arguments.unshift(m_sheet);
m_app.beginSheetModalForWindowModalDelegateDidEndSelectorContextInfo.apply(m_app, arguments);
}
+
+ private function windowHasClosed(n:NSNotification) {
+ var pos:NSPoint = m_sheet.rootView().frame().origin;
+
+ if(g_pos[m_msg]==null) {
+ g_pos[m_msg]=pos;
+ } else {
+ g_pos[m_msg]=pos;
+ }
+ }
}
\ No newline at end of file
|