00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011 #if !defined(_XRB_CHECKBOX_HPP_)
00012 #define _XRB_CHECKBOX_HPP_
00013
00014 #include "xrb.hpp"
00015
00016 #include "xrb_button.hpp"
00017
00018 namespace Xrb
00019 {
00020
00021 class CheckBox : public Button {
00022 public:
00023
00024 CheckBox (
00025 ContainerWidget *const parent,
00026 std::string const &name = "CheckBox");
00027 virtual ~CheckBox () { }
00028
00029 inline bool IsChecked () const { return m_is_checked; }
00030
00032
00033 inline SignalSender1<bool> const *SenderCheckedStateChanged () { return &m_sender_checked_state_changed; }
00034 inline SignalSender0 const *SenderChecked () { return &m_sender_checked; }
00035 inline SignalSender0 const *SenderUnchecked () { return &m_sender_unchecked; }
00036
00038
00040
00041 inline SignalReceiver1<bool> const *ReceiverSetIsChecked () { return &m_receiver_set_is_checked; }
00042 inline SignalReceiver0 const *ReceiverCheck () { return &m_receiver_check; }
00043 inline SignalReceiver0 const *ReceiverUncheck () { return &m_receiver_uncheck; }
00044 inline SignalReceiver0 const *ReceiverToggleIsChecked () { return &m_receiver_toggle_is_checked; }
00045
00047
00048 virtual void SetIsEnabled (bool is_enabled);
00049 void SetIsChecked (bool is_checked);
00050
00051 inline void Check () { SetIsChecked(true); }
00052 inline void Uncheck () { SetIsChecked(false); }
00053 void ToggleIsChecked ();
00054
00055 protected:
00056
00057 virtual bool ProcessMouseButtonEvent (EventMouseButton const *e);
00058 virtual void UpdateRenderBackground ();
00059 virtual void UpdateRenderPicture ();
00060
00061 virtual void HandleIsCheckedChanged () { }
00062
00063
00064 virtual void HandleChangedWidgetSkinWidgetBackground (
00065 WidgetSkin::WidgetBackgroundType widget_background_type);
00066 virtual void HandleChangedWidgetSkinTexture (
00067 WidgetSkin::TextureType texture_type);
00068
00069 private:
00070
00071 bool m_is_checked;
00072
00074
00075 SignalSender1<bool> m_sender_checked_state_changed;
00076 SignalSender0 m_sender_checked;
00077 SignalSender0 m_sender_unchecked;
00078
00080
00082
00083 SignalReceiver1<bool> m_receiver_set_is_checked;
00084 SignalReceiver0 m_receiver_check;
00085 SignalReceiver0 m_receiver_uncheck;
00086 SignalReceiver0 m_receiver_toggle_is_checked;
00087
00089 };
00090
00091 }
00092
00093 #endif // !defined(_XRB_CHECKBOX_HPP_)