2
* Copyright (c) 2009, 2010, Oracle and/or its affiliates. All rights reserved.
4
* This program is free software; you can redistribute it and/or
5
* modify it under the terms of the GNU General Public License as
6
* published by the Free Software Foundation; version 2 of the
9
* This program is distributed in the hope that it will be useful,
10
* but WITHOUT ANY WARRANTY; without even the implied warranty of
11
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12
* GNU General Public License for more details.
14
* You should have received a copy of the GNU General Public License
15
* along with this program; if not, write to the Free Software
16
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
21
* This file contains a search-and-replace dialog with various options. The actual search/replace functionality
22
* is implemented by the owner.
24
#ifndef _SEARCH_REPLACE_H_
25
#define _SEARCH_REPLACE_H_
27
#include "cairo/cairo.h"
28
#include "mforms/form.h"
29
#include "mforms/table.h"
30
#include "mforms/box.h"
31
#include "mforms/checkbox.h"
32
#include "mforms/selector.h"
33
#include "mforms/label.h"
37
// Determines which search options to show and, on return, which option was active.
41
SearchMatchCase = 1 << 0,
42
SearchMatchWholeWord = 1 << 1,
43
SearchUseRegularExpression = 1 << 2,
45
SearchDoReplace = 1 << 3,
46
SearchAll = 1 << 4, // If set the target should replace all occurences (makes no sense for search alone).
47
SearchPrevious = 1 << 5, // If set the target should search backwards instead forwards.
50
typedef boost::function<bool (const std::string, const std::string, SearchFlags)> SearchCallback;
52
class MFORMS_EXPORT SearchReplace : public Form
57
void show(bool modal, SearchFlags flags, bool replace);
58
void set_callback(SearchCallback new_callback);
61
void cancel_pressed();
62
void button_pressed(Button* button);
69
Selector _find_selector;
70
Selector _replace_selector;
72
CheckBox _ignore_case_checkbox;
73
CheckBox _match_whole_word_checkbox;
74
CheckBox _use_regex_checkbox;
77
Button _replace_all_button;
78
Button _replace_button;
79
Button _find_previous_button;
80
Button _find_next_button;
82
Button _cancel_button;
84
SearchCallback _on_action;
88
#endif // _SEARCH_REPLACE_H_