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.

75 lines
2.0 KiB

  1. //========= Copyright Valve Corporation, All rights reserved. ============//
  2. //
  3. // Purpose:
  4. //
  5. // $NoKeywords: $
  6. //=============================================================================//
  7. #include "DemoPage.h"
  8. #include "vgui/IVGui.h"
  9. #include "vgui_controls/Controls.h"
  10. #include <vgui/IScheme.h>
  11. #include <vgui_controls/ImagePanel.h>
  12. #include <vgui/IImage.h>
  13. using namespace vgui;
  14. //-----------------------------------------------------------------------------
  15. // An ImagePanel is a panel class that handles drawing of Images and gives
  16. // them all kinds of panel features.
  17. //-----------------------------------------------------------------------------
  18. class ImagePanelDemo: public DemoPage
  19. {
  20. typedef DemoPage BaseClass;
  21. public:
  22. ImagePanelDemo(Panel *parent, const char *name);
  23. ~ImagePanelDemo();
  24. virtual void ApplySchemeSettings(IScheme *pScheme);
  25. private:
  26. IImage *m_pImage;
  27. ImagePanel *m_pImagePanel;
  28. };
  29. //-----------------------------------------------------------------------------
  30. // Purpose: Constructor
  31. //-----------------------------------------------------------------------------
  32. ImagePanelDemo::ImagePanelDemo(Panel *parent, const char *name) : DemoPage(parent, name)
  33. {
  34. // Create an Image Panel
  35. m_pImagePanel = new ImagePanel(this, "AnImagePanel");
  36. // Set the position
  37. m_pImagePanel->SetPos(100, 100);
  38. }
  39. //-----------------------------------------------------------------------------
  40. // Purpose: Destructor
  41. //-----------------------------------------------------------------------------
  42. ImagePanelDemo::~ImagePanelDemo()
  43. {
  44. }
  45. //-----------------------------------------------------------------------------
  46. // Scheme settings
  47. //-----------------------------------------------------------------------------
  48. void ImagePanelDemo::ApplySchemeSettings(IScheme *pScheme)
  49. {
  50. BaseClass::ApplySchemeSettings( pScheme );
  51. // get an image
  52. m_pImage = scheme()->GetImage("Resource/valve_logo", false );
  53. // now insert an image
  54. m_pImagePanel->SetImage(m_pImage);
  55. }
  56. Panel* ImagePanelDemo_Create(Panel *parent)
  57. {
  58. return new ImagePanelDemo(parent, "ImagePanelDemo");
  59. }