Exemple #1
0
void TElementsView::FrameResized(float w,float h)
{
	AdjustScrollBars();
	DrawDragRect();

	BView::FrameResized(w, h);
}
Exemple #2
0
void TElementsView::Draw(BRect updateRect)
{
	BView::Draw(updateRect);

	// Draw simulated DragRect
	DrawDragRect();
}
void CEdit::DrawDragCaret( BOOL bMakeEmpty ) const
{
	if ( m_rcDragCaret.right )
		DrawDragRect( m_rcDragCaret );

	if ( bMakeEmpty )
		SetRectEmpty( ( LPRECT ) &m_rcDragCaret );
}
//绘制当前矩形
//注意:如果绘制后m_DragRc位置没有变动,则再次调用为擦除矩形
void RingDragger::DrawRect(int width)
{
	if(width > 1)
		DrawDragRect(m_DC,&m_DragRc,width);
	else
		DrawLineRect(m_DC,&m_DragRc);

	m_width = width;
}
Exemple #5
0
void DrawDragRect(Ctrl& q, const Rect& rect1, const Rect& rect2, const Rect& clip, int n,
                  Color color, int type, int animation)
{
	Ctrl *top = q.GetTopCtrl();
	if(top) {
		Point off = q.GetScreenView().TopLeft();
		DrawDragRectInfo f;
		f.rect1 = rect1.Offseted(off);
		f.rect2 = rect2.Offseted(off);
		f.clip = (clip & q.GetSize()).Offseted(off);
		f.n = n;
		f.type = type;
		f.animation = animation;
		DrawDragRect(*top, f);
		Ctrl::SyncClient();
		Ctrl::Output();
	}
}
Exemple #6
0
void CDlgMovedBase::OnMouseMove(UINT nFlags, CPoint point)
{
	// TODO: 在此添加消息处理程序代码和/或调用默认值
	if (!m_bDraging)
	{
		return CDialog::OnMouseMove(nFlags, point);
	}

	CRect rcNext = m_rcPre;
	CPoint ptCur;
	GetCursorPos(&ptCur);
	rcNext.OffsetRect(ptCur - m_ptPre);
	if (!m_bDragWithWnd)
	{
		DrawDragRect(&m_rcPre, &rcNext);
	}
	else
	{
		SetWindowPos(NULL, rcNext.left, rcNext.top, 0,0, SWP_NOSIZE);
	}
	m_rcPre= rcNext;
	m_ptPre = ptCur;
	CDialog::OnMouseMove(nFlags, point);
}
Exemple #7
0
void CDlgMovedBase::OnLButtonUp(UINT nFlags, CPoint point)
{
	// TODO: 在此添加消息处理程序代码和/或调用默认值
	if (!m_bDraging)
	{
		return CDialog::OnLButtonUp(nFlags, point);;
	}

	m_bDraging = FALSE;
	ReleaseCapture();
	if (!m_bDragWithWnd)
	{
		DrawDragRect(&m_rcPre, &m_rcPre, 2);
	}

	CRect rcNext = m_rcOrg;
	CPoint ptCur;
	GetCursorPos(&ptCur);
	rcNext.OffsetRect(ptCur - m_ptBeforeDrag);

	MoveWindow(rcNext);
	//Invalidate(TRUE);
	CDialog::OnLButtonUp(nFlags, point);
}
Exemple #8
0
void CDlgMovedBase::OnLButtonDown(UINT nFlags, CPoint point)
{
	// TODO: 在此添加消息处理程序代码和/或调用默认值
	if (!m_rcDragRect.IsRectEmpty())
	{
		GetWindowRect(m_rcOrg);
		GetCursorPos(&m_ptBeforeDrag);
		CRect rcDragScreen(m_rcDragRect);
		ClientToScreen(&rcDragScreen);
		if (rcDragScreen.PtInRect(m_ptBeforeDrag))
		{
			m_rcPre = m_rcOrg;
			m_ptPre = m_ptBeforeDrag;
			m_bDraging = TRUE;
			SetCapture();
			if (!m_bDragWithWnd)
			{
				DrawDragRect(&m_rcPre, &m_rcPre, 0);
			}
		}
		
	}
	CDialog::OnLButtonDown(nFlags, point);
}
Exemple #9
0
gboolean Ctrl::GtkEvent(GtkWidget *widget, GdkEvent *event, gpointer user_data)
{
	GuiLock __;
	GdkEventKey *key;
	bool pressed = false;
	bool  retval = true;
	Value value;
	Ctrl *p = GetTopCtrlFromId(user_data);
#ifdef LOG_EVENTS
	String ev = "?";
	Tuple2<int, const char *> *f = FindTuple(xEvent, __countof(xEvent), event->type);
	if(f)
		ev = f->b;
	LOG(rmsecs() << " FETCH EVENT " << ev << " ctrl: " << Name(p));
#endif

	switch(event->type) {
	case GDK_EXPOSE:
	case GDK_DAMAGE:
		if(p) {
#ifdef LOG_EVENTS
			TimeStop tm;
#endif
			p->fullrefresh = false;
			GdkEventExpose *e = (GdkEventExpose *)event;
			SystemDraw w(gdk_cairo_create(p->gdk()), p->gdk());
			painting = true;
			Rect r = RectC(e->area.x, e->area.y, e->area.width, e->area.height);
			w.SetInvalid(e->region);
			w.Clip(r);
			p->UpdateArea(w, r);
			w.End();
			cairo_destroy(w);
			if(p->top->dr)
				DrawDragRect(*p, *p->top->dr);
			painting = false;
#ifdef LOG_EVENTS
			LOG("* " << ev << " elapsed " << tm);
#endif
		}
		return true;
	case GDK_DELETE:
		break;
	case GDK_FOCUS_CHANGE:
		if(p) {
			if(((GdkEventFocus *)event)->in)
				gtk_im_context_focus_in(p->top->im_context);
			else
				gtk_im_context_focus_out(p->top->im_context);
			AddEvent(user_data, EVENT_NONE, value, event);
		}
		return false;
	case GDK_LEAVE_NOTIFY:
	case GDK_MOTION_NOTIFY:
		break;
	case GDK_BUTTON_PRESS:
		value = DoButtonEvent(event, true);
		if(IsNull(value))
			return false;
		break;
	case GDK_2BUTTON_PRESS:
		value = DoButtonEvent(event, true);
		if(IsNull(value))
			return false;
		break;
	case GDK_BUTTON_RELEASE:
		value = DoButtonEvent(event, false);
		if(IsNull(value))
			return false;
		break;
	case GDK_SCROLL: {
		GdkEventScroll *e = (GdkEventScroll *)event;
		value = findarg(e->direction, GDK_SCROLL_UP, GDK_SCROLL_LEFT) < 0 ? -120 : 120;
		break;
	}
	case GDK_KEY_PRESS:
		pressed = true;
	case GDK_KEY_RELEASE:
		key = (GdkEventKey *)event;
		value = (int) key->keyval;
		if(pressed) {
			p = GetTopCtrlFromId(user_data);
			if(p && gtk_im_context_filter_keypress(p->top->im_context, key))
				return true;
		}
		break;
	case GDK_CONFIGURE: {
		retval = false;
		GdkEventConfigure *e = (GdkEventConfigure *)event;
		value = RectC(e->x, e->y, e->width, e->height);
		LLOG("GDK_CONFIGURE " << value);
		break;
	}
	default:
		return false;
	}
	AddEvent(user_data, event->type, value, event);
	return retval;
}