コード例 #1
0
ファイル: checkbox_view.cpp プロジェクト: ARMCoderCHS/ClanLib
	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(); });
	}
コード例 #2
0
ファイル: checkbox_view.cpp プロジェクト: ArtHome12/ClanLib
	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(); });
	}
コード例 #3
0
ファイル: scrollbar_view.cpp プロジェクト: ArtHome12/ClanLib
	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();
	}