mirror of
https://git.lyx.org/repos/lyx.git
synced 2024-09-23 16:47:35 +00:00
cb81965b1e
- initialiseParams(): overload ControlCommand::initialiseParams() so that we can update the model at this point (QToc is the controller _and_ the model). - update(): new - updateBackend(): new protected method to update the TocBackend (called for the "Update" button). * QToc: - is now a QObject - modelReset: new Qt signal to indicate a model reset to associated dialog(s). - QToc(): avoid the duplicate update() call that will be done in the show command anyway. * Dialogs.C - use new TocWidget in a DockView. * TocWidget.[Ch]: renamed from QTocDialog. This striped down widget is only a widget that connects to the 'QToc' model/controller. * DockView.h: new template class that encapsulates a given Widget inside a DockWidget and presents a Dialog::View interface. * QTocUi.ui: - now is a simple Widget. - rearrange the buttons a bit - get rid of the unneeded close button. - modify the shortcut to "Promote" to 'r' because of a clash with "Alt-p" number (we really need real, always valid, shortcuts for all outline action!) git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@17416 a592a061-630c-0410-9148-cb99ea01b6c8
68 lines
1.5 KiB
C++
68 lines
1.5 KiB
C++
// -*- C++ -*-
|
|
/**
|
|
* \file DockView.h
|
|
* This file is part of LyX, the document processor.
|
|
* Licence details can be found in the file COPYING.
|
|
*
|
|
* \author Abdelrazak Younes
|
|
*
|
|
* Full author contact details are available in file CREDITS.
|
|
*/
|
|
|
|
#ifndef DOCK_VIEW_H
|
|
#define DOCK_VIEW_H
|
|
|
|
#include "controllers/dialog.h"
|
|
|
|
#include <boost/scoped_ptr.hpp>
|
|
|
|
#include <QDockWidget>
|
|
#include <QMainWindow>
|
|
|
|
namespace lyx {
|
|
namespace frontend {
|
|
|
|
/// Dock Widget container for LyX dialogs.
|
|
/// This template class that encapsulates a given Widget inside a
|
|
/// DockWidget and presents a Dialog::View interface
|
|
template<class Controller, class Widget>
|
|
class DockView : public QDockWidget, public Dialog::View
|
|
{
|
|
public:
|
|
DockView(
|
|
Dialog & dialog, ///< The (one) parent Dialog class.
|
|
Controller * form, ///< Associated model/controller
|
|
QMainWindow * parent, ///< the main window where to dock.
|
|
docstring const & title ///< Window title (shown in the top title bar).
|
|
)
|
|
: QDockWidget(toqstr(title), parent), Dialog::View(dialog, title)
|
|
{
|
|
widget_.reset(new Widget(form));
|
|
setWidget(widget_.get());
|
|
parent->addDockWidget(Qt::LeftDockWidgetArea, this);
|
|
}
|
|
|
|
/// Dialog::View inherited methods
|
|
//@{
|
|
void apply() {}
|
|
void hide() { QDockWidget::hide(); }
|
|
void show() { QDockWidget::show(); }
|
|
bool isVisible() const
|
|
{ return QDockWidget::isVisible(); }
|
|
void redraw() {}
|
|
void update()
|
|
{
|
|
widget_->update();
|
|
QDockWidget::update();
|
|
}
|
|
//@}
|
|
private:
|
|
/// The encapsulated widget.
|
|
boost::scoped_ptr<Widget> widget_;
|
|
};
|
|
|
|
} // frontend
|
|
} // lyx
|
|
|
|
#endif // TOC_WIDGET_H
|