void MsgDialog::savePrefs() { SEQWindow::savePrefs(); QString tempStr; MyButton* but; int j = 1; for (but = m_buttonList.first(); but != NULL; but = m_buttonList.next()) { tempStr.sprintf("Button%dName", j); pSEQPrefs->setPrefString(tempStr, preferenceName(), but->name()); tempStr.sprintf("Button%dFilter", j); pSEQPrefs->setPrefString(tempStr, preferenceName(), but->filter()); tempStr.sprintf("Button%dColor", j); pSEQPrefs->setPrefColor(tempStr, preferenceName(), but->color()); tempStr.sprintf("Button%dActive", j); pSEQPrefs->setPrefBool(tempStr, preferenceName(), but->isChecked()); j++; } while (j < 15) { tempStr.sprintf("Button%dName", j); pSEQPrefs->setPrefString(tempStr, preferenceName(), ""); tempStr.sprintf("Button%dFilter", j); pSEQPrefs->setPrefString(tempStr, preferenceName(), ""); tempStr.sprintf("Button%dColor", j); pSEQPrefs->setPrefColor(tempStr, preferenceName(), ""); tempStr.sprintf("Button%dActive", j); pSEQPrefs->setPrefBool(tempStr, preferenceName(), ""); j++; } }
void PanoramaWidget::initComponet() { QStringList stringList; stringList << "客户资料 " << "CRM " << "知识库 "; MyButton * myButton; //设置按钮 for (int i=0; i<stringList.size(); ++i) { myButton = new MyButton(); myButton->setFixedWidth(50); myButton->setText(stringList.at(i), TOP2BOTTOM); this->m_listMyButton.append(myButton); connect(myButton, SIGNAL(clicked()), &m_SigalMapper, SLOT(map())); this->m_SigalMapper.setMapping(myButton, i); this->m_pBtnVLayout->addWidget(myButton); } connect(&m_SigalMapper, SIGNAL(mapped(int)), this, SLOT(switchWidget(int))); //添加与按钮对应的显示信息界面 this->m_pMainHLayout->addLayout(this->m_pBtnVLayout); this->m_pMainHLayout->addWidget(this->m_pCstInfoWidget); this->m_pMainHLayout->addWidget(this->m_pCRMWidget); this->m_pMainHLayout->addWidget(this->m_pKnowledgeWidget); this->m_pMainHLayout->setSpacing(1); setLayout(this->m_pMainHLayout); this->m_pCurrentWidget = this->m_pCstInfoWidget; this->m_pCurrentWidget->show(); this->m_listMyButton.at(0)->setBtnClicked(true); }
int main(int argc, char *argv[]) { QApplication app(argc, argv); MyButton window; window.resize(250, 150); window.setWindowTitle("Example button"); window.show(); return app.exec(); }
// Check if OK to connect to another button. // Returns 0 if OK, -1 on error with errmsg set to reason. // int MyButton::Connecting(Fl_OpButton *opbut, std::string &errmsg) { MyButton *but = (MyButton*)opbut; if ( ! this->IsDataType(but->GetDataType()) ) { errmsg = std::string("Can't connect "); errmsg += this->GetDataTypeStr(); errmsg += std::string(" and "); errmsg += but->GetDataTypeStr(); return(-1); } return(0); }
void MyProject::OnNoteClick(const axButtonMsg& msg) { // std::cout << "Note click : " << msg.GetSender()->GetId() << std::endl; std::vector<MyButtonId> ids = { NOTE_C0, NOTE_D, NOTE_E, NOTE_F, NOTE_G, NOTE_A, NOTE_B, NOTE_C1, NOTE_C0_S, NOTE_D_S, NOTE_F_S, NOTE_G_S, NOTE_A_S }; MyButtonId noteId; for(auto& n : ids) { MyButton* sender = static_cast<MyButton*>(msg.GetSender()); if(_btns[n] != sender) { _btns[n]->SetActive(false); } else { noteId = n; sender->SetActive(true); } } int index = 0; switch(noteId) { case NOTE_C0: index = 0; break; case NOTE_C0_S: index = 1; break; case NOTE_D: index = 2; break; case NOTE_D_S: index = 3; break; case NOTE_E: index = 4; break; case NOTE_F: index = 5; break; case NOTE_F_S: index = 6; break; case NOTE_G: index = 7; break; case NOTE_G_S: index = 8; break; case NOTE_A: index = 9; break; case NOTE_A_S: index = 10; break; case NOTE_B: index = 11; break; case NOTE_C1: index = 12; break; } std::cout << "NOTE CLICK : " << _numberPanel->GetNumber() - 1 << " " << index << std::endl; // MyAudioSynth::GetInstance()->SetNoteInfoNote(_numberPanel->GetNumber() - 1, // index); }
// // addButton - add a button // // Creates a new button and Pops up a modal CButDlg widget to edit it. // After the button has been edited it added to the active filters // if it is selected // (this is for a slot) // void MsgDialog::addButton(void) { #ifdef DEBUGMSG qDebug("addButton()"); #endif MyButton* but = newButton("Name", "Filter", QColor("black"), FALSE); QString oldfilter(but->filter()); // hold copy of old filter CButDlg butdlg(parentWidget(), "ButtonDlg", but); butdlg.exec(); // apply the filter if we are active if (but->isChecked()) addFilter(but->filter()); } // end addButton()
EFI_STATUS ffMainGui ( IN UINTN Argc, IN CHAR16 **Argv ) { //_asm int 3; EFI_STATUS Status = 0; #define PLAY_WIDTH 70 Brick::Initialize(); Window AdminWindow; AdminWindow.SetEventHandler(WndProc); const int START_X = 100; const int START_Y = FULL_HEIGHT - 200; Label* l = new Label((CHAR16*)L"Test"); l->Pos(50, 50); MyButton* b = new MyButton(); b->Pos(50, 100); b->Size(100,30); b->AddtoTabList(); b->SetFocus(); PlayerSwitcher* btn = new PlayerSwitcher("on.bmp", "off.bmp"); btn->Pos(START_X, START_Y); btn->Size(PLAY_WIDTH,PLAY_WIDTH); btn->SetFocus(); btn->AddtoTabList(); progress = new ProgressBar(); progress->Pos(START_X + PLAY_WIDTH , START_Y+ PLAY_WIDTH/2 - 8); progress->Size<UINT16>((UINT16)(FULL_WIDTH - (START_X + PLAY_WIDTH)*2),10); progress->AddtoTabList(); progress->SetMax(1000); Brick::Run(); Brick::Finish(); return Status ; }
void SelectLevel::displayLevels() { stringstream ss; CCLabelAtlas *lable = NULL; MyButton *but = NULL; string str_level, str_description; CCScene *scene = NULL; int max_level = userDefault->getIntegerForKey("max_level"); float xPosition = CONSTANT->getFirstLevelPosition()[0]; float yPosition = CONSTANT->getFirstLevelPosition()[1]; CCDictionary *dict = CCDictionary::createWithContentsOfFile("/word/words.xml"); for (int i = 0; i < max_level; i++) { ss << (i + 1); lable = CCLabelAtlas::create(ss.str().c_str(), "/pic/numbers.png", 23, 26, '0'); but = MyButton::createWithTexture(IMAGEPOOL->textureForKey("/pic/level.png")); but->setTag(0); scene = CONSTANT->getAllLevels()[i]; but->setNavigation(scene); but->addChild(lable); lable->setPosition(ccp(25, 25)); but->setPosition(ccp(xPosition + i % 4 * 84, yPosition - i / 4 * 83)); this->addChild(but, 1); ss.str(""); } Constant::isSetLevel = false; }
// // newButton - add a button // // Creates a new button given all the paramerters for it // This does the majority of the work for the other addButton slots // MyButton * MsgDialog::newButton(const QString &name, const QString &filter, const QColor &color, bool bAct) { #ifdef DEBUGMSG qDebug("newButton() '%s', '%s', '%s' %s", name.ascii(), filter.ascii(), color.name().ascii(), bAct?"Active":"InActive"); #endif // Create a new button MyButton *but = new MyButton(name, m_pButtonsPanel, this); but->setFilter(filter); but->setChecked(bAct); // setup signals connect(but, SIGNAL (editButton(MyButton *)), this, SLOT (editButton(MyButton *))); connect(but, SIGNAL (addFilter(const QString &)), this, SLOT (addFilter(const QString &))); connect(but, SIGNAL (delFilter(const QString &)), this, SLOT (delFilter(const QString &))); connect(but, SIGNAL (toggled(bool)), but, SLOT (toggled(bool))); connect(but, SIGNAL (setButton(MyButton*, bool)), this, SLOT (setButton(MyButton*, bool))); // setup Color but->setColor(color); // add to the button layout m_nButtons++; m_pButtonsLayout->addWidget(but); but->show(); // add the button to the button list m_buttonList.append(but); // re-apply the filter if we are active if (but->isChecked()) addFilter(but->filter()); return but; } // end newButton()
// COPY CTOR MyButton::MyButton(const MyButton &o) : Fl_OpButton(o.label(), o.GetButtonType()) { const_val = o.const_val; dtype = o.dtype; const_dialog = 0; callback(MyButtonCallback, (void*)this); }
void MyButton::MyButtonCallback(Fl_Widget *w, void *userdata) { MyButton *b = (MyButton*)userdata; b->MyButtonCallback2(); }
void SetScene::onCreate(){ char filgpath[] = "choose7.lyout";//"fight7.lyout";//combineChars(layoutPath, pSceneName); LOGI("Graph2:%s", filgpath); char *data = getLoadFile().getDataOfLyoutFile(filgpath);//getCharsofFile(filgpath); //pGRG->clear(); int dataPos = 0; int NumGraphRace = 0; int NumEntity = 0; int entityNum = 0; int LfileName = 0; dataPos++; dataPos+=sizeof(int);//version NumGraphRace = data[dataPos]; dataPos++; for (int h=0; h<NumGraphRace; h++) { NumEntity=data[dataPos]; dataPos++; LfileName=data[dataPos]; dataPos++; char *strFN=(char*)malloc(LfileName+1); for (int j=0; j<LfileName; j++) { strFN[j]=data[dataPos]; dataPos++; } strFN[LfileName]=0; GraphData *pGD=GraphData::getInstance(strFN);//new GraphData(); //pGD->setFileName(strFN); //pGD->load(); pGD->setBatchs(1); for(int i=0; i<NumEntity; i++) { MyButton *pGTemp = new MyButton(); //MessageBox(_T(chars)); pGTemp->setFileName(strFN); pGTemp->gp=pGD; //pGMain->pGRG->add(gdata2); //gdata2->load(); for (int j=0; j<16; j++) { float f_=*(float*)(data+dataPos); dataPos+=4; pGTemp->pTransform->pTOmatrix->mMatrixQueue[0][j]=f_; } for (int j=0; j<16; j++) { float f_=*(float*)(data+dataPos); dataPos+=4; pGTemp->pTransform->pSOmatrix->mMatrixQueue[0][j]=f_; } for (int j=0; j<16; j++) { float f_=*(float*)(data+dataPos); dataPos+=4; pGTemp->pTransform->pROmatrix->mMatrixQueue[0][j]=f_; } pGTemp->calculateMatrix(); // read type of the role pGTemp->roleType=*(int*)(data+dataPos); dataPos+=4; if(pGTemp->roleType==Graph::ROLE_FIXED0)// bg { pgBackground=pGTemp; } else if(pGTemp->roleType==Graph::ROLE_FIXED1) vButtonAll.push_back(pGTemp); //pGMain->graphList.push_back(gdata2); //dataPos=onShapeRead(gdata2,data,dataPos); } free(strFN); //dataPos+=64; } float *pfca=(float *)(data+dataPos); pCamera=new Camera(); //pCamera->setCamera(pfca[0],pfca[1],pfca[2], pfca[3],pfca[4],pfca[5], pfca[6],pfca[7],pfca[8]); pCamera->setCamera(0.0f,5.0f,13.5f, 0.0f, 1.2f,-3.5f, 0.0f,1.0f,0.0f); //LOGI("c0:%f,%f,%f",pfca[0],pfca[1],pfca[2]); //LOGI("c1:%f,%f,%f",pfca[3],pfca[4],pfca[5]); //LOGI("c2:%f,%f,%f",pfca[6],pfca[7],pfca[8]); pCamera->m_PointVector = pCamera->m_View - pCamera->m_Position; inOutVec1=pCamera->m_PointVector*(1.0f/(float)frameAllGetIn); inOutVec2=-inOutVec1; //for(int i=0;i<6;i++) //{ // vMyButton.push_back(vButtonAll[i]); //} invX=vButtonAll[3]->pTransform->pTOmatrix->mMatrixQueue.back()[12] - vButtonAll[0]->pTransform->pTOmatrix->mMatrixQueue.back()[12]; invY=vButtonAll[3]->pTransform->pTOmatrix->mMatrixQueue.back()[13] - vButtonAll[0]->pTransform->pTOmatrix->mMatrixQueue.back()[13]; invZ=vButtonAll[3]->pTransform->pTOmatrix->mMatrixQueue.back()[14] - vButtonAll[0]->pTransform->pTOmatrix->mMatrixQueue.back()[14]; //pCamera->setCamera(0.5,50,-100, 0,0,0, 0, 1, 0); //dataPos+=9*sizeof(float); sceneNum=vButtonAll.size(); }
controlForm::controlForm(QString fileName,QWidget *parent) : QWidget(parent), ui(new Ui::controlForm) { ui->setupUi(this); this->setToolTip ("select target"); QString sceneName = fileName.split ("/").last ().split (".")[0]; scene_ID = sceneName; sceneName.remove (0,1); qDebug () << sceneName; QStringList temp = fileName.split ("/"); temp.removeLast (); QString path = temp.join ("/")+ "/Single"; qDebug () << path; QDir currentDir = QDir(path); QStringList singleFileList = currentDir.entryList (); int count = 0; int showCount = 0 ; foreach (QString temp, singleFileList) { if (temp.contains (sceneName.split ("-")[0])) count++; } // QHBoxLayout *layout = new QHBoxLayout; // QHBoxLayout *layout2 = new QHBoxLayout; // QHBoxLayout *layout3 = new QHBoxLayout; // QHBoxLayout *layout4 = new QHBoxLayout; foreach(QString singleFile, singleFileList) { qDebug () <<count; if (singleFile.contains (sceneName.split ("-")[0])) { showCount++; qDebug () << singleFile << "file name"; QPixmap pixmapItem; QString imageForButton = path + "/" + singleFile; MyButton *myButtonWithImage; QPalette palette; QIcon icon = QIcon(imageForButton); myButtonWithImage = new MyButton(icon); myButtonWithImage->setText (singleFile.split (".")[0]); myButtonWithImage->setAutoFillBackground(true); palette = myButtonWithImage->palette(); palette.setColor(QPalette::Button,QColor(82,110,166)); myButtonWithImage->setPalette(palette); myButtonWithImage->setIcon(icon); myButtonWithImage->setIconSize(QSize(80, 120)); myButtonWithImage->setToolTip("Select target"); QLabel *IDLabel = new QLabel(); IDLabel->setText (singleFile.split (".")[0]); myButtonWithImage->setFixedSize (80,130); // layout->addWidget (myButtonWithImage); // layout->addWidget (IDLabel); ui->horizontalLayout->addWidget (myButtonWithImage); ui->horizontalLayout->addWidget (IDLabel); ui->horizontalLayout->setDirection (QBoxLayout::RightToLeft); //ui->horizontalLayout->addLayout (layout); globalMyButtons.append (myButtonWithImage); } ui->horizontalLayout->addStretch (0); }
bool Main::OnInit() { MyButton* button = new MyButton(wxT("Button and event table")); button->Show(true); return true; }