On System 7, draw the default ring in grey if the window is disabled.

This isn't _quite_ right, since it uses a b/w dither everywhere, whereas
it should use grey on colour screens.  That would involve mucking around
with DeviceLoop, though, and I'm not sure I can be bothered.

[originally from svn r3066]
This commit is contained in:
Ben Harris 2003-04-05 18:00:46 +00:00
Родитель dddcb9ceda
Коммит 6de4a868ff
1 изменённых файлов: 12 добавлений и 3 удалений

Просмотреть файл

@ -1,4 +1,4 @@
/* $Id: macctrls.c,v 1.28 2003/04/05 17:19:38 ben Exp $ */ /* $Id: macctrls.c,v 1.29 2003/04/05 18:00:46 ben Exp $ */
/* /*
* Copyright (c) 2003 Ben Harris * Copyright (c) 2003 Ben Harris
* All rights reserved. * All rights reserved.
@ -91,6 +91,7 @@ union macctrl {
struct { struct {
struct macctrl_generic generic; struct macctrl_generic generic;
ControlRef tbctrl; ControlRef tbctrl;
ControlRef tbring;
} button; } button;
struct { struct {
struct macctrl_generic generic; struct macctrl_generic generic;
@ -714,6 +715,7 @@ static void macctrl_button(struct macctrls *mcs, WindowPtr window,
c2pstrcpy(title, ctrl->button.label); c2pstrcpy(title, ctrl->button.label);
mc->button.tbctrl = NewControl(window, &bounds, title, TRUE, 0, 0, 1, mc->button.tbctrl = NewControl(window, &bounds, title, TRUE, 0, 0, 1,
pushButProc, (long)mc); pushButProc, (long)mc);
mc->button.tbring = NULL;
if (mac_gestalts.apprvers >= 0x100) { if (mac_gestalts.apprvers >= 0x100) {
Boolean isdefault = ctrl->button.isdefault; Boolean isdefault = ctrl->button.isdefault;
@ -722,8 +724,8 @@ static void macctrl_button(struct macctrls *mcs, WindowPtr window,
sizeof(isdefault), &isdefault); sizeof(isdefault), &isdefault);
} else if (ctrl->button.isdefault) { } else if (ctrl->button.isdefault) {
InsetRect(&bounds, -4, -4); InsetRect(&bounds, -4, -4);
NewControl(window, &bounds, title, TRUE, 0, 0, 1, mc->button.tbring = NewControl(window, &bounds, title, TRUE, 0, 0, 1,
SYS7_DEFAULT_PROC, (long)mc); SYS7_DEFAULT_PROC, (long)mc);
} }
if (mac_gestalts.apprvers >= 0x110) { if (mac_gestalts.apprvers >= 0x110) {
Boolean iscancel = ctrl->button.iscancel; Boolean iscancel = ctrl->button.iscancel;
@ -751,15 +753,20 @@ static pascal SInt32 macctrl_sys7_default_cdef(SInt16 variant,
RgnHandle rgn; RgnHandle rgn;
Rect rect; Rect rect;
int oval; int oval;
PenState savestate;
switch (msg) { switch (msg) {
case drawCntl: case drawCntl:
if ((*control)->contrlVis) { if ((*control)->contrlVis) {
rect = (*control)->contrlRect; rect = (*control)->contrlRect;
GetPenState(&savestate);
PenNormal(); PenNormal();
PenSize(3, 3); PenSize(3, 3);
if ((*control)->contrlHilite == kControlInactivePart)
PenPat(&qd.gray);
oval = (rect.bottom - rect.top) / 2 + 2; oval = (rect.bottom - rect.top) / 2 + 2;
FrameRoundRect(&rect, oval, oval); FrameRoundRect(&rect, oval, oval);
SetPenState(&savestate);
} }
return 0; return 0;
case calcCRgns: case calcCRgns:
@ -882,6 +889,8 @@ void macctrl_activate(WindowPtr window, EventRecord *event)
break; break;
case MACCTRL_BUTTON: case MACCTRL_BUTTON:
HiliteControl(mc->button.tbctrl, state); HiliteControl(mc->button.tbctrl, state);
if (mc->button.tbring != NULL)
HiliteControl(mc->button.tbring, state);
break; break;
case MACCTRL_POPUP: case MACCTRL_POPUP:
HiliteControl(mc->popup.tbctrl, state); HiliteControl(mc->popup.tbctrl, state);