67 thumb_size = range_rect.height * THUMB_SIZE_RATIO |
67 thumb_size = range_rect.height * THUMB_SIZE_RATIO |
68 thumb_range = range_rect.height - thumb_size |
68 thumb_range = range_rect.height - thumb_size |
69 thumb_center_position = (thumb_size + (self.ThumbPosition + 1) * thumb_range) / 2. |
69 thumb_center_position = (thumb_size + (self.ThumbPosition + 1) * thumb_range) / 2. |
70 thumb_start = int(thumb_center_position - thumb_size / 2.) |
70 thumb_start = int(thumb_center_position - thumb_size / 2.) |
71 thumb_end = int(thumb_center_position + thumb_size / 2.) |
71 thumb_end = int(thumb_center_position + thumb_size / 2.) |
72 return wx.Rect(1, range_rect.y + thumb_start, width - 1, thumb_end - thumb_start) |
72 return wx.Rect(0, range_rect.y + thumb_start, width, thumb_end - thumb_start) |
73 |
73 |
74 def RefreshThumbPosition(self, thumb_position=None): |
74 def RefreshThumbPosition(self, thumb_position=None): |
75 if thumb_position is None: |
75 if thumb_position is None: |
76 thumb_position = self.ThumbPosition |
76 thumb_position = self.ThumbPosition |
77 if self.Parent.IsMessagePanelTop(): |
77 if self.Parent.IsMessagePanelTop(): |
127 def OnPaint(self, event): |
127 def OnPaint(self, event): |
128 dc = wx.BufferedPaintDC(self) |
128 dc = wx.BufferedPaintDC(self) |
129 dc.Clear() |
129 dc.Clear() |
130 dc.BeginDrawing() |
130 dc.BeginDrawing() |
131 |
131 |
|
132 gc = wx.GCDC(dc) |
|
133 |
132 width, height = self.GetClientSize() |
134 width, height = self.GetClientSize() |
133 |
135 |
134 dc.SetPen(wx.Pen(wx.NamedColour("GREY"), 2)) |
136 gc.SetPen(wx.Pen(wx.NamedColour("GREY"), 2)) |
135 dc.SetBrush(wx.GREY_BRUSH) |
137 gc.SetBrush(wx.GREY_BRUSH) |
136 |
138 |
137 dc.DrawLines(ArrowPoints(wx.TOP, width, width * 0.75, 2 * width)) |
139 gc.DrawLines(ArrowPoints(wx.TOP, width, width * 0.75, 2 * width)) |
138 dc.DrawLines(ArrowPoints(wx.TOP, width, width * 0.75, 2 * width + 6)) |
140 gc.DrawLines(ArrowPoints(wx.TOP, width, width * 0.75, 2 * width + 6)) |
139 |
141 |
140 dc.DrawLines(ArrowPoints(wx.BOTTOM, width, width * 0.75, height - 2 * width)) |
142 gc.DrawLines(ArrowPoints(wx.BOTTOM, width, width * 0.75, height - 2 * width)) |
141 dc.DrawLines(ArrowPoints(wx.BOTTOM, width, width * 0.75, height - 2 * width - 6)) |
143 gc.DrawLines(ArrowPoints(wx.BOTTOM, width, width * 0.75, height - 2 * width - 6)) |
142 |
144 |
143 thumb_rect = self.GetThumbRect() |
145 thumb_rect = self.GetThumbRect() |
144 exclusion_rect = wx.Rect(thumb_rect.x, thumb_rect.y, |
146 exclusion_rect = wx.Rect(thumb_rect.x, thumb_rect.y, |
145 thumb_rect.width, thumb_rect.height) |
147 thumb_rect.width, thumb_rect.height) |
146 if self.Parent.IsMessagePanelTop(): |
148 if self.Parent.IsMessagePanelTop(): |
147 exclusion_rect.y, exclusion_rect.height = width, exclusion_rect.y + exclusion_rect.height - width |
149 exclusion_rect.y, exclusion_rect.height = width, exclusion_rect.y + exclusion_rect.height - width |
148 if self.Parent.IsMessagePanelBottom(): |
150 if self.Parent.IsMessagePanelBottom(): |
149 exclusion_rect.height = height - width - exclusion_rect.y |
151 exclusion_rect.height = height - width - exclusion_rect.y |
150 if exclusion_rect != thumb_rect: |
152 if exclusion_rect != thumb_rect: |
151 colour = wx.NamedColour("LIGHT GREY") |
153 colour = wx.NamedColour("LIGHT GREY") |
152 dc.SetPen(wx.Pen(colour)) |
154 gc.SetPen(wx.Pen(colour)) |
153 dc.SetBrush(wx.Brush(colour)) |
155 gc.SetBrush(wx.Brush(colour)) |
154 |
156 |
155 dc.DrawRectangle(exclusion_rect.x, exclusion_rect.y, |
157 gc.DrawRectangle(exclusion_rect.x, exclusion_rect.y, |
156 exclusion_rect.width, exclusion_rect.height) |
158 exclusion_rect.width, exclusion_rect.height) |
157 |
159 |
158 dc.SetPen(wx.GREY_PEN) |
160 gc.SetPen(wx.GREY_PEN) |
159 dc.SetBrush(wx.GREY_BRUSH) |
161 gc.SetBrush(wx.GREY_BRUSH) |
160 |
162 |
161 dc.DrawPolygon(ArrowPoints(wx.TOP, width, width, 0)) |
163 gc.DrawPolygon(ArrowPoints(wx.TOP, width, width, 0)) |
162 |
164 |
163 dc.DrawPolygon(ArrowPoints(wx.BOTTOM, width, width, height)) |
165 gc.DrawPolygon(ArrowPoints(wx.BOTTOM, width, width, height)) |
164 |
166 |
165 dc.DrawRectangle(thumb_rect.x, thumb_rect.y, |
167 gc.DrawRectangle(thumb_rect.x, thumb_rect.y, |
166 thumb_rect.width, thumb_rect.height) |
168 thumb_rect.width, thumb_rect.height) |
167 |
169 |
168 dc.EndDrawing() |
170 dc.EndDrawing() |
169 event.Skip() |
171 event.Skip() |
170 |
172 |