summaryrefslogtreecommitdiff
path: root/src/Fl_Search_Chooser.cxx
diff options
context:
space:
mode:
authorJohannes Hofmann <Johannes.Hofmann@gmx.de>2007-01-16 15:30:24 +0100
committerJohannes Hofmann <Johannes.Hofmann@gmx.de>2007-01-16 15:30:24 +0100
commit54f77f2aca70e6b895e07778e4bfa9810bef9c58 (patch)
tree1e31a762cf69360892de1522cee4c0fdbe54476b /src/Fl_Search_Chooser.cxx
parentd5f04f65ca793753ed8dc5ad31c99b30dee863f8 (diff)
parentea65a7c0bcd3c8bf5c889b11141210b23b987916 (diff)
merge with main
Diffstat (limited to 'src/Fl_Search_Chooser.cxx')
-rw-r--r--src/Fl_Search_Chooser.cxx40
1 files changed, 27 insertions, 13 deletions
diff --git a/src/Fl_Search_Chooser.cxx b/src/Fl_Search_Chooser.cxx
index d4f93b2..0b3cc93 100644
--- a/src/Fl_Search_Chooser.cxx
+++ b/src/Fl_Search_Chooser.cxx
@@ -22,7 +22,7 @@ Fl_Search_Browser::find_prefix(const char *p) {
select(i);
return 0;
}
-};
+}
int
Fl_Search_Browser::find_prefix(const char *p, int s, int e) {
@@ -56,19 +56,20 @@ static void input_cb(Fl_Input* in, void*c) {
static void ok_cb(Fl_Input* in, void*c) {
Fl_Search_Chooser *sc = (Fl_Search_Chooser *) c;
- sc->w->hide();
+ sc->close();
}
static void cancel_cb(Fl_Input* in, void*c) {
Fl_Search_Chooser *sc = (Fl_Search_Chooser *) c;
sc->sb->deselect();
- sc->w->hide();
+ sc->close();
}
-Fl_Search_Chooser::Fl_Search_Chooser(const char *title) {
- w = new Fl_Window(320, 320, title?title:"Choose");
- Fl_Group *g = new Fl_Group(10, 10, w->w() - 10, w->h() - 10);
+Fl_Search_Chooser::Fl_Search_Chooser(const char *title) : Fl_Window(320, 320, title?title:"Choose") {
+ visible_focus = Fl::visible_focus();
+ Fl::visible_focus(0);
+ Fl_Group *g = new Fl_Group(10, 10, w() - 10, h() - 10);
sb = new Fl_Search_Browser(g->x(), g->y(), g->w() , g->h() - 100, NULL);
sb->type(FL_HOLD_BROWSER);
Fl_Input *in = new Fl_Input(g->x()+50, g->h()-80, g->w()-80, 20, "Search");
@@ -80,7 +81,13 @@ Fl_Search_Chooser::Fl_Search_Chooser(const char *title) {
ok_b->callback((Fl_Callback*) ok_cb, this);
Fl::focus(in);
g->end();
- w->end();
+ end();
+}
+
+void
+Fl_Search_Chooser::close() {
+ hide();
+ Fl::visible_focus(visible_focus);
}
void
@@ -98,12 +105,19 @@ Fl_Search_Chooser::data() {
}
}
-void
-Fl_Search_Chooser::show() {
- w->show();
-}
int
-Fl_Search_Chooser::shown() {
- return w->shown();
+Fl_Search_Chooser::handle(int event) {
+ switch(event) {
+ case FL_KEYBOARD:
+ int key = Fl::event_key();
+
+ if (key == FL_Up || key == FL_Down) {
+ return sb->handle(event);
+ } else if (key == FL_Enter) {
+ close();
+ }
+ }
+
+ return Fl_Window::handle(event);
}