Exemple #1
0
	void Pipe::Write(raw data, uint32 size)
	{
		if (_IsServer)
		{
			((uint32*)((uint32)_Data + 7))[0] = size;
			memcpy((raw)((uint32)_Data + VF_PIPE_PRTCSIZE), data, size);
			_SetFlag(1, 1);
		}
		else
		{
			((uint32*)((uint32)_Data + 11))[0] = size;
			memcpy((raw)((uint32)_Data + VF_PIPE_PRTCSIZE + _Volume), data, size);
			_SetFlag(2, 1);
		}
	}
Exemple #2
0
	void Pipe::Close()
	{
		if(_IsServer) 
			_SetFlag(0, 0);
		_CloseMapping();
		Clear(_Id);
	}
Exemple #3
0
void
BButton::MouseDown(BPoint point)
{
	if (!IsEnabled())
		return;

	if (fBehavior == B_POP_UP_BEHAVIOR && _PopUpRect().Contains(point)) {
		InvokeNotify(fPopUpMessage, B_CONTROL_MODIFIED);
		return;
	}

	bool toggleBehavior = fBehavior == B_TOGGLE_BEHAVIOR;

	if (toggleBehavior) {
		bool wasPressed = Value() == B_CONTROL_ON;
		_SetFlag(FLAG_WAS_PRESSED, wasPressed);
		SetValue(wasPressed ? B_CONTROL_OFF : B_CONTROL_ON);
		Invalidate();
	} else
		SetValue(B_CONTROL_ON);

	if (Window()->Flags() & B_ASYNCHRONOUS_CONTROLS) {
 		SetTracking(true);
 		SetMouseEventMask(B_POINTER_EVENTS, B_LOCK_WINDOW_FOCUS);
 	} else {
		BRect bounds = Bounds();
		uint32 buttons;
		bool inside = false;

		do {
			Window()->UpdateIfNeeded();
			snooze(40000);

			GetMouse(&point, &buttons, true);

 			inside = bounds.Contains(point);

			if (toggleBehavior) {
				bool pressed = inside ^ _Flag(FLAG_WAS_PRESSED);
				SetValue(pressed ? B_CONTROL_ON : B_CONTROL_OFF);
			} else {
				if ((Value() == B_CONTROL_ON) != inside)
					SetValue(inside ? B_CONTROL_ON : B_CONTROL_OFF);
			}
		} while (buttons != 0);

		if (inside) {
			if (toggleBehavior) {
				SetValue(
					_Flag(FLAG_WAS_PRESSED) ? B_CONTROL_OFF : B_CONTROL_ON);
			}

			Invoke();
		} else if (_Flag(FLAG_FLAT))
			Invalidate();
	}
}
Exemple #4
0
	raw Pipe::Read()
	{
		raw data = null;
		uint32 size = 0;
		if (_IsServer)
		{
			size = _GetValue(11);
			data = new byte[size];
			memcpy(data, (raw)((uint32)_Data + VF_PIPE_PRTCSIZE + _Volume), size);
			_SetFlag(2, 0);
		}
		else
		{
			size = _GetValue(7);
			data = new byte[size];
			memcpy(data, (raw)((uint32)_Data + VF_PIPE_PRTCSIZE), size);
			_SetFlag(1, 0);
		}
		return data;
	}
