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


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

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


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

示例3: mousePressed

void TabbedArea::mousePressed(gcn::MouseEvent &mouseEvent)
{
    if (mouseEvent.isConsumed())
        return;

    if (mouseEvent.getButton() == gcn::MouseEvent::LEFT)
    {
        gcn::Widget *widget = mTabContainer->getWidgetAt(mouseEvent.getX(),
                                                         mouseEvent.getY());
        gcn::Tab *tab = dynamic_cast<gcn::Tab*>(widget);

        if (tab)
        {
            setSelectedTab(tab);
            requestFocus();
        }
    }
}
开发者ID:B-Rich,项目名称:mana,代码行数:18,代码来源:tabbedarea.cpp

示例4: mouseClicked

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

  gcn::Widget* sourceWidget = mouseEvent.getSource();
  if (sourceWidget == dynamic_cast<gcn::Widget*>(playButton)) {
    std::cout << "Click on PLAY button" << std::endl;
    changeState(PLAYING);
  } else if (sourceWidget == dynamic_cast<gcn::Widget*>(pauseButton)) {
    std::cout << "Click on PAUSE button" << std::endl;
    changeState(PAUSED);
  } else if (sourceWidget == dynamic_cast<gcn::Widget*>(stopButton)) {
    std::cout << "Click on STOP button" << std::endl;
    changeState(STOPPED);
  }

  mouseEvent.consume();
}
开发者ID:igneus,项目名称:particled,代码行数:20,代码来源:playcontrolpanel.cpp

示例5: 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

