bool MouseEventMatcher::operator()(Event* e) {
    if (e->hash() != MouseEvent::chash()) return false;
    auto me = static_cast<MouseEvent*>(e);

    if (me->state() == MouseState::Move) {
        if (states_.value & me->state()) {
            if (modifiers_ == KeyModifiers(flags::any) || modifiers_ == me->modifiers()) {
                if (me->buttonState() != MouseButton::None) {
                    for (auto s : me->buttonState()) {
                        if (buttons_.value & s) {
                            return true;
                        }
                    }
                } else if (buttons_.value == MouseButton::None) {
                    return true;
                } else if (buttons_.value == MouseButtons(flags::any)) {
                    return true;
                }
            }
        }
    } else {
        if (buttons_.value & me->button()) {
            if (states_.value & me->state()) {
                if (modifiers_ == KeyModifiers(flags::any) || modifiers_ == me->modifiers()) {
                    return true;
                }
            }
        }
    }

    return false;
}
Exemple #2
0
// Select
void
PropertyListView::Select(PropertyItemView* item)
{
	if (item) {
		if (modifiers() & B_SHIFT_KEY) {
			item->SetSelected(!item->IsSelected());
		} else if (modifiers() & B_OPTION_KEY) {
			item->SetSelected(true);
			int32 firstSelected = _CountItems();
			int32 lastSelected = -1;
			for (int32 i = 0; PropertyItemView* otherItem = _ItemAt(i); i++) {
				if (otherItem->IsSelected()) {
					 if (i < firstSelected)
					 	firstSelected = i;
					 if (i > lastSelected)
					 	lastSelected = i;
				}
			}
			if (lastSelected > firstSelected) {
				for (int32 i = firstSelected; PropertyItemView* otherItem = _ItemAt(i); i++) {
					if (i > lastSelected)
						break;
					otherItem->SetSelected(true);
				}
			}
		} else {
			for (int32 i = 0; PropertyItemView* otherItem = _ItemAt(i); i++) {
				otherItem->SetSelected(otherItem == item);
			}
		}
	}
	_CheckMenuStatus();
}
void SimControlWidget::fieldClicked(Point2D pos, Qt::MouseButton button) {
  if(!simulation_) return;
  if(button == Qt::LeftButton && (modifiers() == Qt::ControlModifier)) {
    simulation_->moveBall(pos);
  } else if (button == Qt::RightButton && (modifiers() == Qt::ControlModifier)) {
    simulation_->teleportBall(pos);
  }
}
Exemple #4
0
void PatternMenuView::MouseDown (BPoint point)
{
	Window()->Lock();
	uint32 buttons = Window()->CurrentMessage()->FindInt32 ("buttons");
//	uint32 clicks = Window()->CurrentMessage()->FindInt32 ("clicks");
	if (click != 2 && buttons & B_PRIMARY_MOUSE_BUTTON && !(modifiers() & B_CONTROL_KEY))
	{
		index = int (point.y/P_SIZE)*P_H_NUM + int (point.x/P_SIZE);
		fPMB->set (index);

		BPoint bp, pbp;
		uint32 bt;
		GetMouse (&pbp, &bt, true);
		bigtime_t start = system_time();
		while (system_time() - start < dcspeed)
		{
			snooze (20000);
			GetMouse (&bp, &bt, true);
			if (!bt && click != 2)
			{
				click = 0;
			}
			if (bt && !click)
			{
				click = 2;
			}
			if (bp != pbp)
				break;
		}
		if (click != 2)
		{
			click = 1;
		}
	}
	if (click == 2 || buttons & B_SECONDARY_MOUSE_BUTTON || modifiers() & B_CONTROL_KEY)
	{
		index = int (point.y/P_SIZE)*P_H_NUM + int (point.x/P_SIZE);
		fPMB->set (index);
//		PatternMenu *menu = fPMB->getMenu();
		click = 1;
		if (fPMB->IsEditorShowing())
		{
//			rgb_color c = fPMB->ColorForIndex (index);
//			BMessage *msg = new BMessage ('SetC');
//			msg->AddInt32 ("color", c.red);
//			msg->AddInt32 ("color", c.green);
//			msg->AddInt32 ("color", c.blue);
//			fPMB->Editor()->PostMessage (msg);
//			delete msg;
		}
		else
		{
			fPMB->ShowEditor();
			Invalidate();
		}
	}
	Window()->Unlock();
}
Exemple #5
0
// the cancel function
void AwayEditorWindow::DispatchMessage( BMessage* msg, BHandler* handler ) {

	// the enter key does a bunch of stuff, depending on prefs...
	if( msg->what == B_KEY_DOWN && msg->HasString("bytes") ) {
		if( msg->HasString("bytes") && msg->FindString("bytes")[0] == B_ENTER && genView->textview->IsFocus() ) {

			uint32 mods = modifiers();

			// shift-enter... depends on pref
			if( mods & B_SHIFT_KEY ) {
				if( !enterIsNewline ) {
					genView->textview->Insert("\n");
					genView->textview->ScrollToSelection();
					return;
				}
			}

			// plain old enter... depends on pref
			else {
				if( enterIsNewline ) {
					genView->textview->Insert("\n");
					genView->textview->ScrollToSelection();
					return;
				}
			}
		}
		
		// handle the almighty tab key
		else if( msg->HasString("bytes") && msg->FindString("bytes")[0] == B_TAB && genView->textview->IsFocus() ) {

			uint32 mods = modifiers();

			if( !tabIsTab ) {
				if( !(mods&B_COMMAND_KEY || mods&B_CONTROL_KEY || mods&B_MENU_KEY || mods&B_SHIFT_KEY) )
					msg->ReplaceInt32( "modifiers", mods | B_COMMAND_KEY );
			}
			
			else {
				if( mods & B_SHIFT_KEY )
					msg->ReplaceInt32( "modifiers", (mods | B_COMMAND_KEY) & ~B_SHIFT_KEY );
			}
		}
		
		else if( msg->HasString("bytes") && msg->FindString("bytes")[0] == B_ESCAPE ) {
			uint32 mods = modifiers();
			if( mods == 0 || mods == 32) {
				PostMessage( new BMessage(B_QUIT_REQUESTED) );
				return;
			}
		}
	}

	// our work here is done... dispatch normally
	BWindow::DispatchMessage( msg, handler );
}
Exemple #6
0
void
SpinnerTextView::KeyDown(const char* bytes, int32 numBytes)
{
	if (fParent == NULL) {
		BTextView::KeyDown(bytes, numBytes);
		return;
	}

	switch (bytes[0]) {
		case B_ENTER:
		case B_SPACE:
			fParent->SetValueFromText();
			break;

		case B_TAB:
			fParent->KeyDown(bytes, numBytes);
			break;

		case B_LEFT_ARROW:
			if (fParent->ButtonStyle() == SPINNER_BUTTON_HORIZONTAL_ARROWS
				&& (modifiers() & B_CONTROL_KEY) != 0) {
				// need to hold down control, otherwise can't move cursor
				fParent->Decrement();
			} else
				BTextView::KeyDown(bytes, numBytes);
			break;

		case B_UP_ARROW:
			if (fParent->ButtonStyle() != SPINNER_BUTTON_HORIZONTAL_ARROWS)
				fParent->Increment();
			else
				BTextView::KeyDown(bytes, numBytes);
			break;

		case B_RIGHT_ARROW:
			if (fParent->ButtonStyle() == SPINNER_BUTTON_HORIZONTAL_ARROWS
				&& (modifiers() & B_CONTROL_KEY) != 0) {
				// need to hold down control, otherwise can't move cursor
				fParent->Increment();
			} else
				BTextView::KeyDown(bytes, numBytes);
			break;

		case B_DOWN_ARROW:
			if (fParent->ButtonStyle() != SPINNER_BUTTON_HORIZONTAL_ARROWS)
				fParent->Decrement();
			else
				BTextView::KeyDown(bytes, numBytes);
			break;

		default:
			BTextView::KeyDown(bytes, numBytes);
			break;
	}
}
    virtual bool EventFilter(GG::Wnd*, const GG::WndEvent& event)
        {
            bool retval = false;
            if (event.Type() == GG::WndEvent::MouseEnter) {
                // TODO set cursor to edit_number_t::scrubby_cursor()
                retval = true;
            } else if (event.Type() == GG::WndEvent::MouseLeave) {
                // TODO set cursor to original
                retval = true;
            } else if (event.Type() == GG::WndEvent::LDrag) {
                GG::Pt point = event.Point();
                GG::Y delta(m_data.last_point_m.y - point.y);

                if (m_data.last_point_m.y != 0 && delta != 0)
                {
                    modifiers_t modifiers(modifier_state());

                    if (modifiers & modifiers_any_shift_s)
                        delta *= 10;

                    m_data.increment_n(Value(delta));
                }

                m_data.last_point_m = point;
                retval = true;
            } else if (event.Type() == GG::WndEvent::LButtonDown) {
                m_data.last_point_m = GG::Pt();
                retval = true;
            }
            return retval;
        }
