Exemple #1
0
CalcView::CalcView(BMessage* archive)
	:
	BView(archive),
	fColumns(5),
	fRows(4),

	fBaseColor((rgb_color){ 128, 128, 128, 255 }),
	fExpressionBGColor((rgb_color){ 0, 0, 0, 255 }),

	fWidth(1),
	fHeight(1),

	fKeypadDescription(strdup(kKeypadDescriptionBasic)),
	fKeypad(NULL),

#ifdef __HAIKU__
	fCalcIcon(new BBitmap(BRect(0, 0, 15, 15), 0, B_RGBA32)),
#else
	fCalcIcon(new BBitmap(BRect(0, 0, 15, 15), 0, B_CMAP8)),
#endif

	fPopUpMenu(NULL),
	fAutoNumlockItem(NULL),
	fAudioFeedbackItem(NULL),
	fOptions(new CalcOptions())
{
	// Do not restore the follow mode, in shelfs, we never follow.
	SetResizingMode(B_FOLLOW_NONE);

	_Init(archive);
}
PropPointEditor::PropPointEditor(PObject *obj, PProperty *prop)
	:	PropertyEditor(obj,prop),
		fXEditor(NULL),
		fYEditor(NULL),
		fMsgr(NULL)
{
	fPropName = new BString();
	
	SetResizingMode(B_FOLLOW_LEFT_RIGHT | B_FOLLOW_TOP);
	SetFlags(Flags() | B_FRAME_EVENTS);
	BString label("PointEditor");
	BString text;
	if (GetProperty())
		label = GetProperty()->GetName();
	
	
	BMessage *editMsg = new BMessage(M_EDIT);
	
	if (obj && prop)
	{
		editMsg->AddPointer("object",obj);
		editMsg->AddPointer("property",prop);
		editMsg->AddInt64("objectid",obj->GetID());
		editMsg->AddString("name",prop->GetName());
		*fPropName = prop->GetName();
	}
	
	fLabel = new BStringView(BRect(0,2,1,3),"label",label.String(),B_FOLLOW_LEFT_RIGHT | B_FOLLOW_TOP);
	fLabel->ResizeToPreferred();
	
	fXEditor = new NumBox(Bounds(),"editor","X:","",editMsg, B_FOLLOW_LEFT | B_FOLLOW_TOP);
	fYEditor = new NumBox(Bounds(),"editor","Y:","",editMsg, B_FOLLOW_LEFT | B_FOLLOW_TOP);
	
	Update();
}
PropStringEditor::PropStringEditor(PObject *obj, PProperty *prop)
	:	PropertyEditor(obj,prop),
		fEditor(NULL),
		fMsgr(NULL)
{
	fPropName = new BString();
	
	SetResizingMode(B_FOLLOW_LEFT_RIGHT | B_FOLLOW_TOP);
	BString label("StringEditor");
	BString text;
	if (GetProperty())
	{
		label = GetProperty()->GetName();
		text = GetProperty()->GetValueAsString();
	}
	
	BMessage *editMsg = new BMessage(M_EDIT);
	
	if (obj && prop)
	{
		editMsg->AddPointer("object",obj);
		editMsg->AddPointer("property",prop);
		editMsg->AddInt64("objectid",obj->GetID());
		editMsg->AddString("name",prop->GetName());
		*fPropName = prop->GetName();
	}
	
	fEditor = new AutoTextControl(Bounds(),"editor",label.String(),text.String(),
									editMsg, B_FOLLOW_LEFT_RIGHT | B_FOLLOW_TOP);
}
Exemple #4
0
void
_BMCMenuBar_::AttachedToWindow()
{
	fMenuField = static_cast<BMenuField*>(Parent());

	// Don't cause the KeyMenuBar to change by being attached
	BMenuBar* menuBar = Window()->KeyMenuBar();
	BMenuBar::AttachedToWindow();
	Window()->SetKeyMenuBar(menuBar);

	if (fFixedSize && (Flags() & B_SUPPORTS_LAYOUT) == 0)
		SetResizingMode(B_FOLLOW_LEFT_RIGHT | B_FOLLOW_TOP);

	if (Parent() != NULL) {
		color_which which = Parent()->LowUIColor();
		if (which == B_NO_COLOR)
			SetLowColor(Parent()->LowColor());
		else
			SetLowUIColor(which);

	} else
		SetLowUIColor(B_MENU_BACKGROUND_COLOR);

	fPreviousWidth = Bounds().Width();
}
// This version will be used by the instantiated replicant
PulseView::PulseView(BMessage *message) : BView(message) {
	SetResizingMode(B_FOLLOW_ALL_SIDES);
	SetFlags(B_WILL_DRAW | B_PULSE_NEEDED);

	popupmenu = NULL;
	cpu_menu_items = NULL;
	Init();
}
Exemple #6
0
BScrollBar::BScrollBar(BRect frame, const char *name, float value, float min, float max, orientation direction)
		: BView(frame, name, B_FOLLOW_NONE, B_WILL_DRAW),
		fStepSmall(1), fStepLarge(10), fTarget(NULL),
		fTracking(false), fTrackingState(0), fRunner(NULL)
{
	fRangeMin = min_c(min, max);
	fRangeMax = max_c(min, max);

	if (value < fRangeMin) value = fRangeMin;
	else if (value > fRangeMax) value = fRangeMax;
	fValue = value;

	fOrientation = direction;

	if (fOrientation == B_HORIZONTAL)
		SetResizingMode(B_FOLLOW_LEFT_RIGHT |B_FOLLOW_BOTTOM);
	else
		SetResizingMode(B_FOLLOW_TOP_BOTTOM |B_FOLLOW_RIGHT);
}
Exemple #7
0
BToolBar::BToolBar(BRect frame, orientation ont)
	:
	BGroupView(ont),
	fOrientation(ont)
{
	_Init();

	MoveTo(frame.LeftTop());
	ResizeTo(frame.Width(), frame.Height());
	SetResizingMode(B_FOLLOW_LEFT_RIGHT | B_FOLLOW_TOP);
}
Exemple #8
0
BToolbar::BToolbar(BRect frame, orientation ont)
	:
	BGroupView(ont),
	fOrientation(ont)
{
	float inset = ceilf(be_control_look->DefaultItemSpacing() / 2);
	GroupLayout()->SetInsets(inset, 0, inset, 0);
	GroupLayout()->SetSpacing(1);

	SetFlags(Flags() | B_FRAME_EVENTS | B_PULSE_NEEDED);

	MoveTo(frame.LeftTop());
	ResizeTo(frame.Width(), frame.Height());
	SetResizingMode(B_FOLLOW_LEFT_RIGHT | B_FOLLOW_TOP);
}
Exemple #9
0
CalcView::CalcView(BMessage* archive)
	:
	BView(archive),
	fColumns(5),
	fRows(4),

	fBaseColor((rgb_color){ 128, 128, 128, 255 }),
	fExpressionBGColor((rgb_color){ 0, 0, 0, 255 }),

	fWidth(1),
	fHeight(1),

	fKeypadDescription(strdup(kKeypadDescriptionBasic)),
	fKeypad(NULL),

