Guido van Rossum | 2e44967 | 1990-11-05 19:44:36 +0000 | [diff] [blame] | 1 | # Abstract classes for parents and children. |
Guido van Rossum | debbe04 | 1990-12-26 15:33:00 +0000 | [diff] [blame] | 2 | # |
Guido van Rossum | 2e44967 | 1990-11-05 19:44:36 +0000 | [diff] [blame] | 3 | # Do not use as base class -- this is for documentation only. |
Guido van Rossum | debbe04 | 1990-12-26 15:33:00 +0000 | [diff] [blame] | 4 | # |
| 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 Rossum | 2e44967 | 1990-11-05 19:44:36 +0000 | [diff] [blame] | 12 | |
Guido van Rossum | ce08448 | 1991-12-26 13:06:29 +0000 | [diff] [blame] | 13 | class AbstractParent: |
Guido van Rossum | 2e44967 | 1990-11-05 19:44:36 +0000 | [diff] [blame] | 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() |
Guido van Rossum | cbe6b53 | 1991-04-07 13:31:53 +0000 | [diff] [blame] | 30 | def getwindow(self): return unimpl() # Only for very special cases |
Guido van Rossum | 2e44967 | 1990-11-05 19:44:36 +0000 | [diff] [blame] | 31 | # |
| 32 | def change(self, area): unimpl() |
Guido van Rossum | 89a7869 | 1992-12-14 12:57:56 +0000 | [diff] [blame] | 33 | def scroll(self, area, (dh, dv)): unimpl() |
Guido van Rossum | 2e44967 | 1990-11-05 19:44:36 +0000 | [diff] [blame] | 34 | def settimer(self, itimer): unimpl() |
| 35 | |
Guido van Rossum | ce08448 | 1991-12-26 13:06:29 +0000 | [diff] [blame] | 36 | class AbstractChild: |
Guido van Rossum | 2e44967 | 1990-11-05 19:44:36 +0000 | [diff] [blame] | 37 | # |
| 38 | # Downcalls from parent to child |
| 39 | # |
| 40 | def destroy(self): unimpl() |
| 41 | # |
Guido van Rossum | cbe6b53 | 1991-04-07 13:31:53 +0000 | [diff] [blame] | 42 | def realize(self): return unimpl() |
Guido van Rossum | 89a7869 | 1992-12-14 12:57:56 +0000 | [diff] [blame] | 43 | def getminsize(self, m, (width, height)): return unimpl() |
Guido van Rossum | 2e44967 | 1990-11-05 19:44:36 +0000 | [diff] [blame] | 44 | def getbounds(self): return unimpl() |
| 45 | def setbounds(self, bounds): unimpl() |
Guido van Rossum | 89a7869 | 1992-12-14 12:57:56 +0000 | [diff] [blame] | 46 | def draw(self, d, area): unimpl() |
Guido van Rossum | 2e44967 | 1990-11-05 19:44:36 +0000 | [diff] [blame] | 47 | # |
| 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 Rossum | ce08448 | 1991-12-26 13:06:29 +0000 | [diff] [blame] | 62 | class AbstractSplit(AbstractChild, AbstractParent): |
Guido van Rossum | 2e44967 | 1990-11-05 19:44:36 +0000 | [diff] [blame] | 63 | pass |