2008-04-24 12:49:12 +00:00
|
|
|
/***************************************************************************
|
|
|
|
|
2015-05-08 17:40:28 +00:00
|
|
|
main.h
|
2008-04-24 12:49:12 +00:00
|
|
|
|
2018-02-12 02:53:46 +01:00
|
|
|
(c) 2000-2017 Benoît Minisini <g4mba5@gmail.com>
|
2008-04-24 12:49:12 +00:00
|
|
|
|
2015-05-08 17:40:28 +00:00
|
|
|
This program is free software; you can redistribute it and/or modify
|
|
|
|
it under the terms of the GNU General Public License as published by
|
|
|
|
the Free Software Foundation; either version 2, or (at your option)
|
|
|
|
any later version.
|
2008-04-24 12:49:12 +00:00
|
|
|
|
2015-05-08 17:40:28 +00:00
|
|
|
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.
|
2008-04-24 12:49:12 +00:00
|
|
|
|
2015-05-08 17:40:28 +00:00
|
|
|
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.
|
2008-04-24 12:49:12 +00:00
|
|
|
|
|
|
|
***************************************************************************/
|
|
|
|
|
|
|
|
#ifndef __MAIN_H
|
|
|
|
#define __MAIN_H
|
|
|
|
|
2008-04-29 13:40:55 +00:00
|
|
|
#include <QEvent>
|
|
|
|
#include <QApplication>
|
2008-04-24 12:49:12 +00:00
|
|
|
#include <QTimerEvent>
|
|
|
|
#include <QEventLoop>
|
2014-07-20 14:41:54 +00:00
|
|
|
#include <QSessionManager>
|
2015-06-13 08:14:40 +00:00
|
|
|
#include <QClipboard>
|
2015-10-03 23:57:14 +00:00
|
|
|
#include <QFont>
|
2008-04-24 12:49:12 +00:00
|
|
|
|
2019-07-03 10:27:12 +02:00
|
|
|
#include "gb_common.h"
|
|
|
|
#include "gambas.h"
|
|
|
|
|
2008-04-24 12:49:12 +00:00
|
|
|
#define DO_NOT_USE_QT_INTERFACE
|
|
|
|
#include "gb.qt.h"
|
2009-01-16 23:12:10 +00:00
|
|
|
#include "gb.image.h"
|
2016-07-17 16:15:07 +00:00
|
|
|
#include "gb.geom.h"
|
2008-04-24 12:49:12 +00:00
|
|
|
|
|
|
|
#ifndef __MAIN_CPP
|
2012-08-25 15:13:39 +00:00
|
|
|
extern "C" const GB_INTERFACE *GB_PTR;
|
2009-01-16 23:12:10 +00:00
|
|
|
extern "C" IMAGE_INTERFACE IMAGE;
|
2016-07-17 16:15:07 +00:00
|
|
|
extern "C" GEOM_INTERFACE GEOM;
|
|
|
|
|
2008-04-24 12:49:12 +00:00
|
|
|
extern int MAIN_in_wait;
|
2009-09-08 12:22:03 +00:00
|
|
|
extern int MAIN_in_message_box;
|
2008-04-24 12:49:12 +00:00
|
|
|
extern int MAIN_loop_level;
|
|
|
|
extern int MAIN_scale;
|
2012-08-19 13:01:57 +00:00
|
|
|
extern bool MAIN_debug_busy;
|
2015-02-05 00:25:29 +00:00
|
|
|
extern bool MAIN_init;
|
2017-09-07 22:00:17 +02:00
|
|
|
extern bool MAIN_key_debug;
|
2019-05-08 19:40:39 +02:00
|
|
|
extern bool MAIN_right_to_left;
|
2008-04-24 12:49:12 +00:00
|
|
|
#ifndef NO_X_WINDOW
|
|
|
|
extern int MAIN_x11_last_key_code;
|
2020-07-14 17:58:15 +02:00
|
|
|
#define MAIN_platform "x11"
|
|
|
|
#else
|
|
|
|
#define MAIN_platform ""
|
2008-04-24 12:49:12 +00:00
|
|
|
#endif
|
2010-01-01 21:32:45 +00:00
|
|
|
|
|
|
|
extern GB_CLASS CLASS_Control;
|
|
|
|
extern GB_CLASS CLASS_Container;
|
2018-09-24 15:39:37 +02:00
|
|
|
extern GB_CLASS CLASS_ContainerChildren;
|
2010-01-01 21:32:45 +00:00
|
|
|
extern GB_CLASS CLASS_UserControl;
|
|
|
|
extern GB_CLASS CLASS_UserContainer;
|
2010-01-10 13:40:48 +00:00
|
|
|
extern GB_CLASS CLASS_TabStrip;
|
2010-01-01 21:32:45 +00:00
|
|
|
extern GB_CLASS CLASS_Window;
|
|
|
|
extern GB_CLASS CLASS_Menu;
|
|
|
|
extern GB_CLASS CLASS_Picture;
|
|
|
|
extern GB_CLASS CLASS_Drawing;
|
|
|
|
extern GB_CLASS CLASS_DrawingArea;
|
2011-01-24 14:37:11 +00:00
|
|
|
extern GB_CLASS CLASS_ScrollArea;
|
2010-01-01 21:32:45 +00:00
|
|
|
extern GB_CLASS CLASS_Printer;
|
|
|
|
extern GB_CLASS CLASS_Image;
|
|
|
|
extern GB_CLASS CLASS_SvgImage;
|
2011-05-02 00:46:00 +00:00
|
|
|
extern GB_CLASS CLASS_TextArea;
|
2021-02-26 11:31:33 +01:00
|
|
|
extern GB_CLASS CLASS_ComboBox;
|
2010-01-01 21:32:45 +00:00
|
|
|
|
2008-04-24 12:49:12 +00:00
|
|
|
#endif
|
|
|
|
|
2012-08-25 15:13:39 +00:00
|
|
|
#define GB (*GB_PTR)
|
|
|
|
|
2008-04-24 12:49:12 +00:00
|
|
|
class MyPostCheck: public QObject
|
|
|
|
{
|
2015-05-08 17:40:28 +00:00
|
|
|
Q_OBJECT
|
2008-04-24 12:49:12 +00:00
|
|
|
|
|
|
|
public:
|
|
|
|
|
2015-05-08 17:40:28 +00:00
|
|
|
static bool in_check;
|
2008-04-24 12:49:12 +00:00
|
|
|
|
|
|
|
public slots:
|
|
|
|
|
2015-05-08 17:40:28 +00:00
|
|
|
void check(void);
|
2008-04-24 12:49:12 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
class MyApplication: public QApplication
|
|
|
|
{
|
2015-05-08 17:40:28 +00:00
|
|
|
Q_OBJECT
|
2008-04-24 12:49:12 +00:00
|
|
|
|
|
|
|
public:
|
|
|
|
|
2015-05-08 17:40:28 +00:00
|
|
|
MyApplication(int &argc, char **argv);
|
|
|
|
#ifndef QT5
|
|
|
|
virtual bool x11EventFilter(XEvent *e);
|
|
|
|
#endif
|
|
|
|
virtual bool eventFilter(QObject *o, QEvent *e);
|
|
|
|
//virtual bool notify(QObject *o, QEvent *e);
|
|
|
|
|
|
|
|
static void setEventFilter(bool set);
|
|
|
|
|
|
|
|
static bool isTooltipEnabled() { return !_tooltip_disable; }
|
|
|
|
static void setTooltipEnabled(bool b);
|
|
|
|
|
2012-07-16 16:30:55 +00:00
|
|
|
static void initClipboard();
|
2015-05-08 17:40:28 +00:00
|
|
|
|
|
|
|
static QEventLoop *eventLoop;
|
2014-07-20 14:41:54 +00:00
|
|
|
|
2009-07-24 13:05:24 +00:00
|
|
|
public slots:
|
2015-05-08 17:40:28 +00:00
|
|
|
|
2009-07-24 13:05:24 +00:00
|
|
|
void linkDestroyed(QObject *);
|
2015-06-13 08:14:40 +00:00
|
|
|
void clipboardHasChanged(QClipboard::Mode);
|
2014-07-20 14:41:54 +00:00
|
|
|
void commitDataRequested(QSessionManager &);
|
2015-05-08 17:40:28 +00:00
|
|
|
|
2008-04-24 12:49:12 +00:00
|
|
|
private:
|
2015-05-08 17:40:28 +00:00
|
|
|
static bool _tooltip_disable;
|
|
|
|
static int _event_filter;
|
2008-04-24 12:49:12 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
class MyTimer : public QObject
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
|
2015-05-08 17:40:28 +00:00
|
|
|
MyTimer(GB_TIMER *timer);
|
|
|
|
~MyTimer();
|
2009-07-07 09:17:48 +00:00
|
|
|
void clearTimer() { timer = 0; }
|
2008-04-24 12:49:12 +00:00
|
|
|
|
|
|
|
protected:
|
|
|
|
|
2015-05-08 17:40:28 +00:00
|
|
|
void timerEvent(QTimerEvent *);
|
2008-04-24 12:49:12 +00:00
|
|
|
|
|
|
|
private:
|
|
|
|
|
|
|
|
GB_TIMER *timer;
|
|
|
|
intptr_t id;
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
#define UTF8_NBUF 4
|
|
|
|
|
|
|
|
void MAIN_check_quit(void);
|
2015-10-03 23:57:14 +00:00
|
|
|
void MAIN_update_scale(const QFont &);
|
2009-01-03 22:24:02 +00:00
|
|
|
void MAIN_process_events(void);
|
2015-02-05 00:25:29 +00:00
|
|
|
void MAIN_init_error(void);
|
|
|
|
|
|
|
|
#define MAIN_CHECK_INIT() (MAIN_init ? 0 : (MAIN_init_error(), 1))
|
2008-04-24 12:49:12 +00:00
|
|
|
|
2015-05-08 06:33:25 +00:00
|
|
|
const char *QT_ToUtf8(const QString &str);
|
|
|
|
int QT_GetLastUtf8Length();
|
|
|
|
char *QT_NewString(const QString &str);
|
|
|
|
void QT_ReturnNewString(const QString &str);
|
2008-04-24 12:49:12 +00:00
|
|
|
void QT_RegisterAction(void *object, const char *key, int on);
|
|
|
|
void QT_RaiseAction(const char *key);
|
2009-07-23 16:53:06 +00:00
|
|
|
void *QT_GetObject(QWidget *);
|
2009-07-24 13:05:24 +00:00
|
|
|
void QT_Link(QObject *, void *);
|
|
|
|
void *QT_GetLink(QObject *);
|
[INTERPRETER]
* NEW: Add a new GB.Component.Declare() API, that allows a component to
dynamically register a class description.
[INFORMER]
* NEW: A component now can declare classes through a GB_OPTIONAL_CLASSES
public symbol. Theses classes are included into the information file,
but are not automatically loaded as the ones defined through the
GB_CLASSES symbol.
[GB.FORM.STATUSICON]
* NEW: This component has been removed and replaced by gb.dbus.trayicon.
* NEW: This component now provide TrayIcon and TrayIcons classes that have
exactly the same interface as the old ones.
[GB.DBUS]
* NEW: Remove the now useless DBusConnection.Raise(). The DBusConnection
Register() and Unregister() are kept for backward-compatibility reason.
* NEW: Add DBus.Raise() and DBus[].Raise() to raise signals. At the moment,
there is no difference between the two methods, as there no mean to
indicate the sender raising a signal. I don't know yet how DBus decides
which service sends a signal!
[GB.DBUS.TRAYICON]
* NEW: This component implements the tray icon DBus protocol. It is
automatically loaded by the GUI components.
[GB.GTK]
* NEW: Load the 'gb.dbus' and 'gb.dbus.trayicon' components if the current
desktop is KDE >= 4. Otherwise, use the old TrayIcon implementation.
* BUG: Fix the old TrayIcon implementation, so that it matches the QT one.
[GB.GTK3]
* NEW: Load the 'gb.dbus' and 'gb.dbus.trayicon' components if the current
desktop is KDE >= 4. Otherwise, use the old TrayIcon implementation.
* BUG: Fix the component name in deprecation warning messages.
* BUG: Fix the old TrayIcon implementation, so that it matches the QT one.
[GB.QT4]
* NEW: Load the 'gb.dbus' and 'gb.dbus.trayicon' components if the current
desktop is KDE >= 4. Otherwise, use the old TrayIcon implementation.
[GB.QT5]
* NEW: Load the 'gb.dbus' and 'gb.dbus.trayicon' components if the current
desktop is KDE >= 4. Otherwise, use the old TrayIcon implementation.
git-svn-id: svn://localhost/gambas/trunk@7154 867c0c6c-44f3-4631-809d-bfa615b0a4ec
2015-06-29 01:46:51 +00:00
|
|
|
void QT_PreventQuit(bool inc);
|
|
|
|
QMenu *QT_FindMenu(void *parent, const char *name);
|
2008-04-29 13:40:55 +00:00
|
|
|
|
2008-04-24 12:49:12 +00:00
|
|
|
#endif
|