libt3widget
finddialog.h
1 /* Copyright (C) 2011-2012 G.P. Halkes
2  This program is free software: you can redistribute it and/or modify
3  it under the terms of the GNU General Public License version 3, as
4  published by the Free Software Foundation.
5 
6  This program is distributed in the hope that it will be useful,
7  but WITHOUT ANY WARRANTY; without even the implied warranty of
8  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
9  GNU General Public License for more details.
10 
11  You should have received a copy of the GNU General Public License
12  along with this program. If not, see <http://www.gnu.org/licenses/>.
13 */
14 #ifndef T3_WIDGET_FINDDIALOG_H
15 #define T3_WIDGET_FINDDIALOG_H
16 
17 #include <string>
18 
19 #include <t3widget/dialogs/dialog.h>
20 #include <t3widget/widgets/textfield.h>
21 #include <t3widget/widgets/checkbox.h>
22 #include <t3widget/widgets/button.h>
23 #include <t3widget/util.h>
24 
25 namespace t3_widget {
26 
27 class replace_buttons_dialog_t;
28 class finder_t;
29 
30 class T3_WIDGET_API find_dialog_t : public dialog_t {
31  private:
32  struct T3_WIDGET_LOCAL implementation_t {
33  smart_label_t *replace_label;
34  text_field_t *find_line, *replace_line;
35  checkbox_t *whole_word_checkbox,
36  *match_case_checkbox,
37  *regex_checkbox,
38  *wrap_checkbox,
39  *transform_backslash_checkbox,
40  *reverse_direction_checkbox;
41  button_t *in_selection_button, *replace_all_button;
42  signals::connection find_button_up_connection;
43  int state; // State of all the checkboxes converted to FIND_* flags
44  };
45  pimpl_ptr<implementation_t>::t impl;
46 
47  void backward_toggled(void);
48  void icase_toggled(void);
49  void regex_toggled(void);
50  void wrap_toggled(void);
51  void transform_backslash_toggled(void);
52  void whole_word_toggled(void);
53  void find_activated(void);
54  void find_activated(find_action_t);
55 
56  public:
57  find_dialog_t(int _state = find_flags_t::ICASE | find_flags_t::WRAP);
58  virtual bool set_size(optint height, optint width);
59  virtual void set_text(const std::string *str);
60  virtual void set_replace(bool _replace);
61  virtual void set_state(int _state);
62 
63  T3_WIDGET_SIGNAL(activate, void, find_action_t, finder_t *);
64 };
65 
66 class T3_WIDGET_API replace_buttons_dialog_t : public dialog_t {
67  private:
68  struct implementation_t {
69  button_t *find_button, *replace_button;
70  };
71  pimpl_ptr<implementation_t>::t impl;
72 
73  public:
75  virtual void reshow(find_action_t button);
76 
77  T3_WIDGET_SIGNAL(activate, void, find_action_t);
78 };
79 
80 }; // namespace
81 #endif
Class holding the context of a find operation.
Definition: findcontext.h:35
The t3_widget namespace is contains all classes, functions and global variables in the libt3widget li...
Definition: autocompleter.cc:18
Definition: smartlabel.h:38
Class implementing a checkbox.
Definition: checkbox.h:23
Definition: textfield.h:27
Definition: finddialog.h:30
Definition: finddialog.h:66
Class defining values with a separate validity check.
Definition: util.h:29
Button widget.
Definition: button.h:23
Base class for dialogs.
Definition: dialog.h:27