Files
DoomRTX/neo/engine/tools/decl/DialogDeclBrowser.h
T
2026-05-18 14:02:06 -07:00

135 lines
4.6 KiB
C++

/*
===========================================================================
IceTech GPL Source Code
Copyright (C) 2026 Justin Marshall
This file is part of the IceTech GPL Source Code (?IceTech Source Code?).
IceTech Source Code is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
IceTech Source Code is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with IceTech Source Code. If not, see <http://www.gnu.org/licenses/>.
In addition, the IceTech Source Code is also subject to certain additional terms. You should have received a copy of these additional terms immediately following the terms and conditions of the GNU General Public License which accompanied the IceTech Source Code. If not, please request a copy in writing from id Software at the address below.
If you have questions concerning this license or the applicable additional terms, you may contact in writing Justin Marshall, justinmarshall20@gmail.com
===========================================================================
*/
#ifndef __DIALOGDECLBROWSER_H__
#define __DIALOGDECLBROWSER_H__
#pragma once
#include "../comafx/CPathTreeCtrl.h"
#include "DialogDeclEditor.h"
// Legacy class name retained for source compatibility. This is now a dockable
// child window instead of a floating editor.
class DialogDeclBrowser : public CWnd {
DECLARE_DYNAMIC(DialogDeclBrowser)
public:
DialogDeclBrowser();
virtual ~DialogDeclBrowser();
BOOL Create( CWnd *parent, UINT id = 0 );
void ReloadDeclarations( void );
bool CompareDecl( HTREEITEM item, const char *name ) const;
const idDecl * GetSelectedDecl( void ) const;
DialogDeclEditor & GetEditor( void ) { return declEditor; }
void FocusDeclEditor( void );
protected:
afx_msg int OnCreate( LPCREATESTRUCT lpCreateStruct );
afx_msg BOOL OnToolTipNotify( UINT id, NMHDR *pNMHDR, LRESULT *pResult );
afx_msg HBRUSH OnCtlColor( CDC* pDC, CWnd* pWnd, UINT nCtlColor );
afx_msg BOOL OnEraseBkgnd( CDC* pDC );
afx_msg void OnPaint();
afx_msg void OnSetFocus( CWnd *pOldWnd );
afx_msg void OnDestroy();
afx_msg void OnSize( UINT nType, int cx, int cy );
afx_msg void OnTreeSelChanged( NMHDR* pNMHDR, LRESULT* pResult );
afx_msg void OnTreeDblclk( NMHDR *pNMHDR, LRESULT *pResult );
afx_msg void OnBnClickedFind();
afx_msg void OnBnClickedLoad();
afx_msg void OnBnClickedCreate();
afx_msg void OnBnClickedReload();
afx_msg void OnTypeChanged();
DECLARE_MESSAGE_MAP()
private:
CPathTreeCtrl declTree;
CPathTreeCtrl baseDeclTree;
CStatic findNameStatic;
CStatic findTextStatic;
CEdit findNameEdit;
CEdit findTextEdit;
CButton findButton;
CButton loadButton;
CButton reloadButton;
CStatic newTypeStatic;
CStatic newNameStatic;
CStatic newFileStatic;
CComboBox newTypeCombo;
CEdit newNameEdit;
CEdit newFileEdit;
CButton createButton;
CStatic statusText;
DialogDeclEditor declEditor;
static toolTip_t toolTips[];
int numListedDecls;
idStr findNameString;
idStr findTextString;
bool controlsCreated;
bool reloadingTree;
char * m_pchTip;
WCHAR * m_pwchTip;
CFont modernFont;
CBrush bgBrush;
CBrush panelBrush;
CBrush editBrush;
CBrush staticBrush;
private:
void CreateChildControls( void );
void PopulateTypeCombo( void );
void AddDeclTypeToTree( declType_t type, const char *root, CPathTreeCtrl &tree );
void InitBaseDeclTree( void );
void GetDeclName( HTREEITEM item, idStr &typeName, idStr &declName ) const;
const idDecl * GetDeclFromTreeItem( HTREEITEM item ) const;
void LoadSelectedDecl( void );
void SelectDeclInTree( declType_t type, const char *name );
void ApplyDarkTheme( void );
void ApplyModernFontRecursive( CWnd *wnd );
void LayoutBrowser( int cx, int cy );
void SetBrowserStatus( const char *text );
declType_t GetSelectedNewType( void );
void SetCreateDefaultsFromSelection( const idDecl *decl );
void GetDefaultFileForType( declType_t type, idStr &fileName ) const;
};
void DeclBrowserInit( const idDict *spawnArgs );
void DeclBrowserRun( void );
void DeclBrowserShutdown( void );
void DeclBrowserReloadDeclarations( void );
#endif /* !__DIALOGDECLBROWSER_H__ */