void ClientGame::OnMouseUp(int x, int y, int button) { if (m_gameState != GameState_Playing) { return; } m_notificationLog.OnMouseUp(x, y, button); if (button == 1) { if (m_mapState == State_Button) { UpdateActiveButton(x, y); m_mapState = State_Idle; if (m_activeButtonDown) { m_activeButtonDown = false; OnButtonPressed(m_activeButton); } m_activeButton = ButtonId_None; } } if (button == 3) { if (m_mapState == State_Panning) { m_mapState = State_Idle; } } }
void pawsScrollBar::Draw() { if(mouseIsDraggingThumb && maxValue>0) MoveThumbToMouse(); pawsWidget::Draw(); if(mouseDown && (clock->GetCurrentTicks() - scrollTicks > SCROLL_TICKS)) { OnButtonPressed(lastButton, lastModifiers, lastWidget); } }
void pawsCharacterPickerWindow::HandleMessage( MsgEntry* me ) { switch( me->GetType() ) { // Incomming character description. At the moment it is just the // // character name and the factory of the mesh. case MSGTYPE_AUTHAPPROVED: { if(charactersFound != 0) return; psAuthApprovedMessage msg(me); for (int i=0; i < msg.msgNumOfChars; i++) { csString name,race,factName,traits,equipment; msg.GetCharacter(me,name,race,factName, traits,equipment); // Set the name of the character in the right button. csString buff; buff.Format("SelectCharacter%i", charactersFound); pawsButton* button = (pawsButton*)FindWidget( buff ); button->SetText( name ); button->Show(); buff.Format("ImgCharacter%i", charactersFound); pawsWidget* radio = FindWidget(buff); radio->Show(); // Store the character data. models[charactersFound].factName = factName; models[charactersFound].race = race; models[charactersFound].traits = traits; models[charactersFound].equipment = equipment; charactersFound++; SelectCharacter(0,FindWidget("SelectCharacter0")); } // If we have all the chars we have then turn on the rest of the // buttons as new character ones. // Allow player to join only after all messages have been received // to prevent user thinking chars have been 'lost'. if ( charactersFound == psengine->GetNumChars() ) { pawsWidget* widget = FindWidget("login"); if ( widget ) widget->Show(); if ( charactersFound < 4 ) { csString buff; buff.Format("SelectCharacter%i", charactersFound); pawsWidget* widget = FindWidget( buff ); widget->Show(); buff.Format("ImgCharacter%i", charactersFound); pawsWidget* radio = FindWidget(buff); radio->Show(); } // If there's some char created then show delete option pawsWidget* deleteCharBut = FindWidget("delete"); if (deleteCharBut) deleteCharBut->Show(); } return; } case MSGTYPE_CHAR_DELETE: { // Emulate back click OnButtonPressed(1,0,FindWidget(BACK_BUTTON)); break; } } }
void ScriptDialogWidget::InitWindow(ScriptDialogRequest &request) { QVBoxLayout* layout = new QVBoxLayout(this); layout->setSpacing(0); layout->setMargin(0); setLayout(layout); QUiLoader loader; QFile file("./data/ui/scriptdialog.ui"); if (!file.exists()) { // TODO: LogError ("Cannot find ScriptDialog.ui file."); return; } // Get pointers to widgets. widget_ = loader.load(&file, 0); file.close(); layout->addWidget(widget_); QPlainTextEdit* message_text = widget_->findChild<QPlainTextEdit*>("messageText"); if (message_text) message_text->appendPlainText( QString::fromUtf8(request_.GetMessageText().c_str(), request_.GetMessageText().size()) ); QLabel* from_text = widget_->findChild<QLabel*>("fromText"); if (from_text) from_text->setText( QString( request_.GetObjectName().c_str()) ); QLabel* owner_text = widget_->findChild<QLabel*>("ownerText"); if (owner_text) owner_text->setText( QString(request_.GetObjectsOwnerName().c_str()) ); ButtonLabels labels = request.GetButtonLabels(); QGridLayout* button_container = widget_->findChild<QGridLayout*>("dynamicButtonsContainer"); if (!button_container) { // todo: LogError: "Cannot show buttons on ScriptDialogWidget, button container pointer not valid." return; } //button_container->setColumnCount(3); //button_container->setRowCount((labels.size()-1) / 3 + 1); int index = 0; for (ButtonLabels::iterator i = labels.begin(); i != labels.end(); ++i) { QString label = QString((*i).c_str()); SelectionButton* button = new SelectionButton(0, label.toStdString().c_str(), label); int column = index % 3; int row = index / 3; button_container->addWidget(button, row, column); connect(button, SIGNAL( Clicked(QString)), this, SLOT( OnButtonPressed(QString))); index++; } QPushButton* default_button = widget_->findChild<QPushButton*>("defaultButton"); if (default_button) { if (labels.size() == 0) { SelectionButton* button = new SelectionButton(0, "Ok", "Ok"); button_container->addWidget(button, 0, 0); connect(button, SIGNAL( Clicked(QString)), this, SLOT( OnButtonPressed(QString))); } else { default_button->setText("Ignore"); connect(default_button, SIGNAL( clicked()), this, SLOT( OnIgnorePressed()) ); } } }
void wxWizBaseDlg::OnCancelButtonClick(wxCommandEvent& event) { OnButtonPressed(2); }
void wxWizBaseDlg::OnBackButtonClick(wxCommandEvent& event) { OnButtonPressed(1); }
void wxWizBaseDlg::OnNextButtonClick(wxCommandEvent& event) { OnButtonPressed(0); }