}
}
-void Container::key_press(unsigned key, unsigned mod)
+bool Container::key_press(unsigned key, unsigned mod)
{
if(input_focus)
- input_focus->key_press(key, mod);
+ return input_focus->key_press(key, mod);
+ else
+ return false;
}
-void Container::key_release(unsigned key, unsigned mod)
+bool Container::key_release(unsigned key, unsigned mod)
{
if(input_focus)
- input_focus->key_release(key, mod);
+ return input_focus->key_release(key, mod);
+ else
+ return false;
}
-void Container::character(wchar_t ch)
+bool Container::character(wchar_t ch)
{
if(input_focus)
- input_focus->character(ch);
+ return input_focus->character(ch);
+ else
+ return false;
}
void Container::focus_out()
virtual void touch_press(int, int, unsigned);
virtual void touch_release(int, int, unsigned);
virtual void touch_motion(int, int, unsigned);
- virtual void key_press(unsigned, unsigned);
- virtual void key_release(unsigned, unsigned);
- virtual void character(wchar_t);
+ virtual bool key_press(unsigned, unsigned);
+ virtual bool key_release(unsigned, unsigned);
+ virtual bool character(wchar_t);
virtual void focus_out();
protected:
virtual void on_reparent();
delete this;
}
-void Dialog::key_release(unsigned key, unsigned mod)
+bool Dialog::key_release(unsigned key, unsigned mod)
{
- Panel::key_release(key, mod);
+ bool result = Panel::key_release(key, mod);
if(stale)
delete this;
+ return result;
}
void Dialog::response(int code)
void add_button(Button &, int);
virtual void button_release(int, int, unsigned);
- virtual void key_release(unsigned, unsigned);
+ virtual bool key_release(unsigned, unsigned);
protected:
void response(int);
slider->render(renderer);
}
-void Entry::key_press(unsigned key, unsigned)
+bool Entry::key_press(unsigned key, unsigned)
{
got_key_press = true;
if(key==Input::KEY_LEFT)
else
signal_enter.emit();
}
+ else
+ return false;
+
+ return true;
}
-void Entry::character(wchar_t ch)
+bool Entry::character(wchar_t ch)
{
if(got_key_press && ch>=' ')
{
text.insert(edit_pos, StringCodec::encode<StringCodec::Utf8>(StringCodec::ustring(1, ch)));
++edit_pos;
rebuild();
+ return true;
}
+
+ return false;
}
void Entry::focus_out()
virtual void render_special(const Part &, GL::Renderer &) const;
public:
- virtual void key_press(unsigned, unsigned);
- virtual void character(wchar_t);
+ virtual bool key_press(unsigned, unsigned);
+ virtual bool character(wchar_t);
virtual void focus_out();
private:
virtual void on_geometry_change();
{
// XXX Modifiers
if(visible)
- {
- Widget *old_focus = input_focus;
-
- key_press(key, 0);
-
- if(input_focus || old_focus)
- return true;
- }
+ return key_press(key, 0);
return false;
}
bool Root::key_release_event(unsigned key)
{
if(visible)
- {
- Widget *old_focus = input_focus;
-
- key_release(key, 0);
-
- if(input_focus || old_focus)
- return true;
- }
+ return key_release(key, 0);
return false;
}
bool Root::character_event(StringCodec::unichar ch)
{
if(visible)
- {
- Widget *old_focus = input_focus;
-
- character(ch);
-
- if(input_focus || old_focus)
- return true;
- }
+ return character(ch);
return false;
}
virtual void touch_press(int, int, unsigned);
virtual void touch_release(int, int, unsigned);
virtual void touch_motion(int, int, unsigned);
- virtual void key_press(unsigned, unsigned) { }
- virtual void key_release(unsigned, unsigned) { }
- virtual void character(wchar_t) { }
+ virtual bool key_press(unsigned, unsigned) { return false; }
+ virtual bool key_release(unsigned, unsigned) { return false; }
+ virtual bool character(wchar_t) { return false; }
virtual void focus_in();
virtual void focus_out();
protected: