2002-06-19 03:38:44 +00:00
|
|
|
|
// -*- C++ -*-
|
|
|
|
|
/**
|
2002-09-26 08:57:43 +00:00
|
|
|
|
* \file qt2/Toolbar_pimpl.h
|
2002-09-24 13:57:09 +00:00
|
|
|
|
* This file is part of LyX, the document processor.
|
|
|
|
|
* Licence details can be found in the file COPYING.
|
2002-06-19 03:38:44 +00:00
|
|
|
|
*
|
2002-09-24 13:57:09 +00:00
|
|
|
|
* \author Lars Gullik Bj<EFBFBD>nnes
|
|
|
|
|
*
|
|
|
|
|
* Full author contact details are available in file CREDITS
|
2002-06-19 03:38:44 +00:00
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
#ifndef TOOLBAR_PIMPL_H
|
|
|
|
|
#define TOOLBAR_PIMPL_H
|
|
|
|
|
|
|
|
|
|
#ifdef __GNUG__
|
|
|
|
|
#pragma interface
|
|
|
|
|
#endif
|
|
|
|
|
|
2002-09-24 13:57:09 +00:00
|
|
|
|
#include "frontends/Toolbar.h"
|
|
|
|
|
|
2002-06-19 03:38:44 +00:00
|
|
|
|
#include <qobject.h>
|
|
|
|
|
#include <qtoolbutton.h>
|
2002-09-24 13:57:09 +00:00
|
|
|
|
|
|
|
|
|
#include <boost/scoped_ptr.hpp>
|
|
|
|
|
#include <map>
|
|
|
|
|
#include <vector>
|
|
|
|
|
|
2002-06-19 03:38:44 +00:00
|
|
|
|
class QtView;
|
|
|
|
|
class QToolBar;
|
2002-07-21 23:08:30 +00:00
|
|
|
|
class QLComboBox;
|
2002-06-21 16:40:54 +00:00
|
|
|
|
class ToolbarProxy;
|
2002-06-19 03:38:44 +00:00
|
|
|
|
|
|
|
|
|
struct Toolbar::Pimpl {
|
2002-09-24 13:57:09 +00:00
|
|
|
|
|
2002-06-19 03:38:44 +00:00
|
|
|
|
friend class ToolbarProxy;
|
2002-09-24 13:57:09 +00:00
|
|
|
|
|
2002-06-19 03:38:44 +00:00
|
|
|
|
public:
|
2002-08-12 14:28:43 +00:00
|
|
|
|
Pimpl(LyXView * o, int x, int y);
|
2002-07-22 21:43:27 +00:00
|
|
|
|
|
2002-06-19 03:38:44 +00:00
|
|
|
|
~Pimpl();
|
2002-09-24 13:57:09 +00:00
|
|
|
|
|
2002-06-19 03:38:44 +00:00
|
|
|
|
/// add a new button to the toolbar.
|
2002-07-22 21:43:27 +00:00
|
|
|
|
void add(int action);
|
|
|
|
|
|
2002-06-19 03:38:44 +00:00
|
|
|
|
/// update the state of the icons
|
|
|
|
|
void update();
|
|
|
|
|
|
|
|
|
|
/// select the right layout in the combox
|
|
|
|
|
void setLayout(string const & layout);
|
|
|
|
|
/// Populate the layout combox; re-do everything if force is true.
|
|
|
|
|
void updateLayoutList(bool force);
|
|
|
|
|
/// Drop down the layout list
|
|
|
|
|
void openLayoutList();
|
|
|
|
|
/// Erase the layout list
|
|
|
|
|
void clearLayoutList();
|
|
|
|
|
|
|
|
|
|
private:
|
|
|
|
|
void changed_layout(string const & sel);
|
|
|
|
|
|
|
|
|
|
void button_selected(QToolButton * button);
|
2002-09-24 13:57:09 +00:00
|
|
|
|
|
|
|
|
|
QtView * owner_;
|
2002-06-19 03:38:44 +00:00
|
|
|
|
|
|
|
|
|
boost::scoped_ptr<ToolbarProxy> proxy_;
|
|
|
|
|
|
|
|
|
|
std::vector<QToolBar *> toolbars_;
|
|
|
|
|
|
2002-07-21 23:08:30 +00:00
|
|
|
|
QLComboBox * combo_;
|
2002-06-19 03:38:44 +00:00
|
|
|
|
|
|
|
|
|
typedef std::map<QToolButton *, int> ButtonMap;
|
|
|
|
|
|
|
|
|
|
ButtonMap map_;
|
2002-09-24 13:57:09 +00:00
|
|
|
|
|
2002-06-19 03:38:44 +00:00
|
|
|
|
};
|
|
|
|
|
|
2002-09-24 13:57:09 +00:00
|
|
|
|
|
2002-06-19 03:38:44 +00:00
|
|
|
|
// moc is mind-numbingly stupid
|
|
|
|
|
class ToolbarProxy : public QObject {
|
|
|
|
|
Q_OBJECT
|
|
|
|
|
|
|
|
|
|
public:
|
|
|
|
|
ToolbarProxy(Toolbar::Pimpl & owner)
|
|
|
|
|
: owner_(owner) { };
|
2002-09-24 13:57:09 +00:00
|
|
|
|
|
2002-06-19 03:38:44 +00:00
|
|
|
|
public slots:
|
2002-09-24 13:57:09 +00:00
|
|
|
|
|
2002-06-19 03:38:44 +00:00
|
|
|
|
void layout_selected(const QString & str) {
|
|
|
|
|
owner_.changed_layout(str.latin1());
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void button_selected() {
|
|
|
|
|
owner_.button_selected(
|
|
|
|
|
const_cast<QToolButton *>(
|
|
|
|
|
static_cast<QToolButton const *>(sender()))
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private:
|
|
|
|
|
Toolbar::Pimpl & owner_;
|
|
|
|
|
};
|
2002-09-24 13:57:09 +00:00
|
|
|
|
|
2002-06-19 03:38:44 +00:00
|
|
|
|
#endif
|