2 /* This file is part of
3 * ======================================================
5 * LyX, The Document Processor
7 * Copyright 2000-2001 The LyX Team.
9 * ======================================================
11 * \file ButtonControllerBase.h
12 * \author Allan Rae, rae@lyx.org
15 #ifndef BUTTONCONTROLLERBASE_H
16 #define BUTTONCONTROLLERBASE_H
22 #include "ButtonPolicies.h"
25 /** Abstract base class for a ButtonController
27 * Controls the activation of the OK, Apply and Cancel buttons.
28 * Actually supports 4 buttons in all and it's up to the user to decide on
29 * the activation policy and which buttons correspond to which output of the
31 * Author: Allan Rae <rae@lyx.org>.
32 * This abstract base class stripped of xforms-specific code by
33 * Angus Leeming <a.leeming@ic.ac.uk>
35 class ButtonControllerBase : boost::noncopyable
39 The cancel/close label entries are _not_ managed within the class
40 thereby allowing you to reassign at will and to use static labels.
41 It also means if you really don't want to have the Cancel button
42 label be different when there is nothing changed in the dialog then
43 you can just assign "Cancel" to both labels. Or even reuse this
44 class for something completely different.
46 ButtonControllerBase(string const & cancel, string const & close);
48 virtual ~ButtonControllerBase() {}
50 virtual ButtonPolicy & bp() = 0;
52 virtual void input(ButtonPolicy::SMInput);
64 virtual void refresh() = 0;
66 virtual void refreshReadOnly() = 0;
68 /// Passthrough function -- returns its input value
69 bool readOnly(bool = true);
73 void valid(bool = true);
84 #endif // BUTTONCONTROLLERBASE_H