gcsx_progress.h 2.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778
  1. /* GCSx
  2. ** PROGRESS.H
  3. **
  4. ** Non-interactive progress meter popup window
  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_PROGRESS_H_
  24. #define __GCSx_PROGRESS_H_
  25. class ProgressMeter : public Window {
  26. private:
  27. class FrameWindow* myFrame;
  28. long long position;
  29. long long total;
  30. Uint32 closeTimer;
  31. Uint32 openTimer;
  32. Uint32 lastUpdate;
  33. int progressDone;
  34. enum {
  35. PROGRESS_METER_HEIGHT = 20,
  36. PROGRESS_METER_BORDER = 1,
  37. DELAY_AUTO_CLOSE = 1000,
  38. DELAY_AUTO_OPEN = 500,
  39. };
  40. // Opens and displays the window
  41. void openMeter();
  42. // Update meter onscreen- if appropriate
  43. void updateDisplay();
  44. public:
  45. ProgressMeter(long long myTotal);
  46. // DON'T delete progress meter yourself- it will automatically
  47. ~ProgressMeter();
  48. // Updates the progress meter- meter opens automatically if delay is great enough
  49. void updateProgress(long long myPosition);
  50. // Done with progress meter- alerts meter that it can delete itself or close as needed
  51. // Only use False for clearEvents if you were running the meter asyncronously-
  52. // allowing user to interact at the same time (ie threaded)
  53. void doneProgress(int cleanEvents = 1);
  54. // Closed and deleted automatically!
  55. int event(int hasFocus, const SDL_Event* event);
  56. void display(SDL_Surface* destSurface, Rect& toDisplay, const Rect& clipArea, int xOffset, int yOffset);
  57. WindowType windowType() const;
  58. WindowSort windowSort() const;
  59. int tempFocus() const;
  60. int wantsToBeDeleted() const;
  61. };
  62. #endif