예제 #1
0
void CImgButton::OnLButtonUp(UINT nFlags, CPoint point)
{
	if (m_Disabled) return;
	InvalidateParent();

	CButton::OnLButtonUp(nFlags, point);
}
예제 #2
0
LRESULT CImgButton::OnMouseHover(WPARAM wparam, LPARAM lparam)
{
	if (m_Disabled) return NULL;
	m_Hovering = TRUE;
	InvalidateParent();

	return NULL;
}
예제 #3
0
LRESULT CImgButton::OnMouseLeave(WPARAM wparam, LPARAM lparam)
{
	if (m_Disabled) return NULL;
	m_Tracking = FALSE;
	m_Hovering = FALSE;
	InvalidateParent();

	return NULL;
}
예제 #4
0
Control::Control(const Rect& r, NoBackgroundTag)
    : Widget(new View(r), new Renderer(),
             new Controller(true, FetchPrototype<ControlEventMap>())),
      BoundControlPtr(std::bind(&Control::GetBoundControlPtr, this,
                                std::placeholders::_1))
{
    const auto h([this](UIEventArgs&&) {
        Invalidate(*this);
    });

    FetchGUIState().Wrap(*this),
                  yunseq(
    FetchEvent<Move>(*this) += [this](UIEventArgs&&) {
        InvalidateParent(*this);
    },
    FetchEvent<Resize>(*this) += h,
                                 FetchEvent<GotFocus>(*this) += h,
                                 FetchEvent<LostFocus>(*this) += h
                  );
}
예제 #5
0
파일: Border.cpp 프로젝트: kis2009dsh/YSLib
void
BorderResizer::Wrap()
{
	auto& controller(widget.get().GetController());

	yunseq(
	FetchEvent<TouchDown>(controller).Add([this](CursorEventArgs&& e){
		yunseq(orig_loc = FetchGUIState().CursorLocation,
			locked_bounds = GetBoundsOf(widget), focused = CheckArea(e));
	}, 0xE0),
	FetchEvent<TouchHeld>(controller).Add([this](CursorEventArgs&& e){
		if(e.Strategy == RoutedEventArgs::Direct
			&& focused != Area(BorderArea::Center, BorderArea::Center))
		{
			auto& st(FetchGUIState());

			if(st.CheckDraggingOffset())
			{
				const auto offset(st.CursorLocation - orig_loc);
				auto bounds(locked_bounds);

				switch(focused.first)
				{
				case BorderArea::Left:
					bounds.Width = max<SPos>(MinSize.Width,
						locked_bounds.Width - offset.X);
					bounds.X += locked_bounds.Width - bounds.Width;
					break;
				case BorderArea::Right:
					bounds.Width = max<SPos>(MinSize.Width,
						locked_bounds.Width + offset.X);
					break;
				default:
					;
				}
				switch(focused.second)
				{
				case BorderArea::Up:
					bounds.Height = max<SPos>(MinSize.Height,
						locked_bounds.Height - offset.Y);
					bounds.Y += locked_bounds.Height - bounds.Height;
					break;
				case BorderArea::Down:
					bounds.Height = max<SPos>(MinSize.Height,
						locked_bounds.Height + offset.Y);
					break;
				default:
					;
				}

				YTraceDe(Notice, "BorderResizer: new bounds = %s.\n",
					to_string(bounds).c_str());

				InvalidateParent(widget);

				if(HostMode)
				{
					const auto& off(
						bounds.GetPoint() - locked_bounds.GetPoint());

					SetBoundsOf(widget, bounds);

					const auto& nloc(FetchGUIState().CursorLocation - off);

					if(bounds.Width != MinSize.Width)
						orig_loc.X = nloc.X;
					if(bounds.Height != MinSize.Height)
						orig_loc.Y = nloc.Y;
					locked_bounds = GetBoundsOf(widget);
					locked_bounds.GetPointRef() -= off;
				}
				else
					SetBoundsOf(widget, bounds);
			}
			e.Handled = true;
			// XXX: Paint context target invalidated.
		}
	}, 0xE0),
	FetchEvent<Click>(controller).Add([this](CursorEventArgs&& e){
		CallEvent<ClickAcross>(widget, e);
	}, 0xE0),
	FetchEvent<ClickAcross>(controller).Add([this](CursorEventArgs&&){
		yunseq(orig_loc = Point::Invalid, locked_bounds = Rect(),
			focused = {BorderArea::Center, BorderArea::Center});
	}, 0xE0)
	);
}