SliderWindow.h 3.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394
  1. /*
  2. ===========================================================================
  3. Doom 3 GPL Source Code
  4. Copyright (C) 1999-2011 id Software LLC, a ZeniMax Media company.
  5. This file is part of the Doom 3 GPL Source Code (?Doom 3 Source Code?).
  6. Doom 3 Source Code is free software: you can redistribute it and/or modify
  7. it under the terms of the GNU General Public License as published by
  8. the Free Software Foundation, either version 3 of the License, or
  9. (at your option) any later version.
  10. Doom 3 Source Code is distributed in the hope that it will be useful,
  11. but WITHOUT ANY WARRANTY; without even the implied warranty of
  12. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  13. GNU General Public License for more details.
  14. You should have received a copy of the GNU General Public License
  15. along with Doom 3 Source Code. If not, see <http://www.gnu.org/licenses/>.
  16. In addition, the Doom 3 Source Code is also subject to certain additional terms. You should have received a copy of these additional terms immediately following the terms and conditions of the GNU General Public License which accompanied the Doom 3 Source Code. If not, please request a copy in writing from id Software at the address below.
  17. If you have questions concerning this license or the applicable additional terms, you may contact in writing id Software LLC, c/o ZeniMax Media Inc., Suite 120, Rockville, Maryland 20850 USA.
  18. ===========================================================================
  19. */
  20. #ifndef __SLIDERWINDOW_H__
  21. #define __SLIDERWINDOW_H__
  22. class idUserInterfaceLocal;
  23. class idSliderWindow : public idWindow {
  24. public:
  25. idSliderWindow(idUserInterfaceLocal *gui);
  26. idSliderWindow(idDeviceContext *d, idUserInterfaceLocal *gui);
  27. virtual ~idSliderWindow();
  28. void InitWithDefaults(const char *_name, const idRectangle &rect, const idVec4 &foreColor, const idVec4 &matColor, const char *_background, const char *thumbShader, bool _vertical, bool _scrollbar);
  29. void SetRange(float _low, float _high, float _step);
  30. float GetLow() { return low; }
  31. float GetHigh() { return high; }
  32. void SetValue(float _value);
  33. float GetValue() { return value; };
  34. virtual size_t Allocated(){return idWindow::Allocated();};
  35. virtual idWinVar * GetWinVarByName(const char *_name, bool winLookup = false, drawWin_t** owner = NULL);
  36. virtual const char *HandleEvent(const sysEvent_t *event, bool *updateVisuals);
  37. virtual void PostParse();
  38. virtual void Draw(int time, float x, float y);
  39. virtual void DrawBackground(const idRectangle &drawRect);
  40. virtual const char *RouteMouseCoords(float xd, float yd);
  41. virtual void Activate(bool activate, idStr &act);
  42. virtual void SetBuddy(idWindow *buddy);
  43. void RunNamedEvent( const char* eventName );
  44. private:
  45. virtual bool ParseInternalVar(const char *name, idParser *src);
  46. void CommonInit();
  47. void InitCvar();
  48. // true: read the updated cvar from cvar system
  49. // false: write to the cvar system
  50. // force == true overrides liveUpdate 0
  51. void UpdateCvar( bool read, bool force = false );
  52. idWinFloat value;
  53. float low;
  54. float high;
  55. float thumbWidth;
  56. float thumbHeight;
  57. float stepSize;
  58. float lastValue;
  59. idRectangle thumbRect;
  60. const idMaterial * thumbMat;
  61. bool vertical;
  62. bool verticalFlip;
  63. bool scrollbar;
  64. idWindow * buddyWin;
  65. idStr thumbShader;
  66. idWinStr cvarStr;
  67. idCVar * cvar;
  68. bool cvar_init;
  69. idWinBool liveUpdate;
  70. idWinStr cvarGroup;
  71. };
  72. #endif /* !__SLIDERWINDOW_H__ */