#ifndef WORKAREA_H
#define WORKAREA_H
+#include "ui_WorkAreaUi.h"
+
#include "frontends/WorkArea.h"
#include <QAbstractScrollArea>
namespace lyx {
class Buffer;
+class FuncRequest;
namespace frontend {
///
void redraw(bool update_metrics);
+ /// return true if the key is part of a shortcut
+ bool queryKeySym(KeySymbol const & key, KeyModifier mod) const;
/// Process Key pressed event.
/// This needs to be public because it is accessed externally by GuiView.
void processKeySym(KeySymbol const & key, KeyModifier mod);
void titleChanged(GuiWorkArea *);
///
void busy(bool);
+ ///
+ void bufferViewChanged();
private Q_SLOTS:
/// Scroll the BufferView.
void mouseMoveEvent(QMouseEvent * ev);
/// wheel event
void wheelEvent(QWheelEvent * ev);
- /// key press
+ /// key press event. It also knows how to handle ShortcutOverride events to
+ /// avoid code duplication.
void keyPressEvent(QKeyEvent * ev);
/// IM events
void inputMethodEvent(QInputMethodEvent * ev);
bool removeWorkArea(GuiWorkArea *);
GuiWorkArea * currentWorkArea();
GuiWorkArea * workArea(Buffer & buffer);
+ GuiWorkArea const * workArea(int index) const;
GuiWorkArea * workArea(int index);
void paintEvent(QPaintEvent *);
/// close the tab given by \c index
void closeTab(int index);
///
+ void moveTab(int fromIndex, int toIndex);
+ ///
void updateTabTexts();
private Q_SLOTS:
void on_currentTabChanged(int index);
///
void showContextMenu(const QPoint & pos);
- ///
- void moveTab(int fromIndex, int toIndex);
+ /// enable closing tab on middle-click
+ void mousePressEvent(QMouseEvent * me);
+ void mouseReleaseEvent(QMouseEvent * me);
///
void mouseDoubleClickEvent(QMouseEvent * event);
+ ///
+ int indexOfWorkArea(GuiWorkArea * w) const;
private:
- ///
+ /// true if position is a tab (rather than the blank space in tab bar)
+ bool posIsTab(QPoint position);
+
int clicked_tab_;
///
+ int midpressed_tab_;
+ ///
QToolButton * closeBufferButton;
}; // TabWorkArea
void tabMoveRequested(int fromIndex, int toIndex);
};
+
+class GuiWorkAreaContainer : public QWidget, public Ui::WorkAreaUi
+{
+ Q_OBJECT
+ GuiWorkArea * const wa_;
+ void dispatch(FuncRequest f) const;
+
+private Q_SLOTS:
+ void updateDisplay();
+ void reload() const;
+ void ignore() const;
+
+protected:
+ void mouseDoubleClickEvent(QMouseEvent * event); //override
+
+public:
+ ///
+ GuiWorkAreaContainer(GuiWorkArea * wa, QWidget * parent = 0);
+ GuiWorkArea * workArea() const { return wa_; }
+};
+
+
+
} // namespace frontend
} // namespace lyx