"""Subclass of FindInFiles, which is generated by wxFormBuilder."""

import wx
import wxx
import app


# Implementing FindInFiles
class FindInFilesDialog(app.FindInFiles):
    """
    This dialog allows to find for a text
    inside files. The results will be
    show in the search pane.
    """
    @wxx.SetInfo(__doc__)
    def __init__(self, parent, container=None):
        """Initialize dialog"""
        self.container = container
        super(FindInFilesDialog, self).__init__(parent)

    def Validate(self):
        """Validate the dialog"""
        self.searchString = self.m_search_string.GetValue()
        return bool(self.searchString)

    def OnOK(self, event):
        """Handler for Ok button press"""
        if self.Validate():
            self.EndModal(wx.ID_OK)

    def OnCancel(self, event):
        """Handler for Cancel button press"""
        self.EndModal(wx.ID_CANCEL)

