2006-03-05 17:24:44 +00:00
|
|
|
|
// -*- C++ -*-
|
|
|
|
|
/**
|
2006-06-20 09:33:01 +00:00
|
|
|
|
* \file GuiView.h
|
2006-03-05 17:24:44 +00:00
|
|
|
|
* This file is part of LyX, the document processor.
|
|
|
|
|
* Licence details can be found in the file COPYING.
|
|
|
|
|
*
|
|
|
|
|
* \author Lars Gullik Bjornes
|
|
|
|
|
* \author John Levon
|
|
|
|
|
* \author Abdelrazak Younes
|
2006-11-29 10:04:35 +00:00
|
|
|
|
* \author Peter K<EFBFBD>mmel
|
2006-03-05 17:24:44 +00:00
|
|
|
|
*
|
|
|
|
|
* Full author contact details are available in file CREDITS.
|
|
|
|
|
*/
|
|
|
|
|
|
2006-06-26 16:55:35 +00:00
|
|
|
|
#ifndef GUI_VIEW_H
|
|
|
|
|
#define GUI_VIEW_H
|
2006-03-05 17:24:44 +00:00
|
|
|
|
|
|
|
|
|
#include "frontends/LyXView.h"
|
2007-04-26 04:41:58 +00:00
|
|
|
|
#include "FuncRequest.h"
|
2006-03-05 17:24:44 +00:00
|
|
|
|
|
|
|
|
|
#include <QAction>
|
|
|
|
|
#include <QCloseEvent>
|
2007-08-14 13:20:16 +00:00
|
|
|
|
#include <QMainWindow>
|
2007-10-06 15:48:58 +00:00
|
|
|
|
#include <QTabWidget>
|
2007-08-14 13:20:16 +00:00
|
|
|
|
#include <QTimer>
|
2006-03-05 17:24:44 +00:00
|
|
|
|
|
2007-08-14 13:20:16 +00:00
|
|
|
|
class QDragEnterEvent;
|
|
|
|
|
class QDropEvent;
|
2006-11-08 23:10:46 +00:00
|
|
|
|
class QMenu;
|
2007-08-14 13:20:16 +00:00
|
|
|
|
class QToolBar;
|
2006-03-05 17:24:44 +00:00
|
|
|
|
|
|
|
|
|
namespace lyx {
|
|
|
|
|
namespace frontend {
|
|
|
|
|
|
2007-10-01 20:45:50 +00:00
|
|
|
|
class GuiToolbar;
|
2007-10-06 15:48:58 +00:00
|
|
|
|
class GuiWorkArea;
|
2007-10-01 20:45:50 +00:00
|
|
|
|
|
2007-09-05 20:33:29 +00:00
|
|
|
|
QWidget * mainWindow();
|
2006-03-05 17:24:44 +00:00
|
|
|
|
|
|
|
|
|
/**
|
2006-06-20 09:33:01 +00:00
|
|
|
|
* GuiView - Qt4 implementation of LyXView
|
2006-03-05 17:24:44 +00:00
|
|
|
|
*
|
2006-06-26 16:55:35 +00:00
|
|
|
|
* qt4-private implementation of the main LyX window.
|
2006-10-24 15:01:07 +00:00
|
|
|
|
*
|
2007-08-31 05:53:55 +00:00
|
|
|
|
* Note: a QObject emits a destroyed(QObject *) Qt signal when it
|
|
|
|
|
* is deleted. This might be useful for closing other dialogs
|
|
|
|
|
* depending on a given GuiView.
|
2006-03-05 17:24:44 +00:00
|
|
|
|
*/
|
2007-11-05 13:52:37 +00:00
|
|
|
|
class GuiView : public QMainWindow, public LyXView
|
2007-09-05 20:33:29 +00:00
|
|
|
|
{
|
2006-03-05 17:24:44 +00:00
|
|
|
|
Q_OBJECT
|
|
|
|
|
public:
|
2006-06-26 16:55:35 +00:00
|
|
|
|
/// create a main window of the given dimensions
|
2007-11-05 13:52:37 +00:00
|
|
|
|
GuiView(int id);
|
2006-03-05 17:24:44 +00:00
|
|
|
|
|
2007-11-05 13:52:37 +00:00
|
|
|
|
~GuiView();
|
2006-03-05 17:24:44 +00:00
|
|
|
|
|
2006-06-26 16:55:35 +00:00
|
|
|
|
virtual void init();
|
2006-10-23 16:29:24 +00:00
|
|
|
|
virtual void close();
|
2006-12-23 17:09:50 +00:00
|
|
|
|
virtual void setFocus();
|
2006-09-29 23:10:17 +00:00
|
|
|
|
virtual void setGeometry(
|
|
|
|
|
unsigned int width,
|
|
|
|
|
unsigned int height,
|
|
|
|
|
int posx, int posy,
|
2007-03-17 12:28:26 +00:00
|
|
|
|
int maximized,
|
2006-11-29 16:45:38 +00:00
|
|
|
|
unsigned int iconSizeXY,
|
|
|
|
|
const std::string & geometryArg);
|
2006-10-23 16:29:24 +00:00
|
|
|
|
virtual void saveGeometry();
|
2007-10-23 21:41:17 +00:00
|
|
|
|
virtual void setBusy(bool);
|
2007-01-31 02:39:46 +00:00
|
|
|
|
/// add toolbar, if newline==true, add a toolbar break before the toolbar
|
2007-10-01 20:45:50 +00:00
|
|
|
|
GuiToolbar * makeToolbar(ToolbarInfo const & tbinfo, bool newline);
|
2006-10-23 16:29:24 +00:00
|
|
|
|
virtual void updateStatusBar();
|
2007-04-25 16:39:21 +00:00
|
|
|
|
virtual void message(docstring const & str);
|
2006-03-05 17:24:44 +00:00
|
|
|
|
virtual void clearMessage();
|
2006-10-23 16:29:24 +00:00
|
|
|
|
virtual bool hasFocus() const;
|
2007-08-23 12:21:47 +00:00
|
|
|
|
void showMiniBuffer(bool);
|
2007-08-23 12:44:21 +00:00
|
|
|
|
void openMenu(docstring const &);
|
2007-10-01 20:45:50 +00:00
|
|
|
|
void openLayoutList();
|
2007-11-10 00:21:42 +00:00
|
|
|
|
void updateLayoutChoice(bool force);
|
2007-10-01 20:45:50 +00:00
|
|
|
|
bool isToolbarVisible(std::string const & id);
|
|
|
|
|
void updateToolbars();
|
|
|
|
|
ToolbarInfo * getToolbarInfo(std::string const & name);
|
|
|
|
|
void toggleToolbarState(std::string const & name, bool allowauto);
|
2006-03-05 17:24:44 +00:00
|
|
|
|
|
2006-10-23 16:29:24 +00:00
|
|
|
|
/// show - display the top-level window
|
2007-09-03 20:28:26 +00:00
|
|
|
|
void showView();
|
2006-07-13 16:37:55 +00:00
|
|
|
|
|
2006-03-05 17:24:44 +00:00
|
|
|
|
/// menu item has been selected
|
|
|
|
|
void activated(FuncRequest const &);
|
|
|
|
|
|
2006-11-08 23:10:46 +00:00
|
|
|
|
QMenu* createPopupMenu();
|
|
|
|
|
|
2007-11-11 10:09:48 +00:00
|
|
|
|
void addTabWorkArea();
|
|
|
|
|
|
2006-10-23 16:29:24 +00:00
|
|
|
|
Q_SIGNALS:
|
|
|
|
|
void closing(int);
|
2006-03-05 17:24:44 +00:00
|
|
|
|
|
2006-06-30 14:37:33 +00:00
|
|
|
|
public Q_SLOTS:
|
2006-03-05 17:24:44 +00:00
|
|
|
|
/// idle timeout
|
|
|
|
|
void update_view_state_qt();
|
|
|
|
|
|
2007-11-11 22:30:21 +00:00
|
|
|
|
///
|
|
|
|
|
void updateWindowTitle(GuiWorkArea * wa);
|
|
|
|
|
|
2007-10-06 15:48:58 +00:00
|
|
|
|
///
|
|
|
|
|
void on_currentWorkAreaChanged(GuiWorkArea *);
|
2006-10-31 14:12:46 +00:00
|
|
|
|
|
2006-11-29 10:04:35 +00:00
|
|
|
|
/// slots to change the icon size
|
|
|
|
|
void smallSizedIcons();
|
|
|
|
|
void normalSizedIcons();
|
|
|
|
|
void bigSizedIcons();
|
|
|
|
|
|
2006-03-05 17:24:44 +00:00
|
|
|
|
protected:
|
|
|
|
|
/// make sure we quit cleanly
|
|
|
|
|
virtual void closeEvent(QCloseEvent * e);
|
2006-06-21 10:30:32 +00:00
|
|
|
|
///
|
|
|
|
|
virtual void resizeEvent(QResizeEvent * e);
|
|
|
|
|
///
|
|
|
|
|
virtual void moveEvent(QMoveEvent * e);
|
|
|
|
|
|
2007-08-21 07:33:46 +00:00
|
|
|
|
/// \return the \c Workarea associated to \p Buffer
|
|
|
|
|
/// \retval 0 if no \c WorkArea is found.
|
|
|
|
|
WorkArea * workArea(Buffer & buffer);
|
|
|
|
|
|
|
|
|
|
/// Add a \c WorkArea
|
|
|
|
|
/// \return the \c Workarea associated to \p Buffer
|
|
|
|
|
/// \retval 0 if no \c WorkArea is found.
|
|
|
|
|
WorkArea * addWorkArea(Buffer & buffer);
|
|
|
|
|
void setCurrentWorkArea(WorkArea * work_area);
|
|
|
|
|
void removeWorkArea(WorkArea * work_area);
|
|
|
|
|
WorkArea const * currentWorkArea() const;
|
|
|
|
|
WorkArea * currentWorkArea();
|
|
|
|
|
|
2006-03-05 17:24:44 +00:00
|
|
|
|
private:
|
2007-08-14 13:14:47 +00:00
|
|
|
|
///
|
|
|
|
|
void dragEnterEvent(QDragEnterEvent * ev);
|
|
|
|
|
///
|
|
|
|
|
void dropEvent(QDropEvent * ev);
|
|
|
|
|
|
2006-12-20 21:28:05 +00:00
|
|
|
|
/// in order to catch Tab key press.
|
|
|
|
|
bool event(QEvent * e);
|
2006-12-22 16:13:19 +00:00
|
|
|
|
bool focusNextPrevChild(bool);
|
2006-12-20 21:28:05 +00:00
|
|
|
|
|
2006-03-05 17:24:44 +00:00
|
|
|
|
QTimer statusbar_timer_;
|
|
|
|
|
|
2006-12-12 01:39:50 +00:00
|
|
|
|
/// are we quitting by the menu?
|
|
|
|
|
bool quitting_by_menu_;
|
|
|
|
|
|
2006-06-21 10:30:32 +00:00
|
|
|
|
///
|
2007-03-17 12:28:26 +00:00
|
|
|
|
QRect updateFloatingGeometry();
|
2006-06-21 10:30:32 +00:00
|
|
|
|
///
|
|
|
|
|
QRect floatingGeometry_;
|
2006-10-31 14:12:46 +00:00
|
|
|
|
|
2006-11-29 10:04:35 +00:00
|
|
|
|
void setIconSize(unsigned int size);
|
|
|
|
|
|
2007-01-29 14:23:05 +00:00
|
|
|
|
struct ToolbarSize {
|
|
|
|
|
int top_width;
|
|
|
|
|
int bottom_width;
|
|
|
|
|
int left_height;
|
|
|
|
|
int right_height;
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
ToolbarSize toolbarSize_;
|
|
|
|
|
|
2006-10-31 14:12:46 +00:00
|
|
|
|
struct GuiViewPrivate;
|
|
|
|
|
GuiViewPrivate& d;
|
2006-03-05 17:24:44 +00:00
|
|
|
|
};
|
|
|
|
|
|
2007-10-06 15:48:58 +00:00
|
|
|
|
|
2006-03-05 17:24:44 +00:00
|
|
|
|
} // namespace frontend
|
|
|
|
|
} // namespace lyx
|
|
|
|
|
|
2006-06-20 09:33:01 +00:00
|
|
|
|
#endif // GUIVIEW_H
|