本文整理汇总了C++中InitWin函数的典型用法代码示例。如果您正苦于以下问题:C++ InitWin函数的具体用法?C++ InitWin怎么用?C++ InitWin使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了InitWin函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: newitem
/*****************************
*
* Routines to create dialog items, all items have an id
* which you can use to extract info. It is possible to have
* multiple items with the same id but it may then not be possible
* to extract information.
* All routines take the position relative to the parent dlg
* and the size and border width.
* If the width and height are set to zero initially, they will
* be calculated and set by the routine. With the dlgitem manipulation
* routines listed below, the application can then move the items around
* on the dlg box, and if wished resize them.
*
****************************/
t_dlgitem *CreateButton(t_x11 *x11,
const char *szLab, gmx_bool bDef, t_id id, t_id groupid,
int x0, int y0, int w, int h, int bw)
{
t_dlgitem *dlgitem;
char *lab;
dlgitem = newitem(x11);
if (h == 0)
{
h = XTextHeight(x11->font)+2*OFFS_Y;
}
if (w == 0)
{
w = XTextWidth(x11->font, szLab, strlen(szLab))+2*OFFS_X;
}
if (bDef)
{
snew(lab, strlen(szLab)+7); /* 6 for >> << and 1 for \0 */
sprintf(lab, ">> %s <<", szLab);
}
else
{
lab = strdup(szLab);
}
InitWin(&(dlgitem->win), x0, y0, w, h, bw, szLab);
sfree(lab);
dlgitem->ID = id;
dlgitem->GroupID = groupid;
dlgitem->type = edlgBN;
dlgitem->u.button.bDefault = bDef;
dlgitem->WndProc = WndProcBN;
return dlgitem;
}
示例2: snew
t_manager *init_man(t_x11 *x11, Window Parent,
int x, int y, int width, int height,
unsigned long fg, unsigned long bg,
int ePBC, matrix box,
gmx_output_env_t *oenv)
{
t_manager *man;
snew(man, 1);
man->status = nullptr;
man->bPlus = true;
man->bSort = true;
man->oenv = oenv;
InitWin(&(man->wd), x, y, width, height, 0, "Manager");
man->wd.self = XCreateSimpleWindow(x11->disp, Parent, man->wd.x, man->wd.y,
man->wd.width, man->wd.height,
man->wd.bwidth, fg, bg);
x11->RegisterCallback(x11, man->wd.self, Parent, ManCallBack, man);
x11->SetInputMask(x11, man->wd.self, StructureNotifyMask |
ExposureMask | ButtonPressMask);
/* The order of creating windows is important for the stacking order */
/* Mol Window */
man->molw = init_mw(x11, man->wd.self, 0, 0, 1, 1, WHITE, BLUE, ePBC, box);
/* Title Window */
InitWin(&(man->title), 0, 0, 1, 1, 0, nullptr);
man->title.self = XCreateSimpleWindow(x11->disp, man->molw->wd.self,
man->title.x, man->title.y,
man->title.width, man->title.height,
man->title.bwidth, WHITE, BLUE);
x11->RegisterCallback(x11, man->title.self, man->molw->wd.self,
TitleCallBack, &(man->title));
x11->SetInputMask(x11, man->title.self, ExposureMask | StructureNotifyMask);
/* Button box */
man->bbox = init_bbox(x11, man->wd.self, man->wd.self, 1, WHITE, BLUE);
/* Legend Window */
man->legw = init_legw(x11, man->wd.self, 0, 0, EWIDTH, LEGHEIGHT, WHITE, BLUE);
/* Video Box */
man->vbox = init_vbox(x11, man->molw->wd.self, man->wd.self, WHITE, BLUE);
return man;
}
示例3: snew
t_butbox *init_bbox(t_x11 *x11, Window Parent, Window SendTo,
int width, unsigned long fg, unsigned long bg)
{
t_butbox *bbox;
static const char *lbut[IDBUTNR] = {
"< X-Rotate >", "< Y-Rotate >", "< Z-Rotate >",
"< X-Move >", "< Y-Move >", "< Z-Move >", "< Scale >",
};
int i, y0, h0;
t_mwbut *but;
Window DrawOn;
snew(bbox, 1);
bbox->nbut = IDBUTNR;
snew(bbox->b, bbox->nbut);
y0 = XTextHeight(x11->font)+2*(AIR+BORDER);
InitWin(&(bbox->wd), 0, 0, /*width,(y0+AIR)*IDBUTNR+AIR+2*BORDER,*/ 1, 1,
1, "Button Box");
width -= 2*AIR+2*BORDER;
bbox->wd.self = XCreateSimpleWindow(x11->disp, Parent,
bbox->wd.x, bbox->wd.y, bbox->wd.width,
bbox->wd.height, bbox->wd.bwidth,
fg, bg);
x11->RegisterCallback(x11, bbox->wd.self, Parent, BBCallBack, bbox);
x11->SetInputMask(x11, bbox->wd.self, StructureNotifyMask);
DrawOn = bbox->wd.self;
h0 = AIR;
for (i = 0; (i < bbox->nbut); i++)
{
but = &(bbox->b[i]);
InitWin(&but->wd, AIR, h0, width, y0, 1, lbut[i]);
h0 += y0+AIR;
but->wd.Parent = SendTo;
but->ID = i;
but->wd.self = XCreateSimpleWindow(x11->disp, DrawOn,
but->wd.x, but->wd.y,
but->wd.width, but->wd.height,
but->wd.bwidth, bg, bg);
x11->RegisterCallback(x11, but->wd.self, DrawOn, ButtonCallBack, but);
x11->SetInputMask(x11, but->wd.self, ExposureMask | ButtonPressMask |
EnterLeave);
}
return bbox;
}
示例4: InitWin
//----------------------------------------------------------------------------//
void CTUIBackGround::Show()
{
if ( !m_pRootWin )
{
InitWin();
}
m_pRootWin->show();
}
示例5: asize
t_logo *init_logo(t_x11 *x11,Window parent,gmx_bool bQuitOnClick)
{
static const char *bfname[]= {
"-b&h-lucida-bold-i-normal-sans-34-240-100-100-p-215-iso8859-1",
"-b&h-lucida-bold-i-normal-sans-26-190-100-100-p-166-iso8859-1",
"lucidasans-bolditalic-24",
"lucidasans-italic-24",
"10x20",
"fixed"
};
#define NBF asize(bfname)
static const char *sfname[]= {
"lucidasans-bold-18",
"10x20",
"fixed"
};
#define NSF asize(sfname)
int i;
unsigned long bg;
char *newcol;
t_logo *logo;
snew(logo,1);
logo->bQuitOnClick = bQuitOnClick;
InitWin(&logo->wd,0,0,360,270,1,"GROMACS");
bg=LIGHTGREY;
if ((newcol=getenv("LOGO"))!=NULL)
GetNamedColor(x11,newcol,&bg);
logo->wd.self=XCreateSimpleWindow(x11->disp,parent,
logo->wd.x, logo->wd.y,
logo->wd.width,logo->wd.height,
logo->wd.bwidth,WHITE,bg);
for (i=0,logo->bigfont=NULL; (i<NBF); i++)
if ((logo->bigfont=XLoadQueryFont(x11->disp,bfname[i]))!=NULL)
break;
if (i==NBF) {
perror(bfname[i-1]);
exit(1);
}
#ifdef DEBUG
fprintf(stderr,"Big Logofont: %s\n",bfname[i]);
#endif
for (i=0,logo->smallfont=NULL; (i<NSF); i++)
if ((logo->smallfont=XLoadQueryFont(x11->disp,sfname[i]))!=NULL)
break;
if (i==NSF) {
perror(sfname[i-1]);
exit(1);
}
#ifdef DEBUG
fprintf(stderr,"Small Logofont: %s\n",sfname[i]);
#endif
x11->RegisterCallback(x11,logo->wd.self,parent,LogoCallBack,logo);
x11->SetInputMask(x11,logo->wd.self,ButtonPressMask | ExposureMask);
return logo;
}
示例6: InitScreen
int
InitScreen(
void)
{
InitWin();
# ifdef HAVE_COLOR
postinit_colors();
# endif /* HAVE_COLOR */
return TRUE;
}
示例7: snew
static t_app *init_app(t_x11 *x11, int argc, char *argv[])
{
static const char *but_nm[ebutNR] = { "Quit", "Start", "Stop", "Rewind", "Toggle Gly" };
XSizeHints hints;
Pixmap pm;
int th;
t_app *app;
t_windata *wd;
int i, dx;
snew(app, 1);
th = XTextHeight(x11->font)+4;
InitWin(&(app->wd), 0, 0, MAXDEG+6, MAXDEG+6+th+6, 0, "Ramachandran Movie");
dx = app->wd.width/ebutNR;
app->wd.self = XCreateSimpleWindow(x11->disp, x11->root, app->wd.x, app->wd.y,
app->wd.width, app->wd.height,
app->wd.bwidth, x11->fg, x11->bg);
x11->RegisterCallback(x11, app->wd.self, x11->root, mainCallBack, app);
x11->SetInputMask(x11, app->wd.self, StructureNotifyMask);
hints.flags = 0;
pm = XCreatePixmapFromBitmapData(x11->disp, x11->root, (char *)rama_bits,
rama_width, rama_height, WHITE, BLACK, 1);
XSetStandardProperties(x11->disp, app->wd.self, app->wd.text,
"Rama", pm, argv, argc, &hints);
x11->RegisterCallback(x11, app->wd.self, x11->root, appCallBack, app);
x11->SetInputMask(x11, app->wd.self, ButtonPressMask | ExposureMask |
StructureNotifyMask);
app->xr = init_xrama(x11, app->wd.self, th+6, app);
for (i = 0; (i < ebutNR); i++)
{
wd = &(app->but[i]);
InitWin(wd, i*dx+2, 2, dx-4, th, 1, but_nm[i]);
wd->self = XCreateSimpleWindow(x11->disp, app->wd.self,
wd->x, wd->y, wd->width, wd->height,
wd->bwidth, x11->fg, x11->bg);
x11->RegisterCallback(x11, wd->self, app->wd.self, appCallBack, app);
x11->SetInputMask(x11, wd->self, ButtonPressMask | ExposureMask);
}
return app;
}
示例8: snew
t_legendwin *init_legw(t_x11 *x11, Window Parent,
int x, int y, int width, int height,
unsigned long fg, unsigned long bg)
{
t_legendwin *lw;
snew(lw, 1);
InitWin(&lw->wd, x, y, width, height, 1, "Legend Window");
lw->wd.self = XCreateSimpleWindow(x11->disp, Parent, x, y, 1, 1, 1, fg, bg);
x11->RegisterCallback(x11, lw->wd.self, Parent, LegWCallBack, lw);
x11->SetInputMask(x11, lw->wd.self, ExposureMask);
return lw;
}
示例9: newitem
t_dlgitem *CreatePixmap(Pixmap pm, t_id id,
t_id /*groupid*/, int x0, int y0, int w, int h, int bw)
{
t_dlgitem *dlgitem;
dlgitem = newitem();
InitWin(&(dlgitem->win), x0, y0, w, h, bw, NULL);
dlgitem->ID = id;
dlgitem->type = edlgPM;
dlgitem->u.pixmap.pm = pm;
dlgitem->WndProc = DefWndProc;
return dlgitem;
}
示例10: snew
t_xhighway *GetXHW(t_x11 *x11, const char *infile)
{
t_xhighway *xhw;
int i, h, dh, w;
char progname[STRLEN];
snew(xhw, 1);
xhw->ncars = read_input(x11, infile, &(xhw->cars), &xhw->ir);
h = xhw->ir.nlane*40;
dh = 20;
w = 752;
strncpy(progname, Program(), STRLEN-1);
InitWin(&xhw->main, 0, 0, w, h+dh+7, 1, progname);
xhw->main.self = XCreateSimpleWindow(x11->disp, x11->root,
xhw->main.x, xhw->main.y,
xhw->main.width, xhw->main.height,
xhw->main.bwidth, WHITE, BLACK);
x11->RegisterCallback(x11, xhw->main.self, 0, xhwCallBack, xhw);
x11->SetInputMask(x11, xhw->main.self, ButtonPressMask | ExposureMask |
StructureNotifyMask);
Configure(xhw);
for (i = 0; (i < NBUT); i++)
{
t_windata *wd = &(xhw->but[i]);
wd->self = XCreateSimpleWindow(x11->disp, xhw->main.self,
wd->x, wd->y,
wd->width, wd->height,
wd->bwidth, WHITE, BLACK);
x11->RegisterCallback(x11, wd->self, xhw->main.self,
butCallBack, xhw);
x11->SetInputMask(x11, wd->self, ButtonPressMask | ExposureMask |
StructureNotifyMask);
}
xhw->win.self = XCreateSimpleWindow(x11->disp, xhw->main.self,
xhw->win.x, xhw->win.y,
xhw->win.width, xhw->win.height,
xhw->win.bwidth, WHITE, BLACK);
x11->RegisterCallback(x11, xhw->win.self, 0, xhwCallBack, xhw);
x11->SetInputMask(x11, xhw->win.self, ButtonPressMask | ExposureMask |
StructureNotifyMask);
return xhw;
}
示例11: __ASSERT_DEBUG
EXPORT_C void CTBaseWin::ConstructL(CTWinBase &aParent)
{
TInt ret;
__ASSERT_DEBUG(aParent.iOwnerWin!=NULL,TbPanic(ETestBasePanicNullOwnerWin));
iOwnerWin=aParent.iOwnerWin;
if ((ret=ConstructWin(aParent))==KErrNone)
{
//TFontSpec fspec(KTestFontTypefaceName,200);
//User::LeaveIfError(Client()->iScreen->GetNearestFontToDesignHeightInTwips((CFont *&)iFont, fspec));
TFontSpec fspec(KTestFontTypefaceName,17);
User::LeaveIfError(Client()->iScreen->GetNearestFontToDesignHeightInPixels((CFont *&)iFont, fspec));
AdjustShadow(1);
InitWin();
iSize=BaseWin()->Size();
}
User::LeaveIfError(ret);
}
示例12: snew
t_pulldown *init_pd(t_x11 *x11, Window Parent, int width,
unsigned long fg, unsigned long bg,
int nmenu, int *nsub, t_mentry *ent[], const char **title)
{
t_pulldown *pd;
int i;
snew(pd, 1);
pd->title = title;
pd->nmenu = nmenu;
pd->nsel = -1;
snew(pd->m, nmenu);
snew(pd->xpos, nmenu+1);
pd->xpos[0] = 5;
for (i = 1; (i <= nmenu); i++)
{
pd->xpos[i] = 20+pd->xpos[i-1]+
XTextWidth(x11->font, title[i-1], std::strlen(title[i-1]));
}
if (pd->xpos[nmenu] > width)
{
std::printf("Menu too wide\n");
}
InitWin(&(pd->wd), 0, 0, width, XTextHeight(x11->font)+2, 0, "PullDown");
pd->wd.self = XCreateSimpleWindow(x11->disp, Parent,
pd->wd.x, pd->wd.y,
pd->wd.width, pd->wd.height,
pd->wd.bwidth, fg, bg);
x11->RegisterCallback(x11, pd->wd.self, Parent, PDCallBack, pd);
x11->SetInputMask(x11, pd->wd.self, ExposureMask | ButtonPressMask |
OwnerGrabButtonMask | ButtonReleaseMask);
XMapWindow(x11->disp, pd->wd.self);
for (i = 0; (i < nmenu); i++)
{
pd->m[i] = init_menu(x11, Parent, fg, bg, nsub[i], ent[i], 1);
}
return pd;
}
示例13: InitScreen
int InitScreen ()
{
#ifndef INDEX_DAEMON
char c,*ptr,buf[32];
/*
* we're going to assume a terminal here...
*/
_clearscreen = "\033[1;1H\033[J";
_moveto = "\033[%d;%dH"; /* not a termcap string! */
_cleartoeoln = "\033[K";
_cleartoeos = "\033[J";
_setinverse = "\033[7m";
_clearinverse = "\033[0m";
_setunderline = "\033[4m";
_clearunderline = "\033[0m";
_terminalinit = "\033c";
_terminalend = "\033c";
_keypadlocal = "";
_keypadxmit = "";
InitWin ();
_lines = _columns = -1;
/*
* Get lines and columns from environment settings - useful when
* you're using something other than an Amiga window
*/
if (ptr = getenv("LINES")) {
_lines = atol(ptr);
}
if (ptr = getenv("COLUMNS")) {
_columns = atol(ptr);
}
/*
* If that failed, try get a response from the console itself
*/
if (_lines == -1 || _columns == -1) {
Raw (TRUE);
tputs ("\2330 q",1,outchar); /* identify yourself */
fflush (stdout);
getsize:
while (ReadCh () != 0x9b) {
; /* Look for escape */
}
/* get top */
ptr = buf;
do {
c = *ptr++ = ReadCh ();
} while (isdigit(c));
if (c != ';') {
goto getsize;
}
/* get right */
ptr = buf;
do {
c = *ptr++ = ReadCh ();
} while (isdigit(c));
if (c != ';') {
goto getsize;
}
/* get bottom */
ptr = buf;
do {
c = *ptr++ = ReadCh ();
} while (isdigit(c));
if (c != ';') {
goto getsize;
}
*ptr = 0;
_lines = atol (buf);
/* get right */
ptr = buf;
do {
c = *ptr++ = ReadCh ();
} while (isdigit(c));
if (c != ' ') {
goto getsize;
}
if (ReadCh () != 'r') {
goto getsize;
}
//.........这里部分代码省略.........
示例14: snew
t_menu *init_menu(t_x11 *x11,Window Parent,unsigned long fg,unsigned long bg,
int nent,t_mentry ent[],int ncol)
{
int i,mlen,mht,area,ht;
int j,k,l;
int frows,fcol;
t_menu *m;
t_child *kid;
t_windata *w;
snew(m,1);
m->nitem=nent;
m->Parent=Parent;
/* Calculate dimensions of the menu */
mlen=0;
for(i=0; (i<nent); i++)
mlen=max(mlen,XTextWidth(x11->font,ent[i].str,strlen(ent[i].str)));
mht=XTextHeight(x11->font);
/* Now we have the biggest single box, add a border of 2 pixels */
mlen+=20; /* We need extra space at the left for checkmarks */
mht+=4;
/* Calculate the area of the menu */
area=mlen*mht;
ht=sqrt(area);
/* No the number of rows per column, only beyond 8 rows */
if (ncol == 0) {
if (nent > 8)
frows=(1+ht/mht);
else
frows=nent;
fcol=nent/frows;
}
else {
fcol=ncol;
frows=nent/ncol;
if (nent % ncol)
frows++;
}
InitWin(&(m->wd),10,10,fcol*mlen,frows*mht,1,"Menu");
snew(m->item,nent);
m->wd.self=XCreateSimpleWindow(x11->disp,Parent,
m->wd.x, m->wd.y,
m->wd.width,m->wd.height,
m->wd.bwidth,fg,bg);
x11->RegisterCallback(x11,m->wd.self,Parent,MenuCallBack,m);
x11->SetInputMask(x11,m->wd.self,ExposureMask |
OwnerGrabButtonMask | ButtonReleaseMask);
for(j=l=0; (j<fcol); j++)
for(k=0; (k<frows) && (l<nent); k++,l++) {
kid=&(m->item[l]);
kid->m=&(ent[l]);
kid->Parent=Parent;
w=&(kid->wd);
InitWin(w,j*mlen,k*mht,mlen-2,mht-2,1,NULL);
w->self=XCreateSimpleWindow(x11->disp,m->wd.self,
w->x,w->y,w->width,w->height,
w->bwidth,bg,bg);
x11->RegisterCallback(x11,w->self,m->wd.self,
ChildCallBack,kid);
x11->SetInputMask(x11,w->self,
ButtonPressMask | ButtonReleaseMask |
OwnerGrabButtonMask | ExposureMask |
EnterWindowMask | LeaveWindowMask);
}
return m;
}
示例15: init_gmx
static void init_gmx(t_x11 *x11, char *program, int nfile, t_filenm fnm[],
const output_env_t oenv)
{
Pixmap pm;
t_gmx *gmx;
XSizeHints hints;
int w0, h0;
int natom, natom_trx;
t_topology top;
int ePBC;
matrix box;
t_trxframe fr;
t_trxstatus *status;
char quote[256];
snew(gmx, 1);
snew(gmx->wd, 1);
ePBC = read_tpx_top(ftp2fn(efTPR, nfile, fnm),
NULL, box, &natom, NULL, NULL, &top);
read_first_frame(oenv, &status, ftp2fn(efTRX, nfile, fnm), &fr, TRX_DONT_SKIP);
close_trx(status);
natom_trx = fr.natoms;
/* Creates a simple window */
w0 = DisplayWidth(x11->disp, x11->screen)-132;
h0 = DisplayHeight(x11->disp, x11->screen)-140;
bromacs(quote, 255);
InitWin(gmx->wd, 0, 0, w0, h0, 3, quote);
gmx->wd->self = XCreateSimpleWindow(x11->disp, x11->root,
gmx->wd->x, gmx->wd->y,
gmx->wd->width, gmx->wd->height,
gmx->wd->bwidth, WHITE, BLACK);
pm = XCreatePixmapFromBitmapData(x11->disp, x11->root,
(char *)gromacs_bits, gromacs_width,
gromacs_height,
WHITE, BLACK, 1);
hints.flags = PMinSize;
hints.min_width = 2*EWIDTH+40;
hints.min_height = EHEIGHT+LDHEIGHT+LEGHEIGHT+40;
XSetStandardProperties(x11->disp, gmx->wd->self, gmx->wd->text, program,
pm, NULL, 0, &hints);
x11->RegisterCallback(x11, gmx->wd->self, x11->root, MainCallBack, gmx);
x11->SetInputMask(x11, gmx->wd->self,
ButtonPressMask | ButtonReleaseMask |
OwnerGrabButtonMask | ExposureMask |
StructureNotifyMask);
/* The order of creating windows is important here! */
/* Manager */
gmx->man = init_man(x11, gmx->wd->self, 0, 0, 1, 1, WHITE, BLACK, ePBC, box, oenv);
gmx->logo = init_logo(x11, gmx->wd->self, false);
/* Now put all windows in the proper place */
move_gmx(x11, gmx, w0, h0, false);
XMapWindow(x11->disp, gmx->wd->self);
map_man(x11, gmx->man);
/* Pull Down menu */
gmx->pd = init_pd(x11, gmx->wd->self, gmx->wd->width,
x11->fg, x11->bg,
MSIZE, gmx_pd_size, gmx_pd, MenuTitle);
/* Dialogs & Filters */
gmx->filter = init_filter(&(top.atoms), ftp2fn_null(efNDX, nfile, fnm),
natom_trx);
init_dlgs(x11, gmx);
/* Now do file operations */
set_file(x11, gmx->man, ftp2fn(efTRX, nfile, fnm), ftp2fn(efTPR, nfile, fnm));
ShowDlg(gmx->dlgs[edFilter]);
}