blob: 9d9013be988967434a447efc21144933cdb2c78b [file] [log] [blame]
Guido van Rossum2e449671990-11-05 19:44:36 +00001# Abstract classes for parents and children.
Guido van Rossumdebbe041990-12-26 15:33:00 +00002#
Guido van Rossum2e449671990-11-05 19:44:36 +00003# Do not use as base class -- this is for documentation only.
Guido van Rossumdebbe041990-12-26 15:33:00 +00004#
5# Note that the tree must be built top down (create the parent,
6# then add the children).
7#
8# Also note that the creation methods are not standardized --
9# these have extra parameters dependent on the widget type.
10# For historical reasons, button creation methods are called
11# define() while split creation methods are called create().
Guido van Rossum2e449671990-11-05 19:44:36 +000012
13class AbstractParent():
14 #
15 # Upcalls from child to parent
16 #
17 def addchild(self, child): unimpl()
18 def delchild(self, child): unimpl()
19 #
20 def need_mouse(self, child): unimpl()
21 def no_mouse(self, child): unimpl()
22 #
23 def need_timer(self, child): unimpl()
24 def no_timer(self, child): unimpl()
25 #
26 # XXX need_kbd, no_kbd; focus???
27 #
28 def begindrawing(self): return unimpl()
29 def beginmeasuring(self): return unimpl()
30 #
31 def change(self, area): unimpl()
32 def scroll(self, (area, (dh, dv))): unimpl()
33 def settimer(self, itimer): unimpl()
34
35class AbstractChild():
36 #
37 # Downcalls from parent to child
38 #
39 def destroy(self): unimpl()
40 #
41 def minsize(self, m): return unimpl()
42 def getbounds(self): return unimpl()
43 def setbounds(self, bounds): unimpl()
44 def draw(self, (d, area)): unimpl()
45 #
46 # Downcalls only made after certain upcalls
47 #
48 def mouse_down(self, detail): unimpl()
49 def mouse_move(self, detail): unimpl()
50 def mouse_up(self, detail): unimpl()
51 #
52 def timer(self): unimpl()
53
54# A "Split" is a child that manages one or more children.
55# (This terminology is due to DEC SRC, except for CSplits.)
56# A child of a split may be another split, a button, a slider, etc.
57# Certain upcalls and downcalls can be handled transparently, but
58# for others (e.g., all geometry related calls) this is not possible.
59
60class AbstractSplit() = AbstractChild(), AbstractParent():
61 pass