本文整理汇总了C++中GWidgetGetControl函数的典型用法代码示例。如果您正苦于以下问题:C++ GWidgetGetControl函数的具体用法?C++ GWidgetGetControl怎么用?C++ GWidgetGetControl使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了GWidgetGetControl函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: CW_OK
static int CW_OK(GGadget *g, GEvent *e) {
if ( e->type==et_controlevent && e->u.control.subtype == et_buttonactivate ) {
int err = false;
CreateWidthDlg *wd = GDrawGetUserData(GGadgetGetWindow(g));
if ( GGadgetIsChecked(GWidgetGetControl(wd->gw,CID_Set)) ) {
wd->wd.type = st_set;
wd->wd.setto = GetReal8(wd->gw,CID_SetVal,rb1[wd->wd.wtype],&err);
if ( wd->wd.setto<0 && wd->wd.wtype==wt_width ) {
char *yesno[3];
yesno[0] = _("_Yes");
yesno[1] = _("_No");
yesno[2] = NULL;
if ( gwwv_ask(_("Negative Width"), (const char **) yesno, 0, 1, _("Negative glyph widths are not allowed in TrueType\nDo you really want a negative width?") )==1 )
return( true );
}
} else if ( GGadgetIsChecked(GWidgetGetControl(wd->gw,CID_Incr)) ) {
wd->wd.type = st_incr;
wd->wd.increment = GetReal8(wd->gw,CID_IncrVal,rb2[wd->wd.wtype],&err);
} else {
wd->wd.type = st_scale;
wd->wd.scale = GetReal8(wd->gw,CID_ScaleVal,rb2[wd->wd.wtype],&err);
}
if ( err )
return(true);
(wd->wd.doit)((CreateWidthData *) wd);
}
return( true );
}
示例2: L2L_OK
static int L2L_OK(GGadget *g, GEvent *e) {
if ( e->type==et_controlevent && e->u.control.subtype == et_buttonactivate ) {
L2LDlg *d = GDrawGetUserData(GGadgetGetWindow(g));
int from, to, clear;
int err=0;
double errbound;
from = GGadgetGetFirstListSelectedItem(GWidgetGetControl(d->gw,CID_FromLayer));
to = GGadgetGetFirstListSelectedItem(GWidgetGetControl(d->gw,CID_ToLayer));
if ( d->l2l==l2l_copy ) {
clear = GGadgetIsChecked(GWidgetGetControl(d->gw,CID_ClearOld));
if ( d->cv )
_DoCVCopy(d->cv,from,to,clear);
else
_DoFVCopy(d->fv,from,to,clear);
} else {
errbound = GetReal8(d->gw,CID_ErrorBound,_("Error Bound"),&err);
if ( err )
return( true );
if ( d->cv )
_DoCVCompare(d->cv,from,to,errbound);
else
_DoFVCompare(d->fv,from,to,errbound);
}
d->done = true;
}
return( true );
}
示例3: BdfP_Resize
static void BdfP_Resize(struct bdf_dlg *bd) {
extern int _GScrollBar_Width;
int sbwidth = GDrawPointsToPixels(bd->gw,_GScrollBar_Width);
GRect size, pos;
static int cids[] = { CID_Delete, CID_DefAll, CID_DefCur, CID_Up,
CID_Down, CID_OK, CID_Cancel, 0 };
int i;
GDrawGetSize(bd->gw,&size);
GDrawGetSize(bd->v,&pos);
if ( size.width!=bd->width || size.height!=bd->height ) {
int yoff = size.height-bd->height;
int xoff = size.width-bd->width;
bd->width = size.width; bd->height = size.height;
bd->vwidth += xoff; bd->vheight += yoff;
GDrawResize(bd->v,bd->vwidth,bd->vheight);
GGadgetMove(bd->vsb,size.width-sbwidth,pos.y-1);
GGadgetResize(bd->vsb,sbwidth,bd->vheight+2);
GGadgetGetSize(bd->tf,&pos);
GGadgetResize(bd->tf,pos.width+xoff,pos.height);
for ( i=0; cids[i]!=0; ++i ) {
GGadgetGetSize(GWidgetGetControl(bd->gw,cids[i]),&pos);
GGadgetMove(GWidgetGetControl(bd->gw,cids[i]),pos.x,pos.y+yoff);
}
}
BdfP_RefigureScrollbar(bd);
GDrawRequestExpose(bd->v,NULL,false);
GDrawRequestExpose(bd->gw,NULL,true);
}
示例4: SVCheck
static void SVCheck(SearchView *sv) {
int show = ( sv->sd.sc_srch.layers[ly_fore].splines!=NULL || sv->sd.sc_srch.layers[ly_fore].refs!=NULL );
int showrplall=show, showrpl;
if ( sv->sd.sc_srch.changed_since_autosave && sv->showsfindnext ) {
GGadgetSetTitle8(GWidgetGetControl(sv->gw,CID_Find),_("Find"));
sv->showsfindnext = false;
}
if ( showrplall ) {
if ( sv->sd.sc_srch.layers[ly_fore].splines!=NULL && sv->sd.sc_srch.layers[ly_fore].splines->next==NULL &&
sv->sd.sc_srch.layers[ly_fore].splines->first->prev==NULL &&
sv->sd.sc_rpl.layers[ly_fore].splines==NULL && sv->sd.sc_rpl.layers[ly_fore].refs==NULL )
showrplall = false;
}
showrpl = showrplall;
if ( !sv->showsfindnext || sv->sd.curchar==NULL || sv->sd.curchar->parent!=sv->sd.fv->sf ||
sv->sd.curchar->orig_pos<0 || sv->sd.curchar->orig_pos>=sv->sd.fv->sf->glyphcnt ||
sv->sd.curchar!=sv->sd.fv->sf->glyphs[sv->sd.curchar->orig_pos] ||
sv->sd.curchar->changed_since_search )
showrpl = false;
if ( sv->findenabled != show ) {
GGadgetSetEnabled(GWidgetGetControl(sv->gw,CID_Find),show);
GGadgetSetEnabled(GWidgetGetControl(sv->gw,CID_FindAll),show);
sv->findenabled = show;
}
if ( sv->rplallenabled != showrplall ) {
GGadgetSetEnabled(GWidgetGetControl(sv->gw,CID_ReplaceAll),showrplall);
sv->rplallenabled = showrplall;
}
if ( sv->rplenabled != showrpl ) {
GGadgetSetEnabled(GWidgetGetControl(sv->gw,CID_Replace),showrpl);
sv->rplenabled = showrpl;
}
}
示例5: kpd_e_h
static int kpd_e_h(GWindow gw, GEvent *event) {
if ( event->type==et_close ) {
KPData *kpd = GDrawGetUserData(gw);
kpd->done = true;
} else if ( event->type == et_mousemove ) {
kpdpopup(GDrawGetUserData(gw));
} else if ( event->type == et_expose ) {
KPData *kpd = GDrawGetUserData(gw);
GRect size, sbsize;
GDrawGetSize(kpd->v,&size);
GGadgetGetSize(GWidgetGetControl(kpd->gw,CID_ScrollBar),&sbsize);
GDrawSetLineWidth(gw,0);
GDrawDrawLine(gw,size.x,size.y-1,sbsize.x+sbsize.width-1,size.y-1,0x000000);
GDrawDrawLine(gw,size.x,size.y+size.height,sbsize.x+sbsize.width-1,size.y+size.height,0x000000);
GDrawDrawLine(gw,size.x-1,size.y-1,size.x-1,size.y+size.height,0x000000);
} else if ( event->type == et_char ) {
if ( event->u.chr.keysym == GK_F1 || event->u.chr.keysym == GK_Help ) {
help("kernpairs.html");
return( true );
}
if ( event->u.chr.chars[0]!='\0' && event->u.chr.chars[1]=='\0' ) {
enum sortby sort = GGadgetGetFirstListSelectedItem(GWidgetGetControl(gw,CID_SortBy));
KPData *kpd = GDrawGetUserData(gw);
if ( sort!=sb_kern ) {
KPScrollTo(kpd,event->u.chr.chars[0],sort);
return( true );
} else
GDrawBeep(NULL);
}
return( false );
} else if ( event->type == et_resize && event->u.resize.sized ) {
KP_Resize((KPData *) GDrawGetUserData(gw) );
}
return( true );
}
示例6: JSTF_Script_OK
static int JSTF_Script_OK(GGadget *g, GEvent *e) {
if ( e->type==et_controlevent && e->u.control.subtype == et_buttonactivate ) {
Jstf_Dlg *jd = GDrawGetUserData(GGadgetGetWindow(g));
SplineFont *sf = jd->sf;
Justify *head=NULL, *last=NULL, *cur;
int rows, i;
int cols = GMatrixEditGetColCnt(GWidgetGetControl(jd->gw,CID_Scripts));
struct matrix_data *strings = GMatrixEditGet(GWidgetGetControl(jd->gw,CID_Scripts), &rows);
for ( i=0; i<rows; ++i ) {
cur = chunkalloc(sizeof(Justify));
cur->script = Str2Tag(strings[cols*i+0].u.md_str);
cur->extenders = copy(strings[cols*i+1].u.md_str);
cur->langs = strings[cols*i+3].u.md_addr;
if ( head==NULL )
head = cur;
else
last->next = cur;
last = cur;
}
JustifyFree(sf->justify);
sf->justify = head;
jd->done = true;
}
return( true );
}
示例7: PoV_DoVanish
static void PoV_DoVanish(struct nldlg *d) {
double x,y,dv,tilt,dir;
double t;
int err = false;
double vp;
char buf[80];
unichar_t ubuf[80];
extern char *coord_sep;
x = GetQuietReal(d->gw,CID_XValue,&err);
y = GetQuietReal(d->gw,CID_YValue,&err);
/*z = GetQuietReal(d->gw,CID_ZValue,&err);*/
dv = GetQuietReal(d->gw,CID_DValue,&err);
tilt = GetQuietReal(d->gw,CID_Tilt,&err)*3.1415926535897932/180;
dir = GetQuietReal(d->gw,CID_GazeDirection,&err)*3.1415926535897932/180;
if ( err )
return;
if ( GGadgetGetFirstListSelectedItem( GWidgetGetControl(d->gw,CID_XType))!=3 )
x = 0;
if ( GGadgetGetFirstListSelectedItem( GWidgetGetControl(d->gw,CID_YType))!=3 )
y = 0;
t = tan(tilt);
if ( t<.000001 && t>-.000001 )
sprintf(buf,"inf%sinf", coord_sep);
else {
vp = dv/t;
x -= sin(dir)*vp;
y += cos(dir)*vp;
sprintf(buf,"%g%s%g", x, coord_sep, y );
}
uc_strcpy(ubuf,buf);
GGadgetSetTitle( GWidgetGetControl(d->gw,CID_Vanish), ubuf );
}
示例8: SVResize
static void SVResize(SearchView *sv, GEvent *event) {
int width, height;
if ( !event->u.resize.sized )
return;
GGadgetMove(GWidgetGetControl(sv->gw,CID_TopBox),4,4);
GGadgetResize(GWidgetGetControl(sv->gw,CID_TopBox),
event->u.resize.size.width-8,
event->u.resize.size.height-12);
width = (event->u.resize.size.width-40)/2;
height = (event->u.resize.size.height-sv->cv_y-sv->button_height-8);
if ( width<70 || height<80 ) {
if ( width<70 ) width = 70;
width = 2*width+40;
if ( height<80 ) height = 80;
height += sv->cv_y+sv->button_height+8;
GDrawResize(sv->gw,width,height);
return;
}
if ( width!=sv->cv_width || height!=sv->cv_height ) {
GDrawResize(sv->cv_srch.gw,width,height);
GDrawResize(sv->cv_rpl.gw,width,height);
sv->cv_width = width; sv->cv_height = height;
sv->rpl_x = 30+width;
GDrawMove(sv->cv_rpl.gw,sv->rpl_x,sv->cv_y);
}
GDrawSync(NULL);
GDrawProcessPendingEvents(NULL);
GDrawRequestExpose(sv->gw,NULL,false);
}
示例9: GetSystem
static int GetSystem(GWindow gw) {
if ( GGadgetIsChecked(GWidgetGetControl(gw,CID_X)) )
return( CID_X );
if ( GGadgetIsChecked(GWidgetGetControl(gw,CID_Win)) )
return( CID_Win );
return( CID_Mac );
}
示例10: DoFindOne
static int DoFindOne(SearchView *sv,int startafter) {
int i, gid;
SplineChar *startcur = sv->sd.curchar;
/* It is possible that some idiot deleted the current character since */
/* the last search... do some mild checks */
if ( sv->sd.curchar!=NULL &&
sv->sd.curchar->parent == sv->sd.fv->sf &&
sv->sd.curchar->orig_pos>=0 && sv->sd.curchar->orig_pos<sv->sd.fv->sf->glyphcnt &&
sv->sd.curchar==sv->sd.fv->sf->glyphs[sv->sd.curchar->orig_pos] )
/* Looks ok */;
else
sv->sd.curchar=startcur=NULL;
if ( !sv->sd.subpatternsearch ) startafter = false;
if ( sv->showsfindnext && sv->sd.curchar!=NULL )
i = sv->sd.fv->map->backmap[sv->sd.curchar->orig_pos]+1-startafter;
else {
startafter = false;
if ( !sv->sd.onlyselected )
i = 0;
else {
for ( i=0; i<sv->sd.fv->map->enccount; ++i )
if ( sv->sd.fv->selected[i] && (gid=sv->sd.fv->map->map[i])!=-1 &&
sv->sd.fv->sf->glyphs[gid]!=NULL )
break;
}
}
for ( ; i<sv->sd.fv->map->enccount; ++i ) {
if (( !sv->sd.onlyselected || sv->sd.fv->selected[i]) && (gid=sv->sd.fv->map->map[i])!=-1 &&
sv->sd.fv->sf->glyphs[gid]!=NULL ) {
SCSplinePointsUntick(sv->sd.fv->sf->glyphs[gid],sv->sd.fv->active_layer);
if ( SearchChar(&sv->sd,gid,startafter) )
break;
}
startafter = false;
}
if ( i>=sv->sd.fv->map->enccount ) {
ff_post_notice(_("Not Found"),sv->showsfindnext?_("The search pattern was not found again in the font %.100s"):_("The search pattern was not found in the font %.100s"),sv->sd.fv->sf->fontname);
sv->sd.curchar = startcur;
GGadgetSetTitle8(GWidgetGetControl(sv->gw,CID_Find),_("Find"));
sv->showsfindnext = false;
return( false );
}
SVSelectSC(sv);
if ( sv->lastcv!=NULL && sv->lastcv->b.sc==startcur && sv->lastcv->b.fv== sv->sd.fv ) {
CVChangeSC(sv->lastcv,sv->sd.curchar);
GDrawSetVisible(sv->lastcv->gw,true);
GDrawRaise(sv->lastcv->gw);
} else
sv->lastcv = CharViewCreate(sv->sd.curchar,(FontView *) sv->sd.fv,-1);
GGadgetSetTitle8(GWidgetGetControl(sv->gw,CID_Find),_("Find Next"));
sv->showsfindnext = true;
return( true );
}
示例11: AnchorD_ClearCorrections
static void AnchorD_ClearCorrections(AnchorDlg *a) {
unichar_t ubuf[2];
ubuf[0] = '0'; ubuf[1] = '\0';
free(a->xadjust.corrections); memset(&a->xadjust,0,sizeof(DeviceTable));
free(a->yadjust.corrections); memset(&a->yadjust,0,sizeof(DeviceTable));
GGadgetSetTitle(GWidgetGetControl(a->gw,CID_XCor),ubuf);
GGadgetSetTitle(GWidgetGetControl(a->gw,CID_YCor),ubuf);
}
示例12: CW_RadioChange
static int CW_RadioChange(GGadget *g, GEvent *e) {
if ( e->type==et_controlevent && e->u.control.subtype == et_radiochanged ) {
CreateWidthDlg *wd = GDrawGetUserData(GGadgetGetWindow(g));
int cid = (intpt) GGadgetGetUserData(g);
GWidgetIndicateFocusGadget(GWidgetGetControl(wd->gw,cid));
GTextFieldSelect(GWidgetGetControl(wd->gw,cid),0,-1);
}
return( true );
}
示例13: FtPpem_PtYChanged
static int FtPpem_PtYChanged(GGadget *g, GEvent *e) {
if ( e->type==et_controlevent && e->u.control.subtype == et_textchanged ) {
FtSizeData *fsd = GDrawGetUserData(GGadgetGetWindow(g));
if ( GGadgetIsChecked(GWidgetGetControl(fsd->gw,CID_SameAs))) {
const unichar_t *y = _GGadgetGetTitle(g);
GGadgetSetTitle(GWidgetGetControl(fsd->gw,CID_PointSizeX),y);
}
}
return( true );
}
示例14: Jstf_Cancel
static void Jstf_Cancel(Jstf_Dlg *jd) {
int rows, i;
int cols = GMatrixEditGetColCnt(GWidgetGetControl(jd->gw,CID_Scripts));
struct matrix_data *strings = GMatrixEditGet(GWidgetGetControl(jd->gw,CID_Scripts), &rows);
for ( i=0; i<rows; ++i ) {
JstfLangFree(strings[cols*i+3].u.md_addr);
}
jd->done = true;
}
示例15: JSTF_Language_OK
static int JSTF_Language_OK(GGadget *g, GEvent *e) {
if ( e->type==et_controlevent && e->u.control.subtype == et_buttonactivate ) {
Jstf_Dlg *jd = GDrawGetUserData(GGadgetGetWindow(g));
int rows, i, j, k, cnt;
struct matrix_data *strings = GMatrixEditGet(GWidgetGetControl(jd->lgw,CID_Languages), &rows);
int cols = GMatrixEditGetColCnt(GWidgetGetControl(jd->lgw,CID_Languages));
struct jstf_lang *head=NULL, *last=NULL, *cur;
for ( i=0; i<rows; ++i ) if ( !(strings[i*cols+0].u.md_str[0]&0x80) ) {
for ( j=i, cnt=0; j<rows; ++j )
if ( strcmp(strings[j*cols+0].u.md_str, strings[i*cols+0].u.md_str)==0 )
++cnt;
cur = chunkalloc(sizeof(struct jstf_lang));
if ( head==NULL )
head = cur;
else
last->next = cur;
last = cur;
cur->lang = Str2Tag(strings[i*cols+0].u.md_str);
cur->cnt = cnt;
cur->prios=gcalloc(cnt,sizeof(struct jstf_prio));
for ( j=i, cnt=0; j<rows; ++j ) {
if ( strcmp(strings[j*cols+0].u.md_str, strings[i*cols+0].u.md_str)==0 ) {
cur->prios[cnt].enableExtend = Str2OTLList(jd->sf,strings[j*cols+1].u.md_str );
cur->prios[cnt].disableExtend = Str2OTLList(jd->sf,strings[j*cols+2].u.md_str );
cur->prios[cnt].maxExtend = Str2OTLList(jd->sf,strings[j*cols+3].u.md_str );
cur->prios[cnt].enableShrink = Str2OTLList(jd->sf,strings[j*cols+4].u.md_str );
cur->prios[cnt].disableShrink = Str2OTLList(jd->sf,strings[j*cols+5].u.md_str );
cur->prios[cnt].maxShrink = Str2OTLList(jd->sf,strings[j*cols+6].u.md_str );
if ( cur->prios[cnt].enableExtend == (OTLookup **) -1 ||
cur->prios[cnt].disableExtend == (OTLookup **) -1 ||
cur->prios[cnt].maxExtend == (OTLookup **) -1 ||
cur->prios[cnt].enableShrink == (OTLookup **) -1 ||
cur->prios[cnt].disableShrink == (OTLookup **) -1 ||
cur->prios[cnt].maxShrink == (OTLookup **) -1 ) {
JstfLangFree(head);
for ( k=0; k<rows; ++k )
strings[k*cols+0].u.md_str[0] &= ~0x80;
return( true );
}
++cnt;
}
}
for ( j=rows-1; j>=i; --j )
if ( strcmp(strings[j*cols+0].u.md_str, strings[i*cols+0].u.md_str)==0 )
strings[j*cols+0].u.md_str[0] |= 0x80;
}
JstfLangFree( *jd->here );
*jd->here = head;
jd->ldone = true;
}
return( true );
}