mirror of https://github.com/aseprite/aseprite.git
Move drawTextBox() function inside Theme class
This commit is contained in:
parent
6c9c0066a0
commit
7e6fc5a815
|
@ -1567,8 +1567,8 @@ void SkinTheme::paintTextBox(ui::PaintEvent& ev)
|
||||||
Graphics* g = ev.graphics();
|
Graphics* g = ev.graphics();
|
||||||
Widget* widget = static_cast<Widget*>(ev.getSource());
|
Widget* widget = static_cast<Widget*>(ev.getSource());
|
||||||
|
|
||||||
drawTextBox(g, widget, NULL, NULL,
|
Theme::drawTextBox(g, widget, nullptr, nullptr,
|
||||||
BGCOLOR, colors.textboxText());
|
BGCOLOR, colors.textboxText());
|
||||||
}
|
}
|
||||||
|
|
||||||
void SkinTheme::paintView(PaintEvent& ev)
|
void SkinTheme::paintView(PaintEvent& ev)
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
// Aseprite UI Library
|
// 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.
|
// This file is released under the terms of the MIT license.
|
||||||
// Read LICENSE.txt for more information.
|
// Read LICENSE.txt for more information.
|
||||||
|
@ -36,11 +36,6 @@ namespace ui {
|
||||||
|
|
||||||
} // namespace details
|
} // namespace details
|
||||||
|
|
||||||
// theme.cpp
|
|
||||||
|
|
||||||
void drawTextBox(Graphics* g, Widget* textbox,
|
|
||||||
int* w, int* h, gfx::Color bg, gfx::Color fg);
|
|
||||||
|
|
||||||
} // namespace ui
|
} // namespace ui
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -156,7 +156,7 @@ void TextBox::onSizeHint(SizeHintEvent& ev)
|
||||||
int w = 0;
|
int w = 0;
|
||||||
int h = 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) {
|
if (this->align() & WORDWRAP) {
|
||||||
View* view = View::getView(this);
|
View* view = View::getView(this);
|
||||||
|
@ -170,7 +170,7 @@ void TextBox::onSizeHint(SizeHintEvent& ev)
|
||||||
}
|
}
|
||||||
|
|
||||||
w = MAX(min, width);
|
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;
|
w = min;
|
||||||
}
|
}
|
||||||
|
|
|
@ -79,8 +79,9 @@ Theme* get_theme()
|
||||||
return current_theme;
|
return current_theme;
|
||||||
}
|
}
|
||||||
|
|
||||||
void drawTextBox(Graphics* g, Widget* widget,
|
// static
|
||||||
int* w, int* h, gfx::Color bg, gfx::Color fg)
|
void Theme::drawTextBox(Graphics* g, Widget* widget,
|
||||||
|
int* w, int* h, gfx::Color bg, gfx::Color fg)
|
||||||
{
|
{
|
||||||
View* view = View::getView(widget);
|
View* view = View::getView(widget);
|
||||||
char* text = const_cast<char*>(widget->text().c_str());
|
char* text = const_cast<char*>(widget->text().c_str());
|
||||||
|
|
|
@ -8,6 +8,7 @@
|
||||||
#define UI_THEME_H_INCLUDED
|
#define UI_THEME_H_INCLUDED
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
|
#include "gfx/color.h"
|
||||||
#include "gfx/size.h"
|
#include "gfx/size.h"
|
||||||
#include "ui/base.h"
|
#include "ui/base.h"
|
||||||
#include "ui/cursor_type.h"
|
#include "ui/cursor_type.h"
|
||||||
|
@ -23,6 +24,7 @@ namespace she {
|
||||||
namespace ui {
|
namespace ui {
|
||||||
|
|
||||||
class Cursor;
|
class Cursor;
|
||||||
|
class Graphics;
|
||||||
class PaintEvent;
|
class PaintEvent;
|
||||||
class Widget;
|
class Widget;
|
||||||
|
|
||||||
|
@ -72,6 +74,9 @@ namespace ui {
|
||||||
virtual void paintPopupWindow(PaintEvent& ev) = 0;
|
virtual void paintPopupWindow(PaintEvent& ev) = 0;
|
||||||
virtual void paintTooltip(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:
|
protected:
|
||||||
virtual void onRegenerate() = 0;
|
virtual void onRegenerate() = 0;
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue