DMenu
Description
A simple menu with sub menu, icon and convar support.
Parent
Derives methods, etc not listed on this page from DScrollPanel.
Methods
Panel DMenu:AddCVar( string strText, string convar, string on, string off, function funcFunction = nil )
Creates a DMenuOptionCVar and adds it as an option into the menu. Checking and unchecking the option will alter the given console variable's value.
Adds a panel to the DMenu as if it were an option.
This invokes DScrollPanel:AddItem and will not create a new panel if a class name is passed, unlike Panel:Add.
DMenu:AddSpacer()
Adds a horizontal line spacer.
Add a sub menu to the DMenu
number DMenu:ChildCount()
Returns the number of child elements of DMenu's DScrollPanel:GetCanvas.
DMenu:ClearHighlights()
We advise against using this. It may be changed or removed in a future update.
Clears all highlights made by DMenu:HighlightItem.
Doesn't appear to be used or do anything.
DMenu:CloseSubMenu( Panel menu )
This is used internally - although you're able to use it you probably shouldn't.
Used internally by DMenu:OpenSubMenu.
boolean DMenu:GetDeleteSelf()
We advise against using this. It may be changed or removed in a future update.
Set by DMenu:SetDeleteSelf
boolean DMenu:GetDrawBorder()
We advise against using this. It may be changed or removed in a future update.
Returns the value set by DMenu:SetDrawBorder.
boolean DMenu:GetDrawColumn()
Returns whether the DMenu should draw the icon column with a different color or not.
See DMenu:SetDrawColumn
number DMenu:GetMaxHeight()
Returns the maximum height of the DMenu.
number DMenu:GetMinimumWidth()
Returns the minimum width of the DMenu in pixels
Panel DMenu:GetOpenSubMenu()
This is used internally - although you're able to use it you probably shouldn't.
Returns the currently opened submenu.
Used internally to store the open submenu by DMenu:Hide, DMenu:OpenSubMenu.
DMenu:Hide()
Used to safely hide (not remove) the menu. This will also hide any opened submenues recursively.
DMenu:HighlightItem( Panel item )
We advise against using this. It may be changed or removed in a future update.
Highlights selected item in the DMenu by setting the item's key "Highlight" to true.
Doesn't appear to be working or used.
DMenu:Open( number x = gui.MouseX(), number y = gui.MouseY(), any skipanimation = nil, Panel ownerpanel = nil )
Opens the DMenu at the current mouse position
Closes any active sub menus, and opens a new one.
Called when a option has been selected
DMenu:OptionSelectedInternal( Panel option )
This is used internally - although you're able to use it you probably shouldn't.
Called by DMenuOption. Calls DMenu:OptionSelected.
DMenu:SetDeleteSelf( boolean newState )
Set to true by default. IF set to true, the menu will be deleted when it is closed, not simply hidden.
This is used by DMenuBar
DMenu:SetDrawBorder( boolean bool )
We advise against using this. It may be changed or removed in a future update.
Does nothing.
DMenu:SetDrawColumn( boolean draw )
Sets whether the DMenu should draw the icon column with a different color.
DMenu:SetMaxHeight( number maxHeight )
Sets the maximum height the DMenu can have. If the height of all menu items exceed this value, a scroll bar will be automatically added.
DMenu:SetMinimumWidth( number minWidth )
Sets the minimum width of the DMenu. The menu will be stretched to match the given value.
DMenu:SetOpenSubMenu( Panel item )
This is used internally - although you're able to use it you probably shouldn't.
Used internally to store the open submenu by DMenu:Hide, DMenu:OpenSubMenu, DMenu:CloseSubMenu
Example
Creates a DMenu with a submenu.