1 // Aseprite UI Library 2 // Copyright (C) 2001-2013, 2015 David Capello 3 // 4 // This file is released under the terms of the MIT license. 5 // Read LICENSE.txt for more information. 6 7 #ifndef UI_OVERLAY_MANAGER_H_INCLUDED 8 #define UI_OVERLAY_MANAGER_H_INCLUDED 9 #pragma once 10 11 #include "ui/base.h" 12 #include <vector> 13 14 namespace she { class Surface; } 15 16 namespace ui { 17 18 class Overlay; 19 20 class OverlayManager { 21 friend class UISystem; // So it can call destroyInstance() from ~UISystem 22 static OverlayManager* m_singleton; 23 24 OverlayManager(); 25 ~OverlayManager(); 26 27 public: 28 static OverlayManager* instance(); 29 30 void addOverlay(Overlay* overlay); 31 void removeOverlay(Overlay* overlay); 32 33 void captureOverlappedAreas(); 34 void restoreOverlappedAreas(); 35 void drawOverlays(); 36 37 private: 38 static void destroyInstance(); 39 40 typedef std::vector<Overlay*> OverlayList; 41 typedef OverlayList::iterator iterator; 42 begin()43 iterator begin() { return m_overlays.begin(); } end()44 iterator end() { return m_overlays.end(); } 45 46 OverlayList m_overlays; 47 }; 48 49 } // namespace ui 50 51 #endif 52