8 #ifndef BOOST_UI_WIDGET_HPP
9 #define BOOST_UI_WIDGET_HPP
13 #ifdef BOOST_HAS_PRAGMA_ONCE
22 #include <boost/ui/detail/shared_count.hpp>
23 #include <boost/ui/detail/event.hpp>
34 class widget_detail_base;
69 { move(pos.
x(), pos.
y());
return *
this; }
92 {
return size(width(), height()); }
96 {
return rect(x(), y(), width(), height()); }
99 widget& enable(
bool do_enable =
true);
105 bool is_enabled()
const;
108 widget& show(
bool do_show =
true);
114 bool is_shown()
const;
130 BOOST_UI_DETAIL_HANDLER(resize,
widget);
134 BOOST_UI_DETAIL_HANDLER(key_press,
widget);
136 BOOST_UI_DETAIL_HANDLER(key_down,
widget);
138 BOOST_UI_DETAIL_HANDLER(key_up,
widget);
143 BOOST_UI_DETAIL_HANDLER(left_mouse_down,
widget);
145 BOOST_UI_DETAIL_HANDLER(left_mouse_up,
widget);
147 BOOST_UI_DETAIL_HANDLER(right_mouse_down,
widget);
149 BOOST_UI_DETAIL_HANDLER(right_mouse_up,
widget);
151 BOOST_UI_DETAIL_HANDLER(middle_mouse_down,
widget);
153 BOOST_UI_DETAIL_HANDLER(middle_mouse_up,
widget);
155 BOOST_UI_DETAIL_HANDLER(left_mouse_double_click,
widget);
156 BOOST_UI_DETAIL_HANDLER_EVENT(left_mouse_double_click_event,
widget,
mouse_event);
157 BOOST_UI_DETAIL_HANDLER(right_mouse_double_click,
widget);
158 BOOST_UI_DETAIL_HANDLER_EVENT(right_mouse_double_click_event,
widget,
mouse_event);
159 BOOST_UI_DETAIL_HANDLER(middle_mouse_double_click,
widget);
160 BOOST_UI_DETAIL_HANDLER_EVENT(middle_mouse_double_click_event,
widget,
mouse_event);
161 BOOST_UI_DETAIL_HANDLER(mouse_move,
widget);
163 BOOST_UI_DETAIL_HANDLER(mouse_drag,
widget);
165 BOOST_UI_DETAIL_HANDLER(mouse_enter,
widget);
167 BOOST_UI_DETAIL_HANDLER(mouse_leave,
widget);
169 BOOST_UI_DETAIL_HANDLER(context_menu,
widget);
171 BOOST_UI_DETAIL_HANDLER(mouse_wheel,
widget);
176 bool native_valid() const BOOST_NOEXCEPT {
return native_handle() != NULL; }
188 void detail_set_detail_impl(detail::widget_detail_base* d);
189 template <
class TDetail>
190 TDetail* get_detail_impl() {
return dynamic_cast<TDetail*
>(m_detail_impl); }
191 template <
class TDetail>
192 const TDetail* get_detail_impl()
const {
return dynamic_cast<const TDetail*
>(m_detail_impl); }
196 void delete_last_detail_impl();
198 void on_resize_raw(
const boost::function<
void()>& hanlder);
200 void on_key_press_raw(
const boost::function<
void()>& handler);
201 void on_key_press_event_raw(
const boost::function<
void(key_event&)>& handler);
202 void on_key_down_raw(
const boost::function<
void()>& handler);
203 void on_key_down_event_raw(
const boost::function<
void(key_event&)>& handler);
204 void on_key_up_raw(
const boost::function<
void()>& handler);
205 void on_key_up_event_raw(
const boost::function<
void(key_event&)>& handler);
207 void on_left_mouse_down_raw(
const boost::function<
void()>& handler);
208 void on_left_mouse_down_event_raw(
const boost::function<
void(mouse_event&)>& handler);
209 void on_left_mouse_up_raw(
const boost::function<
void()>& handler);
210 void on_left_mouse_up_event_raw(
const boost::function<
void(mouse_event&)>& handler);
211 void on_right_mouse_down_raw(
const boost::function<
void()>& handler);
212 void on_right_mouse_down_event_raw(
const boost::function<
void(mouse_event&)>& handler);
213 void on_right_mouse_up_raw(
const boost::function<
void()>& handler);
214 void on_right_mouse_up_event_raw(
const boost::function<
void(mouse_event&)>& handler);
215 void on_middle_mouse_down_raw(
const boost::function<
void()>& handler);
216 void on_middle_mouse_down_event_raw(
const boost::function<
void(mouse_event&)>& handler);
217 void on_middle_mouse_up_raw(
const boost::function<
void()>& handler);
218 void on_middle_mouse_up_event_raw(
const boost::function<
void(mouse_event&)>& handler);
219 void on_left_mouse_double_click_raw(
const boost::function<
void()>& handler);
220 void on_left_mouse_double_click_event_raw(
const boost::function<
void(mouse_event&)>& handler);
221 void on_right_mouse_double_click_raw(
const boost::function<
void()>& handler);
222 void on_right_mouse_double_click_event_raw(
const boost::function<
void(mouse_event&)>& handler);
223 void on_middle_mouse_double_click_raw(
const boost::function<
void()>& handler);
224 void on_middle_mouse_double_click_event_raw(
const boost::function<
void(mouse_event&)>& handler);
225 void on_mouse_move_raw(
const boost::function<
void()>& handler);
226 void on_mouse_move_event_raw(
const boost::function<
void(mouse_event&)>& handler);
227 void on_mouse_drag_raw(
const boost::function<
void()>& handler);
228 void on_mouse_drag_event_raw(
const boost::function<
void(mouse_event&)>& handler);
229 void on_mouse_enter_raw(
const boost::function<
void()>& handler);
230 void on_mouse_enter_event_raw(
const boost::function<
void(mouse_event&)>& handler);
231 void on_mouse_leave_raw(
const boost::function<
void()>& handler);
232 void on_mouse_leave_event_raw(
const boost::function<
void(mouse_event&)>& handler);
233 void on_context_menu_raw(
const boost::function<
void()>& handler);
234 void on_context_menu_event_raw(
const boost::function<
void(mouse_event&)>& handler);
235 void on_mouse_wheel_raw(
const boost::function<
void()>& handler);
236 void on_mouse_wheel_event_raw(
const boost::function<
void(wheel_event&)>& handler);
238 detail::widget_detail_base* m_detail_impl;
239 detail::shared_count m_shared_count;
242 friend class native_helper;
259 #endif // BOOST_UI_WIDGET_HPP