| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2006 Michael Emmel mike.emmel@gmail.com | 2 * Copyright (C) 2006 Michael Emmel mike.emmel@gmail.com |
| 3 * Copyright (C) 2007 Holger Hans Peter Freyther | 3 * Copyright (C) 2007 Holger Hans Peter Freyther |
| 4 * All rights reserved. | 4 * All rights reserved. |
| 5 * | 5 * |
| 6 * Redistribution and use in source and binary forms, with or without | 6 * Redistribution and use in source and binary forms, with or without |
| 7 * modification, are permitted provided that the following conditions | 7 * modification, are permitted provided that the following conditions |
| 8 * are met: | 8 * are met: |
| 9 * 1. Redistributions of source code must retain the above copyright | 9 * 1. Redistributions of source code must retain the above copyright |
| 10 * notice, this list of conditions and the following disclaimer. | 10 * notice, this list of conditions and the following disclaimer. |
| (...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 88 gtk_widget_show(platformWidget()); | 88 gtk_widget_show(platformWidget()); |
| 89 } | 89 } |
| 90 | 90 |
| 91 void Widget::hide() | 91 void Widget::hide() |
| 92 { | 92 { |
| 93 if (!platformWidget()) | 93 if (!platformWidget()) |
| 94 return; | 94 return; |
| 95 gtk_widget_hide(platformWidget()); | 95 gtk_widget_hide(platformWidget()); |
| 96 } | 96 } |
| 97 | 97 |
| 98 /* | 98 void Widget::paint(GraphicsContext* context, const IntRect& rect) |
| 99 * Strategy to painting a Widget: | |
| 100 * 1.) do not paint if there is no GtkWidget set | |
| 101 * 2.) We assume that GTK_NO_WINDOW is set and that frameRectsChanged positione
d | |
| 102 * the widget correctly. ATM we do not honor the GraphicsContext translatio
n. | |
| 103 */ | |
| 104 void Widget::paint(GraphicsContext* context, const IntRect&) | |
| 105 { | 99 { |
| 106 if (!platformWidget()) | |
| 107 return; | |
| 108 | |
| 109 if (!context->gdkExposeEvent()) | |
| 110 return; | |
| 111 | |
| 112 GtkWidget* widget = platformWidget(); | |
| 113 ASSERT(GTK_WIDGET_NO_WINDOW(widget)); | |
| 114 | |
| 115 GdkEvent* event = gdk_event_new(GDK_EXPOSE); | |
| 116 event->expose = *context->gdkExposeEvent(); | |
| 117 event->expose.region = gtk_widget_region_intersect(widget, event->expose.reg
ion); | |
| 118 | |
| 119 /* | |
| 120 * This will be unref'ed by gdk_event_free. | |
| 121 */ | |
| 122 g_object_ref(event->expose.window); | |
| 123 | |
| 124 /* | |
| 125 * If we are going to paint do the translation and GtkAllocation manipulatio
n. | |
| 126 */ | |
| 127 if (!gdk_region_empty(event->expose.region)) { | |
| 128 gdk_region_get_clipbox(event->expose.region, &event->expose.area); | |
| 129 gtk_widget_send_expose(widget, event); | |
| 130 } | |
| 131 | |
| 132 gdk_event_free(event); | |
| 133 } | 100 } |
| 134 | 101 |
| 135 void Widget::setIsSelected(bool) | 102 void Widget::setIsSelected(bool) |
| 136 { | 103 { |
| 137 notImplemented(); | 104 notImplemented(); |
| 138 } | 105 } |
| 139 | 106 |
| 140 IntRect Widget::frameRect() const | 107 IntRect Widget::frameRect() const |
| 141 { | 108 { |
| 142 return m_frame; | 109 return m_frame; |
| (...skipping 12 matching lines...) Expand all Loading... |
| 155 } | 122 } |
| 156 | 123 |
| 157 void Widget::retainPlatformWidget() | 124 void Widget::retainPlatformWidget() |
| 158 { | 125 { |
| 159 if (!platformWidget()) | 126 if (!platformWidget()) |
| 160 return; | 127 return; |
| 161 g_object_ref_sink(platformWidget()); | 128 g_object_ref_sink(platformWidget()); |
| 162 } | 129 } |
| 163 | 130 |
| 164 } | 131 } |
| OLD | NEW |