2006-03-05 17:24:44 +00:00
|
|
|
// -*- C++ -*-
|
|
|
|
/**
|
2007-08-31 05:53:55 +00:00
|
|
|
* \file GuiToolbar.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.
|
|
|
|
*
|
2008-11-14 15:58:50 +00:00
|
|
|
* \author Lars Gullik Bjønnes
|
2006-03-05 17:24:44 +00:00
|
|
|
* \author John Levon
|
|
|
|
* \author Jean-Marc Lasgouttes
|
|
|
|
* \author Angus Leeming
|
|
|
|
* \author Abdelrazak Younes
|
|
|
|
*
|
|
|
|
* Full author contact details are available in file CREDITS.
|
|
|
|
*/
|
|
|
|
|
2007-08-31 22:16:11 +00:00
|
|
|
#ifndef GUITOOLBAR_H
|
|
|
|
#define GUITOOLBAR_H
|
2006-03-05 17:24:44 +00:00
|
|
|
|
2007-08-14 09:54:59 +00:00
|
|
|
#include "Session.h"
|
2006-03-05 17:24:44 +00:00
|
|
|
|
2007-09-28 22:53:00 +00:00
|
|
|
#include <QList>
|
2006-09-10 11:03:21 +00:00
|
|
|
#include <QToolBar>
|
2009-04-18 10:44:44 +00:00
|
|
|
#include <QToolButton>
|
2006-03-05 17:24:44 +00:00
|
|
|
|
|
|
|
namespace lyx {
|
2007-08-31 05:53:55 +00:00
|
|
|
|
This is the last of the commits that hopes to enforce the distinction between "layout files" and "document classes" that was introduced by the modules code. For the most part, these changes just refactor code from TextClass between: (a) a TextClass base class; (b) a LayoutFile subclass, which represents the information in a .layout file; and (c) a DocumentClass subclass, which represents the layout information associated with a Buffer---a LayoutFile plus Modules. Methods from TextClass have been apportioned between the three classes depending upon what is needed where, and signatures have been changed where necessary so that the right kind of class is required.
At this point, there are no simple TextClass objects in the main LyX code, and it is impossible to create them, since the TextClass constructor is protected. Only LayoutFile and DocumentClass objects can be constructed, and for the most part these are constructed only by their respective containers: BaseClassList and DocumentClassBundle. There is an exception: LayoutFile does have a public default constructor, but if anyone knows how to make it go away, please do.
There will be one or two more commits along these lines, but these will be simple renamings. For example, BaseClassList should be LayoutFileList.
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@23343 a592a061-630c-0410-9148-cb99ea01b6c8
2008-02-29 02:45:33 +00:00
|
|
|
class DocumentClass;
|
2008-03-10 13:02:57 +00:00
|
|
|
class Inset;
|
2007-08-31 05:53:55 +00:00
|
|
|
|
2006-03-05 17:24:44 +00:00
|
|
|
namespace frontend {
|
|
|
|
|
2008-03-10 13:02:57 +00:00
|
|
|
class Action;
|
2007-10-15 22:43:55 +00:00
|
|
|
class GuiCommandBuffer;
|
2008-03-10 13:02:57 +00:00
|
|
|
class GuiLayoutFilterModel;
|
2008-05-25 08:30:06 +00:00
|
|
|
class GuiToolbar;
|
2007-11-05 13:52:37 +00:00
|
|
|
class GuiView;
|
2009-08-12 21:51:10 +00:00
|
|
|
class LayoutBox;
|
2008-05-25 08:30:06 +00:00
|
|
|
class ToolbarInfo;
|
|
|
|
class ToolbarItem;
|
2006-03-05 17:24:44 +00:00
|
|
|
|
2009-04-18 10:44:44 +00:00
|
|
|
class MenuButton : public QToolButton
|
|
|
|
{
|
|
|
|
Q_OBJECT
|
|
|
|
public:
|
|
|
|
///
|
|
|
|
MenuButton(GuiToolbar * bar, ToolbarItem const & item,
|
|
|
|
bool const sticky = false);
|
|
|
|
///
|
|
|
|
void mousePressEvent(QMouseEvent * e);
|
|
|
|
|
|
|
|
private:
|
|
|
|
///
|
|
|
|
GuiToolbar * bar_;
|
|
|
|
///
|
|
|
|
ToolbarItem const & tbitem_;
|
|
|
|
///
|
|
|
|
bool initialized_;
|
|
|
|
|
|
|
|
private Q_SLOTS:
|
|
|
|
///
|
|
|
|
void actionTriggered(QAction * action);
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
|
2007-10-01 20:45:50 +00:00
|
|
|
class GuiToolbar : public QToolBar
|
2007-09-05 20:33:29 +00:00
|
|
|
{
|
2006-03-05 17:24:44 +00:00
|
|
|
Q_OBJECT
|
|
|
|
public:
|
2008-05-27 11:15:17 +00:00
|
|
|
///
|
2007-11-05 13:52:37 +00:00
|
|
|
GuiToolbar(ToolbarInfo const &, GuiView &);
|
2006-04-05 23:56:29 +00:00
|
|
|
|
2008-05-27 11:15:17 +00:00
|
|
|
///
|
|
|
|
void setVisibility(int visibility);
|
|
|
|
|
2007-10-01 20:45:50 +00:00
|
|
|
/// Add a button to the bar.
|
2007-04-19 19:43:15 +00:00
|
|
|
void add(ToolbarItem const & item);
|
2008-05-27 11:15:17 +00:00
|
|
|
|
|
|
|
/// Session key.
|
|
|
|
/**
|
|
|
|
* This key must be used for any session setting.
|
|
|
|
**/
|
|
|
|
QString sessionKey() const;
|
|
|
|
/// Save session settings.
|
|
|
|
void saveSession() const;
|
|
|
|
/// Restore session settings.
|
|
|
|
void restoreSession();
|
|
|
|
|
2007-10-01 20:45:50 +00:00
|
|
|
/// Refresh the contents of the bar.
|
2008-05-27 11:15:17 +00:00
|
|
|
void update(bool in_math, bool in_table, bool review,
|
|
|
|
bool in_mathmacrotemplate);
|
|
|
|
|
|
|
|
///
|
|
|
|
void toggle();
|
|
|
|
|
2007-10-02 06:59:02 +00:00
|
|
|
///
|
|
|
|
GuiCommandBuffer * commandBuffer() { return command_buffer_; }
|
2006-09-10 11:03:21 +00:00
|
|
|
|
2008-03-14 16:39:34 +00:00
|
|
|
///
|
2008-01-16 18:27:24 +00:00
|
|
|
Action * addItem(ToolbarItem const & item);
|
|
|
|
|
2006-06-30 14:37:33 +00:00
|
|
|
Q_SIGNALS:
|
2008-03-14 16:39:34 +00:00
|
|
|
///
|
2006-05-31 12:53:05 +00:00
|
|
|
void updated();
|
|
|
|
|
2006-03-05 17:24:44 +00:00
|
|
|
private:
|
2008-05-27 11:15:17 +00:00
|
|
|
// load flags with saved values
|
|
|
|
void initFlags();
|
2008-05-28 10:26:03 +00:00
|
|
|
///
|
|
|
|
void fill();
|
|
|
|
///
|
|
|
|
void showEvent(QShowEvent *);
|
|
|
|
|
2008-03-14 16:39:34 +00:00
|
|
|
///
|
2007-09-28 22:53:00 +00:00
|
|
|
QList<Action *> actions_;
|
2008-05-27 11:15:17 +00:00
|
|
|
/// initial visibility flags
|
|
|
|
int visibility_;
|
|
|
|
///
|
2007-11-05 13:52:37 +00:00
|
|
|
GuiView & owner_;
|
2008-03-14 16:39:34 +00:00
|
|
|
///
|
2007-09-28 22:53:00 +00:00
|
|
|
GuiCommandBuffer * command_buffer_;
|
2008-05-28 10:26:03 +00:00
|
|
|
///
|
|
|
|
ToolbarInfo const & tbinfo_;
|
2008-05-28 10:30:25 +00:00
|
|
|
///
|
|
|
|
bool filled_;
|
2006-03-05 17:24:44 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
} // namespace frontend
|
|
|
|
} // namespace lyx
|
|
|
|
|
2007-08-31 22:16:11 +00:00
|
|
|
#endif // GUITOOLBAR_H
|