Remove public variable members from ui::Theme class

This commit is contained in:
David Capello 2015-08-12 16:48:40 -03:00
parent 77d8024026
commit d323b4affc
5 changed files with 9 additions and 10 deletions

View File

@ -144,7 +144,6 @@ SkinTheme* SkinTheme::instance()
SkinTheme::SkinTheme()
: m_cursors(ui::kCursorTypes, NULL)
{
this->name = "Skin Theme";
m_selected_skin = get_config_string("Skin", "Selected", "default");
m_defaultFont = nullptr;
m_miniFont = nullptr;
@ -218,8 +217,6 @@ void SkinTheme::onRegenerate()
loadSheet();
loadFonts();
scrollbar_size = 12 * guiscale();
// Load the skin XML
std::string xml_filename = "skins/" + m_selected_skin + "/skin.xml";
ResourceFinder rf;
@ -728,6 +725,11 @@ void SkinTheme::setDecorativeWidgetBounds(Widget* widget)
}
}
int SkinTheme::getScrollbarSize()
{
return 12 * guiscale();
}
void SkinTheme::paintDesktop(PaintEvent& ev)
{
Graphics* g = ev.getGraphics();

View File

@ -54,6 +54,7 @@ namespace app {
void initWidget(ui::Widget* widget) override;
void getWindowMask(ui::Widget* widget, gfx::Region& region) override;
void setDecorativeWidgetBounds(ui::Widget* widget) override;
int getScrollbarSize() override;
void paintDesktop(ui::PaintEvent& ev) override;
void paintBox(ui::PaintEvent& ev) override;

View File

@ -25,7 +25,7 @@ int ScrollBar::m_whereclick = 0;
ScrollBar::ScrollBar(int align)
: Widget(kViewScrollbarWidget)
, m_barWidth(getTheme()->scrollbar_size)
, m_barWidth(getTheme()->getScrollbarSize())
, m_pos(0)
, m_size(0)
{
@ -206,7 +206,7 @@ void ScrollBar::getScrollBarInfo(int *_pos, int *_len, int *_bar_size, int *_vie
}
else {
len = bar_size * viewport_size / m_size;
len = MID(getTheme()->scrollbar_size*2-border_width, len, bar_size);
len = MID(getTheme()->getScrollbarSize()*2-border_width, len, bar_size);
pos = (bar_size-len) * m_pos / (m_size-viewport_size);
pos = MID(0, pos, bar_size-len);
}

View File

@ -28,8 +28,6 @@ static Theme* current_theme = NULL;
Theme::Theme()
: m_guiscale(1)
{
this->name = "Theme";
this->scrollbar_size = 0;
}
Theme::~Theme()

View File

@ -27,9 +27,6 @@ namespace ui {
class Theme {
public:
const char* name;
int scrollbar_size;
Theme();
virtual ~Theme();
@ -45,6 +42,7 @@ namespace ui {
virtual void initWidget(Widget* widget) = 0;
virtual void getWindowMask(Widget* widget, gfx::Region& region) = 0;
virtual void setDecorativeWidgetBounds(Widget* widget) = 0;
virtual int getScrollbarSize() = 0;
virtual void paintDesktop(PaintEvent& ev) = 0;
virtual void paintBox(PaintEvent& ev) = 0;