/********************************************************************************
*                                                                               *
*                      T e x t   R e p l a c e   D i a l o g                    *
*                                                                               *
*********************************************************************************
* Copyright (C) 2000 by Jeroen van der Zijp.   All Rights Reserved.             *
*********************************************************************************
* This library is free software; you can redistribute it and/or                 *
* modify it under the terms of the GNU Library General Public                   *
* License as published by the Free Software Foundation; either                  *
* version 2 of the License, or (at your option) any later version.              *
*                                                                               *
* This library is distributed in the hope that it will be useful,               *
* but WITHOUT ANY WARRANTY; without even the implied warranty of                *
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU             *
* Library General Public License for more details.                              *
*                                                                               *
* You should have received a copy of the GNU Library General Public             *
* License along with this library; if not, write to the Free                    *
* Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.            *
*********************************************************************************
* $Id: FXReplaceDialog.h,v 1.3 2000/08/25 17:07:58 jeroen Exp $                 *
********************************************************************************/
#ifndef FXREPLACEDIALOG_H
#define FXREPLACEDIALOG_H


class FXTextField;
class FXButton;
 

/// Text replace dialog
class FXAPI FXReplaceDialog : public FXDialogBox {
  FXDECLARE(FXReplaceDialog)
protected:
  FXTextField *searchtext;          // Text to look for
  FXTextField *replacetext;         // Text to replace with
  FXButton    *nextbutton;          // Button which goes to next instance
  FXButton    *lastbutton;          // Button which goes to last instance
  FXButton    *replacebutton;       // Button which replaces one instance
  FXButton    *replaceallbutton;    // Button which replaces all instances
  FXuchar      searchmode;          // Search matching mode
  FXuchar      backwards;           // Search direction flag
  FXDataTarget matchtgt;            // Changing match mode
  FXDataTarget dirtgt;              // Changing direction flag
protected:
  FXReplaceDialog(){}
private:
  FXReplaceDialog(const FXReplaceDialog&);
  FXReplaceDialog &operator=(const FXReplaceDialog&);
public:
  
  /// Construct Directory Dialog Box
  FXReplaceDialog(FXWindow* owner,const FXString& name,FXuint opts=0,FXint x=0,FXint y=0,FXint w=0,FXint h=0);

  /// Set text or pattern to search for
  void setSearchText(const FXString& text);
  
  /// Return text or pattern the user has entered
  FXString getSearchText() const;
  
  /// Set text or pattern to search with
  void setReplaceText(const FXString& text);
  
  /// Return text or pattern the user has entered
  FXString getReplaceText() const;

  /// Set search match mode
  void setSearchMode(FXSearchMode mode){ searchmode=(FXuchar)mode; }
  
  /// Return search mode the user has selected
  FXSearchMode getSearchMode() const { return (FXSearchMode)searchmode; }

  /// Set search direction flag
  void setSearchDir(FXbool back=FALSE){ backwards=back; }

  /// Get search direction flag
  FXbool getSearchDir() const { return backwards; }

  /// Save to stream
  virtual void save(FXStream& store) const;
  
  /// Load from stream
  virtual void load(FXStream& store);

  /// Destructor
  virtual ~FXReplaceDialog();
  };


#endif
