Mercurial > cpython-lru_cache-weakref
annotate Lib/lib-stdwin/BoxParent.py @ 5817:48b94de85bf3 legacy-trunk
Extensive changes by AMK.
| author | Guido van Rossum <guido@python.org> |
|---|---|
| date | Thu, 17 Jul 1997 16:29:42 +0000 |
| parents | f9bbb01388d5 |
| children |
| rev | line source |
|---|---|
| 344 | 1 from TransParent import TransParent |
| 2 | |
| 531 | 3 class BoxParent(TransParent): |
| 344 | 4 # |
|
1110
1d06b1499eb9
* Got entirely rid of path.py.
Guido van Rossum <guido@python.org>
parents:
531
diff
changeset
|
5 def create(self, parent, (dh, dv)): |
| 344 | 6 self = TransParent.create(self, parent) |
| 7 self.dh = dh | |
| 8 self.dv = dv | |
| 9 return self | |
| 10 # | |
|
1110
1d06b1499eb9
* Got entirely rid of path.py.
Guido van Rossum <guido@python.org>
parents:
531
diff
changeset
|
11 def getminsize(self, m, (width, height)): |
| 344 | 12 width = max(0, width - 2*self.dh) |
| 13 height = max(0, height - 2*self.dv) | |
| 14 width, height = self.child.getminsize(m, (width, height)) | |
| 15 return width + 2*self.dh, height + 2*self.dv | |
| 16 # | |
| 17 def setbounds(self, bounds): | |
| 18 (left, top), (right, bottom) = bounds | |
| 19 self.bounds = bounds | |
| 20 left = min(right, left + self.dh) | |
| 21 top = min(bottom, top + self.dv) | |
| 22 right = max(left, right - self.dh) | |
| 23 bottom = max(top, bottom - self.dv) | |
| 24 self.innerbounds = (left, top), (right, bottom) | |
| 25 self.child.setbounds(self.innerbounds) | |
| 26 # | |
| 27 def getbounds(self): | |
| 28 return self.bounds | |
| 29 # | |
|
1178
f9bbb01388d5
* More changes due to stricter argument passing rules
Guido van Rossum <guido@python.org>
parents:
1110
diff
changeset
|
30 def draw(self, d, area): |
| 344 | 31 (left, top), (right, bottom) = self.bounds |
| 32 left = left + 1 | |
| 33 top = top + 1 | |
| 34 right = right - 1 | |
| 35 bottom = bottom - 1 | |
| 36 d.box((left, top), (right, bottom)) | |
|
1178
f9bbb01388d5
* More changes due to stricter argument passing rules
Guido van Rossum <guido@python.org>
parents:
1110
diff
changeset
|
37 TransParent.draw(self, d, area) # XXX clip to innerbounds? |
| 344 | 38 # |
| 39 # XXX should scroll clip to innerbounds??? | |
| 40 # XXX currently the only user restricts itself to child's bounds |
