2001-03-15 13:37:04 +00:00
|
|
|
// -*- C++ -*-
|
|
|
|
/* This file is part of
|
|
|
|
* ======================================================
|
|
|
|
*
|
|
|
|
* LyX, The Document Processor
|
|
|
|
*
|
2001-03-21 13:27:03 +00:00
|
|
|
* Copyright 2001 The LyX Team.
|
2001-03-15 13:37:04 +00:00
|
|
|
*
|
|
|
|
* ======================================================
|
|
|
|
*
|
|
|
|
* Author: Angus Leeming <a.leeming@ic.ac.uk>
|
|
|
|
*/
|
|
|
|
|
|
|
|
#ifndef VIEWBASE_H
|
|
|
|
#define VIEWBASE_H
|
|
|
|
|
|
|
|
#include <boost/utility.hpp>
|
2001-04-03 14:30:58 +00:00
|
|
|
#include "ControlButtons.h"
|
2001-03-27 13:00:41 +00:00
|
|
|
#include "ControlSplash.h"
|
2001-03-15 13:37:04 +00:00
|
|
|
|
|
|
|
class ViewBase {
|
|
|
|
public:
|
|
|
|
///
|
2001-04-03 14:30:58 +00:00
|
|
|
ViewBase(ControlButtons & c) : controller_(c) {}
|
2001-03-15 13:37:04 +00:00
|
|
|
///
|
|
|
|
virtual ~ViewBase() {}
|
|
|
|
|
|
|
|
/// Apply changes to LyX data from dialog.
|
|
|
|
virtual void apply() = 0;
|
|
|
|
/// Hide the dialog.
|
|
|
|
virtual void hide() = 0;
|
|
|
|
/// Redraw the dialog (e.g. if the colors have been remapped).
|
|
|
|
virtual void redraw() {}
|
|
|
|
/// Create the dialog if necessary, update it and display it.
|
|
|
|
virtual void show() = 0;
|
|
|
|
/// Update dialog before/whilst showing it.
|
|
|
|
virtual void update() = 0;
|
|
|
|
|
|
|
|
/** These shortcuts allow (e.g. xform's) global callback functions
|
|
|
|
access to the buttons without making the whole controller_ public.
|
|
|
|
*/
|
|
|
|
///
|
|
|
|
void ApplyButton() { controller_.ApplyButton(); }
|
|
|
|
///
|
|
|
|
void OKButton() { controller_.OKButton(); }
|
|
|
|
///
|
|
|
|
void CancelButton() { controller_.CancelButton(); }
|
|
|
|
///
|
|
|
|
void RestoreButton() { controller_.RestoreButton(); }
|
2001-07-13 11:50:39 +00:00
|
|
|
|
|
|
|
/** Defaults to nothing. Can be used by the Controller, however, to
|
|
|
|
indicate to the View that something has changed and that the
|
|
|
|
dialog therefore needs updating. */
|
2001-07-13 14:03:48 +00:00
|
|
|
virtual void partialUpdate(int) {}
|
2001-07-13 11:50:39 +00:00
|
|
|
|
2001-03-15 13:37:04 +00:00
|
|
|
protected:
|
|
|
|
/// The view is, after all, controlled!
|
2001-04-03 14:30:58 +00:00
|
|
|
ControlButtons & controller_;
|
2001-03-15 13:37:04 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
|
2001-03-27 13:00:41 +00:00
|
|
|
class ViewSplash {
|
|
|
|
public:
|
|
|
|
///
|
|
|
|
ViewSplash(ControlSplash & c) : controller_(c) {}
|
|
|
|
///
|
|
|
|
virtual ~ViewSplash() {}
|
|
|
|
|
|
|
|
/// Hide the dialog.
|
|
|
|
virtual void hide() = 0;
|
|
|
|
/// Create the dialog and show it.
|
|
|
|
virtual void show() = 0;
|
|
|
|
|
|
|
|
/** The shortcut allows (e.g. xform's) global callback functions
|
|
|
|
access without making the whole controller_ public.
|
|
|
|
*/
|
|
|
|
///
|
|
|
|
void Hide() { controller_.hide(); }
|
|
|
|
|
|
|
|
protected:
|
|
|
|
/// The view is, after all, controlled!
|
|
|
|
ControlSplash & controller_;
|
|
|
|
};
|
|
|
|
|
|
|
|
|
2001-03-15 13:37:04 +00:00
|
|
|
/** A generic class to cast the ButtonController controller_.bc_ to it's
|
|
|
|
daughter class. */
|
|
|
|
template <class GUIbc>
|
|
|
|
class ViewBC : public ViewBase {
|
|
|
|
public:
|
|
|
|
///
|
2001-04-03 14:30:58 +00:00
|
|
|
ViewBC(ControlButtons & c) : ViewBase(c) {}
|
2001-03-19 16:37:01 +00:00
|
|
|
|
|
|
|
protected:
|
2001-03-15 13:37:04 +00:00
|
|
|
///
|
|
|
|
GUIbc & bc() const
|
|
|
|
{
|
|
|
|
return static_cast<GUIbc &>(controller_.bc());
|
|
|
|
// return dynamic_cast<GUIbc &>(controller_.bc());
|
|
|
|
}
|
|
|
|
};
|
|
|
|
|
|
|
|
#endif // VIEWBASE_H
|