void DiagramEndPoint::mouseDown(
	BPoint point,
	uint32 buttons,
	uint32 clicks)
{
	D_MOUSE(("DiagramEndPoint::mouseDown()\n"));
	if (clicks == 1)
	{
		if (isSelectable())
		{
			BMessage selectMsg(M_SELECTION_CHANGED);
			if (modifiers() & B_SHIFT_KEY)
			{
				selectMsg.AddBool("replace", false);
			}
			else
			{
				selectMsg.AddBool("replace", true);
			}
			selectMsg.AddPointer("item", reinterpret_cast<void *>(this));
			DiagramView* v = view();
			BMessenger(v).SendMessage(&selectMsg);
		}
		if (isDraggable() && (buttons == B_PRIMARY_MOUSE_BUTTON))
		{
			BMessage dragMsg(M_WIRE_DRAGGED);
			dragMsg.AddPointer("from", static_cast<void *>(this));
			view()->DragMessage(&dragMsg, BRect(0.0, 0.0, -1.0, -1.0), view());
			view()->messageDragged(point, B_INSIDE_VIEW, &dragMsg);
		}
	}
}
Exemple #9
0
void
BF_GUI_Text::PrepareKeysMenu()
{
	if(!poSysKeysMenu) return;
	iKeysModifiers = modifiers();
	
	poSysKeysMenu->Clear();
	if (iKeysModifiers & B_LEFT_SHIFT_KEY || iKeysModifiers & B_RIGHT_SHIFT_KEY)
	{
		poSysKeysMenu->SetText(7,"Next");
		
		BMessage *poMessage = new BMessage(BF_MSG_VIEWER_SEARCH);
		poMessage->AddInt32("bf_viewer_search_cmd",BF_VIEWER_CMD_SEARCH_NEXT);
		
		poSysKeysMenu->SetMessage(7,poMessage,poHandler);
	}
	else
	{
		poSysKeysMenu->SetText(3,"Close");
		poSysKeysMenu->SetText(8,"CP");
		poSysKeysMenu->SetText(10,"Close");
		poSysKeysMenu->SetText(7,"Search");

		poSysKeysMenu->SetMessage(3,new BMessage(BF_MSG_VIEWER_CLOSED),poHandler);
		poSysKeysMenu->SetMessage(8,new BMessage(BF_MSG_VIEWER_CH_CP),poHandler);
		poSysKeysMenu->SetMessage(10,new BMessage(BF_MSG_VIEWER_CLOSED),poHandler);
		BMessage *poMessage = new BMessage(BF_MSG_VIEWER_SEARCH);
		poMessage->AddInt32("bf_viewer_search_cmd",BF_VIEWER_CMD_SEARCH_DIALOG);
		poSysKeysMenu->SetMessage(7,poMessage,poHandler);
	};
}
Exemple #10
0
void
DiskProbe::RefsReceived(BMessage* message)
{
	bool traverseLinks = (modifiers() & B_SHIFT_KEY) == 0;

	int32 index = 0;
	entry_ref ref;
	while (message->FindRef("refs", index++, &ref) == B_OK) {
		const char* attribute = NULL;
		if (message->FindString("attributes", index - 1, &attribute) == B_OK)
			traverseLinks = false;

		BEntry entry;
		status_t status = entry.SetTo(&ref, traverseLinks);

		if (status == B_OK)
			status = Probe(entry, attribute);

		if (status != B_OK) {
			char buffer[1024];
			snprintf(buffer, sizeof(buffer),
				B_TRANSLATE_COMMENT("Could not open \"%s\":\n"
				"%s", "Opening of entry reference buffer for a DiskProbe "
				"request Alert message. The name of entry reference and "
				"error message is shown."),
				ref.name, strerror(status));

			BAlert* alert = new BAlert(B_TRANSLATE("DiskProbe request"),
				buffer, B_TRANSLATE("OK"), NULL, NULL,
				B_WIDTH_AS_USUAL, B_STOP_ALERT);
			alert->SetFlags(alert->Flags() | B_CLOSE_ON_ESCAPE);
			alert->Go();
		}
	}
}
// -----------------------------------------------------------------------------
// CTestSDKCFD::TestEHKEYHotKeyFromCommandId
// -----------------------------------------------------------------------------
//
TInt CTestSDKEIKHKEYT::TestEHKEYHotKeyFromCommandIdL( CStifItemParser& /*aItem*/ )
    {
    CEikHotKeyTable* hotkeytableptr;
    hotkeytableptr = new( ELeave ) CEikHotKeyTable;
    CleanupStack::PushL( hotkeytableptr );

    TInt commandId( KOne );
    TInt keycode( KTwo );
    TInt modifiers( KZero );
    hotkeytableptr->AddItemL( commandId, keycode, modifiers );
    
    TInt commandId2( KTwo );
    TInt keycode2( KThree );
    TInt modifiers2( KZero );
    hotkeytableptr->AddItemL( commandId2, keycode2, modifiers2 );
    
    TInt returnkeycode;
    TInt returnkeycode2;
    TBool flag;
    TBool flag2;
    flag = hotkeytableptr->HotKeyFromCommandId( commandId, returnkeycode,
        modifiers );
    STIF_ASSERT_TRUE( flag );
    flag2 = hotkeytableptr->HotKeyFromCommandId( commandId2, returnkeycode2,
        modifiers2 );
    STIF_ASSERT_TRUE( flag2 );
    STIF_ASSERT_NOT_EQUALS( returnkeycode, returnkeycode2 );
    
    CleanupStack::PopAndDestroy( hotkeytableptr );
    return KErrNone;
    }