示例6: mouseClicked

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

    //click from the map image ( worldImagePlaceHolder )
    if( mouseEvent.getSource() == worldImagePlaceHolder ){
        //consume mouse event
        mouseEvent.consume();
        //click from the tilesetImage
        if( world != NULL ){
            if( world->empty() ){ return; };

            int layerNum = layerToggleBox->getWorkingLayer();
            Layer& workingLayer = world->getLayer(layerNum);

            // tileset select
            int tileWidth = workingLayer.getTileWidth();
            int tileHeight = workingLayer.getTileHeight();

            // get the x-y co-ords reletive to the tileset region
            int col = mouseEvent.getX() - worldImagePlaceHolder->getX();
            int row = mouseEvent.getY() - worldImagePlaceHolder->getY();

            // if its a multiple of tilewidth/height (ie in the barrier between)
            if( col % tileWidth == 0){ ++col; };
            if( row % tileHeight == 0){ ++row; };

            // turn co-ords into row/col
            col = col/tileWidth;
            row = row/tileHeight;


            // calculate the amount of tiles off the screen
            int trueCol = worldImagePlaceHolder->getX();
            int trueRow = worldImagePlaceHolder->getY();

            //  if its a multiple of tilewidth/height (ie in the barrier between)
            if( trueCol % tileWidth == 0){ ++col; };
            if( trueRow % tileHeight == 0){ ++row; };
            // turn co-ords into row/col
            trueCol = trueCol/tileWidth;
            trueRow = trueRow/tileHeight;
            //add the on screen offset to the offsecreen tiles
            trueCol += col-1;
            trueRow += row-1;

            //check if within range
            if( (trueCol < workingLayer.getWidth()) &&
                (trueRow < workingLayer.getHeight()) ){
                //if left click
                if( mouseEvent.getButton() == gcn::MouseEvent::LEFT ){
                    //set the tile wher mouse is on map, to selected tile on ts
                    //if the attrib ts is on
                    if( tilesetBox->getSelectedTileset() == tilesetBox->getAttribTileset() ){
                        //only replace the attibute
                        workingLayer.at(trueCol, trueRow).setAttribute( tilesetBox->getSelectedTile().getAttribute() );
                    } else {
                        //replace old tile
                        workingLayer.at(trueCol, trueRow) = tilesetBox->getSelectedTile();
                    }
                } else if( mouseEvent.getButton() == gcn::MouseEvent::MIDDLE ){
                    //fill layer, to selected tile on ts
                    //if the attrib ts is on
                    if( tilesetBox->getSelectedTileset() == tilesetBox->getAttribTileset() ){
                        //only replace the attibute
                        for(int i = 0; i < workingLayer.getHeight(); ++i){
                            for(int j = 0; j < workingLayer.getWidth(); ++j){
                                workingLayer.at(j, i).setAttribute( tilesetBox->getSelectedTile().getAttribute() );
                            }
                        }
                    } else {
                        //replace old tile
                        for(int i = 0; i < workingLayer.getHeight(); ++i){
                            for(int j = 0; j < workingLayer.getWidth(); ++j){
                                workingLayer.at(j, i) = tilesetBox->getSelectedTile();
                            }
                        }
                    }
                } else if ( mouseEvent.getButton() == gcn::MouseEvent::RIGHT ){
                    //if the attrib ts is on
                    if( tilesetBox->getSelectedTileset() == tilesetBox->getAttribTileset() ){
                        //clear attrib
                        workingLayer.at(trueCol, trueRow).setAttribute( MapTile::REGULAR );
                    } else {
                        //clear the tileset (delete tile)
                        workingLayer.at(trueCol, trueRow).setSource( NULL, 0, 0 );
                    }
                }
                mapTouched = 1;
            }
        }//end if event from drop down
    } else




    //click from the tilset panel
    //load tileset button
    if( mouseEvent.getSource() == tilesetBox->getLoadTilesetButton() ){
        mouseEvent.consume();
        loadTilesetBox->setVisible( true );
//.........这里部分代码省略.........
开发者ID:hoodwolf,项目名称:Infraelly,代码行数:101,代码来源:MapperGui.cpp

示例7: mouseClicked

void MapperTilesetBox::mouseClicked(gcn::MouseEvent& mouseEvent){
    InfraellyWindow::mouseClicked(mouseEvent);

    if( mouseEvent.isConsumed() ){ return; };

    //if click was from closeTilesetButton
    if( mouseEvent.getSource() == closeTilesetButton ){
        //consume mouse event
        mouseEvent.consume();
        //get the pointer to the tileset to remove
        Tileset *toRemove = tilesetList->at( tilesetDropDown->getSelected() );

        //check if the user is trying to dlete teh nullTS
        if( toRemove != tilesetList->at(0) ){
            //store number to remove
            int removeIndex = tilesetDropDown->getSelected();
            //change the selected ts to the nullTS
            tilesetDropDown->setSelected(0);
            //delete the entry from teh list
            tilesetList->removeElementAt( removeIndex );


            //if there is a map activley associated
            if( world != NULL ){
                //stip dependency from map working on
                //if there IS dependency
                if( !world->empty() ){
                    //cycle through layers
                    for( size_t i = 0; i < world->size(); ++i ){
                        //cycle thru tiles
                        for( size_t j = 0; j < world->getLayer(i).getHeight() * world->getLayer(i).getWidth(); ++j){
                            if( world->getLayer(i).index(j).getTileset() == toRemove ){
                                world->getLayer(i).index(j).setTileset(NULL);
                            }
                        }
                    }
                }
            }
            //dependency of tileset stripped
            //delete the tileset
            cache::tilesets.erase(toRemove);

            //remove from selected tile
            selectedTile.setSource(NULL,0,0);
        }
    }


    //click from the tilesetImage
    if( mouseEvent.getSource() == tilesetImage ){
        //consume mouse event
        mouseEvent.consume();
        if( !tilesetList->empty() ){
            Tileset *selectedTs = selectedTile.getTileset();
            if( selectedTs != NULL ){
                // tileset select
                int tileWidth = selectedTs->getTileWidth();
                int tileHeight = selectedTs->getTileHeight();

                // get the x-y co-ords reletive to the tileset region
                int col = mouseEvent.getX() - (tilesetImage->getX()+selectedTs->getXOffset());
                int row = mouseEvent.getY() - (tilesetImage->getY()+selectedTs->getYOffset());

                // if its a multiple of tilewidth/height (ie in the barrier between)
                if( col % tileWidth == 0){ ++col; };
                if( row % tileHeight == 0){ ++row; };

                // turn co-ords into row/col
                col = col/tileWidth;
                row = row/tileHeight;


                // calculate the amount of tiles off the screen
                int trueCol = tilesetImage->getX();
                int trueRow = tilesetImage->getY();

                //  if its a multiple of tilewidth/height (ie in the barrier between)
                if( trueCol % tileWidth == 0){ ++col; };
                if( trueRow % tileHeight == 0){ ++row; };
                // turn co-ords into row/col
                trueCol = trueCol/tileWidth;
                trueRow = trueRow/tileHeight;
                //add the on screen offset to the offsecreen tiles
                trueCol += col-1;
                trueRow += row-1;

                //store the tile's new row-col
                selectedTile.setSource( selectedTs, trueCol, trueRow);
                //store attribute if on atrib ts
                if( selectedTile.getTileset() == attribTs ){
                    selectedTile.setAttribute(attribGrid[trueCol][trueRow]);
                }
            }// end if null
        }//end if empty list
    }//end if event from drop down*/
}
开发者ID:hoodwolf,项目名称:Infraelly,代码行数:96,代码来源:MapperTilesetBox.cpp


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