Debian Codegraph @

src/af/xap/xp/xap_CustomWidget.cpp

raw
1 /* AbiSource Application Framework
2 * Copyright (C) 2010 Patrik Fimml
3 *
4 * This program is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU General Public License
6 * as published by the Free Software Foundation; either version 2
7 * of the License, or (at your option) any later version.
8 *
9 * This program is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
13 *
14 * You should have received a copy of the GNU General Public License
15 * along with this program; if not, write to the Free Software
16 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
17 * 02110-1301 USA.
18 */
19
20 #include "xap_CustomWidget.h"
21
22 void XAP_CustomWidget::queueDraw(const UT_Rect *clip)
23 {
24 /* We provide a generic implementation here, calling draw() directly. On
25 * some platforms this may not be practical, so don't rely on this
26 * behaviour. In future this might default to a generic mechanism that
27 * combines multiple drawing requests.
28 */
29 draw(clip);
30 }
31
32 void XAP_CustomWidgetLU::queueDrawLU(const UT_Rect *clip)
33 {
34 GR_Graphics *gr = getGraphics();
35 UT_ASSERT(gr);
36
37 if (clip == NULL)
38 queueDraw();
39 else
40 {
41 UT_Rect r(
42 gr->tdu(clip->left),
43 gr->tdu(clip->top),
44 gr->tdu(clip->width),
45 gr->tdu(clip->height)
46 );
47 queueDraw(&r);
48 }
49 }
50
51 void XAP_CustomWidgetLU::draw(const UT_Rect *clip)
52 {
53 GR_Graphics *gr = getGraphics();
54 UT_ASSERT(gr);
55
56 if (clip == NULL)
57 drawLU(NULL);
58 else
59 {
60 UT_Rect r(
61 gr->tlu(clip->left),
62 gr->tlu(clip->top),
63 gr->tlu(clip->width),
64 gr->tlu(clip->height)
65 );
66 drawLU(&r);
67 }
68 }
69