diff options
author | Guido van Rossum <guido@python.org> | 1992-01-22 22:21:31 (GMT) |
---|---|---|
committer | Guido van Rossum <guido@python.org> | 1992-01-22 22:21:31 (GMT) |
commit | babe2bf8f45090cef6072e6e6bb38b32afa9423e (patch) | |
tree | 5f44100e0da80f8abb18cbc40f7e4c4b06214fb3 /Lib/stdwin/basewin.py | |
parent | 68c172e3f2aa0ad6d22492417eaa2682bc9f9797 (diff) | |
download | cpython-babe2bf8f45090cef6072e6e6bb38b32afa9423e.zip cpython-babe2bf8f45090cef6072e6e6bb38b32afa9423e.tar.gz cpython-babe2bf8f45090cef6072e6e6bb38b32afa9423e.tar.bz2 |
Initial revision
Diffstat (limited to 'Lib/stdwin/basewin.py')
-rwxr-xr-x | Lib/stdwin/basewin.py | 65 |
1 files changed, 65 insertions, 0 deletions
diff --git a/Lib/stdwin/basewin.py b/Lib/stdwin/basewin.py new file mode 100755 index 0000000..f896fe2 --- /dev/null +++ b/Lib/stdwin/basewin.py @@ -0,0 +1,65 @@ +# basewin.py + +import stdwin +import mainloop +from stdwinevents import * + +class BaseWindow: + + def init(self, title): + self.win = stdwin.open(title) + self.win.dispatch = self.dispatch + mainloop.register(self.win) + return self + +# def reopen(self): +# title = self.win.gettitle() +# winpos = self.win.getwinpos() +# winsize = self.win.getwinsize() +# origin = self.win.getorigin() +# docsize = self.win.getdocsize() +# mainloop.unregister(self.win) +# del self.win.dispatch +# self.win.close() +# stdwin.setdefwinpos(winpos) +# stdwin.setdefwinsize(winsize) +# self.win = stdwin.open(title) +# stdwin.setdefwinpos(0, 0) +# stdwin.setdefwinsize(0, 0) +# self.win.setdocsize(docsize) +# self.win.setorigin(origin) +# self.win.dispatch = self.dispatch +# mainloop.register(self.win) + + def popup(self): + if self.win is not stdwin.getactive(): + self.win.setactive() + + def close(self): + mainloop.unregister(self.win) + del self.win.dispatch + self.win.close() + + def dispatch(self, event): + type, win, detail = event + if type == WE_CHAR: + self.char(detail) + elif type == WE_COMMAND: + self.command(detail) + elif type == WE_MOUSE_DOWN: + self.mouse_down(detail) + elif type == WE_MOUSE_MOVE: + self.mouse_move(detail) + elif type == WE_MOUSE_UP: + self.mouse_up(detail) + elif type == WE_DRAW: + self.draw(detail) + elif type == WE_CLOSE: + self.close() + + def no_op(self, detail): + pass + char = command = mouse_down = mouse_move = mouse_up = draw = no_op + + def refreshall(self): + self.win.change((-10, 0), (10000, 30000)) |