mirror of
https://git.tartarus.org/simon/putty.git
synced 2025-01-25 09:12:24 +00:00
Add support for drawing a ring around the default button in System 7.
[originally from svn r2967]
This commit is contained in:
parent
ea3dd210de
commit
6d95dc84b4
@ -1,4 +1,4 @@
|
||||
/* $Id: mac_res.r,v 1.33 2003/03/18 00:35:40 ben Exp $ */
|
||||
/* $Id: mac_res.r,v 1.34 2003/03/19 00:40:15 ben Exp $ */
|
||||
/*
|
||||
* Copyright (c) 1999, 2002, 2003 Ben Harris
|
||||
* All rights reserved.
|
||||
@ -1125,3 +1125,6 @@ resource 'TEXT' (wLicence, "licence", purgeable) {
|
||||
data 'CDEF' (CDEF_Text) {
|
||||
$"4EF9 00000000"
|
||||
};
|
||||
data 'CDEF' (CDEF_Default) {
|
||||
$"4EF9 00000000"
|
||||
};
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $Id: macctrls.c,v 1.5 2003/03/18 23:47:33 ben Exp $ */
|
||||
/* $Id: macctrls.c,v 1.6 2003/03/19 00:40:15 ben Exp $ */
|
||||
/*
|
||||
* Copyright (c) 2003 Ben Harris
|
||||
* All rights reserved.
|
||||
@ -93,6 +93,8 @@ static void macctrl_button(struct macctrls *, WindowPtr,
|
||||
#if !TARGET_API_MAC_CARBON
|
||||
static pascal SInt32 macctrl_sys7_text_cdef(SInt16, ControlRef,
|
||||
ControlDefProcMessage, SInt32);
|
||||
static pascal SInt32 macctrl_sys7_default_cdef(SInt16, ControlRef,
|
||||
ControlDefProcMessage, SInt32);
|
||||
#endif
|
||||
|
||||
#if !TARGET_API_MAC_CARBON
|
||||
@ -119,6 +121,8 @@ static void macctrl_init()
|
||||
if (inited) return;
|
||||
cdef = (PatchCDEF)GetResource(kControlDefProcResourceType, CDEF_Text);
|
||||
(*cdef)->theUPP = NewControlDefProc(macctrl_sys7_text_cdef);
|
||||
cdef = (PatchCDEF)GetResource(kControlDefProcResourceType, CDEF_Default);
|
||||
(*cdef)->theUPP = NewControlDefProc(macctrl_sys7_default_cdef);
|
||||
inited = 1;
|
||||
#endif
|
||||
}
|
||||
@ -365,6 +369,10 @@ static void macctrl_button(struct macctrls *mcs, WindowPtr window,
|
||||
SetControlData(mc->button.tbctrl, kControlEntireControl,
|
||||
kControlPushButtonDefaultTag,
|
||||
sizeof(isdefault), &isdefault);
|
||||
} else if (ctrl->button.isdefault) {
|
||||
InsetRect(&bounds, -4, -4);
|
||||
NewControl(window, &bounds, title, TRUE, 0, 0, 1,
|
||||
SYS7_DEFAULT_PROC, (long)mc);
|
||||
}
|
||||
if (mac_gestalts.apprvers >= 0x110) {
|
||||
Boolean iscancel = ctrl->button.iscancel;
|
||||
@ -377,6 +385,47 @@ static void macctrl_button(struct macctrls *mcs, WindowPtr window,
|
||||
curstate->pos.v += 26;
|
||||
}
|
||||
|
||||
#if !TARGET_API_MAC_CARBON
|
||||
static pascal SInt32 macctrl_sys7_default_cdef(SInt16 variant,
|
||||
ControlRef control,
|
||||
ControlDefProcMessage msg,
|
||||
SInt32 param)
|
||||
{
|
||||
RgnHandle rgn;
|
||||
Rect rect;
|
||||
int oval;
|
||||
|
||||
switch (msg) {
|
||||
case drawCntl:
|
||||
if ((*control)->contrlVis) {
|
||||
rect = (*control)->contrlRect;
|
||||
PenNormal();
|
||||
PenSize(3, 3);
|
||||
oval = (rect.bottom - rect.top) / 2 + 2;
|
||||
FrameRoundRect(&rect, oval, oval);
|
||||
}
|
||||
return 0;
|
||||
case calcCRgns:
|
||||
if (param & (1 << 31)) {
|
||||
param &= ~(1 << 31);
|
||||
goto calcthumbrgn;
|
||||
}
|
||||
/* FALLTHROUGH */
|
||||
case calcCntlRgn:
|
||||
rgn = (RgnHandle)param;
|
||||
RectRgn(rgn, &(*control)->contrlRect);
|
||||
return 0;
|
||||
case calcThumbRgn:
|
||||
calcthumbrgn:
|
||||
rgn = (RgnHandle)param;
|
||||
SetEmptyRgn(rgn);
|
||||
return 0;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
void macctrl_activate(WindowPtr window, EventRecord *event)
|
||||
{
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $Id: macresid.h,v 1.11 2003/03/18 00:35:40 ben Exp $ */
|
||||
/* $Id: macresid.h,v 1.12 2003/03/19 00:40:15 ben Exp $ */
|
||||
|
||||
/*
|
||||
* macresid.h -- Mac resource IDs
|
||||
@ -62,3 +62,5 @@
|
||||
/* xDEFs */
|
||||
#define CDEF_Text 128
|
||||
#define SYS7_TEXT_PROC (CDEF_Text << 4)
|
||||
#define CDEF_Default 129
|
||||
#define SYS7_DEFAULT_PROC (CDEF_Default << 4)
|
||||
|
Loading…
Reference in New Issue
Block a user