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.

103 lines
2.4 KiB

  1. //========= Copyright � 1996-2005, Valve Corporation, All rights reserved. ============//
  2. //
  3. // Purpose:
  4. //
  5. // $NoKeywords: $
  6. //=============================================================================//
  7. #ifndef TABWINDOW_H
  8. #define TABWINDOW_H
  9. #ifdef _WIN32
  10. #pragma once
  11. #endif
  12. #include <mxtk/mx.h>
  13. #include "utlvector.h"
  14. #include "color.h"
  15. class CChoreoWidgetDrawHelper;
  16. //-----------------------------------------------------------------------------
  17. // Purpose: A custom tab control for handling expression class strings
  18. //-----------------------------------------------------------------------------
  19. class CTabWindow : public mxWindow
  20. {
  21. public:
  22. enum
  23. {
  24. COLOR_BG = 0,
  25. COLOR_FG,
  26. COLOR_FG_SELECTED,
  27. COLOR_HILITE,
  28. COLOR_HILITE_SELECTED,
  29. COLOR_TEXT,
  30. COLOR_TEXT_SELECTED,
  31. NUM_COLORS
  32. };
  33. CTabWindow( mxWindow *parent, int x, int y, int w, int h, int id = 0, int style = 0 );
  34. virtual ~CTabWindow ( void );
  35. virtual void redraw( void );
  36. virtual int handleEvent (mxEvent *event);
  37. // MANIPULATORS
  38. virtual void add (const char *item);
  39. virtual void select (int index);
  40. virtual void remove (int index);
  41. virtual void removeAll ();
  42. virtual void setPrefix( int item, char const *prefix );
  43. // ACCESSORS
  44. virtual int getItemCount () const;
  45. virtual int getSelectedIndex () const;
  46. virtual char const *getLabel( int item );
  47. virtual char const *getPrefix( int item );
  48. virtual void ShowRightClickMenu( int mx, int my ) = 0;
  49. void SetColor( int index, const Color& clr );
  50. void SetInverted( bool invert );
  51. void SetRightJustify( bool rightjustify );
  52. int GetBestHeight( int width );
  53. void SetRowHeight( int rowheight );
  54. protected:
  55. void GetTabRect( const RECT& rcClient, RECT& tabRect, int tabNum );
  56. virtual void DrawTab( CChoreoWidgetDrawHelper& drawHelper, RECT& rcClient, int tabnum, bool selected = false );
  57. int RecomputeLayout( int windowWidth, bool dolayout = true );
  58. class CETItem
  59. {
  60. public:
  61. enum
  62. {
  63. MAX_ET_STRING_LENGTH = 64
  64. };
  65. char m_szString[ MAX_ET_STRING_LENGTH ];
  66. char m_szPrefix[ MAX_ET_STRING_LENGTH ];
  67. RECT rect;
  68. };
  69. int GetItemUnderMouse( int mx, int my );
  70. CUtlVector <CETItem> m_Items;
  71. int m_nRowsRequired;
  72. int m_nSelected;
  73. int m_nTabWidth;
  74. int m_nPixelDelta;
  75. bool m_bInverted;
  76. bool m_bRightJustify;
  77. Color m_Colors[ NUM_COLORS ];
  78. int m_nRowHeight;
  79. };
  80. #endif // TABWINDOW_H