2 # Draw a window in which the user can type.
4 # This test expects Win, Evt and FrameWork (and anything used by those)
7 # Actually, it is more a test of FrameWork by now....
9 from FrameWork
import *
16 class WasteWindow(Window
):
18 r
= (40, 40, 400, 300)
19 w
= Win
.NewWindow(r
, name
, 1, 0, -1, 1, 0x55555555)
20 r2
= (0, 0, 400-40-16, 300-40-16)
22 flags
= WASTEconst
.weDoAutoScroll | WASTEconst
.weDoOutlineHilite | \
23 WASTEconst
.weDoMonoStyled
24 self
.ted
= waste
.WENew(r2
, r2
, flags
)
32 def do_activate(self
, onoff
, evt
):
36 self
.ted
.WEDeactivate()
38 def do_update(self
, wid
, event
):
39 Qd
.EraseRect(wid
.GetWindowPort().portRect
)
40 self
.ted
.WEUpdate(wid
.GetWindowPort().visRgn
)
42 def do_contentclick(self
, local
, modifiers
, evt
):
43 (what
, message
, when
, where
, modifiers
) = evt
44 self
.ted
.WEClick(local
, modifiers
, when
)
46 def do_char(self
, ch
, event
):
47 (what
, message
, when
, where
, modifiers
) = event
48 self
.ted
.WEKey(ord(ch
), modifiers
)
50 class TestWaste(Application
):
52 Application
.__init
__(self
)
56 def makeusermenus(self
):
57 self
.filemenu
= m
= Menu(self
.menubar
, "File")
58 self
.newitem
= MenuItem(m
, "New window...", "O", self
.open)
59 self
.quititem
= MenuItem(m
, "Quit", "Q", self
.quit
)
61 def open(self
, *args
):
63 w
.open('Window %d'%self
.num
)
64 self
.num
= self
.num
+ 1
65 self
.listoflists
.append(w
)
67 def quit(self
, *args
):
70 def do_about(self
, id, item
, window
, event
):
71 EasyDialogs
.Message("""Test the WASTE interface.
72 Simple window in which you can type""")
74 def do_idle(self
, *args
):
75 for l
in self
.listoflists
:
84 if __name__
== '__main__':