2 * Copyright (C) 2006 Dirk Mueller <mueller@kde.org>
3 * Copyright (C) 2006 George Stiakos <staikos@kde.org>
4 * Copyright (C) 2006 Zack Rusin <zack@kde.org>
5 * Copyright (C) 2006 Nikolas Zimmermann <zimmermann@kde.org>
9 * Redistribution and use in source and binary forms, with or without
10 * modification, are permitted provided that the following conditions
12 * 1. Redistributions of source code must retain the above copyright
13 * notice, this list of conditions and the following disclaimer.
14 * 2. Redistributions in binary form must reproduce the above copyright
15 * notice, this list of conditions and the following disclaimer in the
16 * documentation and/or other materials provided with the distribution.
18 * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY
19 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
20 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
21 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR
22 * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
23 * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
24 * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
25 * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
26 * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
27 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
28 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
37 #include "RenderObject.h"
38 #include "GraphicsContext.h"
42 #define notImplemented() do { fprintf(stderr, "FIXME: UNIMPLEMENTED: %s:%d\n", __FILE__, __LINE__); } while(0)
48 WidgetPrivate() : m_parent(0), m_widget(0) { }
49 ~WidgetPrivate() { delete m_widget; }
57 : data(new WidgetPrivate())
67 void Widget::setClient(WidgetClient* c)
72 WidgetClient* Widget::client() const
78 IntRect Widget::frameGeometry() const
83 return data->m_widget->geometry();
86 bool Widget::hasFocus() const
91 return data->m_widget->hasFocus();
94 void Widget::setFocus()
97 data->m_widget->setFocus();
100 void Widget::clearFocus()
103 data->m_widget->clearFocus();
106 const Font& Widget::font() const
111 void Widget::setFont(const Font& font)
114 data->m_widget->setFont(font);
117 void Widget::setCursor(const Cursor& cursor)
120 data->m_widget->setCursor(cursor.impl());
126 data->m_widget->show();
132 data->m_widget->hide();
135 void Widget::setQWidget(QWidget* child)
137 delete data->m_widget;
138 data->m_widget = child;
141 QWidget* Widget::qwidget()
143 return data->m_widget;
146 void Widget::setParentWidget(QWidget* parent)
148 data->m_parent = parent;
151 QWidget* Widget::parentWidget() const
153 return data->m_parent;
156 void Widget::setFrameGeometry(const IntRect& r)
161 data->m_widget->setGeometry(r);
164 IntPoint Widget::mapFromGlobal(const IntPoint& p) const
169 return data->m_widget->mapFromGlobal(p);
172 float Widget::scaleFactor() const
177 GraphicsContext* Widget::lockDrawingFocus()
183 void Widget::unlockDrawingFocus(GraphicsContext*)
188 void Widget::paint(GraphicsContext*, IntRect const&)
193 void Widget::enableFlushDrawing()
198 bool Widget::isEnabled() const
203 return data->m_widget->isEnabled();
206 void Widget::setIsSelected(bool)
211 void Widget::disableFlushDrawing()
216 void Widget::setEnabled(bool en)
219 data->m_widget->setEnabled(en);
222 Widget::FocusPolicy Widget::focusPolicy() const
227 switch (data->m_widget->focusPolicy())
233 case Qt::StrongFocus: