void end_aktion (void) { if (akt_handle > 0) { int msg[8], d, event = 0; wind_close(akt_handle); wind_delete(akt_handle); akt_handle = -1; /* * Alle auflaufenden Redraw-Messages abarbeiten, damit * alle Fenster sauber sind, wenn der Dialog beendet ist. */ while (event != MU_TIMER) { event = evnt_multi(MU_MESAG|MU_TIMER, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, msg, 1, &d, &d, &d, &d, &d, &d); if ((event & MU_MESAG) && (msg[0] == WM_REDRAW)) handle_msg(msg); } /* Men� wieder an */ enable_menu(); } }
/* open window and enter event loop */ void start_program (void) { struct win_data wd; int fullx, fully, fullw, fullh; graf_mouse (ARROW, 0L); /* ensure mouse is an arrow */ /* 1. set up and open our window */ wind_get (0, WF_WORKXYWH, &fullx, &fully, &fullw, &fullh); wd.handle = wind_create (NAME|CLOSER, fullx, fully, fullw, fullh); wind_set (wd.handle, WF_NAME, "Example: Version 1", 0, 0); wind_open (wd.handle, fullx, fully, 300, 200); /* create any application-specific data: the string to show, in this case */ wd.text = "Hello"; /* display content in window */ draw_example (app_handle, &wd); /* 2. process events for our window */ event_loop (&wd); /* 3. close and remove our window */ wind_close (wd.handle); wind_delete (wd.handle); }
void close_settings(void) { LOG(("")); gemtk_wm_remove(settings_guiwin); settings_guiwin = NULL; wind_close(h_aes_win); wind_delete(h_aes_win); h_aes_win = 0; LOG(("Done")); }
void destroy_output_window(OUTPUT_WINDOW *window) { objc_delete(window->obj_tree, 1); free(window->obj_tree[1].ob_spec.userblk); free(window->obj_tree); window->obj_tree_length = 0; wind_close(window->handle); wind_delete(window->handle); free(window); window = NULL; }
void wind_exit( void ) { WINFO *w = window1, *pw; while( w ) { wind_close( w->id ); wind_delete( w->id ); w = (pw=w)->next; free( pw ); } }
/*---------------------------------------------------*/ void quit_all() { (void)wind_get(wid,WF_CURRXYWH,&cx,&cy,&cw,&ch); wind_close(wid); wind_delete(wid); open_f=0; if (!_app) {/* ACCESSORY */ return; } (void)appl_exit(); exit(0); }
/* Wm_Closed() *========================================================================== * Handle main event_multi window close messages * * IN: int *msg: Event messages * OUT: void * * GLOBAL: WINFO w: window structure messages * _app: TRUE- we ran as a PRG file */ void Wm_Closed( int *msg ) { if( msg[3] == w.id ) { wind_close( w.id ); wind_delete( w.id ); GrowShrinkBox( SHRINKBOX ); w.id = NO_WINDOW; if( _app ) gem_exit( 0 ); } }
static void GEM_FreeBuffers(_THIS) { /* Release buffer */ if ( GEM_buffer ) { free( GEM_buffer ); GEM_buffer=NULL; } /* Destroy window */ if (GEM_handle>=0) { wind_close(GEM_handle); wind_delete(GEM_handle); GEM_handle=-1; } }
void xw_close(WINDOW *w) { WINDOW *tw; if (xw_exist(w)) { wind_close(w->xw_handle); w->xw_opened = FALSE; if ((tw = xw_top()) != NULL) { if (tw->xw_func->wd_top != 0L) tw->xw_func->wd_top(tw); } else if ((desktop != NULL) && (desktop->xw_func->wd_top != 0L)) desktop->xw_func->wd_top(tw); } }
/*------------------------------*/ static void close_window(WORD handle) { int cx, cy, cw, ch; /* Holds current XYWH position */ graf_mouse(HOUR, 0L); /* Show hourglass */ wind_get(handle, WF_CXYWH, &cx, &cy, &cw, &ch); wind_close(handle); /* Close window off screen */ graf_shrinkbox(xstart, ystart, HBOX, WBOX, cx, cy, cw, ch); wind_delete(handle); /* Clear window from system */ graf_mouse(ARROW, 0L); /* Change cursor to ARROW */ }
/* Wm_Closed() *========================================================================== * Handle main event_multi window close messages * * IN: int *msg: Event messages * OUT: void * * GLOBAL: WINFO w: window structure messages * _app: TRUE- we ran as a PRG file */ void Wm_Closed( int *msg ) { if( msg[3] == w.id ) { close_xconfig( FALSE ); clear_active_slot( FALSE ); Close_Call_CPX( FALSE ); Shut_CPX_Down( FALSE ); wind_close( w.id ); wind_delete( w.id ); GrowShrinkBox( SHRINKBOX ); w.id = NO_WINDOW; evnt_set( Event2_Mask, -1, -1, -1, NULL, NULL, -1L ); if( _app ) gem_exit( 0 ); } }
/* rsrc_exit(); * ================================================================ */ void rsrc_exit( void ) { /* Free up the DATA Buffer */ if( data_buffer ) Mfree( data_buffer ); data_buffer = NULL; /* Close up and Free all the windows */ if( wid > 0 ) { wind_close( wid ); wind_delete( wid ); } /* Free up the Resource */ rsrc_free(); /* Free up the SubMenus and Popups */ FreeMenus(); }
main() { gem_init(); whandle = wind_create (4095, 20, 20, 280, 150); /* 4095 = tous les organes de commande */ if (whandle < 0) form_alert (1, "[3][D‚sol‚!|Il ne reste plus de handle fenˆtre libre!][OK]" ); else { wind_open (whandle, 20, 20, 280, 150); /* Calcul de la zone de travail */ wind_calc (1, 4095, 20, 20, 280, 150, &x, &y, &w, &h); /* Conversion de hauteur/largeur du deuxiŠme angle (x2/y2) */ pxyarray[0] = x; pxyarray[1] = y; pxyarray[2] = x+w-1; pxyarray[3] = y+h-1; /* Effacer la zone de travail */ vsf_interior (handle, 0); /* Remplir avec couleur du fond */ vsf_perimeter (handle, 0); /* Pas de cadre */ v_bar (handle, pxyarray); vsf_perimeter (handle, 1); /* R‚activer le cadre */ Crawcin(); /* Attendre appui touche */ wind_close (whandle); wind_delete (whandle); } gem_exit(); }
/* ------------------------- | Dialog window handler | ------------------------- */ int dialog_window(int wind_id, OBJECT *dialog, int action, int ext) { int x, y, w, h, s; int w_x, w_y, w_w, w_h; int hndl, sel; switch(action) { case CLS_DIA: wind_close(wind_id); wind_delete(wind_id); break; case OPN_DIA: form_center(dialog, &x, &y, &w, &h); wind_calc(WC_BORDER, MOVER|NAME, x, y, w, h, &w_x, &w_y, &w_w, &w_h); hndl = open_window(MOVER|NAME, w_x, w_y, w_w, w_h, ""); return hndl; case RDW_DIA: s = first_rect(wind_id, 0); while(s) { objc_draw(dialog, ext, MAX_DEPTH, r_xy[0], r_xy[1], r_xy[2], r_xy[3]); s = next_rect(wind_id, 0); } break; case ACT_DIA: sel = win_formdo(dialog, ext, wind_id); if (dialog[sel].ob_flags & EXIT) dialog[sel].ob_state &= ~SELECTED; return sel; } return 0; }
/* ***PopUp darstellen*** */ short wdial_popup(OBJECT *ptree, short *pitem, short popupx, short popupy, void (*msghndlr)(int msgbf[]), unsigned long msec, void (*tmrhndlr)()) { int mpopupret, pwhndl; int dx, dy, dw, dh; int newitem=-1, olditem=-1; int msgbuf[8]; int which; int mx, my, mb, br; wind_get(0, WF_WORKXYWH, &dx, &dy, &dw, &dh); /* Desktopgr��e */ if(popupx+ptree->ob_width > dx+dw) popupx=dx+dw-ptree->ob_width; if(popupx<dx) popupx=dx; ptree->ob_x=popupx; if(*pitem > 0) popupy-=ptree[*pitem].ob_y; if(popupy+ptree->ob_height > dy+dh) popupy=dy+dh-ptree->ob_height; if(popupy<dy) popupy=dy; ptree->ob_y=popupy; wind_calc(WC_BORDER, 0, ptree->ob_x, ptree->ob_y, ptree->ob_width, ptree->ob_height, &dx, &dy, &dw, &dh); pwhndl=wind_create(0, dx, dy, dw, dh); /* Fenster anmelden */ if(pwhndl<0) return(FALSE); wind_open(pwhndl, dx, dy, dw, dh); /* Fenster �ffnen */ /*objc_draw(ptree, 0, 1, dx, dy, dw, dh); ->Durch WM_REDRAW zeichnen lassen*/ do graf_mkstate(&mx, &my, &mb, &dx); while(mb); /* Maustasten vorher loslassen */ do { which=evnt_multi(MU_MESAG|MU_BUTTON|MU_TIMER, 1,1,1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, msgbuf, (short)msec,(short)(msec>>16), &mx, &my, &mb, &dx, &dx, &br); if(which&MU_MESAG) { if(msgbuf[3]==pwhndl && msgbuf[0]>=WM_REDRAW && msgbuf[0]<=WM_NEWTOP) { switch(msgbuf[0]) { case WM_REDRAW: wdial_redraw(pwhndl, ptree, (GRECT *)(&msgbuf[4])); break; case WM_TOPPED: wind_set(pwhndl, WF_TOP, 0L, 0L); break; } } else if( msghndlr ) msghndlr(msgbuf); } if(which&MU_TIMER) { newitem=objc_find(ptree, 0, 1, mx, my); if(newitem>0 && newitem!=olditem) { if( (ptree[newitem].ob_flags&TOUCHEXIT) && !(ptree[newitem].ob_state&DISABLED) ) { GRECT prct; ptree[olditem].ob_state&=~SELECTED; ptree[newitem].ob_state|=SELECTED; prct.g_x=ptree->ob_x+ptree[olditem].ob_x; prct.g_y=ptree->ob_y+ptree[olditem].ob_y; prct.g_w=ptree[olditem].ob_width; prct.g_h=ptree[olditem].ob_height; wdial_redraw(pwhndl, ptree, &prct); prct.g_x=ptree->ob_x+ptree[newitem].ob_x; prct.g_y=ptree->ob_y+ptree[newitem].ob_y; prct.g_w=ptree[newitem].ob_width; prct.g_h=ptree[newitem].ob_height; wdial_redraw(pwhndl, ptree, &prct); olditem=newitem; } else newitem=olditem; } else newitem=olditem; if( tmrhndlr ) tmrhndlr(); } } while(mb!=1); /* Bis Maustaste gedr�ckt */ newitem=objc_find(ptree, 0, 1, mx, my); if(newitem>0 && (ptree[newitem].ob_flags&TOUCHEXIT) && !(ptree[newitem].ob_state&DISABLED) ) { *pitem=newitem; mpopupret=TRUE; } else { mpopupret=FALSE; } if(olditem>0) ptree[olditem].ob_state&=~SELECTED; wind_close(pwhndl); wind_delete(pwhndl); /* Fenster schliessen */ return(mpopupret); }
int handle_message(int pipe[8]) { static int first_open=0; int wnr,error; /* ,avmsg[8]; */ char *vamsg,*o; #ifdef DEBUG char tmp[128]; #endif switch (pipe[0]) { case AC_OPEN: if (pipe[4] == acc_id) { if(first_open) { if(windforms[WIND_CTRL].wind_open) wind_set(windforms[WIND_CTRL].whandle,WF_TOP); else fgbg=FG; } else { fg_init(&windforms[WIND_CTRL]); fgbg=FG; first_open=1; } } #ifdef DEBUG form_alert(1,"[1][Got AC_OPEN][Ok]"); #endif break; case AC_CLOSE: /* if (pipe[4] == acc_id) */ { #ifdef DEBUG sprintf(tmp,"[1][Got AC_CLOSE|ACC id: %d|pipe4: %d][Ok]",acc_id,pipe[4]); form_alert(1,tmp); #endif if(windforms[WIND_CTRL].wind_open) { wind_close(windforms[WIND_CTRL].whandle); wind_delete(windforms[WIND_CTRL].whandle); windforms[WIND_CTRL].wind_open=0; } if(windforms[WIND_INFO].wind_open) { wind_close(windforms[WIND_INFO].whandle); wind_delete(windforms[WIND_INFO].whandle); windforms[WIND_INFO].wind_open=0; } #ifdef DEBUG sprintf(tmp,"[1][Filepos: %ld][Ok]",filepos); form_alert(1,tmp); #endif file_was_open=file_open; if(file_open) close_file(fd); closed_acc=1; return 1; } /* break; */ case AP_TERM: quit=1; return 1; /* switch(pipe[5]) { case AP_RESCHG: printf("Got AP_RESCHG!\n"); break; case AP_TERM: printf("Got AP_TERM!"); break; default: printf("Got unknown AP_TERM!"); } */ /* break; */ case RESCHG_COMPLETED: /* printf("Got RESCHG_COMPLETED!"); */ break; case WM_REDRAW: if((wnr=find_windform(pipe[3]))>=0) update_objects(&windforms[wnr],windforms[wnr].firstobj, windforms[wnr].objdepth,pipe); break; case WM_MOVED: if((wnr=find_windform(pipe[3]))>=0) { wind_set(windforms[wnr].whandle,WF_CURRXYWH,pipe[4],pipe[5],pipe[6],pipe[7]); windforms[wnr].wind.x=pipe[4]; windforms[wnr].wind.y=pipe[5]; windforms[wnr].wind.w=pipe[6]; windforms[wnr].wind.h=pipe[7]; wind_calc(WC_WORK,windforms[wnr].windkind, windforms[wnr].wind.x,windforms[wnr].wind.y, windforms[wnr].wind.w,windforms[wnr].wind.h, &windforms[wnr].form.x,&windforms[wnr].form.y, &windforms[wnr].form.w,&windforms[wnr].form.h); windforms[wnr].formtree[windforms[wnr].firstobj].ob_x=windforms[wnr].form.x; windforms[wnr].formtree[windforms[wnr].firstobj].ob_y=windforms[wnr].form.y; windforms[wnr].formtree[windforms[wnr].firstobj].ob_width=windforms[wnr].form.w; windforms[wnr].formtree[windforms[wnr].firstobj].ob_height=windforms[wnr].form.h; if(replay) update_time(); } break; case WM_CLOSED: if((wnr=find_windform(pipe[3]))>=0) { wind_close(windforms[wnr].whandle); windforms[wnr].wind_open=0; if(wnr==WIND_CTRL) { if(windforms[WIND_INFO].wind_open) { wind_close(windforms[WIND_INFO].whandle); windforms[WIND_INFO].wind_open=0; } return 1; } else wind_delete(windforms[wnr].whandle); } break; case WM_TOPPED: if((wnr=find_windform(pipe[3]))>=0) wind_set(pipe[3],WF_TOP); break; case AP_DRAGDROP: if(wind_find(pipe[4],pipe[5]) == windforms[WIND_CTRL].whandle) { if(do_dragdrop(pipe,DD_OK)) { exit_replay(); if(windforms[WIND_CTRL].formtree[CTRL_FF].ob_state & SELECTED) toggle_object(&windforms[WIND_CTRL],CTRL_FF,SET_NORMAL); Dsp_Hf1(0); if(windforms[WIND_CTRL].formtree[CTRL_PAUSE].ob_state & SELECTED) toggle_object(&windforms[WIND_CTRL],CTRL_PAUSE,SET_NORMAL); replay_pause=0; filepos=0; fd=reopen_file(); filesize=Fseek(0L,fd,2); Fseek(0L,fd,0); if((error=getmp2info(fd))==MP2_NOERR) { update_time(); setfilename(filename); if(!(pipe[6] & K_ALT)) init_replay(); } else { exit_replay(); show_mp2_error(error); close_file(fd); strcpy(windforms[WIND_CTRL].wind_title,"MPEG"); wind_set(windforms[WIND_CTRL].whandle,WF_NAME, windforms[WIND_CTRL].wind_title); setfilename("MPEGFILE"); } } } else { do_dragdrop(pipe,DD_NAK); } break; case VA_START: vamsg=*((char **)&pipe[3]); strcpy(path,vamsg); /* This *should* be sent to the application which sent the VA_START msg, but it seems to hang Thing doing it. */ /* avmsg[0]=AV_STARTED; avmsg[1]=app_id; avmsg[2]=0; avmsg[3]=pipe[3]; avmsg[4]=pipe[4]; appl_write(pipe[1],5*2,avmsg); */ if((o=strchr(path,' '))!=NULL) o[0]='\0'; o=strrchr(path,'\\'); strcpy(filename,&o[1]); o=strrchr(path,'\\'); strncpy(o,"\\*.MP?",6); o[6] = '\0'; exit_replay(); if(windforms[WIND_CTRL].formtree[CTRL_FF].ob_state & SELECTED) toggle_object(&windforms[WIND_CTRL],CTRL_FF,SET_NORMAL); Dsp_Hf1(0); if(windforms[WIND_CTRL].formtree[CTRL_PAUSE].ob_state & SELECTED) toggle_object(&windforms[WIND_CTRL],CTRL_PAUSE,SET_NORMAL); replay_pause=0; filepos=0; fd=reopen_file(); filesize=Fseek(0L,fd,2); Fseek(0L,fd,0); if((error=getmp2info(fd))==MP2_NOERR) { update_time(); setfilename(filename); init_replay(); } else { exit_replay(); show_mp2_error(error); close_file(fd); strcpy(windforms[WIND_CTRL].wind_title,"MPEG"); wind_set(windforms[WIND_CTRL].whandle,WF_NAME, windforms[WIND_CTRL].wind_title); setfilename("MPEGFILE"); } break; default: #ifdef DEBUG sprintf(tmp,"[1][Unimplemented| message: %d][Ok]",pipe[0]); form_alert(1,tmp); #endif break; } return 0; }
void do_menu( const int *msg, int *event ) { WORD ret; WORD puntmsg[8]; WINFO *w; menu_tnormal( menu, MnTitle(msg), TRUE ); switch( MnItem(msg) ) { case TEST: ret = new_window( &w, tree ); if( ret == (int)ENHNDL ) { form_alert( 1, "[1][Sorry, no more windows| are available.|Please close one| you aren't using.][ OK ]" ); } else if( ret == (int)ENSMEM ) { form_alert( 1, "[1][Sorry, not enough| free memory for| another window.][ OK ]" ); } else { ++nwindows; ObX(ROOT) = w->work.g_x; ObY(ROOT) = w->work.g_y; redraw( w, &w->work ); do { ret = xform_do( w, 0, puntmsg ); if( ret == -1 ) { switch( MsgType(puntmsg) ) { case MN_SELECTED: do_menu( (int *)puntmsg, event ); if( *event == 0 ) { ret = 0; } else { wind_get( 0, WF_TOP, &ret ); w = id_2winfo( ret ); if( w == NULL ) { form_alert( 1, "[3][Error topping window][ OK ]" ); ret = *event = 0; } else { ObX(ROOT) = w->work.g_x; ObY(ROOT) = w->work.g_y; ret = -1; } } break; case WM_TOPPED: case WM_NEWTOP: w = id_2winfo( WmId(puntmsg) ); if( w == NULL ) { form_alert( 1, "[3][Error topping window][ OK ]" ); ret = *event = 0; } wind_set( w->id, WF_TOP ); ObX(ROOT) = w->work.g_x; ObY(ROOT) = w->work.g_y; break; case WM_CLOSED: wind_close( w->id ); wind_unlink( w ); wind_delete( w->id ); free( w ); --nwindows; ret = 0; break; } } else { wind_close( w->id ); wind_unlink( w ); wind_delete( w->id ); free( w ); } } while( ret == -1 ); Deselect(ret & 0x7fff); } break; case QUIT: *event = 0; break; } }
/* ***Fenster schlie�en + l�schen*** */ void wdial_close(int dwhndl) { wind_close(dwhndl); /* Fenster schliessen */ wind_delete(dwhndl); /* Fenster abmelden */ }
void slideshow() { VEIL *tv; LEDP *led; int i,j,k,l; typedef int t_rgb[3]; t_rgb *col; int pal; long len; int wha,wx,wy,ww,wh; wind_update(BEG_MCTRL); graf_mouse(M_OFF,NULL); time(&t2); shift=(int)Kbshift(-1); if (glb.opt.deskfull) { wx=glb.aes.desk.x; wy=glb.aes.desk.y; ww=glb.aes.desk.w; wh=glb.aes.desk.h; } else { wx=0; wy=0; ww=1+glb.vdi.wscr; wh=1+glb.vdi.hscr; } wha=wind_create(0,0,0,1+glb.vdi.wscr,1+glb.vdi.hscr); if (wha<=0) { form_alert(1,glb.rsc.head.frstr[NOWIN]); graf_mouse(M_ON,NULL); graf_mouse(ARROW,NULL); wind_update(END_MCTRL); return; } _menuBar(glb.aes.tree.menu,FALSE); wind_open(wha,wx,wy,ww,wh); wind_get(wha,WF_CURRXYWH,&wx,&wy,&ww,&wh); if (glb.opt.is_tv && glb.opt.sl_tv) { tv=(VEIL *)_cookie('VeiL'); j=(int)tv->stop; tv->stop=0xFF; } if (glb.opt.is_led && glb.opt.sl_led) { led=(LEDP *)_cookie('LEDP'); k=led->active; led->active&=~1; } len=(long)glb.vdi.out[13]*(long)sizeof(t_rgb); pal=_mAlloc(len,FALSE); glb.opt.mask=0; if (pal!=NO_MEMORY) { col=(t_rgb *)glb.mem.adr[pal]; for (i=0;i<glb.vdi.out[13];i++) vq_color(glb.vdi.ha,i,1,(int *)col[i]); } glb.div.slide=TRUE; l=Balaie_Path(glb.opt.sl_path,wx,wy,ww,wh); if (!l && glb.opt.sl_loop && num>0) do { l=Balaie_Path(glb.opt.sl_path,wx,wy,ww,wh); } while (!l); glb.div.slide=FALSE; updFreeMem(); if (pal!=NO_MEMORY) { col=(t_rgb *)glb.mem.adr[pal]; for (i=0;i<glb.vdi.out[13];i++) vs_color(glb.vdi.ha,i,(int *)col[i]); _mFree(pal); } if (glb.opt.is_tv && glb.opt.sl_tv) { tv=(VEIL *)_cookie('VeiL'); tv->stop=j; } if (glb.opt.is_led && glb.opt.sl_led) { led=(LEDP *)_cookie('LEDP'); led->active=k; } wind_close(wha); wind_delete(wha); _menuBar(glb.aes.tree.menu,TRUE); graf_mouse(M_ON,NULL); graf_mouse(ARROW,NULL); wind_update(END_MCTRL); }
/* ***Fenster schlie�en*** */ void close_window(void) { wind_close(wihndl); wind_delete(wihndl); }
bossWindow::bossWindow(QWidget *parent) : QWidget(parent), ui(new Ui::bossWindow) { ui->setupUi(this); #pragma region window initialize QPropertyAnimation *animation = new QPropertyAnimation(this, "windowOpacity"); animation->setDuration(700); animation->setStartValue(0); animation->setEndValue(1); animation->start(); //界面动画,改变透明度的方式出现0 - 1渐变 //设置窗体标题栏隐藏并设置位于顶层 QPalette palette; setWindowOpacity(1); QPixmap pixmap("image/uiBG.png"); palette.setBrush(ui->Under->backgroundRole(),QBrush(pixmap)); ui->Under->setPalette(palette); ui->Under->setMask(pixmap.mask()); //可以将图片中透明部分显示为透明的 ui->Under->setAutoFillBackground(true); ui->lineEdit_passwd->setEchoMode(QLineEdit::Password); setWindowFlags(Qt::FramelessWindowHint); setAttribute(Qt::WA_TranslucentBackground); //构建最小化、最大化、关闭按钮 QToolButton *minButton = new QToolButton(this); QToolButton *closeButton= new QToolButton(this); connect (minButton,SIGNAL(clicked()),this,SLOT(showMinimized())); connect (closeButton,SIGNAL(clicked()),this,SLOT(wind_close()));//构建新槽 关闭当前窗口=注销 //获取最小化、关闭按钮图标 QPixmap minPix = style()->standardPixmap(QStyle::SP_TitleBarMinButton); QPixmap closePix = style()->standardPixmap(QStyle::SP_TitleBarCloseButton); //设置最小化、关闭按钮图标 minButton->setIcon(minPix); closeButton->setIcon(closePix); //设置最小化、关闭按钮在界面的位置 minButton->setGeometry(700-30,10,20,20); closeButton->setGeometry(700-8,10,20,20); //设置鼠标移至按钮上的提示信息 minButton->setToolTip(tr("最小化")); closeButton->setToolTip(tr("关闭")); //设置最小化、关闭按钮的样式 minButton->setStyleSheet("background-color:transparent;"); closeButton->setStyleSheet("background-color:transparent;"); qDebug()<< "asdasd"; // ui->frame_menu->hide(); ui->frame_order->hide();//查看页面隐藏 ui->frame_scy->hide(); ui->label_username->setText(all_SCY[active_scy].show_username());//用户名设置 ui->lcdNumber_amount->display(all_SCY[active_scy].show_amount_count());//总金额 ui->lcdNumber_counter->display(all_SCY[active_scy].show_order_count());//总订单数 #pragma endregion window initialize int i; /*菜单初始化*/ model_menu2->setHorizontalHeaderItem(0,new QStandardItem(QObject::tr("Name")));//行标设置 model_menu2->setHorizontalHeaderItem(1,new QStandardItem(QObject::tr("Price"))); model_menu2->setHorizontalHeaderItem(2,new QStandardItem(QObject::tr("Rank"))); ui->tableView_menu->setSelectionBehavior(QAbstractItemView::SelectRows);//点击选中行 ui->tableView_menu->setEditTriggers(QAbstractItemView::NoEditTriggers);//不能编辑 /*输出菜单至界面*/ for (i = 0;i<all_food.size();i++) { model_menu2->setItem(i, 0, new QStandardItem(all_food[i].show_food_name()));//输出菜品名字 model_menu2->setItem(i, 1, new QStandardItem(QString::number(all_food[i].show_food_price(),10)));//价格 model_menu2->setItem(i, 2, new QStandardItem("★★★★★"));//评分 } ui->tableView_menu->setModel(model_menu2);//讲model与tableview关联 ui->tableView_menu->setColumnWidth(0,184);//设置列宽 ui->tableView_menu->setColumnWidth(1,86); ui->tableView_menu->setColumnWidth(2,86); model_orders->setHorizontalHeaderItem(0,new QStandardItem(QObject::tr("OrderID"))); model_orders->setHorizontalHeaderItem(1,new QStandardItem(QObject::tr("Address"))); model_orders->setHorizontalHeaderItem(2,new QStandardItem(QObject::tr("Amount"))); model_orders->setHorizontalHeaderItem(3,new QStandardItem(QObject::tr("state"))); model_orders->setHorizontalHeaderItem(4,new QStandardItem(QObject::tr("Customer"))); model_orders->setHorizontalHeaderItem(5,new QStandardItem(QObject::tr("Deliver"))); ui->tableView_orders ->setSelectionBehavior(QAbstractItemView::SelectRows); ui->tableView_orders->setEditTriggers(QAbstractItemView::NoEditTriggers); ui->tableView_orders->setModel(model_orders); ui->tableView_orders->setColumnWidth(0,50); ui->tableView_orders->setColumnWidth(1,200); ui->tableView_orders->setColumnWidth(2,50); ui->tableView_orders->setColumnWidth(3,80); ui->tableView_orders->setColumnWidth(4,80); ui->tableView_orders->setColumnWidth(5,80); set_view_orders(); model_scy->setHorizontalHeaderItem(0,new QStandardItem(QObject::tr("ID"))); model_scy->setHorizontalHeaderItem(1,new QStandardItem(QObject::tr("Name"))); model_scy->setHorizontalHeaderItem(2,new QStandardItem(QObject::tr("Delivering order"))); model_scy->setHorizontalHeaderItem(3,new QStandardItem(QObject::tr("Amount count"))); model_scy->setHorizontalHeaderItem(4,new QStandardItem(QObject::tr("Order count"))); ui->tableView_scy ->setSelectionBehavior(QAbstractItemView::SelectRows); ui->tableView_scy->setEditTriggers(QAbstractItemView::NoEditTriggers); ui->tableView_scy->setModel(model_scy); set_view_scy(); }
/* MAIN() * ================================================================ */ VOID main( VOID ) { WORD button; BOOLEAN done; OBJECT *tree; appl_init(); phys_handle = graf_handle( &gl_wchar, &gl_hchar, &gl_wbox, &gl_hbox ); open_vwork(); graf_mouse( ARROW, 0L ); rsrc_load( "DEMO.RSC" ); rsrc_gaddr( 0, MENUBAR, &ad_menubar ); rsrc_gaddr( 0, ATREE, &ad_tree ); rsrc_gaddr( 0, FONTTREE, &ad_fonts ); rsrc_gaddr( 0, STREE, &ad_style ); rsrc_gaddr( 0, POSTREE, &ad_position ); rsrc_gaddr( 0, CTREE, &ad_color ); rsrc_gaddr( 0, PTREE, &ad_pattern ); rsrc_gaddr( 0, MTREE, &ad_modem ); rsrc_gaddr( 0, BAUDRATE, &ad_baudrate ); rsrc_gaddr( 0, PARTREE, &ad_parity ); rsrc_gaddr( 0, BITTREE, &ad_bittree ); rsrc_gaddr( 0, STOPTREE, &ad_stoptree ); rsrc_gaddr( 0, PORTTREE, &ad_porttree ); rsrc_gaddr( 0, FLOWTREE, &ad_flowtree ); rsrc_gaddr( 0, LTREE, &ad_list ); rsrc_gaddr( 0, TOOLBOX, &ad_tools ); rsrc_gaddr( 0, BLANK, &ad_blank ); rsrc_gaddr( 0, TOOLBOX2, &ad_box2 ); rsrc_gaddr( 0, TOOLBAR, &ad_box3 ); rsrc_gaddr( 0, FONT2, &ad_font2 ); /* Attach all Submenus that are being attached */ AttachMenus(); /* CheckMark the Current Menu Items in their respective menus */ menu_icheck( ad_baudrate, CurBaudRate, 1 ); menu_icheck( ad_parity, CurParity, 1 ); menu_icheck( ad_bittree, CurBits, 1 ); menu_icheck( ad_stoptree, CurStopBits, 1 ); menu_icheck( ad_porttree, CurPort, 1 ); menu_icheck( ad_flowtree, CurFlow, 1 ); menu_icheck( ad_style, CurStyle, 1 ); menu_icheck( ad_position, CurPos, 1 ); menu_icheck( ad_fonts, CurFonts, 1 ); menu_icheck( ad_font2, CurFont2, 1 ); /* display menubar stuff here */ menu_bar( ad_menubar, TRUE ); /* initialize windows */ wind_get( 0, WF_FULLXYWH, &desk.g_x, &desk.g_y, &desk.g_w, &desk.g_h ); cur_tree = ad_tools; menu_flag = TRUE; /* Set Toggle Flags */ SubFlag = TRUE; ToolFlag = TRUE; CurRect.g_x = desk.g_x; CurRect.g_y = desk.g_y; CurRect.g_w = 320; CurRect.g_h = 200; InitObjects(); InitWindow(); menu_ienable( ad_menubar, FOPEN, 0 ); menu_ienable( ad_menubar, FCLOSE, 1 ); done = FALSE; do { evnt_mesag( msg ); wind_update( BEG_UPDATE ); if( msg[0] == MN_SELECTED ) { /* msg[7] is the parent of FQUIT - which the user can't know */ ptr = ( OBJECT **)&msg[5]; if( *ptr == ad_menubar ) { switch( msg[4] ) { case FQUIT: button = form_alert( 1, "[1][ | EXIT PROGRAM? ][OK|Cancel]"); if( button == 1 ) done = TRUE; break; case ABOUTX: execform( ad_tree, 0 ); break; case PHONE: do_modem(); break; case TABOUT: /* Enable, Disable About PLUS change TEXT */ menu_flag ^= 1; menu_ienable( ad_menubar, ABOUTX, menu_flag ); menu_text( ad_menubar, TABOUT, TextAbout[ menu_flag ] ); if( menu_flag ) menu_text( ad_menubar, ABOUTX, " About Demo... " ); else menu_text( ad_menubar, ABOUTX, " Disabled... " ); break; case TSUB: /* Enable/Disable all Submenus */ SubFlag ^= 1; menu_text( ad_menubar, TSUB, TextSubMenu[ SubFlag ] ); if( SubFlag ) AttachMenus(); else DetachMenus(); break; case SLISTS: DoList(); /* Do A Drop Down List Dialog */ break; case TOOLFLAG: /* Enable/Disable ToolBox */ ToolFlag ^= 1; menu_text( ad_menubar, TOOLFLAG, TextToolBox[ ToolFlag ] ); if( ToolFlag ) { *( (LONG *)&tree_data[0] ) = ( LONG )cur_tree; wind_set( wid, WF_TOOLBAR, tree_data[0], tree_data[1], dummy, dummy ); } else wind_set( wid, WF_TOOLBAR, 0, 0, dummy, dummy ); break; case SWITCH: /* Switch ToolBoxes */ if( cur_tree == ad_tools ) cur_tree = ad_box2; else if( cur_tree == ad_box2 ) { cur_tree = ad_box3; ActiveTree( ad_fonts ); textptr = ObString( CurFonts ); strncpy( &tbuff[0], &textptr[1], 28 ); ActiveTree( ad_box3 ); TedText( FBUTT1 ) = &tbuff[0]; } else cur_tree = ad_tools; *( (LONG *)&tree_data[0] ) = ( LONG )cur_tree; ToolFlag = TRUE; menu_text( ad_menubar, TOOLFLAG, TextToolBox[ ToolFlag ] ); wind_set( wid, WF_TOOLBAR, tree_data[0], tree_data[1], dummy, dummy ); break; case FCLOSE: /* close Window */ if( wid ) { wind_get( wid, WF_CURRXYWH, &CurRect.g_x, &CurRect.g_y, &CurRect.g_w, &CurRect.g_h ); wind_close( wid ); wind_delete( wid ); wid = 0; menu_ienable( ad_menubar, FCLOSE, 0 ); menu_ienable( ad_menubar, FOPEN, 1 ); } break; case FOPEN: /* open Window */ if( !wid ) { InitWindow(); menu_ienable( ad_menubar, FOPEN, 0 ); menu_ienable( ad_menubar, FCLOSE, 1 ); } break; default: break; } } /* MENU SELECTED -> Font Style Menu Clicked on as a SUBMENU from the Menubar*/ if( *ptr == ad_style ) { menu_icheck( ad_style, CurStyle, 0 ); /* Turn OFF Old Checkmark */ menu_icheck( ad_style, msg[4], 1 ); /* Turn ON New CheckMark */ CurStyle = msg[4]; /* Update Current Var */ menu_istart( 1, ad_style, ROOT, CurStyle ); /* Reset Starting Position*/ } /* MENU SELECTED -> Font Position Clicked on as a SUBMENU from the menubar */ if( *ptr == ad_position ) { menu_icheck( ad_position, CurPos, 0 ); menu_icheck( ad_position, msg[4], 1 ); CurPos = msg[4]; menu_istart( 1, ad_position, ROOT, CurPos ); } /* MENU SELECTED -> Fonts Menu Clicked on as a SUBMENU from the menubar */ if( *ptr == ad_fonts ) { menu_icheck( ad_fonts, CurFonts, 0 ); menu_icheck( ad_fonts, msg[4], 1 ); CurFonts = msg[4]; menu_istart( 1, ad_fonts, ROOT, CurFonts ); } menu_tnormal( ad_menubar, msg[3], TRUE ); } if( msg[0] != MN_SELECTED ) { switch( msg[0] ) { case WM_FULLED: DoFull( msg[3] ); break; case WM_REDRAW: DoRedraw( msg ); break; case WM_ARROWED: case WM_HSLID: case WM_VSLID: break; case WM_MOVED: if( msg[3] == wid ) { wind_set( wid, WF_CURRXYWH, msg[4], msg[5], msg[6], msg[7] ); } break; case WM_TOPPED: if( msg[3] == wid ) { wind_set( wid, WF_TOP ); } break; case WM_CLOSED: if( msg[3] == wid ) { wind_get( wid, WF_CURRXYWH, &CurRect.g_x, &CurRect.g_y, &CurRect.g_w, &CurRect.g_h ); wind_close( wid ); wind_delete( wid ); wid = 0; menu_ienable( ad_menubar, FCLOSE, 0 ); menu_ienable( ad_menubar, FOPEN, 1 ); } break; case WM_SIZED: DoSizer( msg ); break; case WM_TOOLBAR: if( msg[3] == wid ) { /* Button Handling for ToolBox #1 */ if( cur_tree == ad_tools ) { switch( msg[4] ) { case T1B1: button = B1B1; break; case T1B2: button = B1B2; break; case T1B3: button = B1B3; break; case T1B4: button = B1B4; break; case T1B5: button = B1B5; break; } } /* Button Handling for TOOLBOX 2 */ if( cur_tree == ad_box2 ) { switch( msg[4] ) { case T2I1: button = T2B1; break; case T2I2: button = T2B2; break; case T2I3: button = T2B3; break; case T2I4: button = T2B4; break; case T2I5: button = T2B5; break; } } /* Word Processing Tree */ if( cur_tree == ad_box3 ) { switch( msg[4] ) { case FBUTT1: case FBUTT2: DoFonts(); break; default: break; } } if( cur_tree != ad_box3 ) { if( cur_tree[ button ].ob_state & SELECTED ) cur_tree[ button ].ob_state &= ~SELECTED; else cur_tree[ button ].ob_state |= SELECTED; objc_offset( cur_tree, button, &r.g_x, &r.g_y ); r.g_x -= 2; r.g_y -= 2; r.g_w = cur_tree[ button ].ob_width + 4; r.g_h = cur_tree[ button ].ob_height + 4; do_redraw( cur_tree, button, &r ); } } /* end of msg[3] == wid */ break; case WM_ICONIFY: if( msg[3] == wid ) wind_set( msg[3], WF_ICONIFY, msg[4], msg[5], msg[6], msg[7] ); break; case WM_UNICONIFY: if( msg[3] == wid ) wind_set( msg[3], WF_UNICONIFY, msg[4], msg[5], msg[6], msg[7] ); break; default: break; } /* end of switch */ } wind_update( END_UPDATE ); }while( !done ); if( wid > 0 ) wind_delete( wid ); menu_bar( ad_menubar, FALSE ); graf_mouse( ARROW, 0L ); rsrc_free(); close_vwork(); appl_exit(); }
short main(int argc, char *argv[]) { MFDB dest; short my_AppId, x, y, w, h; short work_in[11] = {1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2}; short work_out[57], msg[16], w_id1; short open_windows = 1, dummy; short wx, wy, ww, wh, clip[4], pnt[4]; char win1_name[20]; unsigned short logo_trnfrm[LOGO_DATASIZE]; GRECT dirty, walk; short e = 0, evx, evy, a, kc_shstate, kc_key, click_count; my_AppId = appl_init(); my_handle = graf_handle(&x, &y, &w, &h); /* Open a virtual workstation */ v_opnvwk(work_in, &my_handle, work_out); logo_bm.fd_w = LOGO_W; logo_bm.fd_h = LOGO_H; logo_bm.fd_wdwidth = 12; logo_bm.fd_nplanes = 4; logo_bm.fd_stand = 1; dest = logo_bm; dest.fd_stand = 0; logo_bm.fd_addr = (void *)x_logo; dest.fd_addr = (void *)logo_trnfrm; vr_trnfm(my_handle, &logo_bm, &dest); logo_bm.fd_addr = (void *)logo_trnfrm; w_id1 = wind_create(NAME|CLOSE|MOVER, 0, 0, LOGO_W + 40, LOGO_H + 40); if (argc > 1) sprintf(win1_name,"%s", argv[1]); else sprintf(win1_name,"Welcome to...", argv[1]); wind_set(w_id1, WF_NAME, ADDR(win1_name)); x = (work_out[0] - (LOGO_W + 40)) / 2; y = (work_out[1] - (LOGO_H + 40)) / 2; wind_open(w_id1, x, y, LOGO_W + 40, LOGO_H + 40); while((open_windows) && (!(e & MU_TIMER))) { e = evnt_multi(MU_MESAG|MU_TIMER, 258, 3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, msg, 15000, 0, &evx, &evy, &a, &kc_shstate, &kc_key, &click_count); if (e & MU_MESAG) { dummy = msg[0]; switch(dummy) { case WM_CLOSED: /* Did someone close one of our windows? */ wind_close(msg[3]); open_windows--; break; case WM_MOVED: wind_set(msg[3], WF_CURRXYWH, msg[4], msg[5], msg[6], msg[7]); break; case WM_REDRAW: dirty.g_x = msg[4]; dirty.g_y = msg[5]; dirty.g_w = msg[6]; dirty.g_h = msg[7]; wind_update(BEG_UPDATE); wind_get(msg[3], WF_WORKXYWH, &wx, &wy, &ww, &wh); walk.g_x = wx; walk.g_y = wy; walk.g_w = ww; walk.g_h = wh; pnt[0] = wx; pnt[1] = wy; pnt[2] = wx + ww; pnt[3] = wy + wh; wind_get(msg[3], WF_FIRSTXYWH, &x, &y, &w, &h); rc_intersect(&walk, &dirty); graf_mouse(M_OFF, NULL); while(h) { walk.g_x = x; walk.g_y = y; walk.g_w = w; walk.g_h = h; if (rc_intersect(&dirty, &walk)) { clip[0] = walk.g_x; clip[1] = walk.g_y; clip[2] = walk.g_x + walk.g_w; clip[3] = walk.g_y + walk.g_h; vs_clip(my_handle, 1, clip); vsf_color(my_handle, LWHITE); v_bar(my_handle, pnt); display_bitmap(wx, wy); } wind_get(msg[3], WF_NEXTXYWH, &x, &y, &w, &h); } vs_clip(my_handle, 0, clip); graf_mouse(M_ON, NULL); wind_update(END_UPDATE); break; case WM_TOPPED: wind_set(msg[3], WF_TOP, 0, 0, 0, 0); break; case WM_BOTTOMED: wind_set(msg[3], WF_BOTTOM, 0, 0, 0, 0); break; } } } v_clsvwk(my_handle); appl_exit(); return 0; }