lyx_mirror/src/frontends/qt4/GuiToolbar.h
Richard Heck 2b3bd7b5f4 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

96 lines
1.8 KiB
C++

// -*- C++ -*-
/**
* \file GuiToolbar.h
* This file is part of LyX, the document processor.
* Licence details can be found in the file COPYING.
*
* \author Lars Gullik Bjønnes
* \author John Levon
* \author Jean-Marc Lasgouttes
* \author Angus Leeming
* \author Abdelrazak Younes
*
* Full author contact details are available in file CREDITS.
*/
#ifndef GUITOOLBAR_H
#define GUITOOLBAR_H
#include "Session.h"
#include <QList>
#include <QToolBar>
#include <QComboBox>
namespace lyx {
class Inset;
class DocumentClass;
class ToolbarItem;
namespace frontend {
class GuiCommandBuffer;
class GuiView;
class Action;
class GuiLayoutBox : public QComboBox
{
Q_OBJECT
public:
GuiLayoutBox(GuiView &);
/// select the right layout in the combobox.
void set(docstring const & layout);
/// Populate the layout combobox.
void updateContents(bool reset);
/// Add Item to Layout box according to sorting settings from preferences
void addItemSort(QString const & item, bool sorted);
private Q_SLOTS:
void selected(const QString & str);
private:
GuiView & owner_;
DocumentClass const * text_class_;
Inset const * inset_;
};
class GuiToolbar : public QToolBar
{
Q_OBJECT
public:
GuiToolbar(ToolbarInfo const &, GuiView &);
/// Add a button to the bar.
void add(ToolbarItem const & item);
/** update toolbar information
* ToolbarInfo will then be saved by session
*/
void saveInfo(ToolbarSection::ToolbarInfo & info);
/// Refresh the contents of the bar.
void updateContents();
///
GuiCommandBuffer * commandBuffer() { return command_buffer_; }
Action * addItem(ToolbarItem const & item);
Q_SIGNALS:
void updated();
private:
QList<Action *> actions_;
GuiView & owner_;
GuiLayoutBox * layout_;
GuiCommandBuffer * command_buffer_;
};
} // namespace frontend
} // namespace lyx
#endif // GUITOOLBAR_H