diff --git a/src/app/widget_loader.cpp b/src/app/widget_loader.cpp index 1fbbbebd2..bcd0d6cd7 100644 --- a/src/app/widget_loader.cpp +++ b/src/app/widget_loader.cpp @@ -126,8 +126,8 @@ Widget* WidgetLoader::loadWidgetFromXmlFile(const char* xmlFilename, const char* Widget* WidgetLoader::convertXmlElementToWidget(const TiXmlElement* elem, Widget* root) { const char *elem_name = elem->Value(); - JWidget widget = NULL; - JWidget child; + Widget* widget = NULL; + Widget* child; // TODO error handling: add a message if the widget is bad specified diff --git a/src/commands/cmd_configure_tools.cpp b/src/commands/cmd_configure_tools.cpp index b2d99b987..77538ed6d 100644 --- a/src/commands/cmd_configure_tools.cpp +++ b/src/commands/cmd_configure_tools.cpp @@ -54,7 +54,7 @@ using namespace tools; static Frame* window = NULL; -static bool window_close_hook(JWidget widget, void *data); +static bool window_close_hook(Widget* widget, void *data); class BrushPreview : public Widget { diff --git a/src/commands/cmd_duplicate_sprite.cpp b/src/commands/cmd_duplicate_sprite.cpp index a9af65389..6e5207afe 100644 --- a/src/commands/cmd_duplicate_sprite.cpp +++ b/src/commands/cmd_duplicate_sprite.cpp @@ -59,7 +59,7 @@ bool DuplicateSpriteCommand::onEnabled(Context* context) void DuplicateSpriteCommand::onExecute(Context* context) { - JWidget src_name, dst_name, flatten; + Widget* src_name, *dst_name, *flatten; const ActiveDocumentReader document(context); char buf[1024]; diff --git a/src/commands/cmd_sprite_editor.cpp b/src/commands/cmd_sprite_editor.cpp index aa895a5b8..024ba7258 100644 --- a/src/commands/cmd_sprite_editor.cpp +++ b/src/commands/cmd_sprite_editor.cpp @@ -19,6 +19,7 @@ #include "config.h" #include "commands/command.h" +#include "gui/base.h" #include "modules/editors.h" ////////////////////////////////////////////////////////////////////// diff --git a/src/commands/cmd_sprite_properties.cpp b/src/commands/cmd_sprite_properties.cpp index 3aac09ff1..4d91fe09d 100644 --- a/src/commands/cmd_sprite_properties.cpp +++ b/src/commands/cmd_sprite_properties.cpp @@ -63,7 +63,7 @@ bool SpritePropertiesCommand::onEnabled(Context* context) void SpritePropertiesCommand::onExecute(Context* context) { - JWidget name, type, size, frames, ok, box_transparent; + Widget* name, *type, *size, *frames, *ok, *box_transparent; base::string imgtype_text; char buf[256]; ColorButton* color_button = NULL; diff --git a/src/commands/filters/color_curve_editor.cpp b/src/commands/filters/color_curve_editor.cpp index b1161549f..d1d42b3c3 100644 --- a/src/commands/filters/color_curve_editor.cpp +++ b/src/commands/filters/color_curve_editor.cpp @@ -353,7 +353,7 @@ gfx::Point* ColorCurveEditor::getClosestPoint(int x, int y, int** edit_x, int** int ColorCurveEditor::editNodeManually(gfx::Point& point) { - JWidget entry_x, entry_y, button_ok; + Widget* entry_x, *entry_y, *button_ok; gfx::Point point_copy = point; int res; diff --git a/src/dialogs/maskcol.cpp b/src/dialogs/maskcol.cpp index 6af862ab0..3d0520c4b 100644 --- a/src/dialogs/maskcol.cpp +++ b/src/dialogs/maskcol.cpp @@ -61,7 +61,7 @@ void dialogs_mask_color(Document* document) Widget* label_color; Button* button_1; Button* button_2; - JWidget label_tolerance; + Widget* label_tolerance; Button* button_ok; Button* button_cancel; Image *image; diff --git a/src/gui/base.h b/src/gui/base.h index c59e8ecb1..0974d40ba 100644 --- a/src/gui/base.h +++ b/src/gui/base.h @@ -157,15 +157,9 @@ typedef struct jlist* JList; typedef struct jstream* JStream; typedef struct jrect* JRect; typedef struct jregion* JRegion; -typedef class Widget* JWidget; -typedef struct jxml* JXml; -typedef struct jxmlattr* JXmlAttr; -typedef struct jxmlnode* JXmlNode; -typedef struct jxmlelem* JXmlElem; -typedef struct jxmltext* JXmlText; -typedef bool (*MessageFunc) (JWidget widget, Message* msg); -typedef void (*JDrawFunc) (JWidget widget, JRect clip); +typedef bool (*MessageFunc) (Widget* widget, Message* msg); +typedef void (*JDrawFunc) (Widget* widget, JRect clip); class Jinete { diff --git a/src/gui/box.cpp b/src/gui/box.cpp index 606cbba05..f9cf51b55 100644 --- a/src/gui/box.cpp +++ b/src/gui/box.cpp @@ -59,12 +59,12 @@ void Box::onPreferredSize(PreferredSizeEvent& ev) } int w, h, nvis_children; - JWidget child; + Widget* child; JLink link; nvis_children = 0; JI_LIST_FOR_EACH(this->children, link) { - child = (JWidget)link->data; + child = (Widget*)link->data; if (!(child->flags & JI_HIDDEN)) nvis_children++; } @@ -72,7 +72,7 @@ void Box::onPreferredSize(PreferredSizeEvent& ev) w = h = 0; JI_LIST_FOR_EACH(this->children, link) { - child = (JWidget)link->data; + child = (Widget*)link->data; if (child->flags & JI_HIDDEN) continue; @@ -135,7 +135,7 @@ void Box::layoutBox(JRect rect) - this->border_width.b); \ \ JI_LIST_FOR_EACH(this->children, link) { \ - child = (JWidget)link->data; \ + child = (Widget*)link->data; \ \ if (!(child->flags & JI_HIDDEN)) { \ if (this->getAlign() & JI_HOMOGENEOUS) { \ @@ -191,7 +191,7 @@ void Box::layoutBox(JRect rect) jrect_copy(this->rc, rect); JI_LIST_FOR_EACH(this->children, link) { - child = (JWidget)link->data; + child = (Widget*)link->data; if (!(child->flags & JI_HIDDEN)) { nvis_children++; diff --git a/src/gui/frame.cpp b/src/gui/frame.cpp index 9e600d07f..74af0003c 100644 --- a/src/gui/frame.cpp +++ b/src/gui/frame.cpp @@ -29,7 +29,7 @@ enum { static JRect click_pos = NULL; static int press_x, press_y; -static void displace_widgets(JWidget widget, int x, int y); +static void displace_widgets(Widget* widget, int x, int y); Frame::Frame(bool desktop, const char* text) : Widget(JI_FRAME) @@ -189,7 +189,7 @@ void Frame::remap_window() void Frame::center_window() { - JWidget manager = getManager(); + Widget* manager = getManager(); if (m_is_autoremap) this->remap_window(); @@ -261,7 +261,7 @@ void Frame::closeWindow(Widget* killer) bool Frame::is_toplevel() { - JWidget manager = getManager(); + Widget* manager = getManager(); if (!jlist_empty(manager->children)) return (this == jlist_first(manager->children)->data); @@ -450,7 +450,7 @@ bool Frame::onProcessMessage(Message* msg) void Frame::onPreferredSize(PreferredSizeEvent& ev) { - JWidget manager = getManager(); + Widget* manager = getManager(); if (m_is_desktop) { JRect cpos = jwidget_get_child_rect(manager); @@ -461,11 +461,11 @@ void Frame::onPreferredSize(PreferredSizeEvent& ev) else { Size maxSize(0, 0); Size reqSize; - JWidget child; + Widget* child; JLink link; JI_LIST_FOR_EACH(this->children, link) { - child = (JWidget)link->data; + child = (Widget*)link->data; if (!child->isDecorative()) { reqSize = child->getPreferredSize(); @@ -510,7 +510,7 @@ void Frame::onSetText() void Frame::window_set_position(JRect rect) { - JWidget child; + Widget* child; JRect cpos; JLink link; @@ -520,7 +520,7 @@ void Frame::window_set_position(JRect rect) /* set all the children to the same "child_pos" */ JI_LIST_FOR_EACH(this->children, link) { - child = (JWidget)link->data; + child = (Widget*)link->data; if (child->isDecorative()) child->getTheme()->map_decorative_widget(child); @@ -652,12 +652,12 @@ void Frame::move_window(JRect rect, bool use_blit) jrect_free(man_pos); } -static void displace_widgets(JWidget widget, int x, int y) +static void displace_widgets(Widget* widget, int x, int y) { JLink link; jrect_displace(widget->rc, x, y); JI_LIST_FOR_EACH(widget->children, link) - displace_widgets(reinterpret_cast(link->data), x, y); + displace_widgets(reinterpret_cast(link->data), x, y); } diff --git a/src/gui/frame.h b/src/gui/frame.h index 8748bdf84..63b9ebfc1 100644 --- a/src/gui/frame.h +++ b/src/gui/frame.h @@ -68,7 +68,7 @@ private: void limit_size(int* w, int* h); void move_window(JRect rect, bool use_blit); - JWidget m_killer; + Widget* m_killer; bool m_is_desktop : 1; bool m_is_moveable : 1; bool m_is_sizeable : 1; diff --git a/src/gui/listbox.cpp b/src/gui/listbox.cpp index d18fa6d60..fe16c1b5a 100644 --- a/src/gui/listbox.cpp +++ b/src/gui/listbox.cpp @@ -170,7 +170,7 @@ bool ListBox::onProcessMessage(Message* msg) } if (pick_item) { - JWidget picked; + Widget* picked; if (view) { picked = view->getViewport()->pick(msg->mouse.x, msg->mouse.y); @@ -301,7 +301,7 @@ void ListBox::onDoubleClickItem() void ListBox::layoutListBox(JRect rect) { Size reqSize; - JWidget child; + Widget* child; JRect cpos; JLink link; @@ -309,7 +309,7 @@ void ListBox::layoutListBox(JRect rect) cpos = jwidget_get_child_rect(this); JI_LIST_FOR_EACH(this->children, link) { - child = (JWidget)link->data; + child = (Widget*)link->data; reqSize = child->getPreferredSize(); diff --git a/src/gui/manager.cpp b/src/gui/manager.cpp index 3b57eb4c5..eee758914 100644 --- a/src/gui/manager.cpp +++ b/src/gui/manager.cpp @@ -50,7 +50,7 @@ struct Filter int message; Widget* widget; - Filter(int message, JWidget widget) + Filter(int message, Widget* widget) : message(message) , widget(widget) { } }; @@ -84,12 +84,12 @@ static unsigned key_repeated[KEY_MAX]; /* keyboard focus movement stuff */ static bool move_focus(gui::Manager* manager, Message* msg); static int count_widgets_accept_focus(Widget* widget); -static bool childs_accept_focus(JWidget widget, bool first); -static JWidget next_widget(JWidget widget); -static int cmp_left(JWidget widget, int x, int y); -static int cmp_right(JWidget widget, int x, int y); -static int cmp_up(JWidget widget, int x, int y); -static int cmp_down(JWidget widget, int x, int y); +static bool childs_accept_focus(Widget* widget, bool first); +static Widget* next_widget(Widget* widget); +static int cmp_left(Widget* widget, int x, int y); +static int cmp_right(Widget* widget, int x, int y); +static int cmp_up(Widget* widget, int x, int y); +static int cmp_down(Widget* widget, int x, int y); /* hooks the close-button in some platform with window support */ static void allegro_window_close_hook() @@ -211,8 +211,8 @@ void Manager::run() bool Manager::generateMessages() { - JWidget widget; - JWidget window; + Widget* widget; + Widget* window; int mousemove; Message* msg; JLink link; @@ -234,10 +234,10 @@ bool Manager::generateMessages() // New windows to show? if (!jlist_empty(new_windows)) { - JWidget magnet; + Widget* magnet; JI_LIST_FOR_EACH(new_windows, link) { - window = reinterpret_cast(link->data); + window = reinterpret_cast(link->data); // Relayout window->layout(); @@ -288,7 +288,7 @@ bool Manager::generateMessages() // Mouse movement if (mousemove) { - JWidget dst; + Widget* dst; // Reset double click status double_click_level = DOUBLE_CLICK_NONE; @@ -572,7 +572,7 @@ void Manager::setFocus(Widget* widget) && !(widget->flags & JI_DECORATIVE) && someParentIsFocusStop(widget)))) { JList widget_parents = NULL; - JWidget common_parent = NULL; + Widget* common_parent = NULL; JLink link, link2; Message* msg; @@ -591,7 +591,7 @@ void Manager::setFocus(Widget* widget) if (widget) { JI_LIST_FOR_EACH(widget_parents, link2) { if (link->data == link2->data) { - common_parent = reinterpret_cast(link->data); + common_parent = reinterpret_cast(link->data); break; } } @@ -599,9 +599,9 @@ void Manager::setFocus(Widget* widget) break; } - if (reinterpret_cast(link->data)->hasFocus()) { - ((JWidget)link->data)->flags &= ~JI_HASFOCUS; - jmessage_add_dest(msg, reinterpret_cast(link->data)); + if (reinterpret_cast(link->data)->hasFocus()) { + ((Widget*)link->data)->flags &= ~JI_HASFOCUS; + jmessage_add_dest(msg, reinterpret_cast(link->data)); } } @@ -622,7 +622,7 @@ void Manager::setFocus(Widget* widget) msg = jmessage_new(JM_FOCUSENTER); for (; link != widget_parents->end; link=link->next) { - JWidget w = (JWidget)link->data; + Widget* w = (Widget*)link->data; if (w->flags & JI_FOCUSSTOP) { w->flags |= JI_HASFOCUS; @@ -642,7 +642,7 @@ void Manager::setMouse(Widget* widget) { if ((mouse_widget != widget) && (!capture_widget)) { JList widget_parents = NULL; - JWidget common_parent = NULL; + Widget* common_parent = NULL; JLink link, link2; Message* msg; @@ -661,7 +661,7 @@ void Manager::setMouse(Widget* widget) if (widget) { JI_LIST_FOR_EACH(widget_parents, link2) { if (link->data == link2->data) { - common_parent = reinterpret_cast(link->data); + common_parent = reinterpret_cast(link->data); break; } } @@ -669,9 +669,9 @@ void Manager::setMouse(Widget* widget) break; } - if (reinterpret_cast(link->data)->hasMouse()) { - ((JWidget)link->data)->flags &= ~JI_HASMOUSE; - jmessage_add_dest(msg, reinterpret_cast(link->data)); + if (reinterpret_cast(link->data)->hasMouse()) { + ((Widget*)link->data)->flags &= ~JI_HASMOUSE; + jmessage_add_dest(msg, reinterpret_cast(link->data)); } } @@ -692,8 +692,8 @@ void Manager::setMouse(Widget* widget) msg = jmessage_new(JM_MOUSEENTER); for (; link != widget_parents->end; link=link->next) { - reinterpret_cast(link->data)->flags |= JI_HASMOUSE; - jmessage_add_dest(msg, reinterpret_cast(link->data)); + reinterpret_cast(link->data)->flags |= JI_HASMOUSE; + jmessage_add_dest(msg, reinterpret_cast(link->data)); } enqueueMessage(msg); @@ -714,7 +714,7 @@ void Manager::setCapture(Widget* widget) void Manager::attractFocus(Widget* widget) { /* get the magnetic widget */ - JWidget magnet = findMagneticWidget(widget->getRoot()); + Widget* magnet = findMagneticWidget(widget->getRoot()); /* if magnetic widget exists and it doesn't have the focus */ if (magnet && !magnet->hasFocus()) @@ -768,7 +768,7 @@ void Manager::removeMessage(Message* msg) jlist_remove(msg_queue, msg); } -void Manager::removeMessagesFor(JWidget widget) +void Manager::removeMessagesFor(Widget* widget) { JLink link; JI_LIST_FOR_EACH(msg_queue, link) @@ -790,7 +790,7 @@ void Manager::removeMessagesForTimer(gui::Timer* timer) } } -void Manager::addMessageFilter(int message, JWidget widget) +void Manager::addMessageFilter(int message, Widget* widget) { int c = message; if (c >= JM_REGISTERED_MESSAGES) @@ -799,7 +799,7 @@ void Manager::addMessageFilter(int message, JWidget widget) jlist_append(msg_filters[c], new Filter(message, widget)); } -void Manager::removeMessageFilter(int message, JWidget widget) +void Manager::removeMessageFilter(int message, Widget* widget) { JLink link, next; int c = message; @@ -815,7 +815,7 @@ void Manager::removeMessageFilter(int message, JWidget widget) } } -void Manager::removeMessageFilterFor(JWidget widget) +void Manager::removeMessageFilterFor(Widget* widget) { JLink link, next; int c; @@ -942,7 +942,7 @@ bool Manager::onProcessMessage(Message* msg) // Send to the window. JI_LIST_FOR_EACH(w->children, link2) - if (reinterpret_cast(link2->data)->sendMessage(msg)) + if (reinterpret_cast(link2->data)->sendMessage(msg)) return true; if (w->is_foreground() || @@ -984,7 +984,7 @@ void Manager::onPreferredSize(PreferredSizeEvent& ev) JLink link; JI_LIST_FOR_EACH(this->children, link) { - cpos = jwidget_get_rect(reinterpret_cast(link->data)); + cpos = jwidget_get_rect(reinterpret_cast(link->data)); jrect_union(pos, cpos); jrect_free(cpos); } @@ -1000,7 +1000,7 @@ void Manager::onPreferredSize(PreferredSizeEvent& ev) void Manager::layoutManager(JRect rect) { JRect cpos, old_pos; - JWidget child; + Widget* child; JLink link; int x, y; @@ -1063,7 +1063,7 @@ void Manager::pumpQueue() done = false; JI_LIST_FOR_EACH(msg->any.widgets, link2) { - widget = reinterpret_cast(link2->data); + widget = reinterpret_cast(link2->data); #ifdef REPORT_EVENTS { @@ -1257,7 +1257,7 @@ Widget* Manager::findMagneticWidget(Widget* widget) JLink link; JI_LIST_FOR_EACH(widget->children, link) { - found = findMagneticWidget(reinterpret_cast(link->data)); + found = findMagneticWidget(reinterpret_cast(link->data)); if (found) return found; } @@ -1269,7 +1269,7 @@ Widget* Manager::findMagneticWidget(Widget* widget) } // static -Message* Manager::newMouseMessage(int type, JWidget widget) +Message* Manager::newMouseMessage(int type, Widget* widget) { Message* msg = jmessage_new(type); if (!msg) @@ -1314,7 +1314,7 @@ void Manager::broadcastKeyMsg(Message* msg) static bool move_focus(gui::Manager* manager, Message* msg) { - int (*cmp)(JWidget, int, int) = NULL; + int (*cmp)(Widget*, int, int) = NULL; Widget* focus = NULL; Widget* it; bool ret = false; @@ -1392,7 +1392,7 @@ static bool move_focus(gui::Manager* manager, Message* msg) for (j=i+1; j (*cmp) (list[j], x, y)) { - JWidget tmp = list[i]; + Widget* tmp = list[i]; list[i] = list[j]; list[j] = tmp; } @@ -1427,7 +1427,7 @@ static int count_widgets_accept_focus(Widget* widget) JLink link; JI_LIST_FOR_EACH(widget->children, link) - count += count_widgets_accept_focus(reinterpret_cast(link->data)); + count += count_widgets_accept_focus(reinterpret_cast(link->data)); if ((count == 0) && (ACCEPT_FOCUS(widget))) count++; @@ -1435,26 +1435,26 @@ static int count_widgets_accept_focus(Widget* widget) return count; } -static bool childs_accept_focus(JWidget widget, bool first) +static bool childs_accept_focus(Widget* widget, bool first) { JLink link; JI_LIST_FOR_EACH(widget->children, link) - if (childs_accept_focus(reinterpret_cast(link->data), false)) + if (childs_accept_focus(reinterpret_cast(link->data), false)) return true; return first ? false: ACCEPT_FOCUS(widget); } -static JWidget next_widget(JWidget widget) +static Widget* next_widget(Widget* widget) { if (!jlist_empty(widget->children)) - return reinterpret_cast(jlist_first(widget->children)->data); + return reinterpret_cast(jlist_first(widget->children)->data); while (widget->parent->type != JI_MANAGER) { JLink link = jlist_find(widget->parent->children, widget); if (link->next != widget->parent->children->end) - return reinterpret_cast(link->next->data); + return reinterpret_cast(link->next->data); else widget = widget->parent; } @@ -1462,7 +1462,7 @@ static JWidget next_widget(JWidget widget) return NULL; } -static int cmp_left(JWidget widget, int x, int y) +static int cmp_left(Widget* widget, int x, int y) { int z = x - (widget->rc->x1+widget->rc->x2)/2; if (z <= 0) @@ -1470,7 +1470,7 @@ static int cmp_left(JWidget widget, int x, int y) return z + ABS((widget->rc->y1+widget->rc->y2)/2 - y) * 8; } -static int cmp_right(JWidget widget, int x, int y) +static int cmp_right(Widget* widget, int x, int y) { int z = (widget->rc->x1+widget->rc->x2)/2 - x; if (z <= 0) @@ -1478,7 +1478,7 @@ static int cmp_right(JWidget widget, int x, int y) return z + ABS((widget->rc->y1+widget->rc->y2)/2 - y) * 8; } -static int cmp_up(JWidget widget, int x, int y) +static int cmp_up(Widget* widget, int x, int y) { int z = y - (widget->rc->y1+widget->rc->y2)/2; if (z <= 0) @@ -1486,7 +1486,7 @@ static int cmp_up(JWidget widget, int x, int y) return z + ABS((widget->rc->x1+widget->rc->x2)/2 - x) * 8; } -static int cmp_down(JWidget widget, int x, int y) +static int cmp_down(Widget* widget, int x, int y) { int z = (widget->rc->y1+widget->rc->y2)/2 - y; if (z <= 0) diff --git a/src/gui/message.cpp b/src/gui/message.cpp index 818db8633..d3a531cb9 100644 --- a/src/gui/message.cpp +++ b/src/gui/message.cpp @@ -107,7 +107,7 @@ void jmessage_free(Message* msg) base_free(msg); } -void jmessage_add_dest(Message* msg, JWidget widget) +void jmessage_add_dest(Message* msg, Widget* widget) { ASSERT(msg != NULL); ASSERT_VALID_WIDGET(widget); @@ -115,7 +115,7 @@ void jmessage_add_dest(Message* msg, JWidget widget) jlist_append(msg->any.widgets, widget); } -void jmessage_add_pre_dest(Message* msg, JWidget widget) +void jmessage_add_pre_dest(Message* msg, Widget* widget) { ASSERT(msg != NULL); ASSERT_VALID_WIDGET(widget); @@ -123,7 +123,7 @@ void jmessage_add_pre_dest(Message* msg, JWidget widget) jlist_prepend(msg->any.widgets, widget); } -void jmessage_broadcast_to_children(Message* msg, JWidget widget) +void jmessage_broadcast_to_children(Message* msg, Widget* widget) { JLink link; @@ -131,12 +131,12 @@ void jmessage_broadcast_to_children(Message* msg, JWidget widget) ASSERT_VALID_WIDGET(widget); JI_LIST_FOR_EACH(widget->children, link) - jmessage_broadcast_to_children(msg, reinterpret_cast(link->data)); + jmessage_broadcast_to_children(msg, reinterpret_cast(link->data)); jmessage_add_dest(msg, widget); } -void jmessage_broadcast_to_parents(Message* msg, JWidget widget) +void jmessage_broadcast_to_parents(Message* msg, Widget* widget) { ASSERT(msg != NULL); ASSERT_VALID_WIDGET(widget); diff --git a/src/gui/message.h b/src/gui/message.h index 2ddf2300c..d44d00656 100644 --- a/src/gui/message.h +++ b/src/gui/message.h @@ -61,7 +61,7 @@ struct MessageSignal { MessageAny any; int num; /* signal number */ - JWidget from; /* signal generator */ + Widget* from; /* signal generator */ }; struct MessageTimer @@ -119,10 +119,10 @@ Message* jmessage_new_copy(const Message* msg); Message* jmessage_new_copy_without_dests(const Message* msg); void jmessage_free(Message* msg); -void jmessage_add_dest(Message* msg, JWidget widget); -void jmessage_add_pre_dest(Message* msg, JWidget widget); +void jmessage_add_dest(Message* msg, Widget* widget); +void jmessage_add_pre_dest(Message* msg, Widget* widget); -void jmessage_broadcast_to_children(Message* msg, JWidget widget); -void jmessage_broadcast_to_parents(Message* msg, JWidget widget); +void jmessage_broadcast_to_children(Message* msg, Widget* widget); +void jmessage_broadcast_to_parents(Message* msg, Widget* widget); #endif diff --git a/src/gui/popup_frame.cpp b/src/gui/popup_frame.cpp index 2f4e5beec..137d98e0c 100644 --- a/src/gui/popup_frame.cpp +++ b/src/gui/popup_frame.cpp @@ -153,11 +153,11 @@ void PopupFrame::onPreferredSize(PreferredSizeEvent& ev) if (!jlist_empty(this->children)) { Size maxSize(0, 0); Size reqSize; - JWidget child; + Widget* child; JLink link; JI_LIST_FOR_EACH(this->children, link) { - child = (JWidget)link->data; + child = (Widget*)link->data; reqSize = child->getPreferredSize(); diff --git a/src/gui/splitter.cpp b/src/gui/splitter.cpp index 466ee21d3..7414cf967 100644 --- a/src/gui/splitter.cpp +++ b/src/gui/splitter.cpp @@ -49,7 +49,7 @@ bool Splitter::onProcessMessage(Message* msg) case JM_BUTTONPRESSED: if (isEnabled()) { - JWidget c1, c2; + Widget* c1, *c2; int x1, y1, x2, y2; int bar, click_bar; JLink link; @@ -58,8 +58,8 @@ bool Splitter::onProcessMessage(Message* msg) JI_LIST_FOR_EACH(this->children, link) { if (link->next != this->children->end) { - c1 = reinterpret_cast(link->data); - c2 = reinterpret_cast(link->next->data); + c1 = reinterpret_cast(link->data); + c2 = reinterpret_cast(link->next->data); ++bar; @@ -117,15 +117,15 @@ bool Splitter::onProcessMessage(Message* msg) case JM_SETCURSOR: if (isEnabled()) { - JWidget c1, c2; + Widget* c1, *c2; JLink link; int x1, y1, x2, y2; bool change_cursor = false; JI_LIST_FOR_EACH(this->children, link) { if (link->next != this->children->end) { - c1 = reinterpret_cast(link->data); - c2 = reinterpret_cast(link->next->data); + c1 = reinterpret_cast(link->data); + c2 = reinterpret_cast(link->next->data); if (this->getAlign() & JI_HORIZONTAL) { x1 = c1->rc->x2; @@ -181,12 +181,12 @@ void Splitter::onPreferredSize(PreferredSizeEvent& ev) int visibleChildren; Size reqSize; - JWidget child; + Widget* child; JLink link; visibleChildren = 0; JI_LIST_FOR_EACH(this->children, link) { - child = (JWidget)link->data; + child = (Widget*)link->data; if (!(child->flags & JI_HIDDEN)) visibleChildren++; } @@ -195,7 +195,7 @@ void Splitter::onPreferredSize(PreferredSizeEvent& ev) w = h = 0; JI_LIST_FOR_EACH(this->children, link) { - child = (JWidget)link->data; + child = (Widget*)link->data; if (child->flags & JI_HIDDEN) continue; @@ -251,8 +251,8 @@ void Splitter::layoutMembers(JRect rect) jrect_copy(this->rc, rect); if (jlist_length(this->children) == 2) { - JWidget child1 = reinterpret_cast(jlist_first(this->children)->data); - JWidget child2 = reinterpret_cast(jlist_first(this->children)->next->data); + Widget* child1 = reinterpret_cast(jlist_first(this->children)->data); + Widget* child2 = reinterpret_cast(jlist_first(this->children)->next->data); //Size reqSize1 = child1->getPreferredSize(); //Size reqSize2 = child2->getPreferredSize(); diff --git a/src/gui/theme.cpp b/src/gui/theme.cpp index 583a50839..0573d38e8 100644 --- a/src/gui/theme.cpp +++ b/src/gui/theme.cpp @@ -152,7 +152,7 @@ void _ji_theme_draw_sprite_color(BITMAP *bmp, BITMAP *sprite, putpixel(bmp, x+u, y+v, color); } -void _ji_theme_textbox_draw(BITMAP *bmp, JWidget widget, +void _ji_theme_textbox_draw(BITMAP *bmp, Widget* widget, int *w, int *h, int bg, int fg) { View* view = View::getView(widget); diff --git a/src/gui/theme.h b/src/gui/theme.h index 7d7cdee23..e93c39099 100644 --- a/src/gui/theme.h +++ b/src/gui/theme.h @@ -35,9 +35,9 @@ public: void regenerate(); virtual BITMAP* set_cursor(int type, int *focus_x, int *focus_y) = 0; - virtual void init_widget(JWidget widget) = 0; - virtual JRegion get_window_mask(JWidget widget) = 0; - virtual void map_decorative_widget(JWidget widget) = 0; + virtual void init_widget(Widget* widget) = 0; + virtual JRegion get_window_mask(Widget* widget) = 0; + virtual void map_decorative_widget(Widget* widget) = 0; virtual int color_foreground() = 0; virtual int color_disabled() = 0; @@ -53,20 +53,20 @@ public: virtual void paintGrid(PaintEvent& ev) = 0; virtual void paintLabel(PaintEvent& ev) = 0; virtual void paintLinkLabel(PaintEvent& ev) = 0; - virtual void draw_listbox(JWidget widget, JRect clip) = 0; - virtual void draw_listitem(JWidget widget, JRect clip) = 0; + virtual void draw_listbox(Widget* widget, JRect clip) = 0; + virtual void draw_listitem(Widget* widget, JRect clip) = 0; virtual void draw_menu(Menu* menu, JRect clip) = 0; virtual void draw_menuitem(MenuItem* menuitem, JRect clip) = 0; - virtual void draw_panel(JWidget widget, JRect clip) = 0; + virtual void draw_panel(Widget* widget, JRect clip) = 0; virtual void paintRadioButton(PaintEvent& ev) = 0; - virtual void draw_separator(JWidget widget, JRect clip) = 0; + virtual void draw_separator(Widget* widget, JRect clip) = 0; virtual void paintSlider(PaintEvent& ev) = 0; virtual void draw_combobox_entry(Entry* widget, JRect clip) = 0; virtual void paintComboBoxButton(PaintEvent& ev) = 0; - virtual void draw_textbox(JWidget widget, JRect clip) = 0; - virtual void draw_view(JWidget widget, JRect clip) = 0; - virtual void draw_view_scrollbar(JWidget widget, JRect clip) = 0; - virtual void draw_view_viewport(JWidget widget, JRect clip) = 0; + virtual void draw_textbox(Widget* widget, JRect clip) = 0; + virtual void draw_view(Widget* widget, JRect clip) = 0; + virtual void draw_view_scrollbar(Widget* widget, JRect clip) = 0; + virtual void draw_view_viewport(Widget* widget, JRect clip) = 0; virtual void paintFrame(PaintEvent& ev) = 0; virtual void paintTooltip(PaintEvent& ev) = 0; diff --git a/src/gui/tooltips.cpp b/src/gui/tooltips.cpp index baae3b7d3..0ee28f48f 100644 --- a/src/gui/tooltips.cpp +++ b/src/gui/tooltips.cpp @@ -284,11 +284,11 @@ void TipWindow::onPreferredSize(PreferredSizeEvent& ev) if (!jlist_empty(this->children)) { Size maxSize(0, 0); Size reqSize; - JWidget child; + Widget* child; JLink link; JI_LIST_FOR_EACH(this->children, link) { - child = (JWidget)link->data; + child = (Widget*)link->data; reqSize = child->getPreferredSize(); diff --git a/src/gui/view.cpp b/src/gui/view.cpp index 7ab431b27..37c34f56b 100644 --- a/src/gui/view.cpp +++ b/src/gui/view.cpp @@ -282,5 +282,5 @@ void View::displaceWidgets(Widget* widget, int x, int y) jrect_displace(widget->rc, x, y); JI_LIST_FOR_EACH(widget->children, link) - displaceWidgets(reinterpret_cast(link->data), x, y); + displaceWidgets(reinterpret_cast(link->data), x, y); } diff --git a/src/gui/viewport.cpp b/src/gui/viewport.cpp index c26faa13e..502cc1e29 100644 --- a/src/gui/viewport.cpp +++ b/src/gui/viewport.cpp @@ -61,7 +61,7 @@ Size Viewport::calculateNeededSize() void Viewport::set_position(JRect rect) { Size reqSize; - JWidget child; + Widget* child; JRect cpos; JLink link; diff --git a/src/gui/widget.cpp b/src/gui/widget.cpp index 258a7e613..3ad67e14a 100644 --- a/src/gui/widget.cpp +++ b/src/gui/widget.cpp @@ -569,7 +569,7 @@ void Widget::setBorder(const Border& br) } /* gets the position of the widget */ -JRect jwidget_get_rect(JWidget widget) +JRect jwidget_get_rect(Widget* widget) { ASSERT_VALID_WIDGET(widget); @@ -577,7 +577,7 @@ JRect jwidget_get_rect(JWidget widget) } /* gets the position for children of the widget */ -JRect jwidget_get_child_rect(JWidget widget) +JRect jwidget_get_child_rect(Widget* widget) { ASSERT_VALID_WIDGET(widget); @@ -587,7 +587,7 @@ JRect jwidget_get_child_rect(JWidget widget) widget->rc->y2 - widget->border_width.b); } -JRegion jwidget_get_region(JWidget widget) +JRegion jwidget_get_region(Widget* widget) { JRegion region; @@ -602,9 +602,9 @@ JRegion jwidget_get_region(JWidget widget) } /* gets the region to be able to draw in */ -JRegion jwidget_get_drawable_region(JWidget widget, int flags) +JRegion jwidget_get_drawable_region(Widget* widget, int flags) { - JWidget window, manager, view, child; + Widget* window, *manager, *view, *child; JRegion region, reg1, reg2, reg3; JList windows_list; JLink link; @@ -628,7 +628,7 @@ JRegion jwidget_get_drawable_region(JWidget widget, int flags) link != windows_list->end) { /* subtract the rectangles */ for (link=link->prev; link != windows_list->end; link=link->prev) { - reg1 = jwidget_get_region(reinterpret_cast(link->data)); + reg1 = jwidget_get_region(reinterpret_cast(link->data)); jregion_subtract(region, region, reg1); jregion_free(reg1); } @@ -645,7 +645,7 @@ JRegion jwidget_get_drawable_region(JWidget widget, int flags) reg1 = jregion_new(NULL, 0); reg2 = jregion_new(cpos, 1); JI_LIST_FOR_EACH(widget->children, link) { - child = reinterpret_cast(link->data); + child = reinterpret_cast(link->data); if (child->isVisible()) { reg3 = jwidget_get_region(child); if (child->flags & JI_DECORATIVE) { @@ -666,7 +666,7 @@ JRegion jwidget_get_drawable_region(JWidget widget, int flags) /* intersect with the parent area */ if (!(widget->flags & JI_DECORATIVE)) { - JWidget parent = widget->parent; + Widget* parent = widget->parent; reg1 = jregion_new(NULL, 0); @@ -682,7 +682,7 @@ JRegion jwidget_get_drawable_region(JWidget widget, int flags) jregion_free(reg1); } else { - JWidget parent = widget->parent; + Widget* parent = widget->parent; if (parent) { cpos = jwidget_get_rect(parent); @@ -723,7 +723,7 @@ JRegion jwidget_get_drawable_region(JWidget widget, int flags) return region; } -int jwidget_get_bg_color(JWidget widget) +int jwidget_get_bg_color(Widget* widget) { ASSERT_VALID_WIDGET(widget); @@ -746,7 +746,7 @@ int jwidget_get_text_height(const Widget* widget) return text_height(widget->getFont()); } -void jwidget_get_texticon_info(JWidget widget, +void jwidget_get_texticon_info(Widget* widget, JRect box, JRect text, JRect icon, int icon_align, int icon_w, int icon_h) { @@ -849,7 +849,7 @@ void jwidget_get_texticon_info(JWidget widget, SETRECT(icon); } -void jwidget_noborders(JWidget widget) +void jwidget_noborders(Widget* widget) { widget->border_width.l = 0; widget->border_width.t = 0; @@ -860,7 +860,7 @@ void jwidget_noborders(JWidget widget) widget->invalidate(); } -void jwidget_set_border(JWidget widget, int value) +void jwidget_set_border(Widget* widget, int value) { ASSERT_VALID_WIDGET(widget); @@ -872,7 +872,7 @@ void jwidget_set_border(JWidget widget, int value) widget->invalidate(); } -void jwidget_set_border(JWidget widget, int l, int t, int r, int b) +void jwidget_set_border(Widget* widget, int l, int t, int r, int b) { ASSERT_VALID_WIDGET(widget); @@ -884,7 +884,7 @@ void jwidget_set_border(JWidget widget, int l, int t, int r, int b) widget->invalidate(); } -void jwidget_set_rect(JWidget widget, JRect rect) +void jwidget_set_rect(Widget* widget, JRect rect) { Message* msg; @@ -896,7 +896,7 @@ void jwidget_set_rect(JWidget widget, JRect rect) jmessage_free(msg); } -void jwidget_set_min_size(JWidget widget, int w, int h) +void jwidget_set_min_size(Widget* widget, int w, int h) { ASSERT_VALID_WIDGET(widget); @@ -904,7 +904,7 @@ void jwidget_set_min_size(JWidget widget, int w, int h) widget->min_h = h; } -void jwidget_set_max_size(JWidget widget, int w, int h) +void jwidget_set_max_size(Widget* widget, int w, int h) { ASSERT_VALID_WIDGET(widget); @@ -912,7 +912,7 @@ void jwidget_set_max_size(JWidget widget, int w, int h) widget->max_h = h; } -void jwidget_set_bg_color(JWidget widget, int color) +void jwidget_set_bg_color(Widget* widget, int color) { ASSERT_VALID_WIDGET(widget); @@ -1001,7 +1001,7 @@ void Widget::invalidate() mark_dirty_flag(this); JI_LIST_FOR_EACH(this->children, link) - reinterpret_cast(link->data)->invalidate(); + reinterpret_cast(link->data)->invalidate(); } } @@ -1242,7 +1242,7 @@ bool Widget::isScancodeMnemonic(int scancode) const bool Widget::onProcessMessage(Message* msg) { - JWidget widget = this; + Widget* widget = this; ASSERT(msg != NULL); ASSERT_VALID_WIDGET(widget); @@ -1256,7 +1256,7 @@ bool Widget::onProcessMessage(Message* msg) // Broadcast the message to the children. JI_LIST_FOR_EACH(widget->children, link) - reinterpret_cast(link->data)->sendMessage(msg); + reinterpret_cast(link->data)->sendMessage(msg); break; } @@ -1312,7 +1312,7 @@ bool Widget::onProcessMessage(Message* msg) // Set all the children to the same "cpos". JI_LIST_FOR_EACH(widget->children, link) - jwidget_set_rect(reinterpret_cast(link->data), cpos); + jwidget_set_rect(reinterpret_cast(link->data), cpos); jrect_free(cpos); return true; @@ -1322,7 +1322,7 @@ bool Widget::onProcessMessage(Message* msg) JLink link; JI_LIST_FOR_EACH(widget->children, link) - reinterpret_cast(link->data)->invalidate(); + reinterpret_cast(link->data)->invalidate(); return true; } @@ -1334,7 +1334,7 @@ bool Widget::onProcessMessage(Message* msg) // Broadcast the message to the children. JI_LIST_FOR_EACH(widget->children, link) - reinterpret_cast(link->data)->sendMessage(msg); + reinterpret_cast(link->data)->sendMessage(msg); } // Propagate the message to the parent. @@ -1390,7 +1390,7 @@ void Widget::onInvalidateRegion(const JRegion region) mark_dirty_flag(this); JI_LIST_FOR_EACH(this->children, link) - reinterpret_cast(link->data)->invalidateRegion(reg1); + reinterpret_cast(link->data)->invalidateRegion(reg1); jregion_free(reg1); } diff --git a/src/gui/widget.h b/src/gui/widget.h index 7848c4601..54c94cebf 100644 --- a/src/gui/widget.h +++ b/src/gui/widget.h @@ -36,24 +36,24 @@ int ji_register_widget_type(); // Position and geometry -JRect jwidget_get_rect(JWidget widget); -JRect jwidget_get_child_rect(JWidget widget); -JRegion jwidget_get_region(JWidget widget); -JRegion jwidget_get_drawable_region(JWidget widget, int flags); -int jwidget_get_bg_color(JWidget widget); +JRect jwidget_get_rect(Widget* widget); +JRect jwidget_get_child_rect(Widget* widget); +JRegion jwidget_get_region(Widget* widget); +JRegion jwidget_get_drawable_region(Widget* widget, int flags); +int jwidget_get_bg_color(Widget* widget); int jwidget_get_text_length(const Widget* widget); int jwidget_get_text_height(const Widget* widget); -void jwidget_get_texticon_info(JWidget widget, +void jwidget_get_texticon_info(Widget* widget, JRect box, JRect text, JRect icon, int icon_align, int icon_w, int icon_h); -void jwidget_noborders(JWidget widget); -void jwidget_set_border(JWidget widget, int value); -void jwidget_set_border(JWidget widget, int l, int t, int r, int b); -void jwidget_set_rect(JWidget widget, JRect rect); -void jwidget_set_min_size(JWidget widget, int w, int h); -void jwidget_set_max_size(JWidget widget, int w, int h); -void jwidget_set_bg_color(JWidget widget, int color); +void jwidget_noborders(Widget* widget); +void jwidget_set_border(Widget* widget, int value); +void jwidget_set_border(Widget* widget, int l, int t, int r, int b); +void jwidget_set_rect(Widget* widget, JRect rect); +void jwidget_set_min_size(Widget* widget, int w, int h); +void jwidget_set_max_size(Widget* widget, int w, int h); +void jwidget_set_bg_color(Widget* widget, int color); ////////////////////////////////////////////////////////////////////// @@ -77,7 +77,7 @@ public: /* structures */ JList children; /* sub-objects */ - JWidget parent; /* who is the parent? */ + Widget* parent; /* who is the parent? */ private: std::string m_id; // Widget's id diff --git a/src/modules/editors.cpp b/src/modules/editors.cpp index 1033ce842..7317f779e 100644 --- a/src/modules/editors.cpp +++ b/src/modules/editors.cpp @@ -434,10 +434,10 @@ void split_editor(Editor* editor, int align) } View* view = View::getView(editor); - JWidget parent_box = view->getParent(); // Box or splitter. + Widget* parent_box = view->getParent(); // Box or splitter. // Create a new box to contain both editors, and a new view to put the new editor. - JWidget new_splitter = new Splitter(align); + Widget* new_splitter = new Splitter(align); View* new_view = new EditorView(EditorView::CurrentEditorMode); Editor* new_editor = create_new_editor(); @@ -482,8 +482,8 @@ void split_editor(Editor* editor, int align) void close_editor(Editor* editor) { View* view = View::getView(editor); - JWidget parent_box = view->getParent(); // Box or panel - JWidget other_widget; + Widget* parent_box = view->getParent(); // Box or panel + Widget* other_widget; // You can't remove all (normal) editors. int normalEditors = 0; @@ -503,7 +503,7 @@ void close_editor(Editor* editor) delete view; // Fixup the parent. - other_widget = reinterpret_cast(jlist_first_data(parent_box->children)); + other_widget = reinterpret_cast(jlist_first_data(parent_box->children)); parent_box->removeChild(other_widget); parent_box->getParent()->replaceChild(parent_box, other_widget); @@ -511,7 +511,7 @@ void close_editor(Editor* editor) // Find next editor to select. if (!current_editor) { - JWidget next_editor = find_next_editor(other_widget); + Widget* next_editor = find_next_editor(other_widget); if (next_editor) { ASSERT(next_editor->type == editor_type()); @@ -533,7 +533,7 @@ void make_unique_editor(Editor* editor) { View* view = View::getView(editor); JLink link, next; - JWidget child; + Widget* child; // It's the unique editor. if (editors.size() == 1) @@ -544,7 +544,7 @@ void make_unique_editor(Editor* editor) // Remove all children of main_editor_box. JI_LIST_FOR_EACH_SAFE(box_editors->children, link, next) { - child = (JWidget)link->data; + child = (Widget*)link->data; box_editors->removeChild(child); delete child; // widget @@ -612,7 +612,7 @@ static Widget* find_next_editor(Widget* widget) } else { JI_LIST_FOR_EACH(widget->children, link) - if ((editor = find_next_editor(reinterpret_cast(link->data)))) + if ((editor = find_next_editor(reinterpret_cast(link->data)))) break; } diff --git a/src/modules/editors.h b/src/modules/editors.h index 63e88f462..7070aae2d 100644 --- a/src/modules/editors.h +++ b/src/modules/editors.h @@ -19,15 +19,13 @@ #ifndef MODULES_EDITORS_H_INCLUDED #define MODULES_EDITORS_H_INCLUDED -#include "app/color.h" -#include "gui/base.h" - class Document; class Editor; class Sprite; +class Widget; extern Editor* current_editor; -extern JWidget box_editors; +extern Widget* box_editors; int init_module_editors(); void exit_module_editors(); diff --git a/src/modules/gui.cpp b/src/modules/gui.cpp index 89a988e63..5d1978b69 100644 --- a/src/modules/gui.cpp +++ b/src/modules/gui.cpp @@ -168,7 +168,7 @@ static void reload_default_font(); static void load_gui_config(int& w, int& h, int& bpp, bool& fullscreen, bool& maximized); static void save_gui_config(); -static bool button_with_icon_msg_proc(JWidget widget, Message* msg); +static bool button_with_icon_msg_proc(Widget* widget, Message* msg); static void on_palette_change_signal(); @@ -619,7 +619,7 @@ static void reload_default_font() _ji_set_font_of_all_widgets(theme->default_font); } -void load_window_pos(JWidget window, const char *section) +void load_window_pos(Widget* window, const char *section) { // Default position Rect orig_pos = window->getBounds(); @@ -637,7 +637,7 @@ void load_window_pos(JWidget window, const char *section) window->setBounds(pos); } -void save_window_pos(JWidget window, const char *section) +void save_window_pos(Widget* window, const char *section) { set_config_rect(section, "WindowPos", window->getBounds()); } diff --git a/src/skin/skin_theme.cpp b/src/skin/skin_theme.cpp index 912299e9d..0f1ef2e8b 100644 --- a/src/skin/skin_theme.cpp +++ b/src/skin/skin_theme.cpp @@ -517,7 +517,7 @@ BITMAP* SkinTheme::set_cursor(int type, int* focus_x, int* focus_y) } } -void SkinTheme::init_widget(JWidget widget) +void SkinTheme::init_widget(Widget* widget) { #define BORDER(n) \ widget->border_width.l = (n); \ @@ -720,15 +720,15 @@ void SkinTheme::init_widget(JWidget widget) } } -JRegion SkinTheme::get_window_mask(JWidget widget) +JRegion SkinTheme::get_window_mask(Widget* widget) { return jregion_new(widget->rc, 1); } -void SkinTheme::map_decorative_widget(JWidget widget) +void SkinTheme::map_decorative_widget(Widget* widget) { if (widget->getId() == kThemeCloseButtonId) { - JWidget window = widget->parent; + Widget* window = widget->parent; JRect rect = jrect_new(0, 0, 0, 0); rect->x2 = m_part[PART_WINDOW_CLOSE_BUTTON_NORMAL]->w; @@ -1032,12 +1032,12 @@ void SkinTheme::paintLinkLabel(PaintEvent& ev) } } -void SkinTheme::draw_listbox(JWidget widget, JRect clip) +void SkinTheme::draw_listbox(Widget* widget, JRect clip) { jdraw_rectfill(widget->rc, COLOR_BACKGROUND); } -void SkinTheme::draw_listitem(JWidget widget, JRect clip) +void SkinTheme::draw_listitem(Widget* widget, JRect clip) { int fg, bg; int x, y; @@ -1194,7 +1194,7 @@ void SkinTheme::draw_menuitem(MenuItem* widget, JRect clip) } } -void SkinTheme::draw_panel(JWidget widget, JRect clip) +void SkinTheme::draw_panel(Widget* widget, JRect clip) { jdraw_rectfill(widget->rc, get_panel_face_color()); } @@ -1239,7 +1239,7 @@ void SkinTheme::paintRadioButton(PaintEvent& ev) } } -void SkinTheme::draw_separator(JWidget widget, JRect clip) +void SkinTheme::draw_separator(Widget* widget, JRect clip) { int x1, y1, x2, y2; @@ -1511,14 +1511,14 @@ void SkinTheme::paintComboBoxButton(PaintEvent& ev) } } -void SkinTheme::draw_textbox(JWidget widget, JRect clip) +void SkinTheme::draw_textbox(Widget* widget, JRect clip) { _ji_theme_textbox_draw(ji_screen, widget, NULL, NULL, this->textbox_bg_color, this->textbox_fg_color); } -void SkinTheme::draw_view(JWidget widget, JRect clip) +void SkinTheme::draw_view(Widget* widget, JRect clip) { draw_bounds_nw(ji_screen, widget->rc->x1, @@ -1530,7 +1530,7 @@ void SkinTheme::draw_view(JWidget widget, JRect clip) COLOR_BACKGROUND); } -void SkinTheme::draw_view_scrollbar(JWidget _widget, JRect clip) +void SkinTheme::draw_view_scrollbar(Widget* _widget, JRect clip) { ScrollBar* widget = static_cast(_widget); int x1, y1, x2, y2; @@ -1570,7 +1570,7 @@ void SkinTheme::draw_view_scrollbar(JWidget _widget, JRect clip) get_scrollbar_thumb_face_color()); } -void SkinTheme::draw_view_viewport(JWidget widget, JRect clip) +void SkinTheme::draw_view_viewport(Widget* widget, JRect clip) { jdraw_rectfill(widget->rc, BGCOLOR); } @@ -1691,7 +1691,7 @@ void SkinTheme::paintTooltip(PaintEvent& ev) g->drawString(widget->getText(), ji_color_foreground(), bg, rc, widget->getAlign()); } -int SkinTheme::get_bg_color(JWidget widget) +int SkinTheme::get_bg_color(Widget* widget) { int c = jwidget_get_bg_color(widget); bool decorative = widget->isDecorative(); @@ -1701,7 +1701,7 @@ int SkinTheme::get_bg_color(JWidget widget) } void SkinTheme::draw_textstring(const char *t, int fg_color, int bg_color, - bool fill_bg, JWidget widget, const JRect rect, + bool fill_bg, Widget* widget, const JRect rect, int selected_offset) { if (t || widget->hasText()) { @@ -1771,7 +1771,7 @@ void SkinTheme::draw_textstring(const char *t, int fg_color, int bg_color, } void SkinTheme::draw_textstring(Graphics* g, const char *t, int fg_color, int bg_color, - bool fill_bg, JWidget widget, const gfx::Rect& rc, + bool fill_bg, Widget* widget, const gfx::Rect& rc, int selected_offset) { if (t || widget->hasText()) { diff --git a/src/skin/skin_theme.h b/src/skin/skin_theme.h index a8b5c2579..6e6cd03d3 100644 --- a/src/skin/skin_theme.h +++ b/src/skin/skin_theme.h @@ -56,9 +56,9 @@ public: void reload_fonts(); BITMAP* set_cursor(int type, int* focus_x, int* focus_y); - void init_widget(JWidget widget); - JRegion get_window_mask(JWidget widget); - void map_decorative_widget(JWidget widget); + void init_widget(Widget* widget); + JRegion get_window_mask(Widget* widget); + void map_decorative_widget(Widget* widget); int color_foreground(); int color_disabled(); @@ -74,20 +74,20 @@ public: void paintGrid(PaintEvent& ev); void paintLabel(PaintEvent& ev); void paintLinkLabel(PaintEvent& ev); - void draw_listbox(JWidget widget, JRect clip); - void draw_listitem(JWidget widget, JRect clip); + void draw_listbox(Widget* widget, JRect clip); + void draw_listitem(Widget* widget, JRect clip); void draw_menu(Menu* menu, JRect clip); void draw_menuitem(MenuItem* menuitem, JRect clip); - void draw_panel(JWidget widget, JRect clip); + void draw_panel(Widget* widget, JRect clip); void paintRadioButton(PaintEvent& ev); - void draw_separator(JWidget widget, JRect clip); + void draw_separator(Widget* widget, JRect clip); void paintSlider(PaintEvent& ev); void draw_combobox_entry(Entry* widget, JRect clip); void paintComboBoxButton(PaintEvent& ev); - void draw_textbox(JWidget widget, JRect clip); - void draw_view(JWidget widget, JRect clip); - void draw_view_scrollbar(JWidget widget, JRect clip); - void draw_view_viewport(JWidget widget, JRect clip); + void draw_textbox(Widget* widget, JRect clip); + void draw_view(Widget* widget, JRect clip); + void draw_view_scrollbar(Widget* widget, JRect clip); + void draw_view_viewport(Widget* widget, JRect clip); void paintFrame(PaintEvent& ev); void draw_frame_button(ButtonBase* widget, JRect clip); void paintTooltip(PaintEvent& ev); @@ -168,12 +168,12 @@ private: int nw, int n, int ne, int e, int se, int s, int sw, int w); BITMAP* cropPartFromSheet(BITMAP* bmp, int x, int y, int w, int h, bool cursor = false); - int get_bg_color(JWidget widget); + int get_bg_color(Widget* widget); void draw_textstring(const char *t, int fg_color, int bg_color, - bool fill_bg, JWidget widget, const JRect rect, + bool fill_bg, Widget* widget, const JRect rect, int selected_offset); void draw_textstring(Graphics* g, const char *t, int fg_color, int bg_color, - bool fill_bg, JWidget widget, const gfx::Rect& rc, + bool fill_bg, Widget* widget, const gfx::Rect& rc, int selected_offset); void draw_entry_caret(Entry* widget, int x, int y); void draw_bevel_box(int x1, int y1, int x2, int y2, int c1, int c2, int *bevel); diff --git a/src/widgets/button_set.cpp b/src/widgets/button_set.cpp index 1473ffe48..7c80daf1c 100644 --- a/src/widgets/button_set.cpp +++ b/src/widgets/button_set.cpp @@ -31,8 +31,8 @@ #include "modules/gui.h" #include "widgets/button_set.h" -static JWidget find_selected(JWidget widget); -static int select_button(JWidget widget, int index); +static Widget* find_selected(Widget* widget); +static int select_button(Widget* widget, int index); class ButtonSet::Item : public RadioButton { diff --git a/src/widgets/editor/editor_view.cpp b/src/widgets/editor/editor_view.cpp index fc56967cb..661937378 100644 --- a/src/widgets/editor/editor_view.cpp +++ b/src/widgets/editor/editor_view.cpp @@ -56,7 +56,7 @@ bool EditorView::onProcessMessage(Message* msg) case JM_DRAW: { Widget* viewport = getViewport(); - Widget* child = reinterpret_cast(jlist_first_data(viewport->children)); + Widget* child = reinterpret_cast(jlist_first_data(viewport->children)); JRect pos = jwidget_get_rect(this); SkinTheme* theme = static_cast(getTheme()); bool selected = false; diff --git a/src/widgets/toolbar.cpp b/src/widgets/toolbar.cpp index eae201958..b07b7b7a2 100644 --- a/src/widgets/toolbar.cpp +++ b/src/widgets/toolbar.cpp @@ -130,17 +130,17 @@ static Size getToolIconSize(Widget* widget) ////////////////////////////////////////////////////////////////////// // ToolBar -JWidget toolbar_new() +Widget* toolbar_new() { return new ToolBar(); } -bool toolbar_is_tool_visible(JWidget toolbar, Tool* tool) +bool toolbar_is_tool_visible(Widget* toolbar, Tool* tool) { return ((ToolBar*)toolbar)->isToolVisible(tool); } -void toolbar_select_tool(JWidget toolbar, Tool* tool) +void toolbar_select_tool(Widget* toolbar, Tool* tool) { ((ToolBar*)toolbar)->selectTool(tool); } diff --git a/src/widgets/toolbar.h b/src/widgets/toolbar.h index 504cd6ad3..3e50d6737 100644 --- a/src/widgets/toolbar.h +++ b/src/widgets/toolbar.h @@ -19,13 +19,12 @@ #ifndef WIDGETS_TOOLBAR_H_INCLUDED #define WIDGETS_TOOLBAR_H_INCLUDED -#include "gui/base.h" - +class Widget; namespace tools { class Tool; } -JWidget toolbar_new(); +Widget* toolbar_new(); -bool toolbar_is_tool_visible(JWidget toolbar, tools::Tool* tool); -void toolbar_select_tool(JWidget toolbar, tools::Tool* tool); +bool toolbar_is_tool_visible(Widget* toolbar, tools::Tool* tool); +void toolbar_select_tool(Widget* toolbar, tools::Tool* tool); #endif