More .m file restructuring on the Mac OS X backend.
This commit is contained in:
parent
0b3f6570ac
commit
65db139be7
|
@ -4,36 +4,9 @@
|
|||
#import "_cgo_export.h"
|
||||
#import <Cocoa/Cocoa.h>
|
||||
|
||||
#define toNSView(x) ((NSView *) (x))
|
||||
#define toNSWindow(x) ((NSWindow *) (x))
|
||||
#define toNSControl(x) ((NSControl *) (x))
|
||||
#define toNSButton(x) ((NSButton *) (x))
|
||||
#define toNSTextField(x) ((NSTextField *) (x))
|
||||
|
||||
// TODO move to control_darwin.m
|
||||
|
||||
void parent(id control, id parentid)
|
||||
{
|
||||
[toNSView(parentid) addSubview:toNSView(control)];
|
||||
}
|
||||
|
||||
void controlSetHidden(id control, BOOL hidden)
|
||||
{
|
||||
[toNSView(control) setHidden:hidden];
|
||||
}
|
||||
|
||||
// also fine for NSCells
|
||||
void setStandardControlFont(id control)
|
||||
{
|
||||
[toNSControl(control) setFont:[NSFont systemFontOfSize:[NSFont systemFontSizeForControlSize:NSRegularControlSize]]];
|
||||
}
|
||||
|
||||
// also fine for NSCells
|
||||
void setSmallControlFont(id control)
|
||||
{
|
||||
[toNSControl(control) setFont:[NSFont systemFontOfSize:[NSFont systemFontSizeForControlSize:NSSmallControlSize]]];
|
||||
}
|
||||
|
||||
@interface goControlDelegate : NSObject {
|
||||
@public
|
||||
void *gocontrol;
|
||||
|
|
|
@ -3,8 +3,30 @@
|
|||
#import "objc_darwin.h"
|
||||
#import <Cocoa/Cocoa.h>
|
||||
|
||||
#define toNSControl(x) ((NSControl *) (x))
|
||||
#define toNSView(x) ((NSView *) (x))
|
||||
#define toNSControl(x) ((NSControl *) (x))
|
||||
|
||||
void parent(id control, id parentid)
|
||||
{
|
||||
[toNSView(parentid) addSubview:toNSView(control)];
|
||||
}
|
||||
|
||||
void controlSetHidden(id control, BOOL hidden)
|
||||
{
|
||||
[toNSView(control) setHidden:hidden];
|
||||
}
|
||||
|
||||
// also fine for NSCells
|
||||
void setStandardControlFont(id control)
|
||||
{
|
||||
[toNSControl(control) setFont:[NSFont systemFontOfSize:[NSFont systemFontSizeForControlSize:NSRegularControlSize]]];
|
||||
}
|
||||
|
||||
// also fine for NSCells
|
||||
void setSmallControlFont(id control)
|
||||
{
|
||||
[toNSControl(control) setFont:[NSFont systemFontOfSize:[NSFont systemFontSizeForControlSize:NSSmallControlSize]]];
|
||||
}
|
||||
|
||||
// also good for NSTableView (TODO might not do what we want) and NSProgressIndicator
|
||||
struct xsize controlPreferredSize(id control)
|
||||
|
|
|
@ -56,10 +56,6 @@ extern id windowContentView(id);
|
|||
extern void windowRedraw(id);
|
||||
|
||||
/* basicctrls_darwin.m */
|
||||
extern void parent(id, id);
|
||||
extern void controlSetHidden(id, BOOL);
|
||||
extern void setStandardControlFont(id);
|
||||
extern void setSmallControlFont(id);
|
||||
extern id newButton(void);
|
||||
extern void buttonSetDelegate(id, void *);
|
||||
extern const char *buttonText(id);
|
||||
|
@ -90,6 +86,10 @@ extern void tableUpdate(id);
|
|||
extern void tableMakeDataSource(id, void *);
|
||||
|
||||
/* control_darwin.m */
|
||||
extern void parent(id, id);
|
||||
extern void controlSetHidden(id, BOOL);
|
||||
extern void setStandardControlFont(id);
|
||||
extern void setSmallControlFont(id);
|
||||
extern struct xsize controlPreferredSize(id);
|
||||
extern id newScrollView(id);
|
||||
|
||||
|
|
Loading…
Reference in New Issue