ListGUILocal.h 2.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071
  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 __LISTGUILOCAL_H__
  21. #define __LISTGUILOCAL_H__
  22. /*
  23. ===============================================================================
  24. feed data to a listDef
  25. each item has an id and a display string
  26. ===============================================================================
  27. */
  28. class idListGUILocal : protected idList<idStr>, public idListGUI {
  29. public:
  30. idListGUILocal() { m_pGUI = NULL; m_water = 0; m_stateUpdates = true; }
  31. // idListGUI interface
  32. void Config( idUserInterface *pGUI, const char *name ) { m_pGUI = pGUI; m_name = name; }
  33. void Add( int id, const idStr& s );
  34. // use the element count as index for the ids
  35. void Push( const idStr& s );
  36. bool Del( int id );
  37. void Clear( void );
  38. int Num( void ) { return idList<idStr>::Num(); }
  39. int GetSelection( char *s, int size, int sel = 0 ) const; // returns the id, not the list index (or -1)
  40. void SetSelection( int sel );
  41. int GetNumSelections();
  42. bool IsConfigured( void ) const;
  43. void SetStateChanges( bool enable );
  44. void Shutdown( void );
  45. private:
  46. idUserInterface * m_pGUI;
  47. idStr m_name;
  48. int m_water;
  49. idList<int> m_ids;
  50. bool m_stateUpdates;
  51. void StateChanged();
  52. };
  53. #endif /* !__LISTGUILOCAL_H__ */