/[thuban]/branches/WIP-pyshapelib-bramz/Thuban/UI/dock.py
ViewVC logotype

Diff of /branches/WIP-pyshapelib-bramz/Thuban/UI/dock.py

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 659 by jonathan, Mon Apr 14 14:07:05 2003 UTC revision 666 by jonathan, Mon Apr 14 16:36:33 2003 UTC
# Line 163  class DockableWindow(Publisher): Line 163  class DockableWindow(Publisher):
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.SetToolTip(wxToolTip(_("Undock")))
             self.__dockButton.SetToolTip(wxToolTip(_("Undock")))  
         else:  
             self.__dockButton.SetLabel(_("Undock"))  
169    
170          self.SetDockSize(self.__dockWindow.GetSize())          self.SetDockSize(self.__dockWindow.GetSize())
171    
172          if wasVisible: self.Show(True)          if wasVisible: self.Show(True)
173    
         #self.__parent._UpdateDocks()  
   
174          self.issue(DOCKABLE_DOCKED, self.__id, self)          self.issue(DOCKABLE_DOCKED, self.__id, self)
175    
176      def UnDock(self):      def UnDock(self):
# Line 193  class DockableWindow(Publisher): Line 188  class DockableWindow(Publisher):
188          self.__topWindow = self.__floatWindow          self.__topWindow = self.__floatWindow
189          self.__dockPanel.Reparent(self.__topWindow)          self.__dockPanel.Reparent(self.__topWindow)
190    
191          if self.__bmpDock is not None:          #self.__dockButton.SetBitmapLabel(self.__bmpDock)
192              self.__dockButton.SetBitmapLabel(self.__bmpDock)          #self.__dockButton.SetBitmapFocus(self.__bmpDock)
193              self.__dockButton.SetBitmapFocus(self.__bmpDock)          self.__dockButton.SetToolTip(wxToolTip(_("Dock")))
             self.__dockButton.SetToolTip(wxToolTip(_("Dock")))  
         else:  
             self.__dockButton.SetLabel(_("Dock"))  
194    
195          if wasVisible: self.Show()          if wasVisible: self.Show()
196    
197          #          #
198          # restore window information          # restore window information
199          #          #
200          if self.__floatPosition is not None: self.SetPosition(self.__floatPosition)          if self.__floatPosition is not None:
201          if self.__floatSize     is not None: self.SetSize(self.__floatSize)              self.SetPosition(self.__floatPosition)
202            if self.__floatSize is not None:
203                self.SetSize(self.__floatSize)
204    
205          self.__dockPanel.SetSize(self.__topWindow.GetClientSize())          self.__dockPanel.SetSize(self.__topWindow.GetClientSize())
206    
# Line 214  class DockableWindow(Publisher): Line 208  class DockableWindow(Publisher):
208    
209      def IsDocked(self):      def IsDocked(self):
210          self.__CheckAllGood()          self.__CheckAllGood()
   
211          return self.__docked          return self.__docked
212    
   
213      def Show(self, show = True):      def Show(self, show = True):
214          if show:          if show:
215              self.__DoShow()              self.__DoShow()
# Line 284  class DockableWindow(Publisher): Line 276  class DockableWindow(Publisher):
276    
277          self.__topWindow.Show()          self.__topWindow.Show()
278    
         #if self.IsDocked():  
             #self.SetDockSize()  
   
279          if self.__topWindow is self.__dockWindow:          if self.__topWindow is self.__dockWindow:
280              self.__parent._UpdateDocks()              self.__parent._UpdateDocks()
281                            
282      def __DoHide(self):      def __DoHide(self):
283          if not self.IsShown(): return          if not self.IsShown(): return
284    
285          self.__topWindow.Show(False)          self.__topWindow.Show(False)
286    
287          if self.__topWindow is self.__dockWindow:          if self.__topWindow is self.__dockWindow:
288              self.__parent._UpdateDocks()              self.__parent._UpdateDocks()
289    
   
290      def __CreateBorder(self):      def __CreateBorder(self):
291    
         #self.__panel.Reparent(self) # Make sure we hang on to the panel  
   
292          self.__dockPanel = wxPanel(self.__topWindow, -1, style=wxSUNKEN_BORDER)          self.__dockPanel = wxPanel(self.__topWindow, -1, style=wxSUNKEN_BORDER)
293    
294          self.__panel.Reparent(self.__dockPanel)          self.__panel.Reparent(self.__dockPanel)
# Line 318  class DockableWindow(Publisher): Line 305  class DockableWindow(Publisher):
305          headerBox = wxStaticBoxSizer(          headerBox = wxStaticBoxSizer(
306                          wxStaticBox(self.__dockPanel, -1, ""), headerBoxOrient)                          wxStaticBox(self.__dockPanel, -1, ""), headerBoxOrient)
307    
         #buttonBox = wxBoxSizer(wxHORIZONTAL)  
   
