OpenMW
components/loadinglistener/loadinglistener.hpp
Go to the documentation of this file.
00001 #ifndef COMPONENTS_LOADINGLISTENER_H
00002 #define COMPONENTS_LOADINGLISTENER_H
00003 
00004 namespace Loading
00005 {
00006     class Listener
00007     {
00008     public:
00009         virtual void setLabel (const std::string& label) = 0;
00010 
00011         // Use ScopedLoad instead of using these directly
00012         virtual void loadingOn() = 0;
00013         virtual void loadingOff() = 0;
00014 
00016         virtual void indicateProgress () = 0;
00017 
00018         virtual void setProgressRange (size_t range) = 0;
00019         virtual void setProgress (size_t value) = 0;
00020         virtual void increaseProgress (size_t increase) = 0;
00021 
00023         virtual void removeWallpaper() = 0;
00024     };
00025 
00026     // Used for stopping a loading sequence when the object goes out of scope
00027     struct ScopedLoad
00028     {
00029         ScopedLoad(Listener* l) : mListener(l) { mListener->loadingOn(); }
00030         ~ScopedLoad() { mListener->loadingOff(); }
00031         Listener* mListener;
00032     };
00033 }
00034 
00035 #endif