Exemple #12
0
// SetDropTargetRect
void
DragSortableListView::SetDropTargetRect(const BMessage* message, BPoint where)

{
	if (AcceptDragMessage(message)) {
		bool copy = modifiers() & B_SHIFT_KEY;
		bool replaceAll = !message->HasPointer("list") && !copy;
		BRect r = Bounds();
		if (replaceAll) {
			r.bottom--;	// compensate for scrollbar offset
			_SetDropAnticipationRect(r);
			fDropIndex = -1;
		} else {
			// offset where by half of item height
			r = ItemFrame(0);
			where.y += r.Height() / 2.0;
	
			int32 index = IndexOf(where);
			if (index < 0)
				index = CountItems();
			_SetDropIndex(index);

			const uchar* cursorData = copy ? kCopyCursor : B_HAND_CURSOR;
			BCursor cursor(cursorData);
			SetViewCursor(&cursor, true);
		}
	}
}
CBCompileDocument::CBCompileDocument
	(
	CBProjectDocument* projDoc
	)
	:
	CBExecOutputDocument(kCBExecOutputFT, kCBCompileHelpName, kJFalse),
	itsProjDoc(projDoc),
	itsHasErrorsFlag(kJFalse)
{
	JXMenuBar* menuBar = GetMenuBar();
	itsErrorMenu = InsertTextMenu(kErrorMenuTitleStr);
	itsErrorMenu->SetMenuItems(kErrorMenuStr, "CBCompileDocument");
	itsErrorMenu->SetUpdateAction(JXMenu::kDisableNone);
	ListenTo(itsErrorMenu);

	GetCommandMenu()->SetProjectDocument(projDoc);

	// allow Meta-_ to parallel Shift key required for Meta-plus

	JXKeyModifiers modifiers(GetDisplay());
	modifiers.SetState(kJXMetaKeyIndex, kJTrue);
	GetWindow()->InstallMenuShortcut(itsErrorMenu, kPrevErrorCmd, '_', modifiers);

	GetWindow()->SetWMClass(CBGetWMClassInstance(), CBGetCompileOutputWindowClass());

	Activate();
}
Exemple #14
0
void
BListView::_Track(BPoint where, uint32)
{
    if (fTrack->item_index >= 0 && fTrack->try_drag) {
        // initiate a drag if the mouse was moved far enough
        BPoint offset = where - fTrack->drag_start;
        float dragDistance = sqrtf(offset.x * offset.x + offset.y * offset.y);
        if (dragDistance >= 5.0f) {
            fTrack->try_drag = false;
            fTrack->is_dragging = InitiateDrag(fTrack->drag_start,
                                               fTrack->item_index, fTrack->was_selected);
        }
    }

    if (!fTrack->is_dragging) {
        // do selection only if a drag was not initiated
        int32 index = IndexOf(where);
        BListItem* item = ItemAt(index);
        if (item != NULL && !item->IsSelected() && item->IsEnabled()) {
            Select(index, fListType == B_MULTIPLE_SELECTION_LIST
                   && (modifiers() & B_SHIFT_KEY) != 0);
            ScrollToSelection();
        }
    }
}
// -----------------------------------------------------------------------------
// CTestSDKCFD::TestEHKEYCommandIdFromHotKey
// -----------------------------------------------------------------------------
//
TInt CTestSDKEIKHKEYT::TestEHKEYCommandIdFromHotKeyL( CStifItemParser& /*aItem*/ )
    {
    CEikHotKeyTable* hotkeytableptr = new( ELeave ) CEikHotKeyTable;
    CleanupStack::PushL( hotkeytableptr );
    
    TInt commandId( KOne);
    TInt keycode( KTwo );
    TInt modifiers( KZero );
    hotkeytableptr->AddItemL( commandId, keycode, modifiers );
    
    TInt commandId2( KTwo );
    TInt keycode2( KThree );
    TInt modifiers2( KZero );
    hotkeytableptr->AddItemL( commandId2, keycode2, modifiers2 );
    
    TInt returncommandId;
    TInt returncommandId2;
    returncommandId = hotkeytableptr->CommandIdFromHotKey( keycode, modifiers );
    returncommandId2 = hotkeytableptr->CommandIdFromHotKey( keycode2,
        modifiers2 );
    STIF_ASSERT_NOT_EQUALS( returncommandId, returncommandId2 );
    CleanupStack::PopAndDestroy( hotkeytableptr );
    
    return KErrNone;
    }
Exemple #16
0
bool TextView::eventFilter(QObject *watched, QEvent *event) {
    if (watched == textEdit()) {
        if (event->type() == QEvent::FocusIn) {
            connect(textEdit_, SIGNAL(cursorPositionChanged()), this, SLOT(updatePositionStatus()));
            updatePositionStatus();
        } else if (event->type() == QEvent::FocusOut) {
            disconnect(textEdit_, SIGNAL(cursorPositionChanged()), this, SLOT(updatePositionStatus()));
        }
    }
    if (watched == textEdit()->viewport()) {
        if (event->type() == QEvent::Resize) {
            updateExtraSelections();
        } else if (event->type() == QEvent::Wheel) {
            auto wheelEvent = static_cast<QWheelEvent *>(event);

            if (wheelEvent->orientation() == Qt::Vertical && wheelEvent->modifiers() & Qt::ControlModifier) {
                if (wheelEvent->delta() > 0) {
                    zoomIn(1 + wheelEvent->delta() / 360);
                } else {
                    zoomOut(1 - wheelEvent->delta() / 360);
                }
                return true;
            }
        }
    }
    return QDockWidget::eventFilter(watched, event);
}
static uint32 translateKeyCode(uint32 key)
{
	uint32 code = 0;
	uint32 i = 0;
	if(modifiers()&&B_NUM_LOCK) {
	    while (ScanCodes_Numlock[i]) {
	      		if ( key == ScanCodes_Numlock[i + 1]) {
	            code = ScanCodes_Numlock[i];
	      		    break;
	        	}
	       	i += 2;
	  	}	
		if(code>0)
			return code;   
	}
	
	i = 0;
    while (ScanCodes[i]) {
      		if ( key == ScanCodes[i + 1]) {
            code = ScanCodes[i];
      		    break;
        	}
       	i += 2;
  	}	
	return code;   
}
Exemple #18
0
void
FieldView::InvokeTile(const IntPoint &tilePt, uint32 button)
{
	if (tilePt.x >= fField->Width() || tilePt.y >= fField->Height())
		return;

	if (gGameState == GAME_OVER)
		return;

	fMainWin->SetFace(FACE_NORMAL);

	if (button & B_PRIMARY_MOUSE_BUTTON)
	{
		int32 mod = modifiers();

		if ( (button & B_SECONDARY_MOUSE_BUTTON) || (mod & B_SHIFT_KEY) )
			NumberReveal(tilePt);
		else if (mod & B_COMMAND_KEY)
			DoSonar(tilePt);
		else
			ClickBox(tilePt);
	}
	else if (button == B_SECONDARY_MOUSE_BUTTON)
		ToggleBox(tilePt);
	else if (button == B_TERTIARY_MOUSE_BUTTON)
		DoSonar(tilePt);
}
Exemple #19
0
 bool eventFilter(QObject *watched, QEvent *event) {
     if (event->type() == QEvent::MouseButtonDblClick ||
             event->type() == QEvent::MouseButtonPress ||
             event->type() == QEvent::MouseButtonRelease) {
         auto ev = static_cast<QMouseEvent*>(event);
         if (ev->button() == Qt::RightButton) {
             auto buttons = ev->buttons();
             if (buttons & Qt::RightButton) {
                 buttons ^= Qt::RightButton;
                 buttons |= Qt::LeftButton;
             }
             QMouseEvent lev{ev->type(),
                             ev->localPos(),
                             ev->windowPos(),
                             ev->screenPos(),
                             Qt::LeftButton,
                             buttons,
                             ev->modifiers(),
                             ev->source()};
             Q_ASSERT(! (lev.buttons() & Qt::RightButton));
             QCoreApplication::sendEvent(watched, &lev);
             return true;
         }
     }
     return QObject::eventFilter(watched, event);
 }
JBoolean
THXKeyPad::HandleButton
	(
	JBroadcaster* sender
	)
	const
{
JIndex i;
JXKeyModifiers modifiers(GetDisplay());

	if (itsExpr == NULL || !itsExpr->Focus())
		{
		return kJFalse;
		}

	for (i=0; i<10; i++)
		{
		if (sender == itsDigitButton[i])
			{
			if (!itsExpr->HasSelection() && !itsExpr->UIFIsActive())
				{
				if (itsExpr->ContainsUIF())
					{
					itsExpr->ActivateNextUIF();
					}
				else
					{
					itsExpr->SelectAll();
					}
				}

			itsExpr->HandleKeyPress('0' + i, modifiers);
			return kJTrue;
			}
		}

	for (i=0; i<kOpCount; i++)
		{
		if (sender == itsOpButton[i])
			{
			if (!itsExpr->HasSelection() && !itsExpr->UIFIsActive())
				{
				itsExpr->SelectAll();
				}

			itsExpr->HandleKeyPress(kOpKey[i], modifiers);
			return kJTrue;
			}
		}

	if (sender == itsClearAllButton)
		{
		itsExpr->CancelEditing();
		itsExpr->SelectAll();
		itsExpr->DeleteSelection();
		return kJTrue;
		}

	return kJFalse;
}
Exemple #21
0
status_t
ModelMenuItem::Invoke(BMessage* message)
{
	if (Menu() == NULL)
		return B_ERROR;

	if (!IsEnabled())
		return B_ERROR;

	if (message == NULL)
		message = Message();

	if (message == NULL)
		return B_BAD_VALUE;

	BMessage clone(*message);
	clone.AddInt32("index", Menu()->IndexOf(this));
	clone.AddInt64("when", system_time());
	clone.AddPointer("source", this);

	if ((modifiers() & B_OPTION_KEY) == 0) {
		// if option not held, remove refs to close to prevent closing
		// parent window
		clone.RemoveData("nodeRefsToClose");
	}

	return BInvoker::Invoke(&clone);
}
Exemple #22
0
status_t
TWindowMenuItem::Invoke(BMessage* /*message*/)
{
	if (!fDragging) {
		if (fID >= 0) {
			int32 action = (modifiers() & B_CONTROL_KEY) != 0
				? B_MINIMIZE_WINDOW : B_BRING_TO_FRONT;

			bool doZoom = false;
			BRect zoomRect(0.0f, 0.0f, 0.0f, 0.0f);
			BMenuItem* item;
			if (!fExpanded)
				item = Menu()->Superitem();
			else
				item = this;

			if (item->Menu()->Window() != NULL) {
				zoomRect = item->Menu()->ConvertToScreen(item->Frame());
				doZoom = (fMini && action == B_BRING_TO_FRONT)
					|| (!fMini && action == B_MINIMIZE_WINDOW);
			}

			do_window_action(fID, action, zoomRect, doZoom);
		}
	}
	return B_OK;
}
Exemple #23
0
void MouseEvent::initMouseEvent(ScriptState* scriptState,
                                const AtomicString& type,
                                bool canBubble,
                                bool cancelable,
                                AbstractView* view,
                                int detail,
                                int screenX,
                                int screenY,
                                int clientX,
                                int clientY,
                                bool ctrlKey,
                                bool altKey,
                                bool shiftKey,
                                bool metaKey,
                                short button,
                                EventTarget* relatedTarget,
                                unsigned short buttons) {
  if (isBeingDispatched())
    return;

  if (scriptState && scriptState->world().isIsolatedWorld())
    UIEventWithKeyState::didCreateEventInIsolatedWorld(ctrlKey, altKey,
                                                       shiftKey, metaKey);

  initModifiers(ctrlKey, altKey, shiftKey, metaKey);
  initMouseEventInternal(type, canBubble, cancelable, view, detail, screenX,
                         screenY, clientX, clientY, modifiers(), button,
                         relatedTarget, nullptr, buttons);
}
Exemple #24
0
// KeyDown
void
PopupTextView::KeyDown(const char* bytes, int32 numBytes)
{
	bool handled = true;
	if (numBytes > 0) {
		switch (bytes[0]) {
			case B_ESCAPE:
				// revert any typing changes
				RevertChanges();
				break;
			case B_TAB: {
				// skip BTextView implementation
				BView::KeyDown(bytes, numBytes);
				int32 next = modifiers() & B_SHIFT_KEY ? -1 : 1;
				ApplyChanges(next);
				break;
			}
			case B_RETURN:
				ApplyChanges();
				break;
			default:
				handled = false;
				break;
		}
	}
	if (!handled)
		BTextView::KeyDown(bytes, numBytes);
}
Exemple #25
0
bool
DragSortableListView::HandleDropMessage(const BMessage* message,
	int32 dropIndex)
{
	DragSortableListView *list = NULL;
	if (message->FindPointer("list", (void **)&list) != B_OK || list != this)
		return false;

	BList items;
	int32 index;
	for (int32 i = 0; message->FindInt32("index", i, &index) == B_OK; i++) {
		BListItem* item = ItemAt(index);
		if (item != NULL)
			items.AddItem((void*)item);
	}

	if (items.CountItems() == 0)
		return false;

	if ((modifiers() & B_SHIFT_KEY) != 0)
		CopyItems(items, dropIndex);
	else
		MoveItems(items, dropIndex);

	return true;
}
// -----------------------------------------------------------------------------
// CTestSDKCFD::TestEHKEYRemoveItem
// -----------------------------------------------------------------------------
//
TInt CTestSDKEIKHKEYT::TestEHKEYRemoveItemL( CStifItemParser& /*aItem*/ )
    {
    CEikHotKeyTable* hotkeytableptr = new( ELeave ) CEikHotKeyTable;
    CleanupStack::PushL( hotkeytableptr );

    TInt commandId( KOne );
    TInt keycode( KTwo );
    TInt modifiers( KZero );
    hotkeytableptr->AddItemL( commandId, keycode, modifiers );
    
    TBool flag;
    TInt returnkeycode;
    TInt returncommandId;
    flag = hotkeytableptr->HotKeyFromCommandId( commandId, returnkeycode,
        modifiers );
    returncommandId = hotkeytableptr->CommandIdFromHotKey( keycode, modifiers );
    
    STIF_ASSERT_TRUE( flag );
    STIF_ASSERT_EQUALS( keycode, returnkeycode );
    STIF_ASSERT_EQUALS( commandId, returncommandId );
    
    hotkeytableptr->RemoveItem( commandId );
    returnkeycode = 0;
    
    flag = hotkeytableptr->HotKeyFromCommandId( commandId, returnkeycode,
        modifiers );
    returncommandId = hotkeytableptr->CommandIdFromHotKey( keycode, modifiers );
    STIF_ASSERT_FALSE( flag );
    STIF_ASSERT_NOT_EQUALS( keycode, returnkeycode );
    STIF_ASSERT_NOT_EQUALS( commandId, returncommandId );
    CleanupStack::PopAndDestroy( hotkeytableptr );
    
    return KErrNone;
    }
bool DragController::isCopyKeyDown(DragData*)
{
    if (modifiers() & B_COMMAND_KEY)
        return true;

    return false;
}
void
TBarView::MouseDown(BPoint where)
{
	where = ConvertToScreen(where);

	if (Window()->Frame().Contains(where)) {
		Window()->Activate();

		if ((modifiers() & (B_CONTROL_KEY | B_COMMAND_KEY | B_OPTION_KEY
					| B_SHIFT_KEY)) == (B_CONTROL_KEY | B_COMMAND_KEY)) {
			// The window key was pressed - enter dragging code
			fDragRegion->MouseDown(fDragRegion->DragRegion().LeftTop());
			return;
		}
	} else {
		// hide deskbar if required
		desk_settings* settings = ((TBarApp*)be_app)->Settings();
		bool alwaysOnTop = settings->alwaysOnTop;
		bool autoRaise = settings->autoRaise;
		bool autoHide = settings->autoHide;
		bool isTopMost = Window()->Feel() == B_FLOATING_ALL_WINDOW_FEEL;

		if (!alwaysOnTop && autoRaise && isTopMost)
			RaiseDeskbar(false);

		if (autoHide && !IsHidden())
			HideDeskbar(true);
	}
}
Exemple #29
0
void
WorkspacesWindow::FrameResized(float width, float height)
{
	if (!modifiers() & B_SHIFT_KEY) {
		BWindow::FrameResized(width, height);
		return;
	}

	uint32 columns, rows;
	BPrivate::get_workspaces_layout(&columns, &rows);

	BScreen screen;
	float screenWidth = screen.Frame().Width();
	float screenHeight = screen.Frame().Height();

	float windowAspectRatio
		= (columns * screenWidth) / (rows * screenHeight);

	float newHeight = width / windowAspectRatio;

	if (height != newHeight)
		ResizeTo(width, newHeight);

	fSettings->SetWindowFrame(Frame());
}
KDEVPLATFORMLANGUAGE_EXPORT
void ConstantIntegralType::setValueInternal<quint64>(quint64 value) {
  if(!(modifiers() & UnsignedModifier)) {
    kDebug() << "setValue(unsigned) called on not unsigned type";
  }
  d_func_dynamic()->m_value = (qint64)value;
}