2006-06-26 17:18:28 +00:00
|
|
|
/**
|
2006-09-22 09:47:39 +00:00
|
|
|
* \file qt4/GuiApplication.h
|
2006-06-26 17:18:28 +00:00
|
|
|
* This file is part of LyX, the document processor.
|
|
|
|
* Licence details can be found in the file COPYING.
|
|
|
|
*
|
|
|
|
* \author unknown
|
|
|
|
* \author John Levon
|
|
|
|
* \author Abdelrazak Younes
|
|
|
|
*
|
|
|
|
* Full author contact details are available in file CREDITS.
|
|
|
|
*/
|
|
|
|
|
2006-09-22 09:47:39 +00:00
|
|
|
#ifndef QT4_APPLICATION_H
|
|
|
|
#define QT4_APPLICATION_H
|
2006-06-26 17:18:28 +00:00
|
|
|
|
2006-09-26 09:57:47 +00:00
|
|
|
#include "ColorCache.h"
|
2006-10-03 16:17:32 +00:00
|
|
|
#include "GuiFontLoader.h"
|
2006-09-22 15:02:41 +00:00
|
|
|
#include "GuiClipboard.h"
|
|
|
|
#include "GuiImplementation.h"
|
|
|
|
#include "GuiSelection.h"
|
2006-06-26 17:18:28 +00:00
|
|
|
|
2006-09-22 09:47:39 +00:00
|
|
|
#include "frontends/Application.h"
|
|
|
|
|
2006-06-26 17:18:28 +00:00
|
|
|
#include <QApplication>
|
|
|
|
|
|
|
|
///////////////////////////////////////////////////////////////
|
|
|
|
// Specific stuff
|
|
|
|
|
|
|
|
#ifdef Q_WS_MACX
|
|
|
|
#include <Carbon/Carbon.h>
|
|
|
|
#endif
|
|
|
|
///////////////////////////////////////////////////////////////
|
|
|
|
|
|
|
|
class BufferView;
|
2006-10-12 14:10:13 +00:00
|
|
|
class socket_callback;
|
2006-06-26 17:18:28 +00:00
|
|
|
|
|
|
|
namespace lyx {
|
|
|
|
namespace frontend {
|
|
|
|
|
|
|
|
class GuiWorkArea;
|
|
|
|
|
|
|
|
/// The Qt main application class
|
|
|
|
/**
|
|
|
|
There should be only one instance of this class. No Qt object
|
|
|
|
initialisation should be done before the instanciation of this class.
|
|
|
|
|
|
|
|
\todo The work areas handling could be moved to a base virtual class
|
|
|
|
comon to all frontends.
|
|
|
|
*/
|
2006-09-22 09:47:39 +00:00
|
|
|
class GuiApplication : public QApplication, public Application
|
2006-06-26 17:18:28 +00:00
|
|
|
{
|
|
|
|
public:
|
2006-09-22 09:47:39 +00:00
|
|
|
GuiApplication(int & argc, char ** argv);
|
2006-10-03 10:34:10 +00:00
|
|
|
///
|
2006-10-13 16:48:12 +00:00
|
|
|
virtual ~GuiApplication();
|
2006-09-22 09:47:39 +00:00
|
|
|
|
|
|
|
/// Method inherited from \c Application class
|
|
|
|
//@{
|
2006-09-22 15:02:41 +00:00
|
|
|
virtual Clipboard& clipboard();
|
|
|
|
virtual Selection& selection();
|
2006-10-03 16:17:32 +00:00
|
|
|
virtual FontLoader & fontLoader() { return font_loader_; }
|
2006-09-22 09:47:39 +00:00
|
|
|
virtual int const exec();
|
|
|
|
virtual Gui & gui() { return gui_; }
|
|
|
|
virtual void exit(int status);
|
2006-10-12 14:10:13 +00:00
|
|
|
void syncEvents();
|
2006-10-03 10:34:10 +00:00
|
|
|
virtual std::string const romanFontName();
|
|
|
|
virtual std::string const sansFontName();
|
|
|
|
virtual std::string const typewriterFontName();
|
2006-10-12 14:10:13 +00:00
|
|
|
virtual bool getRgbColor(LColor_color col, lyx::RGBColor & rgbcol);
|
|
|
|
virtual std::string const hexName(LColor_color col);
|
|
|
|
virtual void updateColor(LColor_color col);
|
|
|
|
virtual void registerSocketCallback(
|
|
|
|
int fd, boost::function<void()> func);
|
|
|
|
virtual void unregisterSocketCallback(int fd);
|
2006-09-22 09:47:39 +00:00
|
|
|
//@}
|
2006-06-26 17:18:28 +00:00
|
|
|
|
2006-09-26 09:57:47 +00:00
|
|
|
///
|
|
|
|
ColorCache & colorCache() { return color_cache_; }
|
2006-06-26 17:18:28 +00:00
|
|
|
///
|
2006-10-03 16:17:32 +00:00
|
|
|
///
|
|
|
|
GuiFontLoader & guiFontLoader() { return font_loader_; }
|
2006-06-26 17:18:28 +00:00
|
|
|
|
2006-09-22 09:47:39 +00:00
|
|
|
private:
|
2006-06-26 17:18:28 +00:00
|
|
|
///
|
|
|
|
GuiImplementation gui_;
|
2006-09-22 15:02:41 +00:00
|
|
|
///
|
|
|
|
GuiClipboard clipboard_;
|
|
|
|
///
|
|
|
|
GuiSelection selection_;
|
2006-06-26 17:18:28 +00:00
|
|
|
///
|
2006-10-03 16:17:32 +00:00
|
|
|
GuiFontLoader font_loader_;
|
2006-09-26 09:57:47 +00:00
|
|
|
///
|
|
|
|
ColorCache color_cache_;
|
2006-10-12 14:10:13 +00:00
|
|
|
///
|
|
|
|
std::map<int, boost::shared_ptr<socket_callback> > socket_callbacks_;
|
2006-06-26 17:18:28 +00:00
|
|
|
|
|
|
|
#ifdef Q_WS_X11
|
|
|
|
public:
|
|
|
|
bool x11EventFilter (XEvent * ev);
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#ifdef Q_WS_MACX
|
|
|
|
public:
|
|
|
|
bool macEventFilter(EventRef event);
|
|
|
|
private:
|
|
|
|
// static OSStatus handleOpenDocuments(
|
|
|
|
static pascal OSErr handleOpenDocuments(
|
|
|
|
const AppleEvent* inEvent, AppleEvent*, long);
|
|
|
|
#endif
|
2006-09-22 09:47:39 +00:00
|
|
|
}; // GuiApplication
|
2006-06-26 17:18:28 +00:00
|
|
|
|
|
|
|
} // namespace frontend
|
|
|
|
} // namespace lyx
|
|
|
|
|
2006-09-22 09:47:39 +00:00
|
|
|
extern lyx::frontend::GuiApplication * guiApp;
|
2006-06-26 17:18:28 +00:00
|
|
|
|
|
|
|
|
2006-09-22 09:47:39 +00:00
|
|
|
#endif // QT4_APPLICATION_H
|