13#include <FL/Fl_Window.H>
25class MyInput :
public Fl_Input {
27 MyInput (
int x,
int y,
int w,
int h,
const char* l=0) :
28 Fl_Input(x,y,w,h,l) {};
32int MyInput::handle(
int e)
34 _MSG(
"findbar MyInput::handle()\n");
35 int ret = 1, k = Fl::event_key();
36 unsigned modifier = Fl::event_state() & (FL_SHIFT| FL_CTRL| FL_ALT|FL_META);
38 if (e == FL_KEYBOARD) {
39 if (k == FL_Page_Down || k == FL_Page_Up || k == FL_Up || k == FL_Down) {
43 if (modifier == FL_SHIFT) {
44 if (k == FL_Left || k == FL_Right) {
48 }
else if (modifier == FL_CTRL) {
49 if (k ==
'a' || k ==
'e') {
50 position(k ==
'a' ? 0 : size());
52 }
else if (k ==
'k') {
53 cut(position(), size());
55 }
else if (k ==
'd') {
56 cut(position(), position()+1);
58 }
else if (k ==
'h' || k ==
'i' || k ==
'j' || k ==
'l' || k ==
'm') {
64 }
else if (k == FL_Escape && modifier == 0) {
71 ret = Fl_Input::handle(e);
81 const char *key = fb->
i->value();
86 key, case_sens,
false);
95 const char *key = fb->
i->value();
100 key, case_sens,
true);
116 Fl_Group(0, 0, width, height)
118 int button_width = 70;
121 int input_width = width - (2 * border + 4 * (button_width + gap));
124 Fl_Group::current(0);
126 height -= 2 * border;
140 i =
new MyInput(x, border, input_width, height);
141 x += input_width + gap;
143 i->when(FL_WHEN_NEVER);
147 x += button_width + gap;
157 x += button_width + gap;
158 prev_btn->shortcut(FL_SHIFT+FL_Enter);
163 "shortcut: Shift+Enter");
166 check_btn =
new Fl_Check_Button(x, border, 2*button_width, height,
168 x += 2 * button_width + gap;
184 int k = Fl::event_key();
185 unsigned modifier = Fl::event_state() & (FL_SHIFT| FL_CTRL| FL_ALT|FL_META);
187 if (event == FL_KEYBOARD && modifier == 0 && k == FL_Escape) {
192 return Fl_Group::handle(event);
208 i->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)