Exemple #1
0
	SliderView::SliderView() : impl(std::make_shared<SliderViewImpl>())
	{
		impl->slider = this;

		impl->track = std::make_shared<View>();
		impl->thumb = std::make_shared<View>();

		add_subview(impl->track);
		add_subview(impl->thumb);
	
		slots.connect(sig_pointer_press(), impl.get(), &SliderViewImpl::on_pointer_track_press);
		slots.connect(sig_pointer_release(), impl.get(), &SliderViewImpl::on_pointer_track_release);

		slots.connect(impl->thumb->sig_pointer_press(), impl.get(), &SliderViewImpl::on_pointer_thumb_press);
		slots.connect(impl->thumb->sig_pointer_release(), impl.get(), &SliderViewImpl::on_pointer_thumb_release);

		slots.connect(impl->thumb->sig_pointer_enter(), [&](PointerEvent &e) {impl->_state_hot = true;  impl->update_state(); });
		slots.connect(impl->thumb->sig_pointer_leave(), [&](PointerEvent &e) {impl->_state_hot = false;  impl->update_state(); });

		slots.connect(impl->thumb->sig_pointer_move(), impl.get(), &SliderViewImpl::on_pointer_move);

		slots.connect(sig_focus_gained(), impl.get(), &SliderViewImpl::on_focus_gained);
		slots.connect(sig_focus_lost(), impl.get(), &SliderViewImpl::on_focus_lost);
		slots.connect(sig_activated(), impl.get(), &SliderViewImpl::on_activated);
		slots.connect(sig_activated(), impl.get(), &SliderViewImpl::on_deactivated);

		impl->scroll_timer.func_expired() = clan::bind_member(impl.get(), &SliderViewImpl::scroll_timer_expired);

		set_vertical();
	}
	CheckBoxView::CheckBoxView() : impl(new CheckBoxView_Impl())
	{
		impl->checkbox = this;

		slots.connect(sig_pointer_press(), impl.get(), &CheckBoxView_Impl::on_pointer_press);
		slots.connect(sig_pointer_release(), impl.get(), &CheckBoxView_Impl::on_pointer_release);

		slots.connect(sig_pointer_enter(), [&](PointerEvent &e) {impl->_state_hot = true;  impl->update_state(); });
		slots.connect(sig_pointer_leave(), [&](PointerEvent &e) {impl->_state_hot = false;  impl->update_state(); });
	}
Exemple #3
0
	CheckBoxView::CheckBoxView() : impl(new CheckBoxView_Impl())
	{
		impl->checkbox = this;

		impl->label = std::make_shared<LabelView>();
		add_child(impl->label);

		slots.connect(sig_pointer_press(), impl.get(), &CheckBoxView_Impl::on_pointer_press);
		slots.connect(sig_pointer_release(), impl.get(), &CheckBoxView_Impl::on_pointer_release);

		slots.connect(sig_pointer_enter(), [&](PointerEvent &e) {impl->_state_hot = true;  impl->update_state(); });
		slots.connect(sig_pointer_leave(), [&](PointerEvent &e) {impl->_state_hot = false;  impl->update_state(); });
		slots.connect(impl->label->sig_pointer_enter(), [&](PointerEvent &e) {impl->_state_hot = true;  impl->update_state(); });
		slots.connect(impl->label->sig_pointer_leave(), [&](PointerEvent &e) {impl->_state_hot = false;  impl->update_state(); });
	}