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.

67 lines
1.8 KiB

  1. //====== Copyright � 1996-2005, Valve Corporation, All rights reserved. =======//
  2. //
  3. // Purpose:
  4. //
  5. // $NoKeywords: $
  6. //
  7. //=============================================================================//
  8. #include "dme_controls/AttributeBasePickerPanel.h"
  9. #include "FileSystem.h"
  10. #include "vgui_controls/Button.h"
  11. #include "vgui_controls/FileOpenDialog.h"
  12. #include "dme_controls/AttributeTextEntry.h"
  13. // memdbgon must be the last include file in a .cpp file!!!
  14. #include "tier0/memdbgon.h"
  15. using namespace vgui;
  16. //-----------------------------------------------------------------------------
  17. // Constructor
  18. //-----------------------------------------------------------------------------
  19. CAttributeBasePickerPanel::CAttributeBasePickerPanel( vgui::Panel *parent, const AttributeWidgetInfo_t &info ) :
  20. BaseClass( parent, info )
  21. {
  22. m_pOpen = new vgui::Button( this, "Open", "...", this, "open" );
  23. // m_pOpen->SetImage( vgui::scheme()->GetImage( "tools/ifm/icon_properties_linkarrow" , false), 0 );
  24. // m_pOpen->SetPaintBorderEnabled( false );
  25. // m_pOpen->SetContentAlignment( vgui::Label::a_center );
  26. }
  27. void CAttributeBasePickerPanel::OnCommand( char const *cmd )
  28. {
  29. if ( !Q_stricmp( cmd, "open" ) )
  30. {
  31. ShowPickerDialog();
  32. }
  33. else
  34. {
  35. BaseClass::OnCommand( cmd );
  36. }
  37. }
  38. void CAttributeBasePickerPanel::PerformLayout()
  39. {
  40. BaseClass::PerformLayout();
  41. int viewWidth, viewHeight;
  42. GetSize( viewWidth, viewHeight );
  43. IImage *arrowImage = vgui::scheme()->GetImage( "tools/ifm/icon_properties_linkarrow" , false);
  44. if( arrowImage )
  45. {
  46. m_pOpen->SetImage( arrowImage , 0 );
  47. m_pOpen->SetPaintBorderEnabled( false );
  48. m_pOpen->SetContentAlignment( vgui::Label::a_center );
  49. m_pOpen->SetBounds( (FirstColumnWidth - ColumnBorderWidth - 16) * 0.5 , ( viewHeight - 16 )* 0.5 , 16, 16 );
  50. }
  51. else
  52. {
  53. m_pOpen->SetBounds( 0, 0, 50, 20 );
  54. }
  55. }