SidebarLibrary.Menus.MenuControl.ProcessMoveLeft C# (CSharp) Method

ProcessMoveLeft() protected method

protected ProcessMoveLeft ( bool select ) : void
select bool
return void
		protected void ProcessMoveLeft(bool select)
		{
			if (_popupMenu == null)
			{
				int newItem = _trackItem;
				int startItem = newItem;

				for(int i=0; i<_drawCommands.Count; i++)
				{
					// Move to previous item
					newItem--;

					// Have we looped all the way around all choices
					if (newItem == startItem)
						return;

					// Check limits
					if (newItem < 0)
						newItem = _drawCommands.Count - 1;

					DrawCommand dc = _drawCommands[newItem] as DrawCommand;

					// Can we select this item?
					if (!dc.Separator && (dc.Chevron || dc.MenuCommand.Enabled))
					{
						// If a change has occured
						if (newItem != _trackItem)
						{
							// Modify the display of the two items
							_trackItem = SwitchTrackingItem(_trackItem, newItem);

							if (_selected)
							{
								if (dc.Chevron || (dc.MenuCommand.MenuCommands.Count > 0))
									WindowsAPI.PostMessage(this.Handle, WM_OPERATEMENU, 0, 1);
							}

							break;
						}
					}
				}
			}
		}