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();
	}
Exemple #2
0
	SpinBaseView::SpinBaseView() : impl(std::make_shared<SpinBaseView_Impl>())
	{
		impl->spin = this;

		impl->button_decrement = std::make_shared<View>();
		impl->button_increment = std::make_shared<View>();

		add_child(impl->button_decrement);
		add_child(impl->button_increment);

		slots.connect(impl->button_decrement->sig_pointer_press(), [this](PointerEvent *e) { impl->on_pointer_decrement_press(*e); });
		slots.connect(impl->button_decrement->sig_pointer_release(), [this](PointerEvent *e) { impl->on_pointer_decrement_release(*e); });
		slots.connect(impl->button_increment->sig_pointer_press(), [this](PointerEvent *e) { impl->on_pointer_increment_press(*e); });
		slots.connect(impl->button_increment->sig_pointer_release(), [this](PointerEvent *e) { impl->on_pointer_increment_release(*e); });

		slots.connect(sig_focus_gained(), [this](FocusChangeEvent *e) { impl->on_focus_gained(*e); });
		slots.connect(sig_focus_lost(), [this](FocusChangeEvent *e) { impl->on_focus_lost(*e); });
		slots.connect(sig_activated(), [this](ActivationChangeEvent *e) { impl->on_activated(*e); });
		slots.connect(sig_deactivated(), [this](ActivationChangeEvent *e) { impl->on_deactivated(*e); });

		slots.connect(impl->button_decrement->sig_pointer_enter(), [&](PointerEvent *e) {impl->_state_decrement_hot = true; impl->update_decrement_state(); });
		slots.connect(impl->button_decrement->sig_pointer_leave(), [&](PointerEvent *e) {impl->_state_decrement_hot = false; impl->update_decrement_state(); });
		slots.connect(impl->button_increment->sig_pointer_enter(), [&](PointerEvent *e) {impl->_state_increment_hot = true; impl->update_increment_state(); });
		slots.connect(impl->button_increment->sig_pointer_leave(), [&](PointerEvent *e) {impl->_state_increment_hot = false; impl->update_increment_state(); });

		impl->timer->func_expired() = uicore::bind_member(impl.get(), &SpinBaseView_Impl::timer_expired);
	}
Exemple #3
0
	SpinView::SpinView() : impl(std::make_shared<SpinView_Impl>())
	{
		impl->spin = this;

		impl->button_decrement = std::make_shared<View>();
		impl->button_increment = std::make_shared<View>();

		add_subview(impl->button_decrement);
		add_subview(impl->button_increment);

		slots.connect(impl->button_decrement->sig_pointer_press(), impl.get(), &SpinView_Impl::on_pointer_decrement_press);
		slots.connect(impl->button_decrement->sig_pointer_release(), impl.get(), &SpinView_Impl::on_pointer_decrement_release);
		slots.connect(impl->button_increment->sig_pointer_press(), impl.get(), &SpinView_Impl::on_pointer_increment_press);
		slots.connect(impl->button_increment->sig_pointer_release(), impl.get(), &SpinView_Impl::on_pointer_increment_release);

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

		slots.connect(impl->button_decrement->sig_pointer_enter(), [&](PointerEvent &e) {impl->_state_decrement_hot = true;  impl->update_decrement_state(); });
		slots.connect(impl->button_decrement->sig_pointer_leave(), [&](PointerEvent &e) {impl->_state_decrement_hot = false;  impl->update_decrement_state(); });
		slots.connect(impl->button_increment->sig_pointer_enter(), [&](PointerEvent &e) {impl->_state_increment_hot = true;  impl->update_increment_state(); });
		slots.connect(impl->button_increment->sig_pointer_leave(), [&](PointerEvent &e) {impl->_state_increment_hot = false;  impl->update_increment_state(); });

		impl->timer.func_expired() = clan::bind_member(impl.get(), &SpinView_Impl::timer_expired);
	}
