Removed the need for C.frame() by splitting apart the alignment rect functions on the Mac OS X side.
This commit is contained in:
parent
10201ef24f
commit
be56135451
|
@ -34,8 +34,7 @@ func dobasecommitResize(id C.id, c *allocation, d *sizing) {
|
||||||
}
|
}
|
||||||
|
|
||||||
func basegetAuxResizeInfo(c controlPrivate, d *sizing) {
|
func basegetAuxResizeInfo(c controlPrivate, d *sizing) {
|
||||||
id := c.id()
|
d.neighborAlign = C.alignmentInfoFrame(c.id())
|
||||||
d.neighborAlign = C.alignmentInfo(id, C.frame(id))
|
|
||||||
}
|
}
|
||||||
|
|
||||||
type scroller struct {
|
type scroller struct {
|
||||||
|
|
|
@ -96,7 +96,7 @@ extern id newScrollView(id, BOOL);
|
||||||
|
|
||||||
/* xsizing_darwin.m */
|
/* xsizing_darwin.m */
|
||||||
extern struct xalignment alignmentInfo(id, struct xrect);
|
extern struct xalignment alignmentInfo(id, struct xrect);
|
||||||
extern struct xrect frame(id);
|
extern struct xalignment alignmentInfoFrame(id);
|
||||||
|
|
||||||
/* area_darwin.h */
|
/* area_darwin.h */
|
||||||
extern Class getAreaClass(void);
|
extern Class getAreaClass(void);
|
||||||
|
|
|
@ -8,20 +8,14 @@
|
||||||
#define toNSScrollView(x) ((NSScrollView *) (x))
|
#define toNSScrollView(x) ((NSScrollView *) (x))
|
||||||
#define toNSView(x) ((NSView *) (x))
|
#define toNSView(x) ((NSView *) (x))
|
||||||
|
|
||||||
// TODO figure out where these should go
|
// TODO figure out where this should go
|
||||||
|
|
||||||
// this function is safe to call on Areas; it'll just return the frame and a baseline of 0 since it uses the default NSView implementations
|
// these function are safe to call on Areas; they'll just return the frame and a baseline of 0 since they use the default NSView implementations
|
||||||
struct xalignment alignmentInfo(id c, struct xrect newrect)
|
|
||||||
|
static struct xalignment doAlignmentInfo(NSView *v, NSRect r)
|
||||||
{
|
{
|
||||||
NSView *v;
|
|
||||||
struct xalignment a;
|
struct xalignment a;
|
||||||
NSRect r;
|
|
||||||
|
|
||||||
v = toNSView(c);
|
|
||||||
r = NSMakeRect((CGFloat) newrect.x,
|
|
||||||
(CGFloat) newrect.y,
|
|
||||||
(CGFloat) newrect.width,
|
|
||||||
(CGFloat) newrect.height);
|
|
||||||
r = [v alignmentRectForFrame:r];
|
r = [v alignmentRectForFrame:r];
|
||||||
a.rect.x = (intptr_t) r.origin.x;
|
a.rect.x = (intptr_t) r.origin.x;
|
||||||
a.rect.y = (intptr_t) r.origin.y;
|
a.rect.y = (intptr_t) r.origin.y;
|
||||||
|
@ -33,16 +27,23 @@ struct xalignment alignmentInfo(id c, struct xrect newrect)
|
||||||
return a;
|
return a;
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO remove?
|
struct xalignment alignmentInfo(id c, struct xrect newrect)
|
||||||
struct xrect frame(id c)
|
|
||||||
{
|
{
|
||||||
|
NSView *v;
|
||||||
NSRect r;
|
NSRect r;
|
||||||
struct xrect s;
|
|
||||||
|
|
||||||
r = [toNSView(c) frame];
|
v = toNSView(c);
|
||||||
s.x = (intptr_t) r.origin.x;
|
r = NSMakeRect((CGFloat) newrect.x,
|
||||||
s.y = (intptr_t) r.origin.y;
|
(CGFloat) newrect.y,
|
||||||
s.width = (intptr_t) r.size.width;
|
(CGFloat) newrect.width,
|
||||||
s.height = (intptr_t) r.size.height;
|
(CGFloat) newrect.height);
|
||||||
return s;
|
return doAlignmentInfo(v, r);
|
||||||
|
}
|
||||||
|
|
||||||
|
struct xalignment alignmentInfoFrame(id c)
|
||||||
|
{
|
||||||
|
NSView *v;
|
||||||
|
|
||||||
|
v = toNSView(c);
|
||||||
|
return doAlignmentInfo(v, [v frame]);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue