mirror of
https://git.tartarus.org/simon/putty.git
synced 2025-01-10 01:48:00 +00:00
Jeremy Sawicki's fix for the multiple-conflicting-accelerators
problems: controls are now destroyed and recreated on a panel switch. In addition, this patch also introduces a better means of doing the group boxes. [originally from svn r884]
This commit is contained in:
parent
beeaa85fc5
commit
5c8e6a5295
30
winctrls.c
30
winctrls.c
@ -72,17 +72,16 @@ void bartitle(struct ctlpos *cp, char *name, int id) {
|
|||||||
/*
|
/*
|
||||||
* Begin a grouping box, with or without a group title.
|
* Begin a grouping box, with or without a group title.
|
||||||
*/
|
*/
|
||||||
void beginbox(struct ctlpos *cp, char *name, int idbox, int idtext) {
|
void beginbox(struct ctlpos *cp, char *name, int idbox) {
|
||||||
if (name)
|
|
||||||
cp->ypos += STATICHEIGHT/2;
|
|
||||||
cp->boxystart = cp->ypos;
|
cp->boxystart = cp->ypos;
|
||||||
|
if (!name)
|
||||||
|
cp->boxystart -= STATICHEIGHT/2;
|
||||||
if (name)
|
if (name)
|
||||||
cp->ypos += STATICHEIGHT - (STATICHEIGHT/2);
|
cp->ypos += STATICHEIGHT;
|
||||||
cp->ypos += GAPYBOX;
|
cp->ypos += GAPYBOX;
|
||||||
cp->width -= 2*GAPXBOX;
|
cp->width -= 2*GAPXBOX;
|
||||||
cp->xoff += GAPXBOX;
|
cp->xoff += GAPXBOX;
|
||||||
cp->boxid = idbox;
|
cp->boxid = idbox;
|
||||||
cp->boxtextid = idtext;
|
|
||||||
cp->boxtext = name;
|
cp->boxtext = name;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -96,25 +95,8 @@ void endbox(struct ctlpos *cp) {
|
|||||||
cp->ypos += GAPYBOX - GAPBETWEEN;
|
cp->ypos += GAPYBOX - GAPBETWEEN;
|
||||||
r.left = GAPBETWEEN; r.right = cp->width;
|
r.left = GAPBETWEEN; r.right = cp->width;
|
||||||
r.top = cp->boxystart; r.bottom = cp->ypos - cp->boxystart;
|
r.top = cp->boxystart; r.bottom = cp->ypos - cp->boxystart;
|
||||||
doctl(cp, r, "STATIC", WS_CHILD | WS_VISIBLE | SS_ETCHEDFRAME, 0,
|
doctl(cp, r, "BUTTON", BS_GROUPBOX | WS_CHILD | WS_VISIBLE, 0,
|
||||||
"", cp->boxid);
|
cp->boxtext ? cp->boxtext : "", cp->boxid);
|
||||||
if (cp->boxtext) {
|
|
||||||
SIZE s;
|
|
||||||
HDC hdc;
|
|
||||||
HFONT oldfont, dlgfont;
|
|
||||||
hdc = GetDC(cp->hwnd);
|
|
||||||
dlgfont = (HFONT)cp->font;
|
|
||||||
oldfont = SelectObject(hdc, dlgfont);
|
|
||||||
GetTextExtentPoint32(hdc, cp->boxtext, strlen(cp->boxtext), &s);
|
|
||||||
SelectObject(hdc, oldfont);
|
|
||||||
DeleteDC(hdc);
|
|
||||||
r.left = GAPXBOX + GAPBETWEEN;
|
|
||||||
r.right = (s.cx * 4 + cp->dlu4inpix-1) / cp->dlu4inpix;
|
|
||||||
|
|
||||||
r.top = cp->boxystart - STATICHEIGHT/2; r.bottom = STATICHEIGHT;
|
|
||||||
doctl(cp, r, "STATIC", WS_CHILD | WS_VISIBLE, 0,
|
|
||||||
cp->boxtext, cp->boxtextid);
|
|
||||||
}
|
|
||||||
cp->ypos += GAPYBOX;
|
cp->ypos += GAPYBOX;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -25,7 +25,7 @@ struct ctlpos {
|
|||||||
int dlu4inpix;
|
int dlu4inpix;
|
||||||
int ypos, width;
|
int ypos, width;
|
||||||
int xoff;
|
int xoff;
|
||||||
int boxystart, boxid, boxtextid;
|
int boxystart, boxid;
|
||||||
char *boxtext;
|
char *boxtext;
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -35,7 +35,7 @@ void doctl(struct ctlpos *cp, RECT r,
|
|||||||
char *wclass, int wstyle, int exstyle,
|
char *wclass, int wstyle, int exstyle,
|
||||||
char *wtext, int wid);
|
char *wtext, int wid);
|
||||||
void bartitle(struct ctlpos *cp, char *name, int id);
|
void bartitle(struct ctlpos *cp, char *name, int id);
|
||||||
void beginbox(struct ctlpos *cp, char *name, int idbox, int idtext);
|
void beginbox(struct ctlpos *cp, char *name, int idbox);
|
||||||
void endbox(struct ctlpos *cp);
|
void endbox(struct ctlpos *cp);
|
||||||
void multiedit(struct ctlpos *cp, ...);
|
void multiedit(struct ctlpos *cp, ...);
|
||||||
void radioline(struct ctlpos *cp,
|
void radioline(struct ctlpos *cp,
|
||||||
|
Loading…
Reference in New Issue
Block a user