예제 #1
0
파일: PopupMenu.cs 프로젝트: ewosp/sycorax
    internal MenuCommand TrackPopup(Point screenPos, Point aboveScreenPos, 
      Direction direction,
      MenuCommandCollection menuCollection, 
      int borderGap, 
      bool selectFirst, 
      MenuControl parentControl,
      ref int returnDir)
    {
      // Remember which direction the MenuControl is drawing in
      direction = direction;

      // Remember the MenuControl that initiated us
      parentControl = parentControl;

      // Remember the gap in drawing the top border
      borderGap = borderGap;

      // Remember any currect menu item collection
      MenuCommandCollection oldCollection =  menuCommands;

      // Use the passed in collection of menu commands
      menuCommands = menuCollection;

      // Remember screen positions
      screenPos = screenPos;
      aboveScreenPos = aboveScreenPos;
      leftScreenPos = screenPos;

      MenuCommand ret = InternalTrackPopup(selectFirst);

      // Restore to original collection
      menuCommands = oldCollection;

      // Remove reference no longer required
      parentControl = null;

      // Return the direction key that caused dismissal
      returnDir =  returnDir;

      return ret;
    }
예제 #2
0
파일: PopupMenu.cs 프로젝트: ewosp/sycorax
    protected MenuCommand InternalTrackPopup(Point screenPosTR, Point screenPosTL, 
      MenuCommandCollection menuCollection, 
      PopupMenu parentMenu, bool selectFirst, 
      MenuControl parentControl, bool popupRight,
      bool popupDown, ref int returnDir)
    {
      // Default the drawing direction
      direction = Direction.Horizontal;

      // Remember the MenuControl that initiated us
      parentControl = parentControl;

      // We have a parent popup menu that should be consulted about operation
      parentMenu = parentMenu;

      // Remember any currect menu item collection
      MenuCommandCollection oldCollection =  menuCommands;

      // Use the passed in collection of menu commands
      menuCommands = menuCollection;

      // Remember screen positions
      screenPos = screenPosTR;
      aboveScreenPos = screenPosTR;
      leftScreenPos = screenPosTL;

      // Remember display directions
      popupRight = popupRight;
      popupDown = popupDown;

      MenuCommand ret = InternalTrackPopup(selectFirst);

      // Restore to original collection
      menuCommands = oldCollection;

      // Remove references no longer required
      parentControl = null;
      parentMenu = null;

      // Return the direction key that caused dismissal
      returnDir =  returnDir;

      return ret;
    }
예제 #3
0
파일: PopupMenu.cs 프로젝트: ewosp/sycorax
    public PopupMenu()
    {
      // Create collection objects
      drawCommands = new ArrayList();
      menuCommands = new MenuCommandCollection(); 

      // Default the properties
      returnDir = 0;
      extraSize = 0;
      popupItem = -1;
      trackItem = -1;
      childMenu = null;
      exitLoop = false;
      popupDown = true;
      mouseOver = false;
      grabFocus = false;
      excludeTop = true;
      popupRight = true;
      parentMenu = null;
      excludeOffset = 0;
      focusCatcher = null;
      parentControl = null;
      returnCommand = null;
      oldFocus = IntPtr.Zero;
      showInfrequent = false;
      style = VisualStyle.IDE;
      lastMousePos = new Point(-1,-1);
      direction = Direction.Horizontal;
      textFont = SystemInformation.MenuFont;

      // Create and initialise the timer object (but do not start it running!)
      timer = new Timer();
      timer.Interval = selectionDelay;
      timer.Tick += new EventHandler(OnTimerExpire);
    }