Move drawTextBox() function inside Theme class

This commit is contained in:
David Capello 2016-12-15 10:50:47 -03:00
parent 6c9c0066a0
commit 7e6fc5a815
5 changed files with 13 additions and 12 deletions

View File

@ -1567,7 +1567,7 @@ void SkinTheme::paintTextBox(ui::PaintEvent& ev)
Graphics* g = ev.graphics();
Widget* widget = static_cast<Widget*>(ev.getSource());
drawTextBox(g, widget, NULL, NULL,
Theme::drawTextBox(g, widget, nullptr, nullptr,
BGCOLOR, colors.textboxText());
}

View File

@ -1,5 +1,5 @@
// Aseprite UI Library
// Copyright (C) 2001-2013, 2015 David Capello
// Copyright (C) 2001-2016 David Capello
//
// This file is released under the terms of the MIT license.
// Read LICENSE.txt for more information.
@ -36,11 +36,6 @@ namespace ui {
} // namespace details
// theme.cpp
void drawTextBox(Graphics* g, Widget* textbox,
int* w, int* h, gfx::Color bg, gfx::Color fg);
} // namespace ui
#endif

View File

@ -156,7 +156,7 @@ void TextBox::onSizeHint(SizeHintEvent& ev)
int w = 0;
int h = 0;
drawTextBox(NULL, this, &w, &h, gfx::ColorNone, gfx::ColorNone);
Theme::drawTextBox(nullptr, this, &w, &h, gfx::ColorNone, gfx::ColorNone);
if (this->align() & WORDWRAP) {
View* view = View::getView(this);
@ -170,7 +170,7 @@ void TextBox::onSizeHint(SizeHintEvent& ev)
}
w = MAX(min, width);
drawTextBox(NULL, this, &w, &h, gfx::ColorNone, gfx::ColorNone);
Theme::drawTextBox(nullptr, this, &w, &h, gfx::ColorNone, gfx::ColorNone);
w = min;
}

View File

@ -79,7 +79,8 @@ Theme* get_theme()
return current_theme;
}
void drawTextBox(Graphics* g, Widget* widget,
// static
void Theme::drawTextBox(Graphics* g, Widget* widget,
int* w, int* h, gfx::Color bg, gfx::Color fg)
{
View* view = View::getView(widget);

View File

@ -8,6 +8,7 @@
#define UI_THEME_H_INCLUDED
#pragma once
#include "gfx/color.h"
#include "gfx/size.h"
#include "ui/base.h"
#include "ui/cursor_type.h"
@ -23,6 +24,7 @@ namespace she {
namespace ui {
class Cursor;
class Graphics;
class PaintEvent;
class Widget;
@ -72,6 +74,9 @@ namespace ui {
virtual void paintPopupWindow(PaintEvent& ev) = 0;
virtual void paintTooltip(PaintEvent& ev) = 0;
static void drawTextBox(Graphics* g, Widget* textbox,
int* w, int* h, gfx::Color bg, gfx::Color fg);
protected:
virtual void onRegenerate() = 0;