mirror of
https://github.com/aseprite/aseprite.git
synced 2025-04-16 23:42:57 +00:00
Move jwidget_init_theme() to Widget::initTheme().
This commit is contained in:
parent
5de5cfc8e1
commit
f96d1f7fa3
@ -26,7 +26,7 @@ Box::Box(int align)
|
||||
: Widget(JI_BOX)
|
||||
{
|
||||
setAlign(align);
|
||||
jwidget_init_theme(this);
|
||||
initTheme();
|
||||
}
|
||||
|
||||
bool Box::onProcessMessage(JMessage msg)
|
||||
|
@ -36,7 +36,7 @@ ButtonBase::ButtonBase(const char* text, int type, int behaviorType, int drawTyp
|
||||
|
||||
// Initialize theme
|
||||
this->type = m_drawType; // TODO Remove this nasty trick
|
||||
jwidget_init_theme(this);
|
||||
initTheme();
|
||||
this->type = type;
|
||||
}
|
||||
|
||||
|
@ -60,7 +60,7 @@ ComboBox::ComboBox()
|
||||
|
||||
setEditable(m_editable);
|
||||
|
||||
jwidget_init_theme(this);
|
||||
initTheme();
|
||||
}
|
||||
|
||||
ComboBox::~ComboBox()
|
||||
|
@ -57,7 +57,7 @@ Entry::Entry(size_t maxsize, const char *format, ...)
|
||||
setText(buf);
|
||||
|
||||
jwidget_focusrest(this, true);
|
||||
jwidget_init_theme(this);
|
||||
initTheme();
|
||||
}
|
||||
|
||||
Entry::~Entry()
|
||||
|
@ -54,7 +54,7 @@ Frame::Frame(bool desktop, const char* text)
|
||||
setText(text);
|
||||
setAlign(JI_LEFT | JI_MIDDLE);
|
||||
|
||||
jwidget_init_theme(this);
|
||||
initTheme();
|
||||
}
|
||||
|
||||
Frame::~Frame()
|
||||
@ -239,7 +239,7 @@ bool Frame::onProcessMessage(JMessage msg)
|
||||
|
||||
case JM_SIGNAL:
|
||||
if (msg->signal.num == JI_SIGNAL_SET_TEXT)
|
||||
jwidget_init_theme(this);
|
||||
initTheme();
|
||||
break;
|
||||
|
||||
case JM_BUTTONPRESSED: {
|
||||
|
@ -46,7 +46,7 @@ Grid::Grid(int columns, bool same_width_columns)
|
||||
m_colstrip[col].expand_count = 0;
|
||||
}
|
||||
|
||||
jwidget_init_theme(this);
|
||||
initTheme();
|
||||
}
|
||||
|
||||
Grid::~Grid()
|
||||
|
@ -106,8 +106,7 @@ void _ji_reinit_theme_in_all_widgets()
|
||||
for (c=0; c<widgets->size(); c++)
|
||||
if (_ji_is_valid_widget((*widgets)[c])) {
|
||||
(*widgets)[c]->setTheme(CurrentTheme::get());
|
||||
|
||||
jwidget_init_theme((*widgets)[c]);
|
||||
(*widgets)[c]->initTheme();
|
||||
}
|
||||
|
||||
// Remap the windows
|
||||
|
@ -15,7 +15,7 @@ Label::Label(const char *text)
|
||||
{
|
||||
this->setAlign(JI_LEFT | JI_MIDDLE);
|
||||
this->setText(text);
|
||||
jwidget_init_theme(this);
|
||||
initTheme();
|
||||
}
|
||||
|
||||
bool Label::onProcessMessage(JMessage msg)
|
||||
|
@ -34,7 +34,7 @@ JWidget jlistbox_new()
|
||||
|
||||
jwidget_add_hook(widget, JI_LISTBOX, listbox_msg_proc, NULL);
|
||||
jwidget_focusrest(widget, true);
|
||||
jwidget_init_theme(widget);
|
||||
widget->initTheme();
|
||||
|
||||
return widget;
|
||||
}
|
||||
@ -46,7 +46,7 @@ JWidget jlistitem_new(const char *text)
|
||||
jwidget_add_hook(widget, JI_LISTITEM, listitem_msg_proc, NULL);
|
||||
widget->setAlign(JI_LEFT | JI_MIDDLE);
|
||||
widget->setText(text);
|
||||
jwidget_init_theme(widget);
|
||||
widget->initTheme();
|
||||
|
||||
return widget;
|
||||
}
|
||||
|
@ -143,7 +143,7 @@ Widget* jmenu_new()
|
||||
menu->menuitem = NULL;
|
||||
|
||||
jwidget_add_hook(widget, JI_MENU, menu_msg_proc, menu);
|
||||
jwidget_init_theme(widget);
|
||||
widget->initTheme();
|
||||
|
||||
return widget;
|
||||
}
|
||||
@ -155,7 +155,7 @@ Widget* jmenubar_new()
|
||||
create_base(widget);
|
||||
|
||||
widget->type = JI_MENUBAR;
|
||||
jwidget_init_theme(widget);
|
||||
widget->initTheme();
|
||||
|
||||
return widget;
|
||||
}
|
||||
@ -169,7 +169,7 @@ Widget* jmenubox_new()
|
||||
|
||||
jwidget_add_hook(widget, JI_MENUBOX, menubox_msg_proc, menubox);
|
||||
jwidget_focusrest(widget, true);
|
||||
jwidget_init_theme(widget);
|
||||
widget->initTheme();
|
||||
|
||||
return widget;
|
||||
}
|
||||
@ -187,7 +187,7 @@ Widget* jmenuitem_new(const char *text)
|
||||
|
||||
jwidget_add_hook(widget, JI_MENUITEM, menuitem_msg_proc, menuitem);
|
||||
widget->setText(text);
|
||||
jwidget_init_theme(widget);
|
||||
widget->initTheme();
|
||||
|
||||
return widget;
|
||||
}
|
||||
|
@ -35,7 +35,7 @@ JWidget jpanel_new(int align)
|
||||
|
||||
panel->pos = 50;
|
||||
|
||||
jwidget_init_theme(widget);
|
||||
widget->initTheme();
|
||||
|
||||
return widget;
|
||||
}
|
||||
|
@ -34,7 +34,7 @@ PopupFrame::PopupFrame(const char* text, bool close_on_buttonpressed)
|
||||
JI_LIST_FOR_EACH_SAFE(this->children, link, next)
|
||||
jwidget_free(reinterpret_cast<JWidget>(link->data));
|
||||
|
||||
jwidget_init_theme(this);
|
||||
initTheme();
|
||||
jwidget_noborders(this);
|
||||
}
|
||||
|
||||
|
@ -24,7 +24,7 @@ JWidget ji_separator_new(const char* text, int align)
|
||||
jwidget_add_hook(widget, JI_SEPARATOR, separator_msg_proc, NULL);
|
||||
widget->setAlign(align);
|
||||
widget->setText(text);
|
||||
jwidget_init_theme(widget);
|
||||
widget->initTheme();
|
||||
|
||||
return widget;
|
||||
}
|
||||
|
@ -30,7 +30,7 @@ Slider::Slider(int min, int max, int value)
|
||||
m_value = MID(min, value, max);
|
||||
|
||||
jwidget_focusrest(this, true);
|
||||
jwidget_init_theme(this);
|
||||
initTheme();
|
||||
}
|
||||
|
||||
void Slider::setRange(int min, int max)
|
||||
|
@ -30,8 +30,7 @@ JWidget jtextbox_new(const char *text, int align)
|
||||
jwidget_focusrest(widget, true);
|
||||
widget->setAlign(align);
|
||||
widget->setText(text);
|
||||
|
||||
jwidget_init_theme(widget);
|
||||
widget->initTheme();
|
||||
|
||||
return widget;
|
||||
}
|
||||
|
@ -150,7 +150,7 @@ TipWindow::TipWindow(const char *text, bool close_on_buttonpressed)
|
||||
JI_LIST_FOR_EACH_SAFE(this->children, link, next)
|
||||
jwidget_free(reinterpret_cast<JWidget>(link->data));
|
||||
|
||||
jwidget_init_theme(this);
|
||||
initTheme();
|
||||
}
|
||||
|
||||
TipWindow::~TipWindow()
|
||||
|
@ -68,7 +68,7 @@ JWidget jview_new()
|
||||
jwidget_add_child(widget, view->viewport);
|
||||
jview_set_size(widget, 0, 0);
|
||||
|
||||
jwidget_init_theme(widget);
|
||||
widget->initTheme();
|
||||
|
||||
return widget;
|
||||
}
|
||||
@ -375,7 +375,7 @@ static JWidget viewport_new()
|
||||
Widget* widget = new Widget(JI_VIEW_VIEWPORT);
|
||||
|
||||
jwidget_add_hook(widget, JI_VIEW_VIEWPORT, viewport_msg_proc, NULL);
|
||||
jwidget_init_theme(widget);
|
||||
widget->initTheme();
|
||||
|
||||
return widget;
|
||||
}
|
||||
@ -456,7 +456,7 @@ static JWidget scrollbar_new(int align)
|
||||
|
||||
jwidget_add_hook(widget, JI_VIEW_SCROLLBAR, scrollbar_msg_proc, NULL);
|
||||
widget->setAlign(align);
|
||||
jwidget_init_theme(widget);
|
||||
widget->initTheme();
|
||||
|
||||
return widget;
|
||||
}
|
||||
|
@ -153,17 +153,15 @@ void jwidget_free_deferred(JWidget widget)
|
||||
jmanager_enqueue_message(msg);
|
||||
}
|
||||
|
||||
void jwidget_init_theme(JWidget widget)
|
||||
void Widget::initTheme()
|
||||
{
|
||||
ASSERT_VALID_WIDGET(widget);
|
||||
if (m_theme) {
|
||||
m_theme->init_widget(this);
|
||||
|
||||
if (widget->getTheme()) {
|
||||
widget->getTheme()->init_widget(widget);
|
||||
if (!(flags & JI_INITIALIZED))
|
||||
flags |= JI_INITIALIZED;
|
||||
|
||||
if (!(widget->flags & JI_INITIALIZED))
|
||||
widget->flags |= JI_INITIALIZED;
|
||||
|
||||
jwidget_emit_signal(widget, JI_SIGNAL_INIT_THEME);
|
||||
jwidget_emit_signal(this, JI_SIGNAL_INIT_THEME);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -34,8 +34,6 @@ int ji_register_widget_type();
|
||||
void jwidget_free(JWidget widget);
|
||||
void jwidget_free_deferred(JWidget widget);
|
||||
|
||||
void jwidget_init_theme(JWidget widget);
|
||||
|
||||
/* hooks */
|
||||
|
||||
void jwidget_add_hook(JWidget widget, int type,
|
||||
@ -216,6 +214,8 @@ public:
|
||||
Theme* getTheme() const { return m_theme; }
|
||||
void setTheme(Theme* theme);
|
||||
|
||||
void initTheme();
|
||||
|
||||
// ===============================================================
|
||||
// PARENTS & CHILDREN
|
||||
// ===============================================================
|
||||
|
@ -140,7 +140,7 @@ Frame* colorselector_new()
|
||||
|
||||
HOOK(pal, SIGNAL_PALETTE_EDITOR_CHANGE, paledit_change_hook, 0);
|
||||
|
||||
jwidget_init_theme(window);
|
||||
window->initTheme();
|
||||
return window;
|
||||
}
|
||||
|
||||
|
@ -75,7 +75,7 @@ Tabs::Tabs(ITabsHandler* handler)
|
||||
jwidget_add_hook(m_button_left, tabs_type(), tabs_button_msg_proc, (void *)-1);
|
||||
jwidget_add_hook(m_button_right, tabs_type(), tabs_button_msg_proc, (void *)+1);
|
||||
|
||||
jwidget_init_theme(this);
|
||||
initTheme();
|
||||
}
|
||||
|
||||
Tabs::~Tabs()
|
||||
|
Loading…
x
Reference in New Issue
Block a user