Fix bug drawing box/grids bgcolor on tooltip windows

This commit is contained in:
David Capello 2017-03-09 15:12:39 -03:00
parent 3b2e76e745
commit e2a94b094a
8 changed files with 13 additions and 48 deletions

View File

@ -816,6 +816,9 @@
<styles>
<style id="box" />
<style id="grid" />
<style id="window_without_title" border="3">
<background color="window_face" />
<border part="menu" />

View File

@ -845,6 +845,7 @@ void SkinTheme::initWidget(Widget* widget)
switch (widget->type()) {
case kBoxWidget:
widget->setStyle(newStyles.box());
BORDER(0);
widget->setChildSpacing(4 * scale);
break;
@ -874,6 +875,7 @@ void SkinTheme::initWidget(Widget* widget)
break;
case kGridWidget:
widget->setStyle(newStyles.grid());
BORDER(0);
widget->setChildSpacing(4 * scale);
break;
@ -1041,17 +1043,6 @@ gfx::Size SkinTheme::getEntryCaretSize(Widget* widget)
return gfx::Size(2*guiscale(), widget->textHeight()+2*guiscale());
}
void SkinTheme::paintBox(PaintEvent& ev)
{
Widget* widget = static_cast<Widget*>(ev.getSource());
Graphics* g = ev.graphics();
if (!widget->isTransparent() &&
!is_transparent(BGCOLOR)) {
g->fillRect(BGCOLOR, g->getClipBounds());
}
}
void SkinTheme::paintCheckBox(PaintEvent& ev)
{
Graphics* g = ev.graphics();
@ -1100,15 +1091,6 @@ void SkinTheme::paintCheckBox(PaintEvent& ev)
}
}
void SkinTheme::paintGrid(PaintEvent& ev)
{
Widget* widget = static_cast<Widget*>(ev.getSource());
Graphics* g = ev.graphics();
if (!is_transparent(BGCOLOR))
g->fillRect(BGCOLOR, g->getClipBounds());
}
void SkinTheme::paintEntry(PaintEvent& ev)
{
Graphics* g = ev.graphics();

View File

@ -57,10 +57,8 @@ namespace app {
int getScrollbarSize() override;
gfx::Size getEntryCaretSize(ui::Widget* widget) override;
void paintBox(ui::PaintEvent& ev) override;
void paintCheckBox(ui::PaintEvent& ev) override;
void paintEntry(ui::PaintEvent& ev) override;
void paintGrid(ui::PaintEvent& ev) override;
void paintListBox(ui::PaintEvent& ev) override;
void paintListItem(ui::PaintEvent& ev) override;
void paintMenu(ui::PaintEvent& ev) override;

View File

@ -1,5 +1,5 @@
// Aseprite UI Library
// Copyright (C) 2001-2016 David Capello
// Copyright (C) 2001-2017 David Capello
//
// This file is released under the terms of the MIT license.
// Read LICENSE.txt for more information.
@ -152,9 +152,4 @@ void Box::onResize(ResizeEvent& ev)
}
}
void Box::onPaint(PaintEvent& ev)
{
theme()->paintBox(ev);
}
} // namespace ui

View File

@ -1,5 +1,5 @@
// Aseprite UI Library
// Copyright (C) 2001-2013, 2015 David Capello
// Copyright (C) 2001-2017 David Capello
//
// This file is released under the terms of the MIT license.
// Read LICENSE.txt for more information.
@ -12,8 +12,7 @@
namespace ui {
class Box : public Widget
{
class Box : public Widget {
public:
Box(int align);
@ -21,23 +20,19 @@ namespace ui {
// Events
void onSizeHint(SizeHintEvent& ev) override;
void onResize(ResizeEvent& ev) override;
void onPaint(PaintEvent& ev) override;
};
class VBox : public Box
{
class VBox : public Box {
public:
VBox() : Box(VERTICAL) { }
};
class HBox : public Box
{
class HBox : public Box {
public:
HBox() : Box(HORIZONTAL) { }
};
class BoxFiller : public Box
{
class BoxFiller : public Box {
public:
BoxFiller() : Box(HORIZONTAL) {
this->setExpansive(true);

View File

@ -1,5 +1,5 @@
// Aseprite UI Library
// Copyright (C) 2001-2016 David Capello
// Copyright (C) 2001-2017 David Capello
//
// This file is released under the terms of the MIT license.
// Read LICENSE.txt for more information.
@ -204,11 +204,6 @@ void Grid::onSizeHint(SizeHintEvent& ev)
ev.setSizeHint(sz);
}
void Grid::onPaint(PaintEvent& ev)
{
theme()->paintGrid(ev);
}
void Grid::sumStripSize(const std::vector<Strip>& strip, int& size)
{
int i, j;

View File

@ -1,5 +1,5 @@
// Aseprite UI Library
// Copyright (C) 2001-2013 David Capello
// Copyright (C) 2001-2017 David Capello
//
// This file is released under the terms of the MIT license.
// Read LICENSE.txt for more information.
@ -36,7 +36,6 @@ namespace ui {
// Events
void onResize(ResizeEvent& ev) override;
void onSizeHint(SizeHintEvent& ev) override;
void onPaint(PaintEvent& ev) override;
private:
struct Cell {

View File

@ -53,10 +53,8 @@ namespace ui {
virtual int getScrollbarSize() = 0;
virtual gfx::Size getEntryCaretSize(Widget* widget) = 0;
virtual void paintBox(PaintEvent& ev) = 0;
virtual void paintCheckBox(PaintEvent& ev) = 0;
virtual void paintEntry(PaintEvent& ev) = 0;
virtual void paintGrid(PaintEvent& ev) = 0;
virtual void paintListBox(PaintEvent& ev) = 0;
virtual void paintListItem(PaintEvent& ev) = 0;
virtual void paintMenu(PaintEvent& ev) = 0;