Exemple #5
0
void
BButton::MakeDefault(bool flag)
{
	BButton* oldDefault = NULL;
	BWindow* window = Window();

	if (window != NULL)
		oldDefault = window->DefaultButton();

	if (flag) {
		if (_Flag(FLAG_DEFAULT) && oldDefault == this)
			return;

		if (_SetFlag(FLAG_DEFAULT, true)) {
			if ((Flags() & B_SUPPORTS_LAYOUT) != 0)
				InvalidateLayout();
			else {
				ResizeBy(6.0f, 6.0f);
				MoveBy(-3.0f, -3.0f);
			}
		}

		if (window && oldDefault != this)
			window->SetDefaultButton(this);
	} else {
		if (!_SetFlag(FLAG_DEFAULT, false))
			return;

		if ((Flags() & B_SUPPORTS_LAYOUT) != 0)
			InvalidateLayout();
		else {
			ResizeBy(-6.0f, -6.0f);
			MoveBy(3.0f, 3.0f);
		}

		if (window && oldDefault == this)
			window->SetDefaultButton(NULL);
	}
}
Exemple #6
0
BButton::BButton(BMessage* data)
	:
	BControl(data),
	fPreferredSize(-1, -1),
	fFlags(0),
	fBehavior(B_BUTTON_BEHAVIOR),
	fPopUpMessage(NULL)
{
	bool isDefault = false;
	if (data->FindBool("_default", &isDefault) == B_OK && isDefault)
		_SetFlag(FLAG_DEFAULT, true);
	// NOTE: Default button state will be synchronized with the window
	// in AttachedToWindow().
}
Exemple #7
0
	bool Pipe::Listen(uint32 vol)
	{
		if(vol < 1) 
			return false;
		Close();
		_IsServer = true;
		_Volume = vol;
		uint32 size = vol * 2 + VF_PIPE_PRTCSIZE;
		if(!_CreateMapping(size))
			return false;
		if(!_BeginUpdate())
			return false;
		_SetFlag(0, 1);
		return true;
	}
Exemple #8
0
void
BButton::MouseMoved(BPoint where, uint32 code, const BMessage* dragMessage)
{
	bool inside = Bounds().Contains(where);
	if (_SetFlag(FLAG_INSIDE, inside))
		Invalidate();

	if (!IsTracking())
		return;

	if (fBehavior == B_TOGGLE_BEHAVIOR) {
		bool pressed = inside ^ _Flag(FLAG_WAS_PRESSED);
		SetValue(pressed ? B_CONTROL_ON : B_CONTROL_OFF);
	} else {
		if ((Value() == B_CONTROL_ON) != inside)
			SetValue(inside ? B_CONTROL_ON : B_CONTROL_OFF);
	}
}
Exemple #9
0
 void 
 Message::SetFlagDeleted(bool bNewVal)
 {
    _SetFlag(FlagDeleted, bNewVal);
 }
Exemple #10
0
 void 
 Message::SetFlagDraft(bool bNewVal)
 {
    _SetFlag(FlagDraft, bNewVal);
 }
void T3DSceneComponent::setWorldBoxLocked(bool val)
{
   _SetFlag(T3DSceneComponent::LockWorldBox, val);
   if (!val && isDirtyWorldBox())
      _UpdateWorldBox();
}
void T3DSceneComponent::setObjectBoxLocked(bool val)
{
   _SetFlag(T3DSceneComponent::LockObjectBox, val);
   if (!val && isDirtyObjectBox())
      _ComputeObjectBox();
}
void T3DSceneComponent::setDirtyWorldBox(bool val)
{
   _SetFlag(T3DSceneComponent::DirtyWorldBox, val);
   if (val && !isWorldBoxLocked())
      _UpdateWorldBox();
}
void T3DSceneComponent::setDirtyObjectBox(bool val)
{
   _SetFlag(T3DSceneComponent::DirtyObjectBox, val);
   if (val && !isObjectBoxLocked())
      _ComputeObjectBox();
}
Exemple #15
0
 void 
 Message::SetFlagSeen(bool bNewVal)
 {
    _SetFlag(FlagSeen, bNewVal);
 }
Exemple #16
0
void
BButton::SetFlat(bool flat)
{
	if (_SetFlag(FLAG_FLAT, flat))
		Invalidate();
}
Exemple #17
0
 void 
 Message::SetFlagVirusScan(bool bNewVal)
 {
    _SetFlag(FlagVirusScan, bNewVal);
 }
Exemple #18
0
 void 
 Message::SetFlagRecent(bool bNewVal)
 {
    _SetFlag(FlagRecent, bNewVal);
 }
Exemple #19
0
 void 
 Message::SetFlagFlagged(bool bNewVal)
 {
    _SetFlag(FlagFlagged, bNewVal);
 }
Exemple #20
0
 void 
 Message::SetFlagAnswered(bool bNewVal)
 {
    _SetFlag(FlagAnswered, bNewVal);
 }