Exemple #1
0
BTextControl::BTextControl(BMessage* archive)
	: BControl(archive)
{
	_InitData(Label(), NULL, archive);

	int32 labelAlignment = B_ALIGN_LEFT;
	int32 textAlignment = B_ALIGN_LEFT;

	if (archive->HasInt32("_a_label"))
		archive->FindInt32("_a_label", &labelAlignment);

	if (archive->HasInt32("_a_text"))
		archive->FindInt32("_a_text", &textAlignment);

	SetAlignment((alignment)labelAlignment, (alignment)textAlignment);

	if (archive->HasFloat("_divide"))
		archive->FindFloat("_divide", &fDivider);

	if (archive->HasMessage("_mod_msg")) {
		BMessage* message = new BMessage;
		archive->FindMessage("_mod_msg", message);
		SetModificationMessage(message);
	}
}
Exemple #2
0
BTextControl::BTextControl(BMessage *data)
	:	BControl(data)
{
	InitData(Label(), NULL, data);

	int32 _a_label = B_ALIGN_LEFT;
	int32 _a_text = B_ALIGN_LEFT;

	if (data->HasInt32("_a_label"))
		data->FindInt32("_a_label", &_a_label);

	if (data->HasInt32("_a_text"))
		data->FindInt32("_a_text", &_a_text);
	
	SetAlignment((alignment)_a_label, (alignment)_a_text);

	if (data->HasFloat("_divide"))
		data->FindFloat("_a_text", &fDivider);

	if (data->HasMessage("_mod_msg")) {
		BMessage *_mod_msg = new BMessage;
		data->FindMessage("_mod_msg", _mod_msg);
		SetModificationMessage(_mod_msg);
	}
}
IPAddressControl::IPAddressControl(int family, const char* label,
	const char* name)
	:
	BTextControl(name, label, "", NULL),
	fFamily(family),
	fAllowEmpty(true)
{
	SetModificationMessage(new BMessage(kMsgModified));
}
Exemple #4
0
TimeSlider::TimeSlider(const char* name, uint32 changedMessage,
	uint32 updateMessage)
	:
	BSlider(name, B_TRANSLATE("30 seconds"), new BMessage(changedMessage),
		0, kTimeUnitCount - 1, B_HORIZONTAL, B_TRIANGLE_THUMB)
{
	SetViewColor(ui_color(B_PANEL_BACKGROUND_COLOR));
	SetModificationMessage(new BMessage(updateMessage));
	SetBarThickness(10);
}
Exemple #5
0
TimeSlider::TimeSlider(BRect frame, const char* name, uint32 changedMessage,
		uint32 updateMessage)
	:
	BSlider(frame, name, B_TRANSLATE("30 seconds"),
		new BMessage(changedMessage),
		0, kTimeUnitCount - 1, B_TRIANGLE_THUMB, B_FOLLOW_LEFT_RIGHT)
{
	SetViewColor(ui_color(B_PANEL_BACKGROUND_COLOR));
	SetModificationMessage(new BMessage(updateMessage));
	SetBarThickness(10);
}
Exemple #6
0
// constructor
VolumeSlider::VolumeSlider(const char* name, int32 minValue, int32 maxValue,
		int32 snapValue, BMessage* message)
	:
	BSlider(name, NULL, NULL, minValue, maxValue, B_HORIZONTAL,
		B_BLOCK_THUMB),
	fMuted(false),
	fSnapValue(snapValue),
	fSnapping(false)
{
	SetModificationMessage(message);
	UseFillColor(true, &kGreen);
	SetBarThickness(PreferredBarThickness());
}
void
AutoTextControl::AttachedToWindow()
{
	BTextControl::AttachedToWindow();
	if (fFilter)
		Window()->AddCommonFilter(fFilter);

	if (IsEmptyAfterTrim(Text())) {
		fEmpty = true;
		MarkAsInvalid(true);
		static_cast<RuleEditWindow*>(Window())->UpdateEmptyCount(true);
	}

	SetModificationMessage(new BMessage(MSG_TEXT_CHANGED));
	SetTarget(this);
}
Exemple #8
0
SeekSlider::SeekSlider(const char* name, BMessage* message, int32 minValue,
		int32 maxValue)
	:
	BSlider(name, NULL, NULL, minValue, maxValue, B_HORIZONTAL,
		B_TRIANGLE_THUMB),
	fTracking(false),
	fLastTrackTime(0),
	fDisabledString(""),
	fScale(0.0f)
{
	BFont font(be_plain_font);
	font.SetSize(9.0);
	SetFont(&font);
	SetSymbolScale(1.0);
	rgb_color fillColor = tint_color(ui_color(B_PANEL_BACKGROUND_COLOR),
		B_DARKEN_3_TINT);
	UseFillColor(true, &fillColor);
	SetModificationMessage(message);
}
Exemple #9
0
/*------------------------------------------------------------------------------*\
	( )
		-	
\*------------------------------------------------------------------------------*/
void BmTextControl::InitSize( const char* label, int32 fixedTextLen, 
										int32 minTextLen, BmMenuControllerBase* popup) {
	ResizeToPreferred();
	BRect b = Bounds();
	float divPos = 0;
	if (label)
		divPos = StringWidth(label) + (mLabelIsMenu ? 27 : 3);
	inherited::SetDivider( divPos);
	BFont font;
	mTextView->GetFont( &font);
	if (fixedTextLen) {
		mTextView->SetMaxBytes( fixedTextLen);
		float width = divPos + font.StringWidth("W")*float(fixedTextLen);
		ct_mpm = minimax( int(width), int(b.Height()+4), int(width), 
								int(b.Height()+4));
	} else {
		if (minTextLen)
			ct_mpm = minimax( int(divPos + font.StringWidth("W")*float(minTextLen)), 
									int(b.Height()+4), 100000, int(b.Height()+4));
		else
			ct_mpm = minimax( int(divPos + font.StringWidth("W")*10), 
									int(b.Height()+4), 100000, int(b.Height()+4));
	}
	if (mLabelIsMenu) {
		float width, height;
		GetPreferredSize( &width, &height);
//		if (!popup)
//			popup = new BmMenuControllerBase( label, true, false);
		if (BeamOnDano)
			mMenuField 
				= new BMenuField( BRect( 2,2,Divider(),height), NULL, label,
										popup, true, B_FOLLOW_NONE, B_WILL_DRAW);
		else
			mMenuField 
				= new BMenuField( BRect( 2,0,Divider(),height), NULL, label,
										popup, true, B_FOLLOW_NONE, B_WILL_DRAW);
		mMenuField->SetDivider( 0);
		AddChild( mMenuField);
	}
	SetModificationMessage( new BMessage(BM_TEXTFIELD_MODIFIED));
}
Exemple #10
0
BTextControl::BTextControl(BMessage* archive)
	:
	BControl(BUnarchiver::PrepareArchive(archive))
{
	BUnarchiver unarchiver(archive);

	_InitData(Label(), archive);

	if (!BUnarchiver::IsArchiveManaged(archive))
		_InitText(NULL, archive);

	status_t err = B_OK;
	if (archive->HasFloat("_divide"))
		err = archive->FindFloat("_divide", &fDivider);

	if (err == B_OK && archive->HasMessage("_mod_msg")) {
		BMessage* message = new BMessage;
		err = archive->FindMessage("_mod_msg", message);
		SetModificationMessage(message);
	}

	unarchiver.Finish(err);
}
Exemple #11
0
	FontSizeSlider(const char* name, const char* label, BMessage* message,
			int32 min, int32 max)
		: BSlider(name, label, NULL, min, max, B_HORIZONTAL)
	{
		SetModificationMessage(message);
	}
