Exemplo n.º 1
0
void Ctrl::WndUpdate(const Rect& r)
{
	GuiLock __;
	LLOG("WndUpdate " << UPP::Name(this));
	Ctrl *top = GetTopCtrl();
	if(top->IsOpen()) {
		HWND hwnd = top->GetHWND();
		HDC hdc = GetDC(hwnd);
		HRGN hrgn = CreateRectRgn(0, 0, 0, 0);
		if(GetUpdateRgn(hwnd, hrgn, FALSE) != NULLREGION) {
			SelectClipRgn(hdc, hrgn);
			SystemDraw draw(hdc);
			bool hcr = focusCtrl && focusCtrl->GetTopCtrl() == top &&
			           caretRect.Intersects(r + top->GetRect().TopLeft());
			if(hcr) ::HideCaret(hwnd);
			draw.Clip(r);
			top->UpdateArea(draw, r);
			ValidateRect(hwnd, r);
			SelectClipRgn(hdc, NULL);
			if(hcr) ::ShowCaret(hwnd);
		}
		ReleaseDC(hwnd, hdc);
		DeleteObject(hrgn);
	}
}
Exemplo n.º 2
0
void Ctrl::StartGrabPopup()
{
	if(activePopup.GetCount() && !grabpopup) {
		Ctrl *w = activePopup[0];
		if(w && w->IsOpen()) {
			ReleaseWndCapture0();
			static GdkCursor *NormalArrowCursor;
			ONCELOCK {
				NormalArrowCursor = gdk_cursor_new(GDK_LEFT_PTR);
			}
			if(gdk_pointer_grab(w->gdk(), FALSE,
							    GdkEventMask(GDK_BUTTON_RELEASE_MASK|GDK_BUTTON_PRESS_MASK|GDK_POINTER_MOTION_MASK),
							    NULL, NormalArrowCursor, CurrentTime) == GDK_GRAB_SUCCESS)
				grabpopup = w;
		}
Exemplo n.º 3
0
void  Ctrl::SetMouseCursor(const Image& image)
{
	LLOG("SetMouseCursor");
	GuiLock __;
	int64 id = image.GetSerialId();
	Ctrl *topctrl = NULL;
	Top *top = NULL;
	if(mouseCtrl)
		topctrl = mouseCtrl->GetTopCtrl();
	else
		topctrl = GetActiveCtrl();
	if(topctrl)
		top = topctrl->top;
	if(top && id != top->cursor_id) {
		top->cursor_id = id;
		int64 aux = image.GetAuxData();
		GdkCursor *c = NULL;
		if(aux)
			c = gdk_cursor_new((GdkCursorType)(aux - 1));
		else
		if(IsNull(image))
			c = gdk_cursor_new(GDK_BLANK_CURSOR);
		else {
			Point p = image.GetHotSpot();
			ImageGdk m;
			m.Set(image);
			GdkPixbuf *pb = m;
			if(pb)
				c = gdk_cursor_new_from_pixbuf(gdk_display_get_default(), pb, p.x, p.y);
		}
		if(c && topctrl->IsOpen()) {
			gdk_window_set_cursor(topctrl->gdk(), c);
			gdk_cursor_unref(c);
			gdk_flush(); // Make it visible immediately
		}
	}
}