123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778 |
- /* GCSx
- ** PROGRESS.H
- **
- ** Non-interactive progress meter popup window
- */
- /*****************************************************************************
- ** Copyright (C) 2003-2006 Janson
- **
- ** This program is free software; you can redistribute it and/or modify
- ** it under the terms of the GNU General Public License as published by
- ** the Free Software Foundation; either version 2 of the License, or
- ** (at your option) any later version.
- **
- ** This program is distributed in the hope that it will be useful,
- ** but WITHOUT ANY WARRANTY; without even the implied warranty of
- ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- ** GNU General Public License for more details.
- **
- ** You should have received a copy of the GNU General Public License
- ** along with this program; if not, write to the Free Software
- ** Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111, USA.
- *****************************************************************************/
- #ifndef __GCSx_PROGRESS_H_
- #define __GCSx_PROGRESS_H_
- class ProgressMeter : public Window {
- private:
- class FrameWindow* myFrame;
-
- long long position;
- long long total;
- Uint32 closeTimer;
- Uint32 openTimer;
- Uint32 lastUpdate;
- int progressDone;
-
- enum {
- PROGRESS_METER_HEIGHT = 20,
- PROGRESS_METER_BORDER = 1,
- DELAY_AUTO_CLOSE = 1000,
- DELAY_AUTO_OPEN = 500,
- };
- // Opens and displays the window
- void openMeter();
-
- // Update meter onscreen- if appropriate
- void updateDisplay();
- public:
- ProgressMeter(long long myTotal);
- // DON'T delete progress meter yourself- it will automatically
- ~ProgressMeter();
-
- // Updates the progress meter- meter opens automatically if delay is great enough
- void updateProgress(long long myPosition);
-
- // Done with progress meter- alerts meter that it can delete itself or close as needed
- // Only use False for clearEvents if you were running the meter asyncronously-
- // allowing user to interact at the same time (ie threaded)
- void doneProgress(int cleanEvents = 1);
-
- // Closed and deleted automatically!
- int event(int hasFocus, const SDL_Event* event);
- void display(SDL_Surface* destSurface, Rect& toDisplay, const Rect& clipArea, int xOffset, int yOffset);
- WindowType windowType() const;
- WindowSort windowSort() const;
- int tempFocus() const;
- int wantsToBeDeleted() const;
- };
- #endif
|