![]() |
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,2009 by Jeroen van der Zijp. All Rights Reserved. * 00007 ********************************************************************************* 00008 * This library is free software; you can redistribute it and/or modify * 00009 * it under the terms of the GNU Lesser General Public License as published by * 00010 * the Free Software Foundation; either version 3 of the License, or * 00011 * (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 * 00016 * GNU Lesser General Public License for more details. * 00017 * * 00018 * You should have received a copy of the GNU Lesser General Public License * 00019 * along with this program. If not, see <http://www.gnu.org/licenses/> * 00020 ********************************************************************************* 00021 * $Id: FXReplaceDialog.h,v 1.27 2009/01/06 13:07:27 fox Exp $ * 00022 ********************************************************************************/ 00023 #ifndef FXREPLACEDIALOG_H 00024 #define FXREPLACEDIALOG_H 00025 00026 #ifndef FXDIALOGBOX_H 00027 #include "FXDialogBox.h" 00028 #endif 00029 00030 namespace FX { 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 long onWheelSearch(FXObject*,FXSelector,void*); 00073 long onWheelReplace(FXObject*,FXSelector,void*); 00074 public: 00075 enum{ 00076 ID_NEXT=FXDialogBox::ID_LAST, 00077 ID_PREV, 00078 ID_SEARCH_UP, 00079 ID_SEARCH_DN, 00080 ID_REPLACE_UP, 00081 ID_REPLACE_DN, 00082 ID_ALL, 00083 ID_DIR, 00084 ID_SEARCH_TEXT, 00085 ID_REPLACE_TEXT, 00086 ID_MODE, 00087 ID_LAST=ID_MODE+32 00088 }; 00089 public: 00090 enum { 00091 DONE = 0, /// Cancel search 00092 SEARCH = 1, /// Search first occurrence 00093 REPLACE = 1, /// Replace first occurrence 00094 SEARCH_NEXT = 2, /// Search next occurrence 00095 REPLACE_NEXT = 2, /// Replace next occurrence 00096 REPLACE_ALL = 3 /// Replace all occurrences 00097 }; 00098 public: 00099 00100 /// Construct search and replace dialog box 00101 FXReplaceDialog(FXWindow* owner,const FXString& caption,FXIcon* ic=NULL,FXuint opts=0,FXint x=0,FXint y=0,FXint w=0,FXint h=0); 00102 00103 /// Set text or pattern to search for 00104 void setSearchText(const FXString& text); 00105 00106 /// Return text or pattern the user has entered 00107 FXString getSearchText() const; 00108 00109 /// Set replace text 00110 void setReplaceText(const FXString& text); 00111 00112 /// Return replace text the user has entered 00113 FXString getReplaceText() const; 00114 00115 /// Set search match mode 00116 void setSearchMode(FXuint mode){ searchmode=mode; } 00117 00118 /// Return search mode the user has selected 00119 FXuint getSearchMode() const { return searchmode; } 00120 00121 /// Run modal invocation of the dialog 00122 virtual FXuint execute(FXuint placement=PLACEMENT_CURSOR); 00123 00124 /// Save to stream 00125 virtual void save(FXStream& store) const; 00126 00127 /// Load from stream 00128 virtual void load(FXStream& store); 00129 00130 /// Destructor 00131 virtual ~FXReplaceDialog(); 00132 }; 00133 00134 } 00135 00136 #endif
![]() |