Exemple #12
0
BTextControl::~BTextControl()
{
	SetModificationMessage(NULL);
	delete fLayoutData;
}
Exemple #13
0
BSlider::BSlider(BMessage *archive)
	: BControl(archive)
{
	fModificationMessage = NULL;

	if (archive->HasMessage("_mod_msg")) {
		BMessage* message = new BMessage;

		archive->FindMessage("_mod_msg", message);

		SetModificationMessage(message);
	}

	if (archive->FindInt32("_sdelay", &fSnoozeAmount) != B_OK)
		SetSnoozeAmount(20000);

	rgb_color color;
	if (archive->FindInt32("_fcolor", (int32 *)&color) == B_OK)
		UseFillColor(true, &color);
	else
		UseFillColor(false);

	int32 orient;
	if (archive->FindInt32("_orient", &orient) == B_OK)
		fOrientation = (orientation)orient;
	else
		fOrientation = B_HORIZONTAL;

	fMinLimitLabel = NULL;
	fMaxLimitLabel = NULL;

	const char* minlbl = NULL;
	const char* maxlbl = NULL;

	archive->FindString("_minlbl", &minlbl);
	archive->FindString("_maxlbl", &maxlbl);

	SetLimitLabels(minlbl, maxlbl);

	if (archive->FindInt32("_min", &fMinValue) != B_OK)
		fMinValue = 0;

	if (archive->FindInt32("_max", &fMaxValue) != B_OK)
		fMaxValue = 100;

	if (archive->FindInt32("_incrementvalue", &fKeyIncrementValue) != B_OK)
		fKeyIncrementValue = 1;

	if (archive->FindInt32("_hashcount", &fHashMarkCount) != B_OK)
		fHashMarkCount = 11;

	int16 hashloc;
	if (archive->FindInt16("_hashloc", &hashloc) == B_OK)
		fHashMarks = (hash_mark_location)hashloc;
	else
		fHashMarks = B_HASH_MARKS_NONE;

	int16 sstyle;
	if (archive->FindInt16("_sstyle", &sstyle) == B_OK)
		fStyle = (thumb_style)sstyle;
	else
		fStyle = B_BLOCK_THUMB;

	if (archive->FindInt32("_bcolor", (int32 *)&color) != B_OK)
		color = tint_color(ui_color(B_PANEL_BACKGROUND_COLOR), B_DARKEN_4_TINT);
	SetBarColor(color);

	float bthickness;
	if (archive->FindFloat("_bthickness", &bthickness) == B_OK)
		fBarThickness = bthickness;
	else
		fBarThickness = 6.0f;

	_InitObject();
}
Exemple #14
0
/*------------------------------------------------------------------------------*\
	( )
		-	
\*------------------------------------------------------------------------------*/
void BmTextControl::SetTextSilently( const char* text) {
	SetModificationMessage( NULL);
	SetText( text);
	SetModificationMessage( new BMessage(BM_TEXTFIELD_MODIFIED));
}
Exemple #15
0
BTextControl::~BTextControl()
{
	SetModificationMessage(NULL);
}