54 Latest Revision before Latest Revision before Latest Revision: 31 May 2005, 23.17 CET |
54 Latest Revision before Latest Revision before Latest Revision: 31 May 2005, 23.17 CET |
55 |
55 |
56 """ |
56 """ |
57 |
57 |
58 from __future__ import absolute_import |
58 from __future__ import absolute_import |
|
59 from __future__ import division |
59 import wx |
60 import wx |
60 |
61 |
61 # Horizontal Alignment Constants |
62 # Horizontal Alignment Constants |
62 ESB_ALIGN_CENTER_VERTICAL = 1 |
63 ESB_ALIGN_CENTER_VERTICAL = 1 |
63 ESB_ALIGN_TOP = 2 |
64 ESB_ALIGN_TOP = 2 |
143 if verticalalignment == ESB_EXACT_FIT: |
144 if verticalalignment == ESB_EXACT_FIT: |
144 widget.SetSize((widgetsize[0], rect.height-2)) |
145 widget.SetSize((widgetsize[0], rect.height-2)) |
145 widget.SetPosition((xpos, rect.y-1)) |
146 widget.SetPosition((xpos, rect.y-1)) |
146 elif verticalalignment == ESB_ALIGN_CENTER_VERTICAL: |
147 elif verticalalignment == ESB_ALIGN_CENTER_VERTICAL: |
147 if widgetsize[1] < rect.height - 1: |
148 if widgetsize[1] < rect.height - 1: |
148 diffs = (rect.height - widgetsize[1])/2 |
149 diffs = (rect.height - widgetsize[1]) // 2 |
149 widget.SetPosition((xpos, rect.y+diffs)) |
150 widget.SetPosition((xpos, rect.y+diffs)) |
150 else: |
151 else: |
151 widget.SetSize((widgetsize[0], rect.height-2)) |
152 widget.SetSize((widgetsize[0], rect.height-2)) |
152 widget.SetPosition((xpos, rect.y-1)) |
153 widget.SetPosition((xpos, rect.y-1)) |
153 elif verticalalignment == ESB_ALIGN_TOP: |
154 elif verticalalignment == ESB_ALIGN_TOP: |
161 if verticalalignment == ESB_EXACT_FIT: |
162 if verticalalignment == ESB_EXACT_FIT: |
162 widget.SetSize((widgetsize[0], rect.height-2)) |
163 widget.SetSize((widgetsize[0], rect.height-2)) |
163 widget.SetPosition((xpos, rect.y-1)) |
164 widget.SetPosition((xpos, rect.y-1)) |
164 elif verticalalignment == ESB_ALIGN_CENTER_VERTICAL: |
165 elif verticalalignment == ESB_ALIGN_CENTER_VERTICAL: |
165 if widgetsize[1] < rect.height - 1: |
166 if widgetsize[1] < rect.height - 1: |
166 diffs = (rect.height - widgetsize[1])/2 |
167 diffs = (rect.height - widgetsize[1]) // 2 |
167 widget.SetPosition((xpos, rect.y+diffs)) |
168 widget.SetPosition((xpos, rect.y+diffs)) |
168 else: |
169 else: |
169 widget.SetSize((widgetsize[0], rect.height-2)) |
170 widget.SetSize((widgetsize[0], rect.height-2)) |
170 widget.SetPosition((xpos, rect.y-1)) |
171 widget.SetPosition((xpos, rect.y-1)) |
171 elif verticalalignment == ESB_ALIGN_TOP: |
172 elif verticalalignment == ESB_ALIGN_TOP: |
173 elif verticalalignment == ESB_ALIGN_BOTTOM: |
174 elif verticalalignment == ESB_ALIGN_BOTTOM: |
174 widget.SetPosition((xpos, rect.height-widgetsize[1])) |
175 widget.SetPosition((xpos, rect.height-widgetsize[1])) |
175 |
176 |
176 elif horizontalalignment == ESB_ALIGN_CENTER_HORIZONTAL: |
177 elif horizontalalignment == ESB_ALIGN_CENTER_HORIZONTAL: |
177 |
178 |
178 xpos = rect.x + (rect.width - widgetsize[0])/2 - 1 |
179 xpos = rect.x + (rect.width - widgetsize[0]) // 2 - 1 |
179 if verticalalignment == ESB_EXACT_FIT: |
180 if verticalalignment == ESB_EXACT_FIT: |
180 widget.SetSize((widgetsize[0], rect.height)) |
181 widget.SetSize((widgetsize[0], rect.height)) |
181 widget.SetPosition((xpos, rect.y)) |
182 widget.SetPosition((xpos, rect.y)) |
182 elif verticalalignment == ESB_ALIGN_CENTER_VERTICAL: |
183 elif verticalalignment == ESB_ALIGN_CENTER_VERTICAL: |
183 if widgetsize[1] < rect.height - 1: |
184 if widgetsize[1] < rect.height - 1: |
184 diffs = (rect.height - widgetsize[1])/2 |
185 diffs = (rect.height - widgetsize[1]) // 2 |
185 widget.SetPosition((xpos, rect.y+diffs)) |
186 widget.SetPosition((xpos, rect.y+diffs)) |
186 else: |
187 else: |
187 widget.SetSize((widgetsize[0], rect.height-1)) |
188 widget.SetSize((widgetsize[0], rect.height-1)) |
188 widget.SetPosition((xpos, rect.y+1)) |
189 widget.SetPosition((xpos, rect.y+1)) |
189 elif verticalalignment == ESB_ALIGN_TOP: |
190 elif verticalalignment == ESB_ALIGN_TOP: |