Garry's Mod Wiki

DMenuOption

Description

This is used internally - although you're able to use it you probably shouldn't.

Internal subpanel that represents an option used by DMenu.

View source

Parent

Derives methods, etc not listed on this page from DButton.

Implements

Implements or overrides the following hooks/methods. If you want to override these, you probably want to call the original function too.

Methods

Panel DMenuOption:AddSubMenu( string Name, function func = nil )
Creates a sub DMenu and returns it. Has no duplicate call protection.
boolean DMenuOption:GetChecked()
Returns the checked state of DMenuOption.
boolean DMenuOption:GetIsCheckable()
Returns whether the DMenuOption is a checkbox option or a normal button option.
Panel DMenuOption:GetMenu()
Returns which DMenu this option belongs.
boolean DMenuOption:GetRadio()
Returns whether this DMenuOption should act like a radio button, set by DMenuOption:SetRadio.
DMenuOption:OnChecked( boolean checked )
Called whenever the DMenuOption's checked state changes.
DMenuOption:SetChecked( boolean checked )
Sets the checked state of the DMenuOption. Does not invoke DMenuOption:OnChecked. This will be fixed in the next update.
DMenuOption:SetIsCheckable( boolean checkable )
Sets whether the DMenuOption is a checkbox option or a normal button option. Enables automatic DMenuOption:GetChecked toggling with left/right clicks.
DMenuOption:SetMenu( Panel pnl )
This is used internally - although you're able to use it you probably shouldn't. Used to set the DMenu for this option.
DMenuOption:SetRadio( boolean checked )
Sets whether this DMenuOption should act like a radio button. Checking a radio button automatically unchecks all adjacent radio buttons.
DMenuOption:SetSubMenu( Panel menu )
This is used internally - although you're able to use it you probably shouldn't. Used internally by DMenuOption:AddSubMenu to create the submenu arrow and assign the created submenu to be opened when this option is hovered.
DMenuOption:ToggleCheck()
Toggles the checked state of DMenuOption. Does not respect DMenuOption:GetIsCheckable.