#ifdef __HAIKU__
	fCalcIcon(new BBitmap(BRect(0, 0, 15, 15), 0, B_RGBA32)),
#else
	fCalcIcon(new BBitmap(BRect(0, 0, 15, 15), 0, B_CMAP8)),
#endif

	fPopUpMenu(NULL),
	fAutoNumlockItem(NULL),
	fAudioFeedbackItem(NULL),
	fOptions(new CalcOptions())
{
	// Do not restore the follow mode, in shelfs, we never follow.
	SetResizingMode(B_FOLLOW_NONE);

	// create expression text view
	fExpressionTextView = new ExpressionTextView(_ExpressionRect(), this);
	AddChild(fExpressionTextView);

	// read data from archive
	_LoadSettings(archive);

	// Fetch the calc icon for compact view
	_FetchAppIcon(fCalcIcon);
}
Exemple #10
0
CalcView::CalcView(BMessage* archive)
	:
	BView(archive),
	fColumns(5),
	fRows(4),

	fBaseColor(ui_color(B_PANEL_BACKGROUND_COLOR)),
	fExpressionBGColor((rgb_color){ 0, 0, 0, 255 }),

	fHasCustomBaseColor(false),

	fWidth(1),
	fHeight(1),

	fKeypadDescription(strdup(kKeypadDescriptionBasic)),
	fKeypad(NULL),

#ifdef __HAIKU__
	fCalcIcon(new BBitmap(BRect(0, 0, 15, 15), 0, B_RGBA32)),
#else
	fCalcIcon(new BBitmap(BRect(0, 0, 15, 15), 0, B_CMAP8)),
#endif

	fPopUpMenu(NULL),
	fAutoNumlockItem(NULL),
	fAudioFeedbackItem(NULL),
	fOptions(new CalcOptions()),
	fEvaluateThread(-1),
	fEvaluateMessageRunner(NULL),
	fEvaluateSemaphore(B_BAD_SEM_ID),
	fEnabled(true)
{
	// Do not restore the follow mode, in shelfs, we never follow.
	SetResizingMode(B_FOLLOW_NONE);

	_Init(archive);
}