from silx.gui import qt


class BaseParameterControl(qt.QWidget):
    """
    Base class for parameter panels.
    Encapsulates a Settings Area
    """

    def __init__(self, title: str = "", parent=None):
        super().__init__(parent=parent)

        self._mainLayout = qt.QVBoxLayout(self)
        self._mainLayout.setContentsMargins(0, 0, 0, 0)
        self.settingsGroup = qt.QGroupBox(title)
        self.settingsLayout = qt.QFormLayout(self.settingsGroup)
        self._mainLayout.addWidget(self.settingsGroup)
        self._mainLayout.addStretch()

    def validate(self) -> bool:
        raise NotImplementedError("Base class did not implement `validate`")
