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

FXReplaceDialog.h
Go to the documentation of this file.
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,2006 by Jeroen van der Zijp. All Rights Reserved. *
7 *********************************************************************************
8 * This library is free software; you can redistribute it and/or *
9 * modify it under the terms of the GNU Lesser General Public *
10 * License as published by the Free Software Foundation; either *
11 * version 2.1 of the License, or (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 GNU *
16 * Lesser General Public License for more details. *
17 * *
18 * You should have received a copy of the GNU Lesser General Public *
19 * License along with this library; if not, write to the Free Software *
20 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. *
21 *********************************************************************************
22 * $Id: FXReplaceDialog.h,v 1.22 2006/01/22 17:58:08 fox Exp $ *
23 ********************************************************************************/
24 #ifndef FXREPLACEDIALOG_H
25 #define FXREPLACEDIALOG_H
26 
27 #ifndef FXDIALOGBOX_H
28 #include "FXDialogBox.h"
29 #endif
30 
31 namespace FX {
32 
33 
34 class FXButton;
35 class FXLabel;
36 class FXTextField;
37 class FXHorizontalFrame;
38 
39 
40 /// Text replace dialog
43 protected:
44  FXLabel *searchlabel;
45  FXTextField *searchtext;
46  FXHorizontalFrame *searchbox;
47  FXLabel *replacelabel;
48  FXTextField *replacetext;
49  FXHorizontalFrame *replacebox;
50  FXButton *accept;
51  FXButton *cancel;
52  FXButton *every;
53  FXuint searchmode;
54  FXuint current;
55 protected:
56  FXReplaceDialog(){}
57  void appendHistory(const FXString& search,const FXString& replace,FXuint mode);
58 private:
60  FXReplaceDialog &operator=(const FXReplaceDialog&);
61 public:
62  long onCmdAll(FXObject*,FXSelector,void*);
63  long onCmdNext(FXObject*,FXSelector,void*);
64  long onUpdDir(FXObject*,FXSelector,void*);
65  long onCmdDir(FXObject*,FXSelector,void*);
66  long onUpdMode(FXObject*,FXSelector,void*);
67  long onCmdMode(FXObject*,FXSelector,void*);
68  long onSearchKey(FXObject*,FXSelector,void*);
69  long onReplaceKey(FXObject*,FXSelector,void*);
70  long onCmdSearchHist(FXObject*,FXSelector,void*);
71  long onCmdReplaceHist(FXObject*,FXSelector,void*);
72  long onCmdAccept(FXObject*,FXSelector,void*);
73 public:
74  enum{
76  ID_PREV,
77  ID_SEARCH_UP,
78  ID_SEARCH_DN,
79  ID_REPLACE_UP,
80  ID_REPLACE_DN,
81  ID_ALL,
82  ID_DIR,
83  ID_SEARCH_TEXT,
84  ID_REPLACE_TEXT,
85  ID_MODE,
86  ID_LAST=ID_MODE+32
87  };
88 public:
89  enum {
90  DONE = 0, /// Cancel search
91  SEARCH = 1, /// Search first occurrence
92  REPLACE = 1, /// Replace first occurrence
93  SEARCH_NEXT = 2, /// Search next occurrence
94  REPLACE_NEXT = 2, /// Replace next occurrence
95  REPLACE_ALL = 3 /// Replace all occurrences
96  };
97 public:
98 
99  /// Construct search and replace dialog box
100  FXReplaceDialog(FXWindow* owner,const FXString& caption,FXIcon* ic=NULL,FXuint opts=0,FXint x=0,FXint y=0,FXint w=0,FXint h=0);
101 
102  /// Set text or pattern to search for
103  void setSearchText(const FXString& text);
104 
105  /// Return text or pattern the user has entered
106  FXString getSearchText() const;
107 
108  /// Set replace text
109  void setReplaceText(const FXString& text);
110 
111  /// Return replace text the user has entered
112  FXString getReplaceText() const;
113 
114  /// Set search match mode
115  void setSearchMode(FXuint mode){ searchmode=mode; }
116 
117  /// Return search mode the user has selected
118  FXuint getSearchMode() const { return searchmode; }
119 
120  /// Run modal invocation of the dialog
121  virtual FXuint execute(FXuint placement=PLACEMENT_CURSOR);
122 
123  /// Save to stream
124  virtual void save(FXStream& store) const;
125 
126  /// Load from stream
127  virtual void load(FXStream& store);
128 
129  /// Destructor
130  virtual ~FXReplaceDialog();
131  };
132 
133 }
134 
135 #endif
DialogBox window.
Definition: FXDialogBox.h:40
A label widget can be used to place a text and/or icon for explanation purposes.
Definition: FXLabel.h:79
Base class for all windows.
Definition: FXWindow.h:115
unsigned int FXuint
Definition: fxdefs.h:389
FXuint FXSelector
Association key.
Definition: FXObject.h:53
A button provides a push button, with optional icon and/or text label.
Definition: FXButton.h:85
#define FXAPI
Definition: fxdefs.h:122
#define NULL
Definition: fxdefs.h:41
Horizontal frame layout manager widget is used to automatically place child-windows horizontally from...
Definition: FXHorizontalFrame.h:39
FXString search(const FXString &pathlist, const FXString &file)
Search path list for this file, return full path name for first occurrence.
Place it under the cursor position.
Definition: FXTopWindow.h:62
Definition: FX4Splitter.h:31
int FXint
Definition: fxdefs.h:390
An Icon is an image with two additional server-side resources: a shape bitmap, which is used to mask ...
Definition: FXIcon.h:45
A text field is a single-line text entry widget.
Definition: FXTextField.h:73
Text replace dialog.
Definition: FXReplaceDialog.h:41
Object is the base class for all objects in FOX; in order to receive messages from the user interface...
Definition: FXObject.h:166
Definition: FXDialogBox.h:51
#define FXDECLARE(classname)
Macro to set up class declaration.
Definition: FXObject.h:92
FXString provides essential string manipulation capabilities.
Definition: FXString.h:33

Copyright © 1997-2005 Jeroen van der Zijp