308          #          #
309          # ideally, we should be able to rotate this text depending on          # ideally, we should be able to rotate this text depending on
310          # our orientation          # our orientation
311          #          #
312          text = wxStaticText(self.__dockPanel, -1, self.GetTitle(),          text = wxStaticText(self.__dockPanel, -1, self.GetTitle(),
313                               style = wxALIGN_CENTRE)                               style = wxALIGN_CENTRE)
   
314          font = text.GetFont()          font = text.GetFont()
315          font.SetPointSize(10)          font.SetPointSize(10)
316          text.SetFont(font)          text.SetFont(font)
317    
318          #          #
319          # Perhaps using wxToggleButton would be better, but it's only          # load the dock/undock/close bitmaps
320          # supported under wxMSW and wxGTK as of v2.4.0.3          # and create the buttons
321          #          #
322          self.__bmpDock   = \          self.__bmpDock   = \
323              resource.GetBitmapResource(DOCK_BMP, wxBITMAP_TYPE_XPM)              resource.GetBitmapResource(DOCK_BMP, wxBITMAP_TYPE_XPM)
324          self.__bmpUnDock = \          self.__bmpUnDock = \
325              resource.GetBitmapResource(UNDOCK_BMP, wxBITMAP_TYPE_XPM)              resource.GetBitmapResource(UNDOCK_BMP, wxBITMAP_TYPE_XPM)
326    
327          if self.__bmpDock is not None \          if self.__docked:
328              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)  
329          else:          else:
330              self.__bmpDock = \              bmp = self.__bmpUnDock
             self.__bmpUnDock = None  
331    
332              self.__dockButton = wxButton(          self.__dockButton = wxBitmapButton(
333                  self.__dockPanel, ID_BUTTON_DOCK,              self.__dockPanel, ID_BUTTON_DOCK,
334                  "WW", style = wxBU_EXACTFIT | wxADJUST_MINSIZE)              bmp,
335                size = wxSize(bmp.GetWidth() + 4, bmp.GetHeight() + 4),
336                style = wxBU_EXACTFIT | wxADJUST_MINSIZE)
337    
338          bmp = resource.GetBitmapResource(CLOSE_BMP, wxBITMAP_TYPE_XPM)          bmp = resource.GetBitmapResource(CLOSE_BMP, wxBITMAP_TYPE_XPM)
339    
# Line 364  class DockableWindow(Publisher): Line 343  class DockableWindow(Publisher):
343                            style = wxBU_EXACTFIT | wxADJUST_MINSIZE)                            style = wxBU_EXACTFIT | wxADJUST_MINSIZE)
344          closeX.SetToolTip(wxToolTip(_("Close")))          closeX.SetToolTip(wxToolTip(_("Close")))
345    
346            #
347          #closeX = wxButton(self.__dockPanel, ID_BUTTON_CLOSE, "X",          # fill in the sizer in an order appropriate to the orientation
348                           #style = wxBU_EXACTFIT | wxADJUST_MINSIZE)          #
   
         #buttonBox.Add(self.__dockButton, 0, wxALIGN_RIGHT, 0)  
         #buttonBox.Add(closeX, 0, wxALIGN_RIGHT, 0)  
   
349          if self.__orientation == wxLAYOUT_VERTICAL:          if self.__orientation == wxLAYOUT_VERTICAL:
350              headerBox.Add(text, 0, wxALIGN_LEFT | wxALIGN_CENTRE_VERTICAL, 0)              headerBox.Add(text, 0, wxALIGN_LEFT | wxALIGN_CENTRE_VERTICAL, 0)
351              headerBox.Add(1, 5, 1, wxGROW)              headerBox.Add(1, 5, 1, wxGROW)
# Line 384  class DockableWindow(Publisher): Line 359  class DockableWindow(Publisher):
359          sizer.Add(headerBox, 0, wxGROW, 0)          sizer.Add(headerBox, 0, wxGROW, 0)
360          sizer.Add(self.__panel, 1, wxGROW, 0)          sizer.Add(self.__panel, 1, wxGROW, 0)
361    
362    
363          self.__dockPanel.SetAutoLayout(True)          self.__dockPanel.SetAutoLayout(True)
364          self.__dockPanel.SetSizer(sizer)          self.__dockPanel.SetSizer(sizer)
365          sizer.SetSizeHints(self.__dockPanel)          sizer.SetSizeHints(self.__dockPanel)
366            sizer.SetSizeHints(self.__floatWindow)
         sizer.SetSizeHints(self.__topWindow)  
367    
368          EVT_BUTTON(self.__dockPanel, ID_BUTTON_DOCK, self._OnToggleDock)          EVT_BUTTON(self.__dockPanel, ID_BUTTON_DOCK, self._OnToggleDock)
369          EVT_BUTTON(self.__dockPanel, ID_BUTTON_CLOSE, self._OnButtonClose)          EVT_BUTTON(self.__dockPanel, ID_BUTTON_CLOSE, self._OnButtonClose)

Legend:
Removed from v.659  
changed lines
  Added in v.666

[email protected]
ViewVC Help
Powered by ViewVC 1.1.26