1 /**********************************************\ 2 * 3 * Simple Viewer GL edition 4 * by Andrey A. Ugolnik 5 * http://www.ugolnik.info 6 * andrey@ugolnik.info 7 * 8 \**********************************************/ 9 10 #pragma once 11 12 #include "popup.h" 13 14 #include <string> 15 16 struct sConfig; 17 18 class cInfoBar final : public cPopup 19 { 20 public: 21 explicit cInfoBar(const sConfig& config); 22 23 void render() override; 24 getHeight()25 float getHeight() const 26 { 27 return m_height; 28 } 29 30 struct sInfo 31 { 32 const char* path = nullptr; 33 const char* type = nullptr; 34 unsigned index = 0; 35 unsigned width = 0; 36 unsigned height = 0; 37 unsigned bpp = 0; 38 float scale = 0.0f; 39 unsigned images = 0; 40 unsigned current = 0; 41 long file_size = 0; 42 size_t mem_size = 0; 43 unsigned files_count = 0; 44 }; 45 46 void setInfo(const sInfo& p); 47 48 private: 49 const char* getHumanSize(float& size); 50 const std::string getFilename(const char* path) const; 51 const std::string shortenFilename(const std::string& path) const; 52 53 private: 54 const sConfig& m_config; 55 56 std::string m_bottominfo; 57 58 float m_height = 0.0f; 59 }; 60