Main Page   Class Hierarchy   Alphabetical List   Compound List   File List   Compound Members

FXReplaceDialog.h

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,2005 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.21 2005/01/16 16:06:06 fox Exp $ * 00023 ********************************************************************************/ 00024 #ifndef FXREPLACEDIALOG_H 00025 #define FXREPLACEDIALOG_H 00026 00027 #ifndef FXDIALOGBOX_H 00028 #include "FXDialogBox.h" 00029 #endif 00030 00031 namespace FX { 00032 00033 00034 class FXButton; 00035 class FXLabel; 00036 class FXTextField; 00037 class FXHorizontalFrame; 00038 00039 00040 /// Text replace dialog 00041 class FXAPI FXReplaceDialog : public FXDialogBox { 00042 FXDECLARE(FXReplaceDialog) 00043 protected: 00044 FXLabel *searchlabel; 00045 FXTextField *searchtext; 00046 FXHorizontalFrame *searchbox; 00047 FXLabel *replacelabel; 00048 FXTextField *replacetext; 00049 FXHorizontalFrame *replacebox; 00050 FXButton *accept; 00051 FXButton *cancel; 00052 FXButton *every; 00053 FXuint searchmode; 00054 FXuint current; 00055 protected: 00056 FXReplaceDialog(){} 00057 void appendHistory(const FXString& search,const FXString& replace,FXuint mode); 00058 private: 00059 FXReplaceDialog(const FXReplaceDialog&); 00060 FXReplaceDialog &operator=(const FXReplaceDialog&); 00061 public: 00062 long onCmdAll(FXObject*,FXSelector,void*); 00063 long onCmdNext(FXObject*,FXSelector,void*); 00064 long onUpdDir(FXObject*,FXSelector,void*); 00065 long onCmdDir(FXObject*,FXSelector,void*); 00066 long onUpdMode(FXObject*,FXSelector,void*); 00067 long onCmdMode(FXObject*,FXSelector,void*); 00068 long onSearchKey(FXObject*,FXSelector,void*); 00069 long onReplaceKey(FXObject*,FXSelector,void*); 00070 long onCmdSearchHist(FXObject*,FXSelector,void*); 00071 long onCmdReplaceHist(FXObject*,FXSelector,void*); 00072 long onCmdAccept(FXObject*,FXSelector,void*); 00073 public: 00074 enum{ 00075 ID_NEXT=FXDialogBox::ID_LAST, 00076 ID_PREV, 00077 ID_SEARCH_UP, 00078 ID_SEARCH_DN, 00079 ID_REPLACE_UP, 00080 ID_REPLACE_DN, 00081 ID_ALL, 00082 ID_DIR, 00083 ID_SEARCH_TEXT, 00084 ID_REPLACE_TEXT, 00085 ID_MODE, 00086 ID_LAST=ID_MODE+32 00087 }; 00088 public: 00089 enum { 00090 DONE = 0, /// Cancel search 00091 SEARCH = 1, /// Search first occurrence 00092 REPLACE = 1, /// Replace first occurrence 00093 SEARCH_NEXT = 2, /// Search next occurrence 00094 REPLACE_NEXT = 2, /// Replace next occurrence 00095 REPLACE_ALL = 3 /// Replace all occurrences 00096 }; 00097 public: 00098 00099 /// Construct search and replace dialog box 00100 FXReplaceDialog(FXWindow* owner,const FXString& caption,FXIcon* ic=NULL,FXuint opts=0,FXint x=0,FXint y=0,FXint w=0,FXint h=0); 00101 00102 /// Set text or pattern to search for 00103 void setSearchText(const FXString& text); 00104 00105 /// Return text or pattern the user has entered 00106 FXString getSearchText() const; 00107 00108 /// Set replace text 00109 void setReplaceText(const FXString& text); 00110 00111 /// Return replace text the user has entered 00112 FXString getReplaceText() const; 00113 00114 /// Set search match mode 00115 void setSearchMode(FXuint mode){ searchmode=mode; } 00116 00117 /// Return search mode the user has selected 00118 FXuint getSearchMode() const { return searchmode; } 00119 00120 /// Run modal invocation of the dialog 00121 virtual FXuint execute(FXuint placement=PLACEMENT_CURSOR); 00122 00123 /// Save to stream 00124 virtual void save(FXStream& store) const; 00125 00126 /// Load from stream 00127 virtual void load(FXStream& store); 00128 00129 /// Destructor 00130 virtual ~FXReplaceDialog(); 00131 }; 00132 00133 } 00134 00135 #endif

Copyright © 1997-2005 Jeroen van der Zijp