From b257f66f0d026cd5d86efcfe3e76e46434b54606 Mon Sep 17 00:00:00 2001 From: Pollux <39353174+Pollux12@users.noreply.github.com> Date: Fri, 9 Oct 2026 14:44:12 +0100 Subject: [PATCH 1/5] Derive DTextEntry, DCheckBoxLabel, DFileBrowser and DNumPad from their real bases --- custom/class.DCheckBoxLabel.lua | 2 +- custom/class.DFileBrowser.lua | 2 +- custom/class.DNumPad.lua | 2 +- custom/class.DTextEntry.lua | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/custom/class.DCheckBoxLabel.lua b/custom/class.DCheckBoxLabel.lua index 340e5a9c..2dbc77dc 100644 --- a/custom/class.DCheckBoxLabel.lua +++ b/custom/class.DCheckBoxLabel.lua @@ -1,4 +1,4 @@ ----@class DCheckBoxLabel : Panel +---@class DCheckBoxLabel : DPanel ---@field Button DCheckBox ---@field Label DLabel local DCheckBoxLabel = {} diff --git a/custom/class.DFileBrowser.lua b/custom/class.DFileBrowser.lua index 3b83f6ef..7c9f69e6 100644 --- a/custom/class.DFileBrowser.lua +++ b/custom/class.DFileBrowser.lua @@ -1,4 +1,4 @@ ----@class DFileBrowser : Panel +---@class DFileBrowser : DPanel --- The horizontal divider separating the tree and file list. ---@field Divider DHorizontalDivider --- The directory tree panel. diff --git a/custom/class.DNumPad.lua b/custom/class.DNumPad.lua index f0a249a5..e9cad66e 100644 --- a/custom/class.DNumPad.lua +++ b/custom/class.DNumPad.lua @@ -1,4 +1,4 @@ ----@class DNumPad : Panel +---@class DNumPad : DPanel --- Table of DButton panels for each keypad button (0-15). ---@field Buttons table --- The currently selected button panel. diff --git a/custom/class.DTextEntry.lua b/custom/class.DTextEntry.lua index d11b7225..c260ef3d 100644 --- a/custom/class.DTextEntry.lua +++ b/custom/class.DTextEntry.lua @@ -1,4 +1,4 @@ ----@class DTextEntry : Panel +---@class DTextEntry : TextEntry --- Text entry input history table, used for up/down arrow navigation. ---@field History table --- Current position in the history table (0 = none selected). From e67368a63c117e27d82cadc476b64bc1d8bf0cfc Mon Sep 17 00:00:00 2001 From: Pollux <39353174+Pollux12@users.noreply.github.com> Date: Fri, 9 Oct 2026 16:00:10 +0100 Subject: [PATCH 2/5] Let skins add their own named colours to SKIN.Colours --- custom/class.SKIN.lua | 1 + 1 file changed, 1 insertion(+) diff --git a/custom/class.SKIN.lua b/custom/class.SKIN.lua index 7e04507c..621e82a2 100644 --- a/custom/class.SKIN.lua +++ b/custom/class.SKIN.lua @@ -68,6 +68,7 @@ ---@field Properties SKINColoursProperties ---@field Category SKINColoursCategory ---@field TooltipText Color +---@field [string] Color Colours a skin adds by name, read with derma.GetColor or SKIN.Colours. ---@class SKINTexScroller ---@field TrackV fun(x: number, y: number, w: number, h: number, col?: Color) Vertical scrollbar track texture. From 86d8d2f944112351d1c281e9d68b7347b95175ea Mon Sep 17 00:00:00 2001 From: Pollux <39353174+Pollux12@users.noreply.github.com> Date: Fri, 9 Oct 2026 17:17:43 +0100 Subject: [PATCH 3/5] Let ents.Create return NULL for known classes too --- custom/ents.Create.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/custom/ents.Create.lua b/custom/ents.Create.lua index 5c1345aa..5ae677b7 100644 --- a/custom/ents.Create.lua +++ b/custom/ents.Create.lua @@ -31,7 +31,7 @@ ---| "widget_axis_disc" ---| "widget_bone" ---| "widget_bones" ----@overload fun(class: KnownEngineEntityClass): Entity +---@overload fun(class: KnownEngineEntityClass): Entity|NULL ---@generic T : Entity ---@param class `T` The classname of the entity to create. ---@return (instance) T|NULL # The created entity, or `NULL` if failed. From 8cb15c2eb9f7dedbdbfb5f6749615d52f292d49a Mon Sep 17 00:00:00 2001 From: Pollux <39353174+Pollux12@users.noreply.github.com> Date: Fri, 9 Oct 2026 21:57:28 +0100 Subject: [PATCH 4/5] Type ControlPanel:AddControl results by control name --- custom/ControlPanel.AddControl.lua | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/custom/ControlPanel.AddControl.lua b/custom/ControlPanel.AddControl.lua index ef03fbf6..d2e37b62 100644 --- a/custom/ControlPanel.AddControl.lua +++ b/custom/ControlPanel.AddControl.lua @@ -1,10 +1,21 @@ ---Adds a control to the control panel. ---@realm client ---@source https://wiki.facepunch.com/gmod/ControlPanel:AddControl ----@overload fun(self: ControlPanel, type: "color", controlinfo: table): CtrlColor +---@overload fun(self: ControlPanel, type: "textbox"|"TextBox", controlinfo: table): DTextEntry +---@overload fun(self: ControlPanel, type: "label"|"Label", controlinfo: table): DLabel +---@overload fun(self: ControlPanel, type: "checkbox"|"CheckBox"|"toggle"|"Toggle", controlinfo: table): DCheckBoxLabel +---@overload fun(self: ControlPanel, type: "slider"|"Slider", controlinfo: table): DNumSlider +---@overload fun(self: ControlPanel, type: "button"|"Button", controlinfo: table): DButton +---@overload fun(self: ControlPanel, type: "numpad"|"Numpad"|"NumPad", controlinfo: table): CtrlNumPad +---@overload fun(self: ControlPanel, type: "color"|"Color", controlinfo: table): CtrlColor +---@overload fun(self: ControlPanel, type: "propselect"|"PropSelect", controlinfo: table): PropSelect +---@overload fun(self: ControlPanel, type: "matselect"|"MatSelect"|"materialgallery"|"MaterialGallery", controlinfo: table): MatSelect +---@overload fun(self: ControlPanel, type: "ropematerial"|"RopeMaterial", controlinfo: table): RopeMaterial +---@overload fun(self: ControlPanel, type: "header"|"Header", controlinfo: table): DLabel? +---@overload fun(self: ControlPanel, type: "listbox"|"ListBox", controlinfo: table): DListView|CtrlListBox +---@overload fun(self: ControlPanel, type: "combobox"|"ComboBox", controlinfo: table): ControlPresets|DListView|CtrlListBox ---@param type string The control type to add. ---@param controlinfo table Each control takes their own table structure. ---@return Panel control The created control. ---@deprecated It is recommended to use DForm's members instead. function ControlPanel:AddControl(type, controlinfo) end - From 922fdfb3ae813deade9a2defe47e4d269b60c647 Mon Sep 17 00:00:00 2001 From: Pollux <39353174+Pollux12@users.noreply.github.com> Date: Sat, 10 Oct 2026 13:54:33 +0100 Subject: [PATCH 5/5] Declare the panel classes ControlPanel:AddControl returns for rope, numpad and colour controls --- custom/class.CtrlColor.lua | 37 ++++++++++++++++++++++++++++++++++- custom/class.CtrlNumPad.lua | 6 ++++++ custom/class.RopeMaterial.lua | 2 ++ 3 files changed, 44 insertions(+), 1 deletion(-) create mode 100644 custom/class.CtrlNumPad.lua create mode 100644 custom/class.RopeMaterial.lua diff --git a/custom/class.CtrlColor.lua b/custom/class.CtrlColor.lua index f765525b..7eb23ef8 100644 --- a/custom/class.CtrlColor.lua +++ b/custom/class.CtrlColor.lua @@ -1,4 +1,39 @@ ----@class CtrlColor : Panel +---@class CtrlColor : DPanel ---@field Mixer DColorMixer The embedded color mixer panel. local CtrlColor = {} +---Sets the label of the embedded color mixer. +---@param text? string Set to non empty string to show the label and its text. +function CtrlColor:SetLabel(text) end + +---Sets the ConVar the red channel of the embedded color mixer sets. +---@param convar string The ConVar name for the red channel of the color. +function CtrlColor:SetConVarR(convar) end + +---Sets the ConVar the green channel of the embedded color mixer sets. +---@param convar string The ConVar name for the green channel of the color. +function CtrlColor:SetConVarG(convar) end + +---Sets the ConVar the blue channel of the embedded color mixer sets. +---@param convar string The ConVar name for the blue channel of the color. +function CtrlColor:SetConVarB(convar) end + +---Sets the ConVar the alpha channel of the embedded color mixer sets. +---@param convar string The ConVar name for the alpha channel of the color. +function CtrlColor:SetConVarA(convar) end + +---The ConVar the red channel of the embedded color mixer sets. +---@return string # The ConVar name for the red channel of the color. +function CtrlColor:GetConVarR() end + +---The ConVar the green channel of the embedded color mixer sets. +---@return string # The ConVar name for the green channel of the color. +function CtrlColor:GetConVarG() end + +---The ConVar the blue channel of the embedded color mixer sets. +---@return string # The ConVar name for the blue channel of the color. +function CtrlColor:GetConVarB() end + +---The ConVar the alpha channel of the embedded color mixer sets. +---@return string # The ConVar name for the alpha channel of the color. +function CtrlColor:GetConVarA() end diff --git a/custom/class.CtrlNumPad.lua b/custom/class.CtrlNumPad.lua new file mode 100644 index 00000000..28f673eb --- /dev/null +++ b/custom/class.CtrlNumPad.lua @@ -0,0 +1,6 @@ +---@class (partial) CtrlNumPad : DPanel +---@field NumPad1 DBinder The binder for the first ConVar. +---@field NumPad2 DBinder The binder for the second ConVar, shown only when it is set. +---@field Label1 DLabel The label of the first binder. +---@field Label2 DLabel The label of the second binder. +local CtrlNumPad = {} diff --git a/custom/class.RopeMaterial.lua b/custom/class.RopeMaterial.lua new file mode 100644 index 00000000..eb5bffe1 --- /dev/null +++ b/custom/class.RopeMaterial.lua @@ -0,0 +1,2 @@ +---@class (partial) RopeMaterial : MatSelect +local RopeMaterial = {}