blob: 51bd305a8644d5afaa57214544e7aaa01bbb759b [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
Guido van Rossumce084481991-12-26 13:06:29 +000013class AbstractParent:
Guido van Rossum2e449671990-11-05 19:44:36 +000014 #
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()
Guido van Rossumcbe6b531991-04-07 13:31:53 +000030 def getwindow(self): return unimpl() # Only for very special cases
Guido van Rossum2e449671990-11-05 19:44:36 +000031 #
32 def change(self, area): unimpl()
Guido van Rossum89a78691992-12-14 12:57:56 +000033 def scroll(self, area, (dh, dv)): unimpl()
Guido van Rossum2e449671990-11-05 19:44:36 +000034 def settimer(self, itimer): unimpl()
35
Guido van Rossumce084481991-12-26 13:06:29 +000036class AbstractChild:
Guido van Rossum2e449671990-11-05 19:44:36 +000037 #
38 # Downcalls from parent to child
39 #
40 def destroy(self): unimpl()
41 #
Guido van Rossumcbe6b531991-04-07 13:31:53 +000042 def realize(self): return unimpl()
Guido van Rossum89a78691992-12-14 12:57:56 +000043 def getminsize(self, m, (width, height)): return unimpl()
Guido van Rossum2e449671990-11-05 19:44:36 +000044 def getbounds(self): return unimpl()
45 def setbounds(self, bounds): unimpl()
Guido van Rossum89a78691992-12-14 12:57:56 +000046 def draw(self, d, area): unimpl()
Guido van Rossum2e449671990-11-05 19:44:36 +000047 #
48 # Downcalls only made after certain upcalls
49 #
50 def mouse_down(self, detail): unimpl()
51 def mouse_move(self, detail): unimpl()
52 def mouse_up(self, detail): unimpl()
53 #
54 def timer(self): unimpl()
55
56# A "Split" is a child that manages one or more children.
57# (This terminology is due to DEC SRC, except for CSplits.)
58# A child of a split may be another split, a button, a slider, etc.
59# Certain upcalls and downcalls can be handled transparently, but
60# for others (e.g., all geometry related calls) this is not possible.
61
Guido van Rossumce084481991-12-26 13:06:29 +000062class AbstractSplit(AbstractChild, AbstractParent):
Guido van Rossum2e449671990-11-05 19:44:36 +000063 pass