示例#1
0
void
Slider6::SetEnabled(bool enabled)
{

const rgb_color green = {0,240,0,255};
const rgb_color red = {240,0,0,255};

if (enabled==true) SetBarColor(red); else SetBarColor(green);

BSlider::SetEnabled(enabled);
}
示例#2
0
void
BSlider::_InitBarColor()
{
	if (be_control_look != NULL) {
		SetBarColor(be_control_look->SliderBarColor(
			ui_color(B_PANEL_BACKGROUND_COLOR)));
	} else {
		SetBarColor(tint_color(ui_color(B_PANEL_BACKGROUND_COLOR),
			B_DARKEN_4_TINT));
	}

	UseFillColor(false, NULL);
}
示例#3
0
文件: Script.c 项目: 772/openclonk
func Init(to, max, cur, timeout, offset, visibility, proplist data)
{
	maximum = max;
	current = cur;
	timeout_time = timeout;
	
	width = data.width ?? 40;
	height = data.height ?? 5;

	
	if(timeout_time)
	{
		var e = AddEffect("TimeOut", this, 1, BoundBy(timeout_time/2, 5, 35), this);
		e.t = timeout_time;
	}
	
	this.Visibility = visibility;
	
	SetGraphics(nil, GetID(), 1, GFXOV_MODE_Base, nil, GFX_BLIT_Custom);
	SetBarColor(data.color, data.back_color);
	
	SetAction("Attach", to);
	SetVertexXY(0, -offset.x, -offset.y);
	
	AddEffect("LifeCheck", to, 1, 0, this);
	Update();
}
示例#4
0
void C_ListBox::LocalFunction(short ID,long P[],_TCHAR *,C_Handler *Hndlr)
{
	switch(ID)
	{
		case CLBP_SETUP:
			Setup(P[0],(short)P[1],Hndlr);
			break;
		case CLBP_ADDITEM:
			AddItem(P[0],(short)P[1],P[2]);
			break;
		case CLBP_ADDSCROLLBAR:
			AddScrollBar(P[0], P[1], P[2], P[3], P[4], P[5]);
			break;
		case CLBP_SETITEMFLAGS:
 			SetItemFlags(P[0],P[1]);
			break;
		case CLBP_SETBGIMAGE:
			SetBgImage(P[0]);
			break;
		case CLBP_SETBGFILL:
			SetBgFill((short)P[0],(short)P[1],(short)P[2],(short)P[3]);
			break;
		case CLBP_SETBGCOLOR:
			SetBgColor(P[0] | (P[1] << 8) | (P[2] << 16));
			break;
		case CLBP_SETNORMALCOLOR:
			SetNormColor(P[0] | (P[1] << 8) | (P[2] << 16));
			break;
		case CLBP_SETSELCOLOR:
			SetSelColor(P[0] | (P[1] << 8) | (P[2] << 16));
			break;
		case CLBP_SETBARCOLOR:
			SetBarColor(P[0] | (P[1] << 8) | (P[2] << 16));
			break;
		case CLBP_SETLABELCOLOR:
			SetLabelColor(P[0] | (P[1] << 8) | (P[2] << 16));
			break;
		case CLBP_SETVALUE:
			SetValue(P[0]);
			break;
		case CLBP_ITEMGROUP:
			SetItemGroup(P[0],P[1]);
			break;
		case CLBP_ITEMCLUSTER:
			SetItemCluster(P[0],P[1]);
			break;
		case CLBP_ITEMUSERDATA:
			SetItemUserData(P[0],(short)P[1],P[2]);
			break;
		case CLBP_SETDROPDOWN:
			SetDropDown(P[0]);
			break;
	}
}
示例#5
0
SizeSlider::SizeSlider(const char* name, const char* label,
		BMessage* message, int32 minValue, int32 maxValue)
	:
	BSlider(name, label, message, minValue, maxValue,
	B_HORIZONTAL, B_TRIANGLE_THUMB),
	fStartOffset(minValue),
	fEndOffset(maxValue)
{
	SetBarColor((rgb_color){ 0, 80, 255, 255 });
	char minString[64];
	char maxString[64];
	snprintf(minString, sizeof(minString), TR("Offset: %ld MB"),
		fStartOffset);
	snprintf(maxString, sizeof(maxString), TR("End: %ld MB"),
		fEndOffset);
	SetLimitLabels(minString, maxString);
}
示例#6
0
void 
MyStatusBar	::	AttachedToWindow(	void)
{
	BStatusBar::AttachedToWindow();
	rgb_color tempRgbColor;
	myPrefs->GetPreferredMyStatusBarHighColor(&tempRgbColor);
	SetHighColor(tempRgbColor);
	myPrefs->GetPreferredMyStatusBarLowColor(&tempRgbColor);
	SetLowColor(tempRgbColor);
	myPrefs->GetPreferredMyStatusBarViewColor(&tempRgbColor);
	SetViewColor(tempRgbColor);
	myPrefs->GetPreferredMyBarStatusColor(&tempRgbColor);
	SetBarColor(tempRgbColor);
	BString label(Label());
	BString trailingLabel(TrailingLabel());
	Reset(label.String(), trailingLabel.String());
	SetMaxValue(mfMaxValue);
	ResizeTo(mfWidthPref, mfHeightPref);
	Update(mfValue);
}//end
示例#7
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();
}