Exemple #4
0
	ScrollBarView::ScrollBarView(bool render_button_arrows) : impl(std::make_shared<ScrollBarViewImpl>())
	{
		impl->scrollbar = this;

		impl->button_decrement = std::make_shared<ScrollBarButtonView>(render_button_arrows);
		impl->button_increment = std::make_shared<ScrollBarButtonView>(render_button_arrows);
		impl->track = std::make_shared<View>();
		impl->thumb = std::make_shared<View>();
		impl->thumb_grip = std::make_shared<View>();
		auto spacer1 = std::make_shared<View>();
		auto spacer2 = std::make_shared<View>();

		add_child(impl->button_decrement);
		add_child(impl->track);
		add_child(impl->button_increment);

		impl->track->add_child(impl->thumb);

		impl->thumb->add_child(spacer1);
		impl->thumb->add_child(impl->thumb_grip);
		impl->thumb->add_child(spacer2);

		impl->button_decrement->style()->set("flex: 0 0 auto");
		impl->button_increment->style()->set("flex: 0 0 auto");
		impl->track->style()->set("flex: 1 1 auto");
		impl->thumb->style()->set("position: absolute");
		spacer1->style()->set("flex: 1 1 auto");
		spacer2->style()->set("flex: 1 1 auto");

		impl->button_decrement->style()->set("width: 17px; height: 17px");
		impl->button_increment->style()->set("width: 17px; height: 17px");

		slots.connect(impl->track->sig_pointer_press(), impl.get(), &ScrollBarViewImpl::on_pointer_track_press);
		slots.connect(impl->track->sig_pointer_double_click(), impl.get(), &ScrollBarViewImpl::on_pointer_track_press);
		slots.connect(impl->track->sig_pointer_release(), impl.get(), &ScrollBarViewImpl::on_pointer_track_release);

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

		slots.connect(impl->button_decrement->sig_pointer_press(), impl.get(), &ScrollBarViewImpl::on_pointer_decrement_press);
		slots.connect(impl->button_decrement->sig_pointer_double_click(), impl.get(), &ScrollBarViewImpl::on_pointer_decrement_press);
		slots.connect(impl->button_decrement->sig_pointer_release(), impl.get(), &ScrollBarViewImpl::on_pointer_decrement_release);
		slots.connect(impl->button_increment->sig_pointer_press(), impl.get(), &ScrollBarViewImpl::on_pointer_increment_press);
		slots.connect(impl->button_increment->sig_pointer_double_click(), impl.get(), &ScrollBarViewImpl::on_pointer_increment_press);
		slots.connect(impl->button_increment->sig_pointer_release(), impl.get(), &ScrollBarViewImpl::on_pointer_increment_release);

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

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

		slots.connect(impl->track->sig_pointer_enter(), [&](PointerEvent &e) {impl->_state_track_hot = true;  impl->update_track_state(); });
		slots.connect(impl->track->sig_pointer_leave(), [&](PointerEvent &e) {impl->_state_track_hot = false;  impl->update_track_state(); });
		slots.connect(impl->thumb->sig_pointer_enter(), [&](PointerEvent &e) {impl->_state_thumb_hot = true;  impl->update_thumb_state(); });
		slots.connect(impl->thumb->sig_pointer_leave(), [&](PointerEvent &e) {impl->_state_thumb_hot = false;  impl->update_thumb_state(); });
		slots.connect(impl->thumb_grip->sig_pointer_enter(), [&](PointerEvent &e) {impl->_state_thumb_hot = true;  impl->update_thumb_state(); });
		slots.connect(impl->thumb_grip->sig_pointer_leave(), [&](PointerEvent &e) {impl->_state_thumb_hot = false;  impl->update_thumb_state(); });
		slots.connect(spacer1->sig_pointer_enter(), [&](PointerEvent &e) {impl->_state_thumb_hot = true;  impl->update_thumb_state(); });
		slots.connect(spacer1->sig_pointer_leave(), [&](PointerEvent &e) {impl->_state_thumb_hot = false;  impl->update_thumb_state(); });
		slots.connect(spacer2->sig_pointer_enter(), [&](PointerEvent &e) {impl->_state_thumb_hot = true;  impl->update_thumb_state(); });
		slots.connect(spacer2->sig_pointer_leave(), [&](PointerEvent &e) {impl->_state_thumb_hot = false;  impl->update_thumb_state(); });
		slots.connect(impl->button_decrement->sig_pointer_enter(), [&](PointerEvent &e) {impl->_state_decrement_hot = true;  impl->update_decrement_state(); });
		slots.connect(impl->button_decrement->sig_pointer_leave(), [&](PointerEvent &e) {impl->_state_decrement_hot = false;  impl->update_decrement_state(); });
		slots.connect(impl->button_increment->sig_pointer_enter(), [&](PointerEvent &e) {impl->_state_increment_hot = true;  impl->update_increment_state(); });
		slots.connect(impl->button_increment->sig_pointer_leave(), [&](PointerEvent &e) {impl->_state_increment_hot = false;  impl->update_increment_state(); });

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

		set_vertical();
	}