@@ -30,7 +30,7 @@ const ruis::real minimal_tile_size_pp = 30;
30
30
const ruis::real dragger_size_pp = 5 ;
31
31
} // namespace
32
32
33
- namespace {
33
+ namespace ruis ::internal {
34
34
class dragger : public ruis ::gap
35
35
{
36
36
bool grabbed = false ;
@@ -126,6 +126,8 @@ class dragger : public ruis::gap
126
126
this ->next_widget ->resize_by (-delta_vec);
127
127
this ->next_widget ->move_by (delta_vec);
128
128
129
+ this ->owner .notify_tiles_resized ();
130
+
129
131
return true ;
130
132
}
131
133
@@ -136,8 +138,14 @@ class dragger : public ruis::gap
136
138
}
137
139
138
140
if (this ->is_hovered () || grabbed) {
139
- this ->arrows_cursor_iter = this ->context .get ().cursor_stack .push (
140
- this ->owner .is_vertical () ? ruis::mouse_cursor::up_down_arrow : ruis::mouse_cursor::left_right_arrow
141
+ this ->arrows_cursor_iter = this ->context .get ().cursor_stack .push ( //
142
+ [&]() {
143
+ if (this ->owner .is_vertical ()) {
144
+ return ruis::mouse_cursor::up_down_arrow;
145
+ } else {
146
+ return ruis::mouse_cursor::left_right_arrow;
147
+ }
148
+ }()
141
149
);
142
150
} else {
143
151
this ->context .get ().cursor_stack .pop (this ->arrows_cursor_iter );
@@ -151,7 +159,7 @@ class dragger : public ruis::gap
151
159
}
152
160
}
153
161
};
154
- } // namespace
162
+ } // namespace ruis::internal
155
163
156
164
tiling_area::tiling_area (
157
165
utki::shared_ref<ruis::context> context, //
@@ -283,7 +291,7 @@ void tiling_area::on_lay_out()
283
291
// add missing draggers
284
292
while (this ->size () - 1 < num_draggers) {
285
293
this ->push_back (
286
- utki::make_shared<dragger>(
294
+ utki::make_shared<internal:: dragger>(
287
295
this ->context , //
288
296
*this ,
289
297
this ->params .dragger_color
@@ -300,7 +308,7 @@ void tiling_area::on_lay_out()
300
308
301
309
ASSERT (index < this ->content ().size ())
302
310
303
- auto & dragger = dynamic_cast <::dragger&>(i->get ());
311
+ auto & dragger = dynamic_cast <internal ::dragger&>(i->get ());
304
312
305
313
dragger.prev_widget = this ->content ().children ()[index].to_shared_ptr ();
306
314
dragger.next_widget = this ->content ().children ()[index + 1 ].to_shared_ptr ();
@@ -312,6 +320,8 @@ void tiling_area::on_lay_out()
312
320
dragger_pos[long_index] = round (dragger.next_widget ->rect ().p [long_index] - this ->dragger_size / 2 );
313
321
dragger.move_to (dragger_pos);
314
322
}
323
+
324
+ this ->notify_tiles_resized ();
315
325
}
316
326
317
327
ruis::vector2 tiling_area::measure (const ruis::vector2& quotum) const
@@ -347,6 +357,13 @@ ruis::vector2 tiling_area::measure(const ruis::vector2& quotum) const
347
357
return ret;
348
358
}
349
359
360
+ void tiling_area::notify_tiles_resized ()
361
+ {
362
+ if (this ->tiles_resized_handler ) {
363
+ this ->tiles_resized_handler (*this );
364
+ }
365
+ }
366
+
350
367
utki::shared_ref<ruis::tiling_area> make::tiling_area (
351
368
utki::shared_ref<ruis::context> context, //
352
369
ruis::tiling_area::all_parameters params,
0 commit comments