Inheritance: System.Windows.Forms.ContainerControl, IMessageFilter
Example #1
0
		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;
		}
Example #2
0
		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;
		}
Example #3
0
		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);
		}