aseprite/src/ui/intern.cpp

70 lines
1.2 KiB
C++
Raw Normal View History

// Aseprite UI Library
// Copyright (C) 2001-2013, 2015 David Capello
//
// This file is released under the terms of the MIT license.
// Read LICENSE.txt for more information.
2007-09-18 23:57:02 +00:00
#ifdef HAVE_CONFIG_H
2009-07-12 20:29:16 +00:00
#include "config.h"
#endif
2009-07-12 20:29:16 +00:00
2012-06-18 01:49:58 +00:00
#include "ui/manager.h"
#include "ui/theme.h"
#include "ui/widget.h"
2012-07-09 02:24:42 +00:00
#include "ui/window.h"
2007-09-18 23:57:02 +00:00
#include <list>
namespace ui {
static std::list<Widget*>* widgets;
int init_widgets()
{
widgets = new std::list<Widget*>;
return 0;
}
void exit_widgets()
{
delete widgets;
}
2007-09-18 23:57:02 +00:00
2013-03-30 16:38:24 +00:00
void addWidget(Widget* widget)
2007-09-18 23:57:02 +00:00
{
widgets->push_back(widget);
2007-09-18 23:57:02 +00:00
}
2013-03-30 16:38:24 +00:00
void removeWidget(Widget* widget)
2007-09-18 23:57:02 +00:00
{
auto it = std::find(widgets->begin(), widgets->end(), widget);
if (it != widgets->end())
widgets->erase(it);
2007-09-18 23:57:02 +00:00
}
void resetFontAllWidgets()
2007-09-18 23:57:02 +00:00
{
for (auto widget : *widgets)
widget->resetFont();
}
2013-03-30 16:38:24 +00:00
void reinitThemeForAllWidgets()
{
// Reinitialize the theme of each widget
for (auto widget : *widgets) {
widget->setTheme(CurrentTheme::get());
widget->initTheme();
}
2007-09-18 23:57:02 +00:00
// Remap the windows
for (auto widget : *widgets) {
if (widget->type == kWindowWidget)
static_cast<Window*>(widget)->remapWindow();
}
2007-09-18 23:57:02 +00:00
// Redraw the whole screen
Manager::getDefault()->invalidate();
2007-09-18 23:57:02 +00:00
}
} // namespace ui