Permalink
Browse files

Added derma_controls_menu

To separate menu and clientside derma_controls
  • Loading branch information...
1 parent 8fe611c commit f5e3feb042aa8916cfe12b8cc86ecd7bde7a71d9 @robotboy655 robotboy655 committed Apr 27, 2016
Showing with 17 additions and 24 deletions.
  1. +17 −24 garrysmod/lua/derma/derma_example.lua
@@ -1,11 +1,3 @@
---[[ _
- ( )
- _| | __ _ __ ___ ___ _ _
- /'_` | /'__`\( '__)/' _ ` _ `\ /'_` )
-( (_| |( ___/| | | ( ) ( ) |( (_| |
-`\__,_)`\____)(_) (_) (_) (_)`\__,_)
-
---]]
local PANEL = {}
@@ -14,23 +6,23 @@ function PANEL:Init()
self:SetTitle( "Derma Initiative Control Test" )
self.ContentPanel = vgui.Create( "DPropertySheet", self )
self.ContentPanel:Dock( FILL )
-
+
self:InvalidateLayout( true )
local w, h = self:GetSize()
-
+
local Controls = table.Copy( derma.GetControlList() )
-
+
for key, ctrl in SortedPairs( Controls ) do
-
+
local Ctrls = _G[ key ]
if ( Ctrls && Ctrls.GenerateExample ) then
-
+
Ctrls:GenerateExample( key, self.ContentPanel, w, h )
-
+
end
-
+
end
-
+
self:SetSize( 600, 450 )
end
@@ -41,25 +33,26 @@ end
local vguiExampleWindow = vgui.RegisterTable( PANEL, "DFrame" )
-
-
-
-
--
-- This is all to open the actual window via concommand
--
local DermaExample = nil
-concommand.Add( "derma_controls", function( player, command, arguments, args )
+local DermaControlsSuffix = ""
- if ( IsValid( DermaExample ) ) then
+if ( MENU_DLL ) then -- Not all controls are available in menu state
+ DermaControlsSuffix = "_menu"
+end
+
+concommand.Add( "derma_controls" .. DermaControlsSuffix, function( player, command, arguments, args )
+
+ if ( IsValid( DermaExample ) ) then
DermaExample:Remove()
return end
-
+
DermaExample = vgui.CreateFromTable( vguiExampleWindow )
DermaExample:SwitchTo( args )
DermaExample:MakePopup()
DermaExample:Center()
end, nil, "", { FCVAR_DONTRECORD } )
-

1 comment on commit f5e3feb

@meepdarknessmeep
Contributor

👍

Please sign in to comment.