163 |
self.__topWindow = self.__dockWindow |
self.__topWindow = self.__dockWindow |
164 |
self.__dockPanel.Reparent(self.__topWindow) |
self.__dockPanel.Reparent(self.__topWindow) |
165 |
|
|
166 |
if self.__bmpUnDock is not None: |
self.__dockButton.SetBitmapLabel(self.__bmpUnDock) |
167 |
self.__dockButton.SetBitmapLabel(self.__bmpUnDock) |
self.__dockButton.SetBitmapFocus(self.__bmpUnDock) |
168 |
self.__dockButton.SetBitmapFocus(self.__bmpUnDock) |
self.__dockButton.SetBitmapSelected(self.__bmpUnDock) |
169 |
self.__dockButton.SetToolTip(wxToolTip(_("Undock"))) |
self.__dockButton.SetBitmapDisabled(self.__bmpUnDock) |
170 |
else: |
self.__dockButton.SetToolTip(wxToolTip(_("Undock"))) |
|
self.__dockButton.SetLabel(_("Undock")) |
|
171 |
|
|
172 |
self.SetDockSize(self.__dockWindow.GetSize()) |
self.SetDockSize(self.__dockWindow.GetSize()) |
173 |
|
|
174 |
if wasVisible: self.Show(True) |
if wasVisible: self.Show(True) |
175 |
|
|
|
#self.__parent._UpdateDocks() |
|
|
|
|
176 |
self.issue(DOCKABLE_DOCKED, self.__id, self) |
self.issue(DOCKABLE_DOCKED, self.__id, self) |
177 |
|
|
178 |
def UnDock(self): |
def UnDock(self): |
190 |
self.__topWindow = self.__floatWindow |
self.__topWindow = self.__floatWindow |
191 |
self.__dockPanel.Reparent(self.__topWindow) |
self.__dockPanel.Reparent(self.__topWindow) |
192 |
|
|
193 |
if self.__bmpDock is not None: |
self.__dockButton.SetBitmapLabel(self.__bmpDock) |
194 |
self.__dockButton.SetBitmapLabel(self.__bmpDock) |
self.__dockButton.SetBitmapFocus(self.__bmpDock) |
195 |
self.__dockButton.SetBitmapFocus(self.__bmpDock) |
self.__dockButton.SetBitmapSelected(self.__bmpDock) |
196 |
self.__dockButton.SetToolTip(wxToolTip(_("Dock"))) |
self.__dockButton.SetBitmapDisabled(self.__bmpDock) |
197 |
else: |
self.__dockButton.SetToolTip(wxToolTip(_("Dock"))) |
|
self.__dockButton.SetLabel(_("Dock")) |
|
198 |
|
|
199 |
if wasVisible: self.Show() |
if wasVisible: self.Show() |
200 |
|
|
201 |
# |
# |
202 |
# restore window information |
# restore window information |
203 |
# |
# |
204 |
if self.__floatPosition is not None: self.SetPosition(self.__floatPosition) |
if self.__floatPosition is not None: |
205 |
if self.__floatSize is not None: self.SetSize(self.__floatSize) |
self.SetPosition(self.__floatPosition) |
206 |
|
if self.__floatSize is not None: |
207 |
|
self.SetSize(self.__floatSize) |
208 |
|
|
209 |
self.__dockPanel.SetSize(self.__topWindow.GetClientSize()) |
self.__dockPanel.SetSize(self.__topWindow.GetClientSize()) |
210 |
|
|
212 |
|
|
213 |
def IsDocked(self): |
def IsDocked(self): |
214 |
self.__CheckAllGood() |
self.__CheckAllGood() |
|
|
|
215 |
return self.__docked |
return self.__docked |
216 |
|
|
|
|
|
217 |
def Show(self, show = True): |
def Show(self, show = True): |
218 |
if show: |
if show: |
219 |
self.__DoShow() |
self.__DoShow() |
280 |
|
|
281 |
self.__topWindow.Show() |
self.__topWindow.Show() |
282 |
|
|
|
#if self.IsDocked(): |
|
|
#self.SetDockSize() |
|
|
|
|
283 |
if self.__topWindow is self.__dockWindow: |
if self.__topWindow is self.__dockWindow: |
284 |
self.__parent._UpdateDocks() |
self.__parent._UpdateDocks() |
285 |
|
|
286 |
def __DoHide(self): |
def __DoHide(self): |
287 |
if not self.IsShown(): return |
if not self.IsShown(): return |
288 |
|
|
289 |
self.__topWindow.Show(False) |
self.__topWindow.Show(False) |
290 |
|
|
291 |
if self.__topWindow is self.__dockWindow: |
if self.__topWindow is self.__dockWindow: |
292 |
self.__parent._UpdateDocks() |
self.__parent._UpdateDocks() |
293 |
|
|
|
|
|
294 |
def __CreateBorder(self): |
def __CreateBorder(self): |
295 |
|
|
|
#self.__panel.Reparent(self) # Make sure we hang on to the panel |
|
|
|
|
296 |
self.__dockPanel = wxPanel(self.__topWindow, -1, style=wxSUNKEN_BORDER) |
self.__dockPanel = wxPanel(self.__topWindow, -1, style=wxSUNKEN_BORDER) |
297 |
|
|
298 |
self.__panel.Reparent(self.__dockPanel) |
self.__panel.Reparent(self.__dockPanel) |
309 |
headerBox = wxStaticBoxSizer( |
headerBox = wxStaticBoxSizer( |
310 |
wxStaticBox(self.__dockPanel, -1, ""), headerBoxOrient) |
wxStaticBox(self.__dockPanel, -1, ""), headerBoxOrient) |
311 |
|
|
|
#buttonBox = wxBoxSizer(wxHORIZONTAL) |
|
|
|
|
312 |
# |
# |
313 |
# ideally, we should be able to rotate this text depending on |
# ideally, we should be able to rotate this text depending on |
314 |
# our orientation |
# our orientation |
315 |
# |
# |
316 |
text = wxStaticText(self.__dockPanel, -1, self.GetTitle(), |
text = wxStaticText(self.__dockPanel, -1, self.GetTitle(), |
317 |
style = wxALIGN_CENTRE) |
style = wxALIGN_CENTRE) |
|
|
|
318 |
font = text.GetFont() |
font = text.GetFont() |
319 |
font.SetPointSize(10) |
font.SetPointSize(10) |
320 |
text.SetFont(font) |
text.SetFont(font) |
321 |
|
|
322 |
# |
# |
323 |
# Perhaps using wxToggleButton would be better, but it's only |
# load the dock/undock/close bitmaps |
324 |
# supported under wxMSW and wxGTK as of v2.4.0.3 |
# and create the buttons |
325 |
# |
# |
326 |
self.__bmpDock = \ |
self.__bmpDock = \ |
327 |
resource.GetBitmapResource(DOCK_BMP, wxBITMAP_TYPE_XPM) |
resource.GetBitmapResource(DOCK_BMP, wxBITMAP_TYPE_XPM) |
328 |
self.__bmpUnDock = \ |
self.__bmpUnDock = \ |
329 |
resource.GetBitmapResource(UNDOCK_BMP, wxBITMAP_TYPE_XPM) |
resource.GetBitmapResource(UNDOCK_BMP, wxBITMAP_TYPE_XPM) |
330 |
|
|
331 |
if self.__bmpDock is not None \ |
if self.__docked: |
332 |
and self.__bmpUnDock is not None: |
bmp = self.__bmpDock |
|
self.__dockButton = wxBitmapButton( |
|
|
self.__dockPanel, ID_BUTTON_DOCK, |
|
|
self.__bmpUnDock, |
|
|
size = wxSize(self.__bmpDock.GetWidth() + 4, |
|
|
self.__bmpDock.GetHeight() + 4), |
|
|
style = wxBU_EXACTFIT | wxADJUST_MINSIZE) |
|
333 |
else: |
else: |
334 |
self.__bmpDock = \ |
bmp = self.__bmpUnDock |
|
self.__bmpUnDock = None |
|
335 |
|
|
336 |
self.__dockButton = wxButton( |
self.__dockButton = wxBitmapButton( |
337 |
self.__dockPanel, ID_BUTTON_DOCK, |
self.__dockPanel, ID_BUTTON_DOCK, |
338 |
"WW", style = wxBU_EXACTFIT | wxADJUST_MINSIZE) |
bmp, |
339 |
|
size = wxSize(bmp.GetWidth() + 4, bmp.GetHeight() + 4), |
340 |
|
style = wxBU_EXACTFIT | wxADJUST_MINSIZE) |
341 |
|
|
342 |
bmp = resource.GetBitmapResource(CLOSE_BMP, wxBITMAP_TYPE_XPM) |
bmp = resource.GetBitmapResource(CLOSE_BMP, wxBITMAP_TYPE_XPM) |
343 |
|
|
347 |
style = wxBU_EXACTFIT | wxADJUST_MINSIZE) |
style = wxBU_EXACTFIT | wxADJUST_MINSIZE) |
348 |
closeX.SetToolTip(wxToolTip(_("Close"))) |
closeX.SetToolTip(wxToolTip(_("Close"))) |
349 |
|
|
350 |
|
# |
351 |
#closeX = wxButton(self.__dockPanel, ID_BUTTON_CLOSE, "X", |
# fill in the sizer in an order appropriate to the orientation |
352 |
#style = wxBU_EXACTFIT | wxADJUST_MINSIZE) |
# |
|
|
|
|
#buttonBox.Add(self.__dockButton, 0, wxALIGN_RIGHT, 0) |
|
|
#buttonBox.Add(closeX, 0, wxALIGN_RIGHT, 0) |
|
|
|
|
353 |
if self.__orientation == wxLAYOUT_VERTICAL: |
if self.__orientation == wxLAYOUT_VERTICAL: |
354 |
headerBox.Add(text, 0, wxALIGN_LEFT | wxALIGN_CENTRE_VERTICAL, 0) |
headerBox.Add(text, 0, wxALIGN_LEFT | wxALIGN_CENTRE_VERTICAL, 0) |
355 |
headerBox.Add(1, 5, 1, wxGROW) |
headerBox.Add(1, 5, 1, wxGROW) |
363 |
sizer.Add(headerBox, 0, wxGROW, 0) |
sizer.Add(headerBox, 0, wxGROW, 0) |
364 |
sizer.Add(self.__panel, 1, wxGROW, 0) |
sizer.Add(self.__panel, 1, wxGROW, 0) |
365 |
|
|
366 |
|
|
367 |
self.__dockPanel.SetAutoLayout(True) |
self.__dockPanel.SetAutoLayout(True) |
368 |
self.__dockPanel.SetSizer(sizer) |
self.__dockPanel.SetSizer(sizer) |
369 |
sizer.SetSizeHints(self.__dockPanel) |
sizer.SetSizeHints(self.__dockPanel) |
370 |
|
sizer.SetSizeHints(self.__floatWindow) |
|
sizer.SetSizeHints(self.__topWindow) |
|
371 |
|
|
372 |
EVT_BUTTON(self.__dockPanel, ID_BUTTON_DOCK, self._OnToggleDock) |
EVT_BUTTON(self.__dockPanel, ID_BUTTON_DOCK, self._OnToggleDock) |
373 |
EVT_BUTTON(self.__dockPanel, ID_BUTTON_CLOSE, self._OnButtonClose) |
EVT_BUTTON(self.__dockPanel, ID_BUTTON_CLOSE, self._OnButtonClose) |