summaryrefslogtreecommitdiff
path: root/utils/vkeyedit/Vkeylistview.cpp
diff options
context:
space:
mode:
authorFluorescentCIAAfricanAmerican <[email protected]>2020-04-22 12:56:21 -0400
committerFluorescentCIAAfricanAmerican <[email protected]>2020-04-22 12:56:21 -0400
commit3bf9df6b2785fa6d951086978a3e66f49427166a (patch)
tree2c0f1f0c63c4832882bc93814ebd2c2b1c6224e5 /utils/vkeyedit/Vkeylistview.cpp
downloadarchived-source-engine-2018-hl2-src-3bf9df6b2785fa6d951086978a3e66f49427166a.tar.xz
archived-source-engine-2018-hl2-src-3bf9df6b2785fa6d951086978a3e66f49427166a.zip
Diffstat (limited to 'utils/vkeyedit/Vkeylistview.cpp')
-rw-r--r--utils/vkeyedit/Vkeylistview.cpp142
1 files changed, 142 insertions, 0 deletions
diff --git a/utils/vkeyedit/Vkeylistview.cpp b/utils/vkeyedit/Vkeylistview.cpp
new file mode 100644
index 0000000..037f93a
--- /dev/null
+++ b/utils/vkeyedit/Vkeylistview.cpp
@@ -0,0 +1,142 @@
+//========= Copyright Valve Corporation, All rights reserved. ============//
+//
+// Purpose:
+//
+// $NoKeywords: $
+//
+//=============================================================================//
+// Vkeylistview.cpp : implementation file
+//
+
+#include "stdafx.h"
+#include "vkeyedit.h"
+#include "Vkeylistview.h"
+
+#include <KeyValues.h>
+
+#ifdef _DEBUG
+#define new DEBUG_NEW
+#undef THIS_FILE
+static char THIS_FILE[] = __FILE__;
+#endif
+
+/////////////////////////////////////////////////////////////////////////////
+// CVkeylistview
+
+IMPLEMENT_DYNCREATE(CVkeylistview, CListView)
+
+CVkeylistview::CVkeylistview()
+{
+}
+
+CVkeylistview::~CVkeylistview()
+{
+}
+
+
+BEGIN_MESSAGE_MAP(CVkeylistview, CListView)
+ //{{AFX_MSG_MAP(CVkeylistview)
+ // NOTE - the ClassWizard will add and remove mapping macros here.
+ //}}AFX_MSG_MAP
+END_MESSAGE_MAP()
+
+/////////////////////////////////////////////////////////////////////////////
+// CVkeylistview drawing
+
+void CVkeylistview::OnDraw(CDC* pDC)
+{
+ CDocument* pDoc = GetDocument();
+ // TODO: add draw code here
+}
+
+/////////////////////////////////////////////////////////////////////////////
+// CVkeylistview diagnostics
+
+#ifdef _DEBUG
+void CVkeylistview::AssertValid() const
+{
+ CListView::AssertValid();
+}
+
+void CVkeylistview::Dump(CDumpContext& dc) const
+{
+ CListView::Dump(dc);
+}
+#endif //_DEBUG
+
+/////////////////////////////////////////////////////////////////////////////
+// CVkeylistview message handlers
+
+void CVkeylistview::OnInitialUpdate()
+{
+ CListView::OnInitialUpdate();
+
+ CListCtrl &theList = GetListCtrl();
+
+ theList.DeleteColumn( 0 );
+ theList.DeleteColumn( 0 );
+
+ theList.InsertColumn( 0, _T("Name"), LVCFMT_LEFT, 200 );
+ theList.InsertColumn( 1, _T("Value"), LVCFMT_LEFT, 800 );
+
+ theList.SetExtendedStyle( LVS_EX_FULLROWSELECT|LVS_EX_GRIDLINES );
+}
+
+void CVkeylistview::CalcWindowRect(LPRECT lpClientRect, UINT nAdjustType)
+{
+ // TODO: Add your specialized code here and/or call the base class
+
+ CListView::CalcWindowRect(lpClientRect, nAdjustType);
+}
+
+BOOL CVkeylistview::PreCreateWindow(CREATESTRUCT& cs)
+{
+ // TODO: Add your specialized code here and/or call the base class
+
+ return CListView::PreCreateWindow(cs);
+}
+
+BOOL CVkeylistview::Create(LPCTSTR lpszClassName, LPCTSTR lpszWindowName, DWORD dwStyle, const RECT& rect, CWnd* pParentWnd, UINT nID, CCreateContext* pContext)
+{
+ // TODO: Add your specialized code here and/or call the base class
+
+ dwStyle |= LVS_REPORT|LVS_SINGLESEL|LVS_EDITLABELS|LVS_AUTOARRANGE;
+
+ return CWnd::Create(lpszClassName, lpszWindowName, dwStyle, rect, pParentWnd, nID, pContext);
+}
+
+void CVkeylistview::OnUpdate(CView* pSender, LPARAM lHint, CObject* pHint)
+{
+ KeyValues *kv = (KeyValues *)pHint;
+
+ if ( !kv || lHint != 2 )
+ return;
+
+ CListCtrl &theList = GetListCtrl();
+
+ theList.DeleteAllItems();
+
+ KeyValues *subkey = kv->GetFirstValue();
+
+ LVITEM lvi;
+
+ int i = 0;
+
+ while ( subkey )
+ {
+ lvi.mask = LVIF_TEXT;
+ lvi.iItem = i;
+
+ lvi.iSubItem = 0;
+ lvi.pszText = (char*)subkey->GetName();
+ theList.InsertItem(&lvi);
+
+ lvi.iSubItem =1;
+ lvi.pszText = (char*)subkey->GetString();
+ theList.SetItem(&lvi);
+
+ i++;
+
+ subkey = subkey->GetNextValue();
+ }
+}