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