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.

86 lines
2.8 KiB

  1. //========= Copyright 1996-2005, Valve Corporation, All rights reserved. ============//
  2. //
  3. // Purpose:
  4. //
  5. // $NoKeywords: $
  6. //=============================================================================//
  7. #ifndef VGUI_BITMAPIMAGE_H
  8. #define VGUI_BITMAPIMAGE_H
  9. #ifdef _WIN32
  10. #pragma once
  11. #endif
  12. #include <vgui_controls/Image.h>
  13. namespace vgui
  14. {
  15. class Panel;
  16. }
  17. class KeyValues;
  18. //-----------------------------------------------------------------------------
  19. // Purpose: Bitmap image
  20. //-----------------------------------------------------------------------------
  21. class BitmapImage : public vgui::Image
  22. {
  23. public:
  24. BitmapImage();
  25. BitmapImage( vgui::VPANEL pPanelSize, const char *pFileName );
  26. virtual ~BitmapImage( void );
  27. bool Init( vgui::VPANEL pParent, const char *pFileName );
  28. bool Init( vgui::VPANEL pParent, KeyValues* pInitData );
  29. /* FIXME: Bleah!!! Don't want two different KeyValues
  30. bool Init( vgui::VPANEL pParent, KeyValues* pInitData ); */
  31. void DoPaint( vgui::VPANEL panel, float yaw = 0, float flAlphaModulate = 1.0f );
  32. void DoPaint( int x, int y, int w, int h, float yaw = 0, float flAlphaModulate = 1.0f );
  33. void Paint( );
  34. void SetColor( const Color& clr );
  35. Color GetColor( );
  36. void GetColor( int& r,int& g,int& b,int& a );
  37. void GetSize( int& wide, int& tall );
  38. void SetPos( int x, int y );
  39. void SetRenderSize( int x, int y );
  40. void SetImageFile( const char *newImage );
  41. // Pass NULL in to use the size set in SetSize
  42. // otherwise it'll use the size of the panel
  43. void UsePanelRenderSize( vgui::VPANEL pPanel );
  44. vgui::VPANEL GetRenderSizePanel( void );
  45. void SetViewport( bool use, float left, float top, float right, float bottom );
  46. private:
  47. int m_nTextureId;
  48. Color m_clr;
  49. int m_pos[2];
  50. int m_Size[2];
  51. vgui::VPANEL m_pPanelSize;
  52. bool m_bUseViewport;
  53. float m_rgViewport[ 4 ];
  54. };
  55. //-----------------------------------------------------------------------------
  56. // Helper method to initialize a bitmap image from KeyValues data..
  57. // KeyValues contains the bitmap data. pSectionName, if it exists,
  58. // indicates which subsection of pInitData should be looked at to get at the
  59. // image data. The parent argument specifies which panel to use as parent,
  60. // and the final argument is the bitmap image to initialize.
  61. // The function returns true if it succeeded.
  62. //
  63. // NOTE: This function looks for the key values 'material' and 'color'
  64. // and uses them to set up the material + modulation color of the image
  65. //-----------------------------------------------------------------------------
  66. bool InitializeImage( KeyValues *pInitData, const char* pSectionName, vgui::Panel *pParent, BitmapImage* pBitmapImage );
  67. /* FIXME: How sad. We need to make KeyValues + vgui::KeyValues be the same. Bleah
  68. bool InitializeImage( KeyValues *pInitData, const char* pSectionName, vgui::Panel *pParent, BitmapImage* pBitmapImage ); */
  69. #endif // VGUI_BITMAPIMAGE_H