Exemple #1
0
void ArpIntControl::StartEdit()
{
	// If I've lost the active state while waiting, don't start editing.
	if ( !Window() || !Window()->IsActive() ) return;
	
	StopEdit(false);
	StopTimer();
	
	BRect		b = ControlBounds();
	float		borderL = b.left;
	float		bottomIndent = 0;
	float		stringIndent = 3;
	BPoint		origin( borderL + 3, b.bottom - bottomIndent - stringIndent );
	
	if (!mTextCtrl) {
		BFont font;
		GetFont(&font);
		mTextCtrl = new ArpInlineTextView(BMessenger(this),
										  "text:edit", &font,
										  origin.x, b.right-2, origin.y);
	}
	if (!mTextCtrl) return;
	
	SetEventMask(B_POINTER_EVENTS, B_NO_POINTER_HISTORY);
	
	mTextCtrl->MoveOver(origin.x, b.right-2, origin.y);
	mTextCtrl->SetViewColor( Prefs().GetColor(ARP_INT_BGF_C));
	mTextCtrl->SetHighColor( Prefs().GetColor(ARP_INT_FGF_C));
	BString16		str;
	GetValueLabel(Value(), str);
	mTextCtrl->SetText( str.String() );
	AddChild(mTextCtrl);
}
Exemple #2
0
void ArpIntControl::DrawOn(BRect updateRect, BView* view)
{
	BRect		cb = ControlBounds();
	float		textY = cb.top + Prefs().GetInt32(ARP_FULLFONT_Y);
	if (mDivider > 0) {
		view->SetHighColor(mViewColor);
		view->FillRect( BRect(0, cb.top, cb.left, cb.bottom) );
		if (mLabel.Length() > 0) {
			if ( IsFocus() ) view->SetHighColor( Prefs().GetColor(ARP_INT_FGF_C));
			else if ( !IsEnabled() ) view->SetHighColor( tint_color(Prefs().GetColor(ARP_INT_FG_C), B_LIGHTEN_1_TINT) );
			else view->SetHighColor( Prefs().GetColor(ARP_INT_FG_C) );
			view->SetLowColor(mViewColor);
			view->DrawString( mLabel.String(), BPoint(0, textY) );
		}
	}
	DrawControlBackgroundOn(cb, view);

	BPoint			drawPt(cb.left + 3, textY);
	if (IsEnabled() == false) {
		drawPt.x++;
		drawPt.y++;
	}
	BString16		str;
	GetValueLabel(Value(), str);
	SetValueColor(view);
	view->DrawString( str.String(), drawPt );
}
void ArpFileNameControl::DrawOn(BView* view, BRect clip)
{
	view->SetHighColor(BG_C);
	view->FillRect(clip);

	view->SetLowColor(BG_C);
	view->SetHighColor(0, 0, 0);

	BPoint			pt(0, 10);
	BString16		s;
	if (mFileName.Length() < 1) s = "Drop file here";
	else s = mFileName;
	float			w = arp_get_string_width(view, s.String());
	float			bw = Bounds().Width();
	if (w >= bw) view->TruncateString(&s, B_TRUNCATE_MIDDLE, bw);

	view->DrawString(s.String(), pt);
}
Exemple #4
0
static void get_control_spacing(ArpIntControl* ctrl, float* minW, float* maxW)
{
	BString16		minStr;
	ctrl->GetValueLabel(ctrl->Min(), minStr);
	*minW = 0;
	if (minStr.Length() > 0) *minW = ctrl->StringWidth( minStr.String() );
	BString16		maxStr;
	ctrl->GetValueLabel(ctrl->Max(), maxStr);
	*maxW = 0;
	if (maxStr.Length() > 0) *maxW = ctrl->StringWidth( maxStr.String() );
}