aseprite/src/ui/intern.cpp

74 lines
1.4 KiB
C++
Raw Normal View History

// ASEPRITE gui library
2013-01-27 15:13:13 +00:00
// Copyright (C) 2001-2013 David Capello
//
// This source file is distributed under a BSD-like license, please
// read LICENSE.txt for more information.
2007-09-18 23:57:02 +00:00
2009-07-12 20:29:16 +00:00
#include "config.h"
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 _ji_widgets_init()
{
widgets = new std::list<Widget*>;
return 0;
}
void _ji_widgets_exit()
{
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
{
std::list<Widget*>::iterator it =
std::find(widgets->begin(), widgets->end(), widget);
2007-09-18 23:57:02 +00:00
if (it != widgets->end())
widgets->erase(it);
2007-09-18 23:57:02 +00:00
}
2013-03-30 16:38:24 +00:00
void setFontOfAllWidgets(FONT* f)
2007-09-18 23:57:02 +00:00
{
for (std::list<Widget*>::iterator it=widgets->begin(), end=widgets->end();
it != end; ++it) {
(*it)->setFont(f);
}
}
2013-03-30 16:38:24 +00:00
void reinitThemeForAllWidgets()
{
// Reinitialize the theme of each widget
for (std::list<Widget*>::iterator it=widgets->begin(), end=widgets->end();
it != end; ++it) {
(*it)->setTheme(CurrentTheme::get());
(*it)->initTheme();
}
2007-09-18 23:57:02 +00:00
// Remap the windows
for (std::list<Widget*>::iterator it=widgets->begin(), end=widgets->end();
it != end; ++it) {
if ((*it)->type == kWindowWidget)
static_cast<Window*>(*it)->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