@@ -79,13 +79,13 @@ class application : public ruisapp::application{
7979 auto c = make_root_widget (this ->window .gui .context );
8080 this ->window .gui .set_root (c);
8181
82- utki::dynamic_reference_cast<ruis::key_proxy>(c).get ().key_handler = [this ](ruis::key_proxy&, const ruis::key_event& e) -> bool {
83- if (e.is_down ){
82+ utki::dynamic_reference_cast<ruis::key_proxy>(c).get ().key_handler = [this ](ruis::key_proxy&, const ruis::key_event& e){
83+ if (e.action == ruis::button_action::press ){
8484 if (e.combo .key == ruis::key::escape){
8585 this ->quit ();
8686 }
8787 }
88- return false ;
88+ return ruis::event_status::propagate ;
8989 };
9090
9191// ruis::ZipFile zf(fsif::FSFile::New("res.zip"), "test.gui.stob");
@@ -110,10 +110,10 @@ class application : public ruisapp::application{
110110
111111 auto & cp = c.get ().get_widget_as <ruis::click_proxy>(" cube_click_proxy" );
112112 auto & bg = c.get ().get_widget_as <ruis::rectangle>(" cube_bg_color" );
113- cp.pressed_change_handler = [r{utki::make_shared_from (bg)}](ruis::click_proxy& w) -> bool {
113+ cp.pressed_change_handler = [r{utki::make_shared_from (bg)}](ruis::click_proxy& w){
114114 // NOLINTNEXTLINE(cppcoreguidelines-avoid-magic-numbers)
115115 r.get ().set_color (w.is_pressed () ? 0xff808080 : 0x80808080 );
116- return true ;
116+ return ruis::event_status::consumed ;
117117 };
118118 cp.pressed_change_handler (cp); // set initial color
119119 cp.click_handler = [cube = utki::make_shared_from (cube)](ruis::click_proxy&) -> bool {
@@ -200,9 +200,9 @@ class application : public ruisapp::application{
200200 mouse_proxy->mouse_button_handler = [state, vl](ruis::mouse_proxy&, const ruis::mouse_button_event& e){
201201 switch (e.button ){
202202 case ruis::mouse_button::left:
203- state->is_left_button_pressed = e. is_down ;
203+ state->is_left_button_pressed = (e. action == ruis::button_action::press) ;
204204 state->old_pos = e.pos ;
205- return true ;
205+ return ruis::event_status::consumed ;
206206 case ruis::mouse_button::wheel_down:
207207 if (auto l = vl.lock ()){
208208 l->scroll_by (wheel_delta);
@@ -216,7 +216,7 @@ class application : public ruisapp::application{
216216 default :
217217 break ;
218218 }
219- return false ;
219+ return ruis::event_status::propagate ;
220220 };
221221
222222 mouse_proxy->mouse_move_handler = [vs, vl, state](ruis::mouse_proxy&, const ruis::mouse_move_event& e){
@@ -226,9 +226,9 @@ class application : public ruisapp::application{
226226 if (auto l = vl.lock ()){
227227 l->scroll_by (dp.y ());
228228 }
229- return true ;
229+ return ruis::event_status::consumed ;
230230 }
231- return false ;
231+ return ruis::event_status::propagate ;
232232 };
233233 }
234234
@@ -268,20 +268,20 @@ class application : public ruisapp::application{
268268 std::cout << " button = " << unsigned (e.button ) << std::endl;
269269 switch (e.button ){
270270 case ruis::mouse_button::left:
271- state->is_left_button_pressed = e. is_down ;
271+ state->is_left_button_pressed = (e. action == ruis::button_action::press) ;
272272 state->old_pos = e.pos ;
273- return true ;
273+ return ruis::event_status::consumed ;
274274 case ruis::mouse_button::wheel_left:
275275 std::cout << " wheel_left" << std::endl;
276- if (e.is_down ){
276+ if (e.action == ruis::button_action::press ){
277277 if (auto l = hl.lock ()){
278278 l->scroll_by (-wheel_delta);
279279 }
280280 }
281281 break ;
282282 case ruis::mouse_button::wheel_right:
283283 std::cout << " wheel_right" << std::endl;
284- if (e.is_down ){
284+ if (e.action == ruis::button_action::press ){
285285 if (auto l = hl.lock ()){
286286 l->scroll_by (wheel_delta);
287287 }
@@ -290,19 +290,19 @@ class application : public ruisapp::application{
290290 default :
291291 break ;
292292 }
293- return false ;
293+ return ruis::event_status::propagate ;
294294 };
295295
296- mouse_proxy->mouse_move_handler = [hl, hs, state](ruis::mouse_proxy& w, const ruis::mouse_move_event& e) -> bool {
296+ mouse_proxy->mouse_move_handler = [hl, hs, state](ruis::mouse_proxy& w, const ruis::mouse_move_event& e){
297297 if (state->is_left_button_pressed ){
298298 auto dp = state->old_pos - e.pos ;
299299 state->old_pos = e.pos ;
300300 if (auto l = hl.lock ()){
301301 l->scroll_by (dp.x ());
302302 }
303- return true ;
303+ return ruis::event_status::consumed ;
304304 }
305- return false ;
305+ return ruis::event_status::propagate ;
306306 };
307307 }
308308
0 commit comments