]> git.lyx.org Git - lyx.git/blobdiff - src/frontends/controllers/ButtonControllerBase.C
Move the external dialog to the new scheme.
[lyx.git] / src / frontends / controllers / ButtonControllerBase.C
index a7898f1ca600bc1b442454c3aa0678e63cb164aa..d35c4d6954bff5f4259becd32000f9ee6019548c 100644 (file)
@@ -1,23 +1,22 @@
-/* This file is part of
- * ====================================================== 
- *
- *           LyX, The Document Processor
- *
- *           Copyright 2000-2001 The LyX Team.
- *
- * ======================================================
- *
+/**
  * \file ButtonControllerBase.C
+ * This file is part of LyX, the document processor.
+ * Licence details can be found in the file COPYING.
+ *
  * \author Allan Rae
+ *
+ * Full author contact details are available in file CREDITS
  */
 
-#ifdef __GNUG__
-#pragma implementation
-#endif
 
 #include <config.h>
 #include "ButtonControllerBase.h"
 #include "support/LAssert.h"
+#include "debug.h"
+
+
+CheckedWidget::~CheckedWidget()
+{}
 
 
 ButtonControllerBase::ButtonControllerBase(string const & cancel,
@@ -34,7 +33,8 @@ void ButtonControllerBase::ok()
 
 void ButtonControllerBase::input(ButtonPolicy::SMInput in)
 {
-       if (ButtonPolicy::SMI_NOOP == in) return;
+       if (ButtonPolicy::SMI_NOOP == in)
+               return;
        bp().input(in);
        refresh();
 }
@@ -82,12 +82,15 @@ void ButtonControllerBase::invalid()
 
 bool ButtonControllerBase::readOnly(bool ro)
 {
+       lyxerr[Debug::GUI] << "Setting controller ro: " << ro << std::endl;
+
        if (ro) {
                bp().input(ButtonPolicy::SMI_READ_ONLY);
        } else {
                bp().input(ButtonPolicy::SMI_READ_WRITE);
        }
        refreshReadOnly();
+       refresh();
        return ro;
 }
 
@@ -96,3 +99,26 @@ void ButtonControllerBase::readWrite()
 {
        readOnly(false);
 }
+
+
+void ButtonControllerBase::addCheckedWidget(CheckedWidget * ptr)
+{
+       if (ptr)
+               checked_widgets.push_back(checked_widget_ptr(ptr));
+}
+
+
+bool ButtonControllerBase::checkWidgets()
+{
+       bool valid = true;
+
+       checked_widget_list::const_iterator it  = checked_widgets.begin();
+       checked_widget_list::const_iterator end = checked_widgets.end();
+
+       for (; it != end; ++it) {
+               valid &= (*it)->check();
+       }
+
+       // return valid status after checking ALL widgets
+       return valid;
+}