00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011 #if !defined(_XRB_KEYSELECTORBUTTON_HPP_)
00012 #define _XRB_KEYSELECTORBUTTON_HPP_
00013
00014 #include "xrb.hpp"
00015
00016 #include "xrb_button.hpp"
00017 #include "xrb_dialog.hpp"
00018 #include "xrb_key.hpp"
00019
00020 namespace Xrb
00021 {
00022
00023 class KeySelectorButton : public Button
00024 {
00025 public:
00026
00027 KeySelectorButton (
00028 std::string const &input_action_name,
00029 Key::Code key_code,
00030 ContainerWidget *parent,
00031 std::string const &name = "KeySelectorButton");
00032
00033 inline Key::Code KeyCode () const { return m_key_code; }
00034 void SetKeyCode (Key::Code key_code);
00035
00036 protected:
00037
00038 virtual void HandleReleased ();
00039
00040 private:
00041
00042 void DialogReturned (Dialog::ButtonID button_id);
00043
00044 class KeySelectorDialog : public Dialog
00045 {
00046 public:
00047
00048 KeySelectorDialog (
00049 std::string const &message,
00050 ContainerWidget *parent,
00051 std::string const &name = "KeySelectorDialog");
00052
00053 inline Key::Code KeyCode () const { return m_key_code; }
00054
00055 protected:
00056
00057 virtual bool ProcessKeyEvent (EventKey const *e);
00058 virtual bool ProcessMouseButtonEvent (EventMouseButton const *e);
00059 virtual bool ProcessMouseWheelEvent (EventMouseWheel const *e);
00060
00061 private:
00062
00063 Key::Code m_key_code;
00064 };
00065
00066 std::string const m_input_action_name;
00067 Key::Code m_key_code;
00068 KeySelectorDialog *m_key_selector_dialog;
00069 SignalReceiver1<Dialog::ButtonID> m_internal_receiver_dialog_returned;
00070 };
00071
00072 }
00073
00074 #endif // !defined(_XRB_KEYSELECTORBUTTON_HPP_)
00075