当前位置: 首页>>代码示例>>C++>>正文


C++ MouseEvent::getSource方法代码示例

本文整理汇总了C++中gcn::MouseEvent::getSource方法的典型用法代码示例。如果您正苦于以下问题:C++ MouseEvent::getSource方法的具体用法?C++ MouseEvent::getSource怎么用?C++ MouseEvent::getSource使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在gcn::MouseEvent的用法示例。


在下文中一共展示了MouseEvent::getSource方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: mouseClicked

void ChatBox::mouseClicked(gcn::MouseEvent& mouseEvent){
    if( mouseEvent.isConsumed() ){ return; }

    InfraellyWindow::mouseClicked(mouseEvent);

    //click from the chat area
    if( mouseEvent.getSource() == chatArea ){
        chatArea->requestFocus();
        typing = 0;
    }

    //click from the input field
    if( mouseEvent.getSource() == inputField ){
        typing = 1;
    }

    //if click was from send button
    if( mouseEvent.getSource() == sendButton ){
        // add the text from the text field into the chat area
        push_back( inputField->getText(), DO_CALLBACK|PUT_USERNAME );
        //clear off the text field
        inputField->setText("");
        //--------------------------
        //          play sound
        //------------------------
    }
}
开发者ID:hoodwolf,项目名称:Infraelly,代码行数:27,代码来源:ChatBox.cpp

示例2: mouseMoved

void MiniStatusWindow::mouseMoved(gcn::MouseEvent &event)
{
    Popup::mouseMoved(event);

    const int x = event.getX();
    const int y = event.getY();

    if (event.getSource() == mXpBar)
    {
        mTextPopup->show(x + getX(), y + getY(),
                         strprintf("%u/%u", PlayerInfo::getAttribute(EXP),
                                   PlayerInfo::getAttribute(EXP_NEEDED)),
                         strprintf("%s: %u", _("Need"),
                                   PlayerInfo::getAttribute(EXP_NEEDED)
                                   - PlayerInfo::getAttribute(EXP)));
    }
    else if (event.getSource() == mHpBar)
    {
        mTextPopup->show(x + getX(), y + getY(),
                         strprintf("%u/%u", PlayerInfo::getAttribute(HP),
                                   PlayerInfo::getAttribute(MAX_HP)));
    }
    else if (event.getSource() == mMpBar)
    {
        mTextPopup->show(x + getX(), y + getY(),
                         strprintf("%u/%u", PlayerInfo::getAttribute(MP),
                                   PlayerInfo::getAttribute(MAX_MP)));
    }
    else
    {
        mTextPopup->setVisible(false);
    }
}
开发者ID:B-Rich,项目名称:mana,代码行数:33,代码来源:ministatus.cpp

示例3: getResizeHandles

int Window::getResizeHandles(gcn::MouseEvent &event)
{
    int resizeHandles = 0;
    const int y = event.getY();

    if (mGrip && y > (int) mTitleBarHeight)
    {
        const int x = event.getX();

        if (!getChildrenArea().isPointInRect(x, y) &&
                event.getSource() == this)
        {
            resizeHandles |= (x > getWidth() - resizeBorderWidth) ? RIGHT :
                              (x < resizeBorderWidth) ? LEFT : 0;
            resizeHandles |= (y > getHeight() - resizeBorderWidth) ? BOTTOM :
                              (y < resizeBorderWidth) ? TOP : 0;
        }

        if (event.getSource() == mGrip)
        {
            mDragOffsetX = x;
            mDragOffsetY = y;
            resizeHandles |= BOTTOM | RIGHT;
        }
    }

    return resizeHandles;
}
开发者ID:Ablu,项目名称:invertika,代码行数:28,代码来源:window.cpp

示例4: mouseClicked

void NpcDialog::mouseClicked(gcn::MouseEvent &mouseEvent)
{
    if (mouseEvent.getSource() == mItemList &&
        isDoubleClick(mItemList->getSelected()))
    {
        action(gcn::ActionEvent(mButton, mButton->getActionEventId()));
    }
    if (mouseEvent.getSource() == mTextBox && isDoubleClick((int)(long)mTextBox))
    {
        if (mActionState == NPC_ACTION_NEXT || mActionState == NPC_ACTION_CLOSE)
            action(gcn::ActionEvent(mButton, mButton->getActionEventId()));
    }
}
开发者ID:B-Rich,项目名称:mana,代码行数:13,代码来源:npcdialog.cpp

