2008-04-24 12:49:12 +00:00
|
|
|
/***************************************************************************
|
|
|
|
|
|
|
|
main.h
|
|
|
|
|
2013-08-03 15:38:01 +00:00
|
|
|
(c) 2000-2013 Benoît Minisini <gambas@users.sourceforge.net>
|
2008-04-24 12:49:12 +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
|
2009-08-17 10:41:51 +00:00
|
|
|
the Free Software Foundation; either version 2, or (at your option)
|
2008-04-24 12:49:12 +00:00
|
|
|
any later version.
|
|
|
|
|
|
|
|
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
|
2011-06-03 00:51:09 +00:00
|
|
|
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
|
2011-12-31 02:39:20 +00:00
|
|
|
MA 02110-1301, USA.
|
2008-04-24 12:49:12 +00:00
|
|
|
|
|
|
|
***************************************************************************/
|
|
|
|
|
|
|
|
#ifndef __MAIN_H
|
|
|
|
#define __MAIN_H
|
|
|
|
|
|
|
|
#include "gambas.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>
|
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"
|
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;
|
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;
|
2008-04-24 12:49:12 +00:00
|
|
|
#ifndef NO_X_WINDOW
|
|
|
|
extern int MAIN_x11_last_key_code;
|
|
|
|
#endif
|
2010-01-01 21:32:45 +00:00
|
|
|
|
|
|
|
extern GB_CLASS CLASS_Control;
|
|
|
|
extern GB_CLASS CLASS_Container;
|
|
|
|
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_ScrollView;
|
|
|
|
extern GB_CLASS CLASS_Image;
|
|
|
|
extern GB_CLASS CLASS_SvgImage;
|
2011-05-02 00:46:00 +00:00
|
|
|
extern GB_CLASS CLASS_TextArea;
|
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
|
|
|
|
{
|
|
|
|
Q_OBJECT
|
|
|
|
|
|
|
|
public:
|
|
|
|
|
|
|
|
static bool in_check;
|
|
|
|
|
|
|
|
public slots:
|
|
|
|
|
|
|
|
void check(void);
|
|
|
|
};
|
|
|
|
|
|
|
|
class MyApplication: public QApplication
|
|
|
|
{
|
|
|
|
Q_OBJECT
|
|
|
|
|
|
|
|
public:
|
|
|
|
|
|
|
|
MyApplication(int &argc, char **argv);
|
|
|
|
#ifndef NO_X_WINDOW
|
|
|
|
virtual bool x11EventFilter(XEvent *e);
|
|
|
|
#endif
|
|
|
|
virtual bool eventFilter(QObject *o, QEvent *e);
|
2008-04-29 13:40:55 +00:00
|
|
|
//virtual bool notify(QObject *o, QEvent *e);
|
2008-04-24 12:49:12 +00:00
|
|
|
|
|
|
|
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();
|
2008-04-24 12:49:12 +00:00
|
|
|
|
|
|
|
static QEventLoop *eventLoop;
|
2009-07-24 13:05:24 +00:00
|
|
|
|
2014-07-20 14:41:54 +00:00
|
|
|
|
2009-07-24 13:05:24 +00:00
|
|
|
public slots:
|
|
|
|
|
|
|
|
void linkDestroyed(QObject *);
|
2012-07-16 16:30:55 +00:00
|
|
|
void clipboardHasChanged();
|
2014-07-20 14:41:54 +00:00
|
|
|
void commitDataRequested(QSessionManager &);
|
2008-04-24 12:49:12 +00:00
|
|
|
|
|
|
|
private:
|
|
|
|
static bool _tooltip_disable;
|
|
|
|
static int _event_filter;
|
|
|
|
};
|
|
|
|
|
|
|
|
class MyTimer : public QObject
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
|
|
|
|
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:
|
|
|
|
|
|
|
|
void timerEvent(QTimerEvent *);
|
|
|
|
|
|
|
|
private:
|
|
|
|
|
|
|
|
GB_TIMER *timer;
|
|
|
|
intptr_t id;
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
#define UTF8_NBUF 4
|
|
|
|
|
|
|
|
void MAIN_check_quit(void);
|
|
|
|
void MAIN_update_scale(void);
|
2009-01-03 22:24:02 +00:00
|
|
|
void MAIN_process_events(void);
|
2008-04-24 12:49:12 +00:00
|
|
|
|
|
|
|
const char *QT_ToUTF8(const QString &str);
|
|
|
|
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 *);
|
2008-04-29 13:40:55 +00:00
|
|
|
|
2008-04-24 12:49:12 +00:00
|
|
|
#endif
|