static void InitCreateInfo (PMAINWINCREATE pCreateInfo) { rcBoard.left = 0; rcBoard.top = 0; rcBoard.right = STONE_COLS * STONE_SIZE; rcBoard.bottom = STONE_LINES * STONE_SIZE; pCreateInfo->dwStyle = WS_CAPTION | WS_BORDER; pCreateInfo->dwExStyle = WS_EX_NONE; pCreateInfo->spCaption = SM_ST_SAME; pCreateInfo->hMenu = createmenu (); pCreateInfo->hCursor = GetSystemCursor (IDC_ARROW); pCreateInfo->hIcon = 0; pCreateInfo->MainWindowProc = SameGameProc; pCreateInfo->lx = 0; pCreateInfo->ty = 0; pCreateInfo->rx = pCreateInfo->lx + ClientWidthToWindowWidth (WS_CAPTION | WS_BORDER, STONE_COLS * STONE_SIZE); pCreateInfo->by = pCreateInfo->ty + ClientHeightToWindowHeight (WS_CAPTION | WS_BORDER, STONE_LINES * STONE_SIZE, TRUE); pCreateInfo->by += GetSysCharHeight () + 4; pCreateInfo->iBkColor = PIXEL_black; pCreateInfo->dwAddData = 0; pCreateInfo->hHosting = HWND_DESKTOP; }
/* Main program */ int main(int argc, char **argv) { Ihandle *dlg; IupOpen(&argc, &argv); IupControlsOpen(); IupSetFunction("removeline", (Icallback)removeline); IupSetFunction("addline", (Icallback)addline); IupSetFunction("removecol", (Icallback)removecol); IupSetFunction("addcol", (Icallback)addcol); IupSetFunction("redraw", (Icallback)redraw); createmenu(); dlg = IupDialog( IupTabs( IupSetAttributes( IupVbox((create_mat()), IupText(""), IupLabel("Label Text"), IupVal("HORIZONTAL"), NULL), "MARGIN=10x10, GAP=10, TABTITLE=Test1"), IupSetAttributes( IupVbox(IupFrame(create_mat()), IupText(""), IupLabel("Label Text"), IupVal("HORIZONTAL"), // NULL), "BGCOLOR=\"0 255 255\", MARGIN=10x10, GAP=10, TABTITLE=Test2,FONT=HELVETICA_ITALIC_14"), NULL), "FONT=HELVETICA_NORMAL_12, BGCOLOR=\"0 255 255\", MARGIN=10x10, GAP=10, TABTITLE=Test2"), NULL)); IupSetAttribute(dlg,IUP_TITLE, "IupMatrix"); IupSetAttribute(dlg,IUP_MENU, "mymenu"); // IupSetAttribute(dlg,"BGCOLOR", "255 0 255"); //IupSetAttribute(dlg,"COMPOSITED", "YES"); //IupSetAttribute(dlg,"LAYERED", "YES"); //IupSetAttribute(dlg,"LAYERALPHA", "192"); IupShowXY(dlg,IUP_CENTER,IUP_CENTER) ; IupMainLoop(); iupmaskMatRemove(IupGetHandle("mat1"), 2, 1) ; iupmaskMatRemove(IupGetHandle("mat2"), 2, 1) ; IupDestroy(dlg); IupControlsClose(); IupClose(); return 0; }
void MatrixCbsTest(void) { Ihandle *dlg, *bt; IupMatrixExOpen(); IupSetFunction("removeline", (Icallback)removeline); IupSetFunction("addline", (Icallback)addline); IupSetFunction("removecol", (Icallback)removecol); IupSetFunction("addcol", (Icallback)addcol); IupSetFunction("redraw", (Icallback)redraw); createmenu(); bt = IupButton("Button", NULL); IupSetCallback(bt, "ACTION", bt_cb); IupSetAttribute(bt, "CANFOCUS", "NO"); dlg = IupDialog( // IupZbox( IupTabs( IupSetAttributes( IupVbox((create_mat(1)), bt, IupText(""), IupLabel("Label Text"), IupFrame(IupVal("HORIZONTAL")), NULL), "MARGIN=10x10, GAP=10, TABTITLE=Test1"), IupSetAttributes( IupVbox(IupFrame(create_mat(2)), IupText(""), IupLabel("Label Text"), IupVal("HORIZONTAL"), // NULL), "BGCOLOR=\"0 255 255\", MARGIN=10x10, GAP=10, TABTITLE=Test2,FONT=HELVETICA_ITALIC_14"), // NULL), "FONT=HELVETICA_NORMAL_12, BGCOLOR=\"0 255 255\", MARGIN=10x10, GAP=10, TABTITLE=Test2"), NULL), "BGCOLOR=\"0 255 255\", MARGIN=10x10, GAP=10, TABTITLE=Test2"), NULL)); IupSetAttribute(dlg,"TITLE", "IupMatrix"); IupSetAttribute(dlg,"MENU", "mymenu"); IupSetAttributeHandle(dlg,"DEFAULTENTER", bt); // IupSetAttribute(dlg,"BGCOLOR", "255 0 255"); //IupSetAttribute(dlg,"COMPOSITED", "YES"); //IupSetAttribute(dlg,"OPACITY", "192"); IupShowXY(dlg,IUP_CENTER,IUP_CENTER); }
MainWindow::MainWindow(QWidget *parent): QMainWindow(parent) { createmenu(); createdock1(); createdock2(); createdock3(); //创建QTextEdit对象 m_pTextEdit = new QTextEdit(this); setCentralWidget(m_pTextEdit); //主窗口中添加dock addDockWidget(Qt::LeftDockWidgetArea, m_pDockWidget1); addDockWidget(Qt::LeftDockWidgetArea, m_pDockWidget2); addDockWidget(Qt::LeftDockWidgetArea, m_pDockWidget3); m_pVMenu->addAction(m_pDockWidget1->toggleViewAction()); m_pVMenu->addAction(m_pDockWidget2->toggleViewAction()); m_pVMenu->addAction(m_pDockWidget3->toggleViewAction()); setWindowTitle("www.hnmade.com"); }
void DonationMenu(Player *player, Creature *_Creature, uint32 action, uint32 sender) { int32 playerid = player->GetGUID(); int32 accountid = player->GetSession()->GetAccountId(); if(action == 6000) { createmenu(accountid,_Creature,player); }else{ QueryResult pResult = WorldDatabase.PQuery("SELECT sc.store_cartID,player,date,store_templateID,scg.status,(SELECT type FROM `store`.store_template as temp WHERE temp.store_templateID=sc.store_templateID) FROM `store`.store_cart_give as scg INNER JOIN `store`.store_cart as sc ON scg.store_cartID=sc.store_cartID WHERE scg.accountid='%u' AND scg.store_cart_giveID = '%u';", accountid, action); // cart give // Status // 0 = Not chosen // 1 Chosen // 2 = confirm // 3 = Completed if(pResult) { //do{ Field* pFields = pResult->Fetch(); //ints int32 db_id = pFields[0].GetInt32(); int32 db_player = pFields[1].GetInt32(); int32 db_date = pFields[2].GetInt32(); int32 db_template = pFields[3].GetInt32(); int32 db_status = pFields[4].GetInt32(); int32 db_type = pFields[5].GetInt32(); //strings std::string itemname; itemname = pFields[1].GetString(); if(db_player || db_date || db_status == 3) { //message _Creature->MonsterWhisper("This reward is already been recieved!", player->GetGUID()); player->CLOSE_GOSSIP_MENU(); return; } if(db_status == 1) // if we are here with this value means they didn't confirm it { WorldDatabase.PExecute("UPDATE `store`.store_cart_give SET status = 0,itemset = 0 WHERE store_cart_giveID = '%u'", action); // reset db_status = 0; } //normal reward go striaght to confirm status if(db_type < 16) { db_status = 2; } // Let the user select itemset they want if(db_type >= 16 && db_status == 0 && !sender) itemsetgroup(_Creature, player,db_template,action); else { //if group itemset update cart if(db_type >= 16 && sender && db_status < 2) { int32 playerid = player->GetGUID(); WorldDatabase.PExecute("UPDATE `store`.store_cart_give SET status = 2, itemset = '%u' WHERE store_cart_giveID = '%u'", sender,action); db_status = 2; sender = 0; } //confirm choice if(db_status == 2 && sender == 0) { //menu player->PlayerTalkClass->ClearMenus(); player->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, "Are you sure?" , 0, 6000); player->ADD_GOSSIP_ITEM(1, "Yes" , 1, action); player->ADD_GOSSIP_ITEM(1, "No" , 0, 6000); player->SEND_GOSSIP_MENU(DEFAULT_GOSSIP_MESSAGE,_Creature->GetGUID()); }else{ if(check(db_template,_Creature, player,action)) { giving_proccess(_Creature, player,db_template,action); record_donation(_Creature, player, action); }else{ _Creature->MonsterWhisper("Failed!", player->GetGUID()); player->CLOSE_GOSSIP_MENU(); } } } }else{ _Creature->MonsterWhisper("Nothing here", player->GetGUID()); player->CLOSE_GOSSIP_MENU(); } } }
// Constructor: This call all other functions, to create the complete GUI. All the QVTKWidgets are inside a QGroupBox // This also adds dummy rendering window to the QVTKWidgets, so that GUI is not distorted. GUI::GUI() { Setstyle(); createactions(); createmenu(); centralWid = new QWidget(this); this->setCentralWidget(centralWid); mainLayout = new QHBoxLayout; createVtoolbar(); acttoolwid = new QWidget(centralWid); mainLayout->addWidget(acttoolwid); mainLayout->setSpacing(0); mainLayout->setContentsMargins(0,0,0,0); centralWid->setContentsMargins(0,0,0,0); centralWid->setLayout(mainLayout); vLayout = new QVBoxLayout; createHtoolbar(); vLayout->setSpacing(0); vLayout->setContentsMargins(0,0,0,0); acttoolwid->setContentsMargins(0,0,0,0); QWidget *upper = new QWidget(acttoolwid); QWidget *lower = new QWidget(acttoolwid); vLayout->addWidget(upper); vLayout->addWidget(lower); acttoolwid->setLayout(vLayout); QHBoxLayout *upperwidlayout = new QHBoxLayout; QHBoxLayout *lowerwidlayout = new QHBoxLayout; QGroupBox *isosurface = new QGroupBox(tr("IsoSurface")); QGroupBox *pathviewer = new QGroupBox(tr("Arbitrary Axis Slice Viewer")); QGroupBox *axialslice = new QGroupBox(tr("Axial Slice")); QGroupBox *coroslice = new QGroupBox(tr("Coronal Slice")); QGroupBox *sagislice = new QGroupBox(tr("Sagittal Slice")); upperwidlayout->addWidget(isosurface); //Adding QGroupBoxes for differnt viewers upperwidlayout->addWidget(pathviewer); lowerwidlayout->addWidget(axialslice); lowerwidlayout->addWidget(coroslice); lowerwidlayout->addWidget(sagislice); upper->setLayout(upperwidlayout); lower->setLayout(lowerwidlayout); QHBoxLayout *corola = new QHBoxLayout; QHBoxLayout *axialla = new QHBoxLayout; QHBoxLayout *sagila = new QHBoxLayout; QHBoxLayout *araxl = new QHBoxLayout; corowid = new QVTKWidget(coroslice); //Widgets that will contains diff rendering windows sagiwid = new QVTKWidget(sagislice); axiawid = new QVTKWidget(axialslice); isoshow = new QVTKWidget(isosurface); defaxwid = new QVTKWidget(pathviewer); vtkRenderer *duma = vtkRenderer::New(); //Dummy renderers vtkRenderer *dums = vtkRenderer::New(); vtkRenderer *dumc = vtkRenderer::New(); vtkRenderer *dumx = vtkRenderer::New(); vtkRenderWindow *winda = vtkRenderWindow::New(); vtkRenderWindow *winds = vtkRenderWindow::New(); vtkRenderWindow *windc = vtkRenderWindow::New(); vtkRenderWindow *windx = vtkRenderWindow::New(); winda->AddRenderer(duma); windc->AddRenderer(dumc); winds->AddRenderer(dums); windx->AddRenderer(dumx); corowid->SetRenderWindow(dumc->GetRenderWindow()); //Adding dummy rendering windows sagiwid->SetRenderWindow(dums->GetRenderWindow()); axiawid->SetRenderWindow(duma->GetRenderWindow()); defaxwid->SetRenderWindow(dumx->GetRenderWindow()); coroslice->setLayout(corola); sagislice->setLayout(sagila); axialslice->setLayout(axialla); pathviewer->setLayout(araxl); QWidget *corosl = new QWidget(coroslice); QWidget *sagisl = new QWidget(sagislice); QWidget *axiasl = new QWidget(axialslice); corola->addWidget(corowid); corola->addWidget(corosl); sagila->addWidget(sagiwid); sagila->addWidget(sagisl); axialla->addWidget(axiawid); axialla->addWidget(axiasl); araxl->addWidget(defaxwid); //Add slider and label labc = new QLabel(corosl); labs = new QLabel(sagisl); laba = new QLabel(axiasl); slc = new QSlider(Qt::Vertical,corosl); sls = new QSlider(Qt::Vertical,sagisl); sla = new QSlider(Qt::Vertical,axiasl); QVBoxLayout *sal = new QVBoxLayout; QVBoxLayout *axl = new QVBoxLayout; QVBoxLayout *col = new QVBoxLayout; QVBoxLayout *iso = new QVBoxLayout; sal->addWidget(labs); sal->addWidget(sls); axl->addWidget(laba); axl->addWidget(sla); col->addWidget(labc); col->addWidget(slc); iso->addWidget(isoshow); corosl->setLayout(col); axiasl->setLayout(axl); sagisl->setLayout(sal); isosurface->setLayout(iso); Disableall(); createstatusbar(); }