示例5: mouseClicked

void LoginBox::mouseClicked(gcn::MouseEvent& mouseEvent){
    if( mouseEvent.getSource() == doneButton ){
        if( isAlphNum(usernameTextField->getText()) &&
            isAlphNum(passwordTextField->getText()) )
        {
            infoReady = true;
        } else {
            infoReady = false;
        }
    } else
    if( mouseEvent.getSource() == cancelButton ){
        setVisible(false);
    }
}
开发者ID:hoodwolf,项目名称:Infraelly,代码行数:14,代码来源:LoginBox.cpp

示例6: mousePressed

void Windowiki::mousePressed(gcn::MouseEvent &event)
{
    // Let Guichan move window to top and figure out title bar drag
    gcn::Window::mousePressed(event);

    const int x = event.getX();
    const int y = event.getY();
    mMouseResize = 0;

    // Activate resizing handles as appropriate
    if (event.getSource() == this && isResizable() &&
            event.getButton() == gcn::MouseEvent::LEFT &&
            !getChildrenArea().isPointInRect(x, y))
    {
        mMouseResize |= (x > getWidth() - resizeBorderWidthiki) ? RIGHT :
                        (x < resizeBorderWidthiki) ? LEFT : 0;
        mMouseResize |= (y > getHeight() - resizeBorderWidthiki) ? BOTTOM :
                        (y < resizeBorderWidthiki) ? TOP : 0;
    }
    else if (event.getSource() == mGrip)
    {
        mDragOffsetX = x + mGrip->getX();
        mDragOffsetY = y + mGrip->getY();
        mMouseResize |= BOTTOM | RIGHT;
        mIsMoving = false;
    }

    if (event.getButton() == gcn::MouseEvent::LEFT)
    {
        const int x = event.getX();
        const int y = event.getY();

        // Handle close button
        if (mCloseButton)
        {
            gcn::Rectangle closeButtonRect(
                getWidth() - closeImage->getWidth() - getPadding(),
                getPadding(),
                closeImage->getWidth(),
                closeImage->getHeight());

            if (closeButtonRect.isPointInRect(x, y))
            {
                setVisible(false);
            }
        }

        // Handle window resizing
    }
}
开发者ID:mekolat,项目名称:elektrogamesvn,代码行数:50,代码来源:window_iki.cpp

示例7: mouseClicked

void ItemMakerBox::mouseClicked(gcn::MouseEvent& mouseEvent){
    if( mouseEvent.isConsumed() ){ return; };

    //  Save Button
    if( mouseEvent.getSource() == saveBtn ){
        mouseEvent.consume();
        save( filenameFld->getText() );
    } else
    //  Load Button
    if( mouseEvent.getSource() == loadBtn ){
        mouseEvent.consume();
        load( filenameFld->getText() );
    } else {
        setCaption(caption_);
    }
}
开发者ID:hoodwolf,项目名称:Infraelly,代码行数:16,代码来源:ItemMakerBox.cpp

示例8: mouseClicked

void InventoryWindow::mouseClicked(gcn::MouseEvent &event)
{
    Window::mouseClicked(event);

    if (event.getButton() == gcn::MouseEvent::RIGHT &&
        event.getSource() == mItems)
        mItems->showPopupMenu(INVENTORY);
}
开发者ID:stevecotton,项目名称:Aethyra,代码行数:8,代码来源:inventorywindow.cpp

示例9: mouseMoved

// Show ItemTooltip
void ItemAmountWindow::mouseMoved(gcn::MouseEvent &event)
{
    if (event.getSource() == mItemIcon)
    {
        mItemPopup->setItem(mItem->getInfo());
        mItemPopup->position(viewport->getMouseX(), viewport->getMouseY());
    }
}
开发者ID:Ablu,项目名称:invertika,代码行数:9,代码来源:itemamount.cpp

示例10: mouseClicked

void StorageWindow::mouseClicked(gcn::MouseEvent &event)
{
    Window::mouseClicked(event);

    if (event.getButton() == gcn::MouseEvent::RIGHT &&
        event.getSource() == mItems)
        mItems->showPopupMenu(STORAGE);
}
开发者ID:Aethyra,项目名称:Client,代码行数:8,代码来源:storagewindow.cpp

示例11: mouseClicked

void BuyDialog::mouseClicked(gcn::MouseEvent &mouseEvent)
{
    if (mouseEvent.getSource() == mShopItemList &&
        isDoubleClick(mShopItemList->getSelected()))
    {
        action(gcn::ActionEvent(mBuyButton, mBuyButton->getActionEventId()));
    }
}
开发者ID:B-Rich,项目名称:mana,代码行数:8,代码来源:buy.cpp

示例12: mouseClicked

void ServerDialog::mouseClicked(gcn::MouseEvent &mouseEvent)
{
    if (mouseEvent.getSource() == mServersList &&
        isDoubleClick(mServersList->getSelected()))
    {
        action(gcn::ActionEvent(mConnectButton,
                                mConnectButton->getActionEventId()));
    }
}
开发者ID:B-Rich,项目名称:mana,代码行数:9,代码来源:serverdialog.cpp

示例13: mouseClicked

void WorldSelectDialog::mouseClicked(gcn::MouseEvent &mouseEvent)
{
    if (mouseEvent.getSource() == mWorldList &&
        isDoubleClick(mWorldList->getSelected()))
    {
        action(gcn::ActionEvent(mChooseWorld,
                                mChooseWorld->getActionEventId()));
    }
}
开发者ID:B-Rich,项目名称:mana,代码行数:9,代码来源:worldselectdialog.cpp

示例14: mousePressed

    void WorldEditor::mousePressed(gcn::MouseEvent& mouseEvent)
    {
        if (mouseEvent.getSource() != this)
        {
            return;
        }

        if (mDrawingNewRoom)
        {
            mDrawingNewRoom = false;
            return;
        }

        if (mouseEvent.getButton() == gcn::MouseEvent::RIGHT)
        {
            if (mWorldPieces.find(mRoomSelector->getSelectedRoom()) == mWorldPieces.end())
            {
                WorldPiece* worldPiece = new WorldPiece(mRoomSelector->getSelectedRoom());
                mWorldPieces[mRoomSelector->getSelectedRoom()] = worldPiece;

                worldPiece->setPosition(mouseEvent.getX() - mouseEvent.getX() % 20, 
                                        mouseEvent.getY() - mouseEvent.getY() % 15);
                worldPiece->addActionListener(this);
                add(worldPiece);
            }
        }
        else if (mouseEvent.getButton() == gcn::MouseEvent::LEFT)
        {
            if (!mNewRoomDialogWindow->isVisible() 
                && getWidgetAt(mouseEvent.getX(), mouseEvent.getY()) == NULL)
            {   
                mDrawingNewRoom = true;

                if (mouseEvent.getX() % 20 < 10)
                {
                    mNewRoomX = mouseEvent.getX() - mouseEvent.getX() % 20;
                }
                else
                {
                    mNewRoomX = mouseEvent.getX() - mouseEvent.getX() % 20 + 20;
                }

                if (mouseEvent.getY() % 15 < 8)
                {
                    mNewRoomY = mouseEvent.getY() - mouseEvent.getY() % 15;
                }
                else
                {
                    mNewRoomY = mouseEvent.getY() - mouseEvent.getY() % 15 + 15;
                }

                mNewRoomWidth = 0;
                mNewRoomHeight = 0;
            }
        }
    }
开发者ID:olofn,项目名称:db_public,代码行数:56,代码来源:worldeditor.cpp

示例15: mouseClicked

void Console::mouseClicked(gcn::MouseEvent& mouseEvent){
    if( mouseEvent.isConsumed() ){ return; };

    //click from the text area
    if( mouseEvent.getSource() == textArea ){
        inputField->requestFocus();
    };

    //if click was from send button
    if( mouseEvent.getSource() == sendButton ){
        // add the text from the text field into the text area
        push_back( inputField->getText(), DO_CALLBACK|PUT_USERNAME);
        //store command entered
        lastCommand = inputField->getText();
        //clear off the text field
        inputField->setText("");
        //--------------------------
        //          play sound
        //------------------------
        inputField->requestFocus();
    }
}
开发者ID:Infraelly,项目名称:old-infraelly-engine,代码行数:22,代码来源:Console.cpp


注:本文中的gcn::MouseEvent::getSource方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。