FXReplaceDialog.h

Go to the documentation of this file.
00001 /********************************************************************************
00002 *                                                                               *
00003 *                      T e x t   R e p l a c e   D i a l o g                    *
00004 *                                                                               *
00005 *********************************************************************************
00006 * Copyright (C) 2000,2006 by Jeroen van der Zijp.   All Rights Reserved.        *
00007 *********************************************************************************
00008 * This library is free software; you can redistribute it and/or                 *
00009 * modify it under the terms of the GNU Lesser General Public                    *
00010 * License as published by the Free Software Foundation; either                  *
00011 * version 2.1 of the License, or (at your option) any later version.            *
00012 *                                                                               *
00013 * This library is distributed in the hope that it will be useful,               *
00014 * but WITHOUT ANY WARRANTY; without even the implied warranty of                *
00015 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU             *
00016 * Lesser General Public License for more details.                               *
00017 *                                                                               *
00018 * You should have received a copy of the GNU Lesser General Public              *
00019 * License along with this library; if not, write to the Free Software           *
00020 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA.    *
00021 *********************************************************************************
00022 * $Id: FXReplaceDialog.h,v 1.22 2006/01/22 17:58:08 fox Exp $                   *
00023 ********************************************************************************/
00024 #ifndef FX_DISABLEFINDREPLACEDIALOGS
00025 
00026 #ifndef FXREPLACEDIALOG_H
00027 #define FXREPLACEDIALOG_H
00028 
00029 #ifndef FXDIALOGBOX_H
00030 #include "FXDialogBox.h"
00031 #endif
00032 
00033 namespace FX {
00034 
00035 
00036 class FXButton;
00037 class FXLabel;
00038 class FXTextField;
00039 class FXHorizontalFrame;
00040 
00041 
00043 class FXAPI FXReplaceDialog : public FXDialogBox {
00044   FXDECLARE(FXReplaceDialog)
00045 protected:
00046   FXLabel           *searchlabel;
00047   FXTextField       *searchtext;
00048   FXHorizontalFrame *searchbox;
00049   FXLabel           *replacelabel;
00050   FXTextField       *replacetext;
00051   FXHorizontalFrame *replacebox;
00052   FXButton          *accept;
00053   FXButton          *cancel;
00054   FXButton          *every;
00055   FXuint             searchmode;
00056   FXuint             current;
00057 protected:
00058   FXReplaceDialog(){}
00059   void appendHistory(const FXString& search,const FXString& replace,FXuint mode);
00060 private:
00061   FXReplaceDialog(const FXReplaceDialog&);
00062   FXReplaceDialog &operator=(const FXReplaceDialog&);
00063 public:
00064   long onCmdAll(FXObject*,FXSelector,void*);
00065   long onCmdNext(FXObject*,FXSelector,void*);
00066   long onUpdDir(FXObject*,FXSelector,void*);
00067   long onCmdDir(FXObject*,FXSelector,void*);
00068   long onUpdMode(FXObject*,FXSelector,void*);
00069   long onCmdMode(FXObject*,FXSelector,void*);
00070   long onSearchKey(FXObject*,FXSelector,void*);
00071   long onReplaceKey(FXObject*,FXSelector,void*);
00072   long onCmdSearchHist(FXObject*,FXSelector,void*);
00073   long onCmdReplaceHist(FXObject*,FXSelector,void*);
00074   long onCmdAccept(FXObject*,FXSelector,void*);
00075 public:
00076   enum{
00077     ID_NEXT=FXDialogBox::ID_LAST,
00078     ID_PREV,
00079     ID_SEARCH_UP,
00080     ID_SEARCH_DN,
00081     ID_REPLACE_UP,
00082     ID_REPLACE_DN,
00083     ID_ALL,
00084     ID_DIR,
00085     ID_SEARCH_TEXT,
00086     ID_REPLACE_TEXT,
00087     ID_MODE,
00088     ID_LAST=ID_MODE+32
00089     };
00090 public:
00091   enum {
00092     DONE          = 0,    
00093     SEARCH        = 1,    
00094     REPLACE       = 1,    
00095     SEARCH_NEXT   = 2,    
00096     REPLACE_NEXT  = 2,    
00097     REPLACE_ALL   = 3     
00098     };
00099 public:
00100 
00102   FXReplaceDialog(FXWindow* owner,const FXString& caption,FXIcon* ic=NULL,FXuint opts=0,FXint x=0,FXint y=0,FXint w=0,FXint h=0);
00103 
00105   void setSearchText(const FXString& text);
00106 
00108   FXString getSearchText() const;
00109 
00111   void setReplaceText(const FXString& text);
00112 
00114   FXString getReplaceText() const;
00115 
00117   void setSearchMode(FXuint mode){ searchmode=mode; }
00118 
00120   FXuint getSearchMode() const { return searchmode; }
00121 
00123   virtual FXuint execute(FXuint placement=PLACEMENT_CURSOR);
00124 
00126   virtual void save(FXStream& store) const;
00127 
00129   virtual void load(FXStream& store);
00130 
00132   virtual ~FXReplaceDialog();
00133   };
00134 
00135 }
00136 
00137 #endif
00138 
00139 #endif

(C) 2002-2009 Niall Douglas. Some parts (C) to assorted authors.
Generated on Fri Nov 20 18:31:24 2009 for TnFOX by doxygen v1.4.7