2015-12-02 01:32:15 +00:00
|
|
|
#ifndef SPECTER_VIEWRESOURCES_HPP
|
|
|
|
#define SPECTER_VIEWRESOURCES_HPP
|
|
|
|
|
|
|
|
#include "TextView.hpp"
|
2015-12-05 00:42:46 +00:00
|
|
|
#include "SplitView.hpp"
|
2015-12-03 03:26:50 +00:00
|
|
|
#include "Toolbar.hpp"
|
2015-12-05 00:42:46 +00:00
|
|
|
#include "Button.hpp"
|
2015-12-02 01:32:15 +00:00
|
|
|
|
2015-12-13 02:26:41 +00:00
|
|
|
#include <thread>
|
|
|
|
|
2015-12-02 01:32:15 +00:00
|
|
|
namespace Specter
|
|
|
|
{
|
2015-12-04 01:35:01 +00:00
|
|
|
class ThemeData
|
|
|
|
{
|
|
|
|
Zeus::CColor m_vpBg = {0.2,0.2,0.2,1.0};
|
|
|
|
Zeus::CColor m_tbBg = {0.4,0.4,0.4,1.0};
|
|
|
|
Zeus::CColor m_uiText = Zeus::CColor::skWhite;
|
2015-12-05 00:42:46 +00:00
|
|
|
Zeus::CColor m_button1Inactive = {0.2823, 0.2823, 0.2823, 1.0};
|
|
|
|
Zeus::CColor m_button2Inactive = {0.1725, 0.1725, 0.1725, 1.0};
|
|
|
|
Zeus::CColor m_button1Hover = {0.3523, 0.3523, 0.3523, 1.0};
|
|
|
|
Zeus::CColor m_button2Hover = {0.2425, 0.2425, 0.2425, 1.0};
|
|
|
|
Zeus::CColor m_button1Press = {0.1725, 0.1725, 0.1725, 1.0};
|
|
|
|
Zeus::CColor m_button2Press = {0.2823, 0.2823, 0.2823, 1.0};
|
|
|
|
Zeus::CColor m_button1Disabled = {0.2823, 0.2823, 0.2823, 0.5};
|
|
|
|
Zeus::CColor m_button2Disabled = {0.1725, 0.1725, 0.1725, 0.5};
|
2015-12-07 01:45:48 +00:00
|
|
|
Zeus::CColor m_tooltipBg = {0.0, 0.0, 0.0, 0.65};
|
2015-12-13 02:26:41 +00:00
|
|
|
Zeus::CColor m_splashBg = {0.1, 0.1, 0.1, 0.65};
|
|
|
|
Zeus::CColor m_splash1 = {1.0, 1.0, 1.0, 1.0};
|
|
|
|
Zeus::CColor m_splash2 = {0.3, 0.3, 0.3, 1.0};
|
2015-12-04 01:35:01 +00:00
|
|
|
public:
|
|
|
|
virtual const Zeus::CColor& viewportBackground() const {return m_vpBg;}
|
|
|
|
virtual const Zeus::CColor& toolbarBackground() const {return m_tbBg;}
|
|
|
|
virtual const Zeus::CColor& uiText() const {return m_uiText;}
|
2015-12-05 00:42:46 +00:00
|
|
|
virtual const Zeus::CColor& button1Inactive() const {return m_button1Inactive;}
|
|
|
|
virtual const Zeus::CColor& button2Inactive() const {return m_button2Inactive;}
|
|
|
|
virtual const Zeus::CColor& button1Hover() const {return m_button1Hover;}
|
|
|
|
virtual const Zeus::CColor& button2Hover() const {return m_button2Hover;}
|
|
|
|
virtual const Zeus::CColor& button1Press() const {return m_button1Press;}
|
|
|
|
virtual const Zeus::CColor& button2Press() const {return m_button2Press;}
|
|
|
|
virtual const Zeus::CColor& button1Disabled() const {return m_button1Disabled;}
|
|
|
|
virtual const Zeus::CColor& button2Disabled() const {return m_button2Disabled;}
|
2015-12-07 00:52:07 +00:00
|
|
|
virtual const Zeus::CColor& tooltipBackground() const {return m_tooltipBg;}
|
2015-12-13 02:26:41 +00:00
|
|
|
virtual const Zeus::CColor& splashBackground() const {return m_splashBg;}
|
|
|
|
virtual const Zeus::CColor& splash1() const {return m_splash1;}
|
|
|
|
virtual const Zeus::CColor& splash2() const {return m_splash2;}
|
2015-12-04 01:35:01 +00:00
|
|
|
};
|
|
|
|
|
2015-12-02 01:32:15 +00:00
|
|
|
class ViewResources
|
|
|
|
{
|
|
|
|
template <class Factory>
|
2015-12-13 02:26:41 +00:00
|
|
|
void init(Factory* factory, const ThemeData& theme, FontCache* fcache)
|
2015-12-02 01:32:15 +00:00
|
|
|
{
|
2015-12-04 01:35:01 +00:00
|
|
|
m_viewRes.init(factory, theme);
|
2015-12-02 01:32:15 +00:00
|
|
|
m_textRes.init(factory, fcache);
|
2015-12-04 01:35:01 +00:00
|
|
|
m_splitRes.init(factory, theme);
|
|
|
|
m_toolbarRes.init(factory, theme);
|
2015-12-05 00:42:46 +00:00
|
|
|
m_buttonRes.init(factory, theme);
|
2015-12-02 01:32:15 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
public:
|
|
|
|
boo::IGraphicsDataFactory* m_factory = nullptr;
|
2015-12-04 01:35:01 +00:00
|
|
|
FontCache* m_fcache = nullptr;
|
2015-12-02 01:32:15 +00:00
|
|
|
View::Resources m_viewRes;
|
|
|
|
TextView::Resources m_textRes;
|
2015-12-03 03:26:50 +00:00
|
|
|
SplitView::Resources m_splitRes;
|
|
|
|
Toolbar::Resources m_toolbarRes;
|
2015-12-05 00:42:46 +00:00
|
|
|
Button::Resources m_buttonRes;
|
|
|
|
boo::IGraphicsDataToken m_resData;
|
2015-12-02 01:32:15 +00:00
|
|
|
|
|
|
|
Specter::FontTag m_mainFont;
|
|
|
|
Specter::FontTag m_monoFont;
|
|
|
|
|
|
|
|
Specter::FontTag m_heading14;
|
|
|
|
Specter::FontTag m_heading18;
|
|
|
|
|
2015-12-13 02:26:41 +00:00
|
|
|
Specter::FontTag m_titleFont;
|
2015-12-07 00:52:07 +00:00
|
|
|
Specter::FontTag m_curveFont;
|
|
|
|
|
2015-12-13 02:26:41 +00:00
|
|
|
std::thread m_fcacheThread;
|
|
|
|
bool m_fcacheReady = false;
|
|
|
|
|
2015-12-02 01:32:15 +00:00
|
|
|
ViewResources() = default;
|
|
|
|
ViewResources(const ViewResources& other) = delete;
|
|
|
|
ViewResources(ViewResources&& other) = default;
|
|
|
|
ViewResources& operator=(const ViewResources& other) = delete;
|
|
|
|
ViewResources& operator=(ViewResources&& other) = default;
|
|
|
|
|
2015-12-13 02:40:03 +00:00
|
|
|
~ViewResources()
|
|
|
|
{
|
|
|
|
m_fcacheThread.detach();
|
|
|
|
}
|
|
|
|
|
2015-12-08 01:44:46 +00:00
|
|
|
void init(boo::IGraphicsDataFactory* factory, FontCache* fcache, const ThemeData& theme, float pixelFactor);
|
2015-12-13 02:26:41 +00:00
|
|
|
void prepFontCacheSync();
|
|
|
|
void prepFontCacheAsync(boo::IWindow* window);
|
|
|
|
bool fontCacheReady() const {return m_fcacheReady;}
|
2015-12-08 01:44:46 +00:00
|
|
|
void resetPixelFactor(float pixelFactor);
|
2015-12-04 01:35:01 +00:00
|
|
|
void resetTheme(const ThemeData& theme);
|
2015-12-06 01:24:51 +00:00
|
|
|
void resetLanguage(const ThemeData& theme);
|
2015-12-03 03:26:50 +00:00
|
|
|
|
|
|
|
float m_pixelFactor = 0;
|
|
|
|
float pixelFactor() const {return m_pixelFactor;}
|
2015-12-04 01:35:01 +00:00
|
|
|
|
|
|
|
ThemeData m_theme;
|
|
|
|
const ThemeData& themeData() const {return m_theme;}
|
2015-12-02 01:32:15 +00:00
|
|
|
};
|
|
|
|
}
|
|
|
|
|
|
|
|
#endif // SPECTER_VIEWRESOURCES_HPP
|