Author: bugman Date: Thu Feb 4 19:43:57 2010 New Revision: 10659 URL: http://svn.gna.org/viewcvs/relax?rev=10659&view=rev Log: The cursor type now changes to a hand when hovering above the link in the relax about widget :) This involves binding all mouse actions (wx.EVT_MOUSE_EVENTS) to the cursor_style() method. Modified: branches/bieri_gui/gui_bieri/about.py Modified: branches/bieri_gui/gui_bieri/about.py URL: http://svn.gna.org/viewcvs/relax/branches/bieri_gui/gui_bieri/about.py?rev=10659&r1=10658&r2=10659&view=diff ============================================================================== --- branches/bieri_gui/gui_bieri/about.py (original) +++ branches/bieri_gui/gui_bieri/about.py Thu Feb 4 19:43:57 2010 @@ -67,7 +67,17 @@ self.Bind(wx.EVT_PAINT, self.generate) # Let the dialog be closable with a left button click. + self.Bind(wx.EVT_MOUSE_EVENTS, self.cursor_style) + + # Let the dialog be closable with a left button click. self.Bind(wx.EVT_LEFT_DOWN, self.process_click) + + + def cursor_style(self, event): + """Dummy method for not changing the mouse cursor!""" + + # Terminate the event. + event.Skip() def generate(self, event): @@ -164,6 +174,9 @@ # A global Y offset for packing the elements together (initialise to the boarder position). self.offset(self.boarder, init=True) + + # The starting cursor type. + self.cursor_type = 'normal' # Draw all the elements. self.draw_title() @@ -175,6 +188,42 @@ self.draw_licence() + def cursor_style(self, event): + """Change the mouse cursor when over the link.""" + + # Determine the mouse position. + x = event.GetX() + y = event.GetY() + + # Selection cursor. + if x > self.link_pos_x[0] and x < self.link_pos_x[1] and y > self.link_pos_y[0] and y < self.link_pos_y[1]: + # Only change if needed. + if self.cursor_type == 'normal': + # Build the cursor. + select_cursor = wx.StockCursor(wx.CURSOR_HAND) + + # Set the cursor. + self.SetCursor(select_cursor) + + # Reset the cursor type. + self.cursor_type = 'select' + + # Normal cursor. + elif self.cursor_type == 'select': + # Build the cursor. + select_cursor = wx.StockCursor(wx.CURSOR_ARROW) + + # Set the cursor. + self.SetCursor(select_cursor) + + # Reset the cursor type. + self.cursor_type = 'normal' + + + # Terminate the event. + event.Skip() + + def draw_copyright(self): """Draw the copyright statements."""