gcsx_toolselect.h 1.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061
  1. /* GCSx
  2. ** TOOLSELECT.H
  3. **
  4. ** Tool selection popup dialogs
  5. */
  6. /*****************************************************************************
  7. ** Copyright (C) 2003-2006 Janson
  8. **
  9. ** This program is free software; you can redistribute it and/or modify
  10. ** it under the terms of the GNU General Public License as published by
  11. ** the Free Software Foundation; either version 2 of the License, or
  12. ** (at your option) any later version.
  13. **
  14. ** This program is distributed in the hope that it will be useful,
  15. ** but WITHOUT ANY WARRANTY; without even the implied warranty of
  16. ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  17. ** GNU General Public License for more details.
  18. **
  19. ** You should have received a copy of the GNU General Public License
  20. ** along with this program; if not, write to the Free Software
  21. ** Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111, USA.
  22. *****************************************************************************/
  23. #ifndef __GCSx_TOOLSELECT_H_
  24. #define __GCSx_TOOLSELECT_H_
  25. class ToolSelect : public Dialog {
  26. public:
  27. struct ToolIconStruct {
  28. int id;
  29. int x;
  30. int y;
  31. const char* tooltip;
  32. };
  33. private:
  34. SDL_Surface* iconSurface;
  35. const ToolIconStruct* tools;
  36. int numTools;
  37. public:
  38. // Assumes icons are 20x20
  39. // 4 per row
  40. ToolSelect(SDL_Surface* tIconSurface, int myNumTools, const ToolIconStruct* toolStructs);
  41. ~ToolSelect();
  42. // Returns ID of tool selected
  43. int run(int atX, int atY);
  44. // Returns true if found
  45. int isTool(int id) const;
  46. // Returns X/Y given a tool; returns true if found
  47. int getToolIcon(int id, int& iX, int& iY) const;
  48. };
  49. #endif