gcsx_imgchoose.h 2.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283
  1. /* GCSx
  2. ** IMGCHOOSE.H
  3. **
  4. ** Image "chooser" popup window or control
  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_IMGCHOOSE_H_
  24. #define __GCSx_IMGCHOOSE_H_
  25. class ImageChooser : public Window {
  26. private:
  27. class TileSetEdit* tileset;
  28. class FrameWindow* myFrame;
  29. class WidgetScroll* myScroll;
  30. int numTiles; // We keep this at -1 to make our calculations easier
  31. int tileWidth;
  32. int tileHeight;
  33. int tilesPerLine;
  34. int fixedTilesPerLine;
  35. int cursor; // We keep this at -1 to make our calculations easier
  36. int haveFocus;
  37. // Dirty range
  38. Rect dirtyRange;
  39. // Set partial dirties
  40. void setDirtyRange(int first, int last);
  41. void setDirtyBox(int begin, int end);
  42. public:
  43. // (NULL tileset ok)
  44. // Locks tileset until deleted or changed
  45. ImageChooser(class TileSetEdit* myTileset);
  46. ~ImageChooser();
  47. // Can change tileset later
  48. void setTileset(class TileSetEdit* newTileset);
  49. // Opens the window, returns selected tile (1+)
  50. // x/y is requested position of the lower left corner
  51. int runModal(int xPos, int yPos);
  52. // Adds self to dialog using a WScroll
  53. void addTo(class Dialog* dialog, int showWidth, int showHeight, int cId);
  54. void reloadTileStats();
  55. int cursorState(int newPos = -1);
  56. int event(int hasFocus, const SDL_Event* event);
  57. void resize(int newWidth, int newHeight, int newViewWidth = -1, int newViewHeight = -1, int fromParent = 0);
  58. void display(SDL_Surface* destSurface, Rect& toDisplay, const Rect& clipArea, int xOffset, int yOffset);
  59. WindowType windowType() const;
  60. WindowSort windowSort() const;
  61. // Not auto-deleted if a standalone modal window
  62. // Auto-deleted if a widget
  63. int wantsToBeDeleted() const;
  64. };
  65. #endif