Counter Strike : Global Offensive Source Code
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.

95 lines
2.4 KiB

  1. //========= Copyright � 1996-2005, Valve Corporation, All rights reserved. ============//
  2. //
  3. // Purpose:
  4. //
  5. // $NoKeywords: $
  6. //=============================================================================//
  7. #ifndef IMAGEPANEL_H
  8. #define IMAGEPANEL_H
  9. #ifdef _WIN32
  10. #pragma once
  11. #endif
  12. #include <vgui/vgui.h>
  13. #include <vgui_controls/Panel.h>
  14. namespace vgui
  15. {
  16. class IImage;
  17. //-----------------------------------------------------------------------------
  18. // Purpose: Panel that holds a single image
  19. //-----------------------------------------------------------------------------
  20. class ImagePanel : public Panel
  21. {
  22. DECLARE_CLASS_SIMPLE( ImagePanel, Panel );
  23. public:
  24. ImagePanel(Panel *parent, const char *name);
  25. ~ImagePanel();
  26. virtual void SetImage(IImage *image);
  27. virtual void SetImage(const char *imageName);
  28. virtual IImage *GetImage();
  29. char *GetImageName();
  30. // sets whether or not the image should scale to fit the size of the ImagePanel (defaults to false)
  31. void SetShouldScaleImage( bool state );
  32. bool GetShouldScaleImage();
  33. void SetScaleAmount( float scale );
  34. float GetScaleAmount( void );
  35. // set the color to fill with, if no image is specified
  36. void SetFillColor( Color col );
  37. Color GetFillColor();
  38. virtual Color GetDrawColor( void );
  39. virtual void SetDrawColor( Color color );
  40. virtual void ApplySettings(KeyValues *inResourceData);
  41. // unhooks and evicts image if possible, caller must re-establish
  42. bool EvictImage();
  43. int GetNumFrames();
  44. void SetFrame( int nFrame );
  45. int GetFrame() const;
  46. void SetRotation( int iRotation ) { m_iRotation = iRotation; }
  47. protected:
  48. virtual void PaintBackground();
  49. virtual void GetSettings(KeyValues *outResourceData);
  50. virtual const char *GetDescription();
  51. virtual void OnSizeChanged(int newWide, int newTall);
  52. virtual void ApplySchemeSettings( IScheme *pScheme );
  53. private:
  54. IImage *m_pImage;
  55. char *m_pszImageName;
  56. char *m_pszFillColorName;
  57. char *m_pszDrawColorName;
  58. bool m_bScaleImage;
  59. bool m_bTileImage;
  60. bool m_bTileHorizontally;
  61. bool m_bTileVertically;
  62. float m_fScaleAmount;
  63. Color m_FillColor;
  64. Color m_DrawColor;
  65. int m_iRotation;
  66. bool m_bFrameImage;
  67. int m_iFrame;
  68. // To do correct tiling, we need floating point proportional tile sizes
  69. int m_iTileHorizontalOverride;
  70. int m_iTileVerticalOverride;
  71. float m_flTileHorizontalOverride;
  72. float m_flTileVerticalOverride;
  73. };
  74. } // namespace vgui
  75. #endif // IMAGEPANEL_H