14#include <FL/Fl_Window.H>
26class MyInput :
public Fl_Input {
28 MyInput (
int x,
int y,
int w,
int h,
const char* l=0) :
29 Fl_Input(x,y,w,h,l) {};
32 void d_position(
int p);
37int MyInput::d_position()
39#if FL_API_VERSION < 10400
40 return MyInput::position();
42 return MyInput::insert_position();
46void MyInput::d_position(
int p)
48#if FL_API_VERSION < 10400
51 MyInput::insert_position(p);
55int MyInput::handle(
int e)
57 _MSG(
"findbar MyInput::handle()\n");
58 int ret = 1, k = Fl::event_key();
59 unsigned modifier = Fl::event_state() & (FL_SHIFT| FL_CTRL| FL_ALT|FL_META);
61 if (e == FL_KEYBOARD) {
62 if (k == FL_Page_Down || k == FL_Page_Up || k == FL_Up || k == FL_Down) {
66 if (modifier == FL_SHIFT) {
67 if (k == FL_Left || k == FL_Right) {
71 }
else if (modifier == FL_CTRL) {
72 if (k ==
'a' || k ==
'e') {
73 d_position(k ==
'a' ? 0 : size());
75 }
else if (k ==
'k') {
76 cut(d_position(), size());
78 }
else if (k ==
'd') {
79 cut(d_position(), d_position()+1);
81 }
else if (k ==
'h' || k ==
'i' || k ==
'j' || k ==
'l' || k ==
'm') {
87 }
else if (k == FL_Escape && modifier == 0) {
94 ret = Fl_Input::handle(e);
104 const char *key = fb->
i->value();
109 key, case_sens,
false);
118 const char *key = fb->
i->value();
121 if (key[0] !=
'\0') {
123 key, case_sens,
true);
139 Fl_Group(0, 0, width, height)
141 int button_width = 70;
144 int input_width = width - (2 * border + 4 * (button_width + gap));
147 Fl_Group::current(0);
149 height -= 2 * border;
163 i =
new MyInput(x, border, input_width, height);
164 x += input_width + gap;
166 i->when(FL_WHEN_NEVER);
170 x += button_width + gap;
180 x += button_width + gap;
181 prev_btn->shortcut(FL_SHIFT+FL_Enter);
186 "shortcut: Shift+Enter");
189 check_btn =
new Fl_Check_Button(x, border, 2*button_width, height,
191 x += 2 * button_width + gap;
207 int k = Fl::event_key();
208 unsigned modifier = Fl::event_state() & (FL_SHIFT| FL_CTRL| FL_ALT|FL_META);
210 if (event == FL_KEYBOARD && modifier == 0 && k == FL_Escape) {
215 return Fl_Group::handle(event);
231#if FL_API_VERSION < 10400
232 i->position(
i->size(), 0);
234 i->insert_position(
i->size(), 0);
Searchbar to find text in page.
static void hide_cb(Fl_Widget *, void *)
Hide the search bar.
int handle(int event)
Handle events.
void show()
Show the findbar and focus the input field.
Fl_Check_Button * check_btn
static void searchBackwards_cb(Fl_Widget *, void *)
Find previous occurrence of input key.
static void search_cb(Fl_Widget *, void *)
Find next occurrence of input key.
Findbar(int width, int height)
Construct text search bar.
static const char *const new_s_xpm[]
Contains the specific data for a single window.
void a_UIcmd_findtext_search(BrowserWindow *bw, const char *key, int case_sens, int backward)
BrowserWindow * a_UIcmd_get_bw_by_widget(void *v_wid)
void a_UIcmd_findbar_toggle(BrowserWindow *bw, int on)