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

FXReplaceDialog.h
1 /********************************************************************************
2 * *
3 * T e x t R e p l a c e D i a l o g *
4 * *
5 *********************************************************************************
6 * Copyright (C) 2000,2017 by Jeroen van der Zijp. All Rights Reserved. *
7 *********************************************************************************
8 * This library is free software; you can redistribute it and/or modify *
9 * it under the terms of the GNU Lesser General Public License as published by *
10 * the Free Software Foundation; either version 3 of the License, or *
11 * (at your option) any later version. *
12 * *
13 * This library is distributed in the hope that it will be useful, *
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of *
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
16 * GNU Lesser General Public License for more details. *
17 * *
18 * You should have received a copy of the GNU Lesser General Public License *
19 * along with this program. If not, see <http://www.gnu.org/licenses/> *
20 ********************************************************************************/
21 #ifndef FXREPLACEDIALOG_H
22 #define FXREPLACEDIALOG_H
23 
24 #ifndef FXDIALOGBOX_H
25 #include "FXDialogBox.h"
26 #endif
27 
28 namespace FX {
29 
30 
31 class FXButton;
32 class FXLabel;
33 class FXTextField;
34 class FXHorizontalFrame;
35 
36 
53 class FXAPI FXReplaceDialog : public FXDialogBox {
54  FXDECLARE(FXReplaceDialog)
55 protected:
56  FXLabel *searchlabel;
57  FXTextField *searchtext;
58  FXHorizontalFrame *searchbox;
59  FXLabel *replacelabel;
60  FXTextField *replacetext;
61  FXHorizontalFrame *replacebox;
62  FXButton *search;
63  FXButton *replace;
64  FXButton *replacesel;
65  FXButton *replaceall;
66  FXButton *cancel;
67  FXString searchHistory[20]; // Search string history
68  FXString replacHistory[20]; // Replace string history
69  FXuint optionHistory[20]; // Options history
70  FXint activeHistory; // Current active history index
71  FXuint searchmode; // Search mode
72 protected:
73  static const FXchar sectionName[];
74 protected:
75  FXReplaceDialog(){}
76  void appendHistory(const FXString& pat,const FXString& sub,FXuint opt);
77  void loadHistory();
78  void saveHistory();
79 private:
81  FXReplaceDialog &operator=(const FXReplaceDialog&);
82 public:
83  long onUpdDir(FXObject*,FXSelector,void*);
84  long onCmdDir(FXObject*,FXSelector,void*);
85  long onUpdWrap(FXObject*,FXSelector,void*);
86  long onCmdWrap(FXObject*,FXSelector,void*);
87  long onUpdCase(FXObject*,FXSelector,void*);
88  long onCmdCase(FXObject*,FXSelector,void*);
89  long onUpdRegex(FXObject*,FXSelector,void*);
90  long onCmdRegex(FXObject*,FXSelector,void*);
91  long onSearchKey(FXObject*,FXSelector,void*);
92  long onReplaceKey(FXObject*,FXSelector,void*);
93  long onCmdSearchHistUp(FXObject*,FXSelector,void*);
94  long onCmdSearchHistDn(FXObject*,FXSelector,void*);
95  long onCmdReplaceHistUp(FXObject*,FXSelector,void*);
96  long onCmdReplaceHistDn(FXObject*,FXSelector,void*);
97  long onWheelSearch(FXObject*,FXSelector,void*);
98  long onWheelReplace(FXObject*,FXSelector,void*);
99  long onCmdSearch(FXObject*,FXSelector,void*);
100  long onUpdSearch(FXObject*,FXSelector,void*);
101  long onCmdReplace(FXObject*,FXSelector,void*);
102  long onCmdReplaceSel(FXObject*,FXSelector,void*);
103  long onCmdReplaceAll(FXObject*,FXSelector,void*);
104 public:
105  enum{
106  ID_SEARCH_UP=FXDialogBox::ID_LAST,
107  ID_SEARCH_DN,
108  ID_REPLACE_UP,
109  ID_REPLACE_DN,
110  ID_SEARCH,
111  ID_SEARCH_NEXT,
112  ID_SEARCH_PREV,
113  ID_REPLACE,
114  ID_REPLACE_SEL,
115  ID_REPLACE_ALL,
116  ID_DIR,
117  ID_CASE,
118  ID_REGEX,
119  ID_WRAP,
120  ID_SEARCH_TEXT,
121  ID_REPLACE_TEXT,
122  ID_LAST
123  };
124 public:
125  enum {
126  DONE = 0,
127  SEARCH = 1,
128  REPLACE = 2,
129  REPLACE_SEL = 3,
130  REPLACE_ALL = 4
131  };
132 public:
133 
135  FXReplaceDialog(FXWindow* owner,const FXString& caption,FXIcon* ic=NULL,FXuint opts=0,FXint x=0,FXint y=0,FXint w=0,FXint h=0);
136 
138  void setSearchText(const FXString& text);
139 
141  FXString getSearchText() const;
142 
144  void setReplaceText(const FXString& text);
145 
147  FXString getReplaceText() const;
148 
150  void setSearchMode(FXuint mode){ searchmode=mode; }
151 
153  FXuint getSearchMode() const { return searchmode; }
154 
156  void setSearchTextColor(FXColor clr);
157 
159  FXColor getSearchTextColor() const;
160 
162  void setReplaceTextColor(FXColor clr);
163 
165  FXColor getReplaceTextColor() const;
166 
168  virtual FXuint execute(FXuint placement=PLACEMENT_CURSOR);
169 
171  virtual void save(FXStream& store) const;
172 
174  virtual void load(FXStream& store);
175 
177  virtual ~FXReplaceDialog();
178  };
179 
180 }
181 
182 #endif

Copyright © 1997-2016 Jeroen van der Zijp