parameters: (self, pos)
return_statement: return pos
docstring: Adjusts position so the menu will be fully visible on screen.
  
          :param `pos`: an instance of :class:`Point` specifying the menu position.
docstring_summary: Adjusts position so the menu will be fully visible on screen.
docstring_tokens: Adjusts position so the menu will be fully visible on screen .
function: def AdjustPosition(self, pos):
          """
          Adjusts position so the menu will be fully visible on screen.
  
          :param `pos`: an instance of :class:`Point` specifying the menu position.
          """
  
          # Check that the menu can fully appear in the screen
          scrWidth  = wx.SystemSettings_GetMetric(wx.SYS_SCREEN_X)
          scrHeight = wx.SystemSettings_GetMetric(wx.SYS_SCREEN_Y)
          
          scrollBarButtons = self.GetRenderer().scrollBarButtons
          scrollBarMenuItems = not scrollBarButtons
  
          size = self.GetSize()
          if scrollBarMenuItems:
              size.y += self.GetItemHeight()*2
  
          # always assume that we have scrollbuttons on
          self._showScrollButtons = False
          pos.y += self._popupPtOffset
          
          if size.y + pos.y > scrHeight:
              # the menu will be truncated
              if self._parentMenu is None:
                  # try to flip the menu
                  flippedPosy = pos.y - size.y
                  flippedPosy -= self._popupPtOffset
  
                  if flippedPosy >= 0 and flippedPosy + size.y < scrHeight:
                      pos.y = flippedPosy
                      return pos
                  else: 
                      # We need to popup scrollbuttons!
                      self._showScrollButtons = True
                  
              else: 
                  # we are a submenu
                  # try to decrease the y value of the menu position
                  newy = pos.y
                  newy -= (size.y + pos.y) - scrHeight
                  
                  if newy + size.y > scrHeight:
                      # probably the menu size is too high to fit
                      # the screen, we need scrollbuttons
                      self._showScrollButtons = True
                  else:
                      pos.y = newy
  
          menuMaxX = pos.x + size.x
  
          if menuMaxX > scrWidth and pos.x < scrWidth:
  
              if self._parentMenu:
              
                  # We are submenu
                  self._shiftePos = (size.x + self._parentMenu.GetSize().x)
                  pos.x -= self._shiftePos
                  pos.x += 10
                              
              else:
  
                  self._shiftePos  = ((size.x + pos.x) - scrWidth)            
                  pos.x -= self._shiftePos
  
          else:
  
              if self._parentMenu:
                  pos.x += 5
                  
          return pos
function_tokens: def AdjustPosition ( self , pos ) : # Check that the menu can fully appear in the screen scrWidth = wx . SystemSettings_GetMetric ( wx . SYS_SCREEN_X ) scrHeight = wx . SystemSettings_GetMetric ( wx . SYS_SCREEN_Y ) scrollBarButtons = self . GetRenderer ( ) . scrollBarButtons scrollBarMenuItems = not scrollBarButtons size = self . GetSize ( ) if scrollBarMenuItems : size . y += self . GetItemHeight ( ) * 2 # always assume that we have scrollbuttons on self . _showScrollButtons = False pos . y += self . _popupPtOffset if size . y + pos . y > scrHeight : # the menu will be truncated if self . _parentMenu is None : # try to flip the menu flippedPosy = pos . y - size . y flippedPosy -= self . _popupPtOffset if flippedPosy >= 0 and flippedPosy + size . y < scrHeight : pos . y = flippedPosy return pos else : # We need to popup scrollbuttons! self . _showScrollButtons = True else : # we are a submenu # try to decrease the y value of the menu position newy = pos . y newy -= ( size . y + pos . y ) - scrHeight if newy + size . y > scrHeight : # probably the menu size is too high to fit # the screen, we need scrollbuttons self . _showScrollButtons = True else : pos . y = newy menuMaxX = pos . x + size . x if menuMaxX > scrWidth and pos . x < scrWidth : if self . _parentMenu : # We are submenu self . _shiftePos = ( size . x + self . _parentMenu . GetSize ( ) . x ) pos . x -= self . _shiftePos pos . x += 10 else : self . _shiftePos = ( ( size . x + pos . x ) - scrWidth ) pos . x -= self . _shiftePos else : if self . _parentMenu : pos . x += 5 return pos