summaryrefslogtreecommitdiff
path: root/navit/graphics/qt5/graphics_qt5.h
blob: f9d19616b2290f4ba9c06bb75e07a9ce7c9df022 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
/**
 * Navit, a modular navigation system.
 * Copyright (C) 2005-2017 Navit Team
 *
 * This program is free software; you can redistribute it and/or
 * modify it under the terms of the GNU General Public License
 * version 2 as published by the Free Software Foundation.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program; if not, write to the
 * Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
 * Boston, MA  02110-1301, USA.
 */
// style with: clang-format -style=WebKit -i *

#ifndef __graphics_qt_h
#define __graphics_qt_h

#ifndef USE_QWIDGET
#define USE_QWIDGET 1
#endif

#ifndef USE_QML
#define USE_QML 0
#endif

#include <QBrush>
#include <QGuiApplication>
#include <QPainter>
#include <QPen>
#include <QPixmap>
#include <glib.h>
#if USE_QML
#include <QObject>
#include <QQmlApplicationEngine>
#include <QQuickWindow>
#endif
#if USE_QWIDGET
#include "QNavitWidget.h"
#endif

#ifndef HAVE_FREETYPE
#define HAVE_FREETYPE 0
#endif

#ifndef SAILFISH_OS
#define SAILFISH_OS 1
#endif

#if HAVE_FREETYPE
#include "navit/font/freetype/font_freetype.h"
#endif

struct graphics_gc_priv;
struct graphics_priv;

#if USE_QML
class GraphicsPriv : public QObject {
    Q_OBJECT
public:
    GraphicsPriv(struct graphics_priv* gp);
    ~GraphicsPriv();
    void emit_update();

    struct graphics_priv* gp;

signals:
    void update();
};
#endif

struct graphics_priv {
#if USE_QML
    QQmlApplicationEngine* engine;
    GraphicsPriv* GPriv;
    QQuickWindow* window;
#endif
#if USE_QWIDGET
    QNavitWidget* widget;
#endif
    QPixmap* pixmap;
    QPainter* painter;
    int use_count;
    int disable;
    int x;
    int y;
    int scroll_x;
    int scroll_y;
    struct graphics_gc_priv* background_graphics_gc_priv;
#if HAVE_FREETYPE
    struct font_priv* (*font_freetype_new)(void* meth);
    struct font_freetype_methods freetype_methods;
#endif
#ifdef SAILFISH_OS
    struct callback* display_on_cb;
    struct event_timeout* display_on_ev;
#endif
    struct callback_list* callbacks;
    GHashTable* overlays;
    struct graphics_priv* parent;
    bool root;
    int argc;
    char* argv[4];
};

struct graphics_gc_priv {
    struct graphics_priv* graphics_priv;
    QPen* pen;
    QBrush* brush;
};
/* central exported application info */
extern QGuiApplication* navit_app;

void resize_callback(struct graphics_priv* gr, int w, int h);

#endif