Team Fortress 2 Source Code as on 22/4/2020
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

58 lines
1.9 KiB

  1. //========= Copyright Valve Corporation, All rights reserved. ============//
  2. //
  3. // Purpose:
  4. //
  5. // $NoKeywords: $
  6. //=============================================================================//
  7. #ifndef TOOL_ITEMS_H
  8. #define TOOL_ITEMS_H
  9. #ifdef _WIN32
  10. #pragma once
  11. #endif
  12. #include "item_model_panel.h"
  13. //-----------------------------------------------------------------------------
  14. // Purpose:
  15. //-----------------------------------------------------------------------------
  16. class CBaseToolUsageDialog : public vgui::EditablePanel
  17. {
  18. DECLARE_CLASS_SIMPLE( CBaseToolUsageDialog, vgui::EditablePanel );
  19. public:
  20. CBaseToolUsageDialog( vgui::Panel *pParent, const char *panelName, CEconItemView *pTool, CEconItemView *pToolSubject );
  21. virtual void ApplySchemeSettings( vgui::IScheme *scheme );
  22. virtual void PerformLayout();
  23. virtual void OnCommand( const char *command );
  24. virtual void OnKeyCodeTyped( vgui::KeyCode code ) OVERRIDE;
  25. virtual void OnKeyCodePressed( vgui::KeyCode code ) OVERRIDE;
  26. virtual void Apply( void ) { return; }
  27. inline CEconItemView *GetToolItem() { return m_pToolModelPanel->GetItem(); };
  28. inline CEconItemView *GetSubjectItem() { return m_pSubjectModelPanel->GetItem(); };
  29. protected:
  30. CItemModelPanel *m_pToolModelPanel;
  31. CItemModelPanel *m_pSubjectModelPanel;
  32. CItemModelPanel *m_pMouseOverItemPanel;
  33. CItemModelPanelToolTip *m_pMouseOverTooltip;
  34. vgui::Label *m_pTitleLabel;
  35. const char *m_pszInternalPanelName;
  36. };
  37. // Utility function for tool dialogs.
  38. void MakeModalAndBringToFront( vgui::EditablePanel *dialog );
  39. bool ToolCanApplyTo( CEconItemView *pTool, CEconItemView *pToolSubject );
  40. // Given a tool and an item to apply the tool's effects upon,
  41. // gather required information from the user and
  42. // send a change request to the GC.
  43. bool ApplyTool( vgui::Panel *pParent, CEconItemView *pTool, CEconItemView *pToolSubject );
  44. #endif // TOOL_ITEMS_H