X-Git-Url: https://git.lyx.org/gitweb/?a=blobdiff_plain;f=src%2Ffrontends%2Fqt4%2FButtonController.h;h=6d72430c9dce298495731553b86db7ecf1848050;hb=425d092204118ea6c24c28e85fdf03fcf2bb51a4;hp=808f97338a6dfd9b179bfc2980686275f95c91ef;hpb=6bb94129d8a5e087642458eb098c09c54c3c425e;p=lyx.git diff --git a/src/frontends/qt4/ButtonController.h b/src/frontends/qt4/ButtonController.h index 808f97338a..6d72430c9d 100644 --- a/src/frontends/qt4/ButtonController.h +++ b/src/frontends/qt4/ButtonController.h @@ -14,27 +14,14 @@ #include "ButtonPolicy.h" -#include - class QWidget; class QPushButton; class QLineEdit; +class QCheckBox; namespace lyx { namespace frontend { -class CheckedLineEdit -{ -public: - CheckedLineEdit(QLineEdit * input, QWidget * label = 0); - bool check() const; - -private: - // non-owned - QLineEdit * input_; - QWidget * label_; -}; - /** General purpose button controller for up to four buttons. Controls the activation of the OK, Apply and Cancel buttons. Actually supports 4 buttons in all and it's up to the user to decide on @@ -55,14 +42,13 @@ class ButtonController { public: ButtonController(); + ~ButtonController(); //@{ - /** Methods to set and get the ButtonPolicy. - * \param ptr is owned by the ButtonController. - */ + /// Methods to set and get the ButtonPolicy. void setPolicy(ButtonPolicy::Policy policy); - ButtonPolicy const & policy() const { return policy_; } - ButtonPolicy & policy() { return policy_; } + ButtonPolicy const & policy() const; + ButtonPolicy & policy(); //@} /// @@ -74,6 +60,7 @@ public: void apply(); void cancel(); void restore(); + void autoApply(); //@} /// Tell the BC that the dialog is being hidden @@ -92,59 +79,46 @@ public: /** Passthrough function -- returns its input value * Tell the BC about the read-only status of the underlying buffer. */ - bool setReadOnly(bool = true); + bool setReadOnly(bool); - /** \param validity Tell the BC that the data is, or is not, valid. + /** * Sets the activation state of the buttons immediately. + * \param validity Tell the BC that the data is, or is not, valid. */ - void setValid(bool = true); + void setValid(bool); // // View // //@{ - /** Store pointers to these widgets. - */ - void setOK(QPushButton * obj) { okay_ = obj; } - void setApply(QPushButton * obj) { apply_ = obj; } - void setCancel(QPushButton * obj) { cancel_ = obj; } - void setRestore(QPushButton * obj) { restore_ = obj; } + /// Store pointers to these widgets. + void setOK(QPushButton * obj); + void setApply(QPushButton * obj); + void setCancel(QPushButton * obj); + void setRestore(QPushButton * obj); + void setAutoApply(QCheckBox * obj); //@} /** Add a pointer to the list of widgets whose activation * state is dependent upon the read-only status of the * underlying buffer. */ - void addReadOnly(QWidget * obj) { read_only_.push_back(obj); } + void addReadOnly(QWidget * obj); /** Add a widget to the list of all widgets whose validity should * be checked explicitly when the buttons are refreshed. */ void addCheckedLineEdit(QLineEdit * input, QWidget * label = 0); -protected: - /// \return true if all CheckedWidgets are in a valid state. - bool checkWidgets() const; - -private: - typedef std::list CheckedWidgetList; - CheckedWidgetList checked_widgets; - -private: - /// Updates the widget sensitivity (enabled/disabled) - void setWidgetEnabled(QWidget *, bool enabled) const; - - QPushButton * okay_; - QPushButton * apply_; - QPushButton * cancel_; - QPushButton * restore_; - - typedef std::list Widgets; - Widgets read_only_; - private: - ButtonPolicy policy_; + /// noncopyable + ButtonController(ButtonController const &); + void operator=(ButtonController const &); + + /// pimpl + class Private; + Private * d; }; } // namespace frontend