Migrated newLabel(), imageImage(), doManualMove(), and doManualResize().

This commit is contained in:
Pietro Gagliardi 2018-05-05 21:28:13 -04:00
parent 69922a0fb3
commit 3914451c34
7 changed files with 20 additions and 17 deletions

View File

@ -1,14 +1,4 @@
// label.m
extern NSTextField *newLabel(NSString *str);
// image.m
extern NSImage *imageImage(uiImage *);
// winmoveresize.m
extern void doManualMove(NSWindow *w, NSEvent *initialEvent);
extern void doManualResize(NSWindow *w, NSEvent *initialEvent, uiWindowResizeEdge edge);
// future.m
extern CFStringRef *FUTURE_kCTFontOpenTypeFeatureTag;
extern CFStringRef *FUTURE_kCTFontOpenTypeFeatureValue;

View File

@ -347,7 +347,7 @@ struct uiForm {
NSLayoutAttribute attribute;
int oldnStretchy;
fc = [[formChild alloc] initWithLabel:newLabel(label)];
fc = [[formChild alloc] initWithLabel:uiprivNewLabel(label)];
fc.c = c;
fc.stretchy = stretchy;
fc.oldHorzHuggingPri = uiDarwinControlHuggingPriority(uiDarwinControl(fc.c), NSLayoutConstraintOrientationHorizontal);

View File

@ -76,7 +76,7 @@ void uiImageAppend(uiImage *i, void *pixels, int pixelWidth, int pixelHeight, in
[i->swizzled addObject:[NSValue valueWithPointer:swizzled]];
}
NSImage *imageImage(uiImage *i)
NSImage *uiprivImageNSImage(uiImage *i)
{
return i->i;
}

View File

@ -18,7 +18,7 @@ void uiLabelSetText(uiLabel *l, const char *text)
[l->textfield setStringValue:uiprivToNSString(text)];
}
NSTextField *newLabel(NSString *str)
NSTextField *uiprivNewLabel(NSString *str)
{
NSTextField *tf;

View File

@ -8,6 +8,9 @@
#import "../ui_darwin.h"
#import "../common/uipriv.h"
// TODO should we rename the uiprivMk things or not
// TODO what about renaming class wrapper functions that return the underlying class (like uiprivNewLabel())
#if __has_feature(objc_arc)
#error Sorry, libui cannot be compiled with ARC.
#endif
@ -138,4 +141,14 @@ extern NSScrollView *uiprivMkScrollView(uiprivScrollViewCreateParams *p, uiprivS
extern void uiprivScrollViewSetScrolling(NSScrollView *sv, uiprivScrollViewData *d, BOOL hscroll, BOOL vscroll);
extern void uiprivScrollViewFreeData(NSScrollView *sv, uiprivScrollViewData *d);
// label.m
extern NSTextField *uiprivNewLabel(NSString *str);
// image.m
extern NSImage *uiprivImageNSImage(uiImage *);
// winmoveresize.m
extern void uiprivDoManualMove(NSWindow *w, NSEvent *initialEvent);
extern void uiprivDoManualResize(NSWindow *w, NSEvent *initialEvent, uiWindowResizeEdge edge);
#import "OLD_uipriv_darwin.h"

View File

@ -22,12 +22,12 @@ struct uiWindow {
- (void)uiprivDoMove:(NSEvent *)initialEvent
{
doManualMove(self, initialEvent);
uiprivDoManualMove(self, initialEvent);
}
- (void)uiprivDoResize:(NSEvent *)initialEvent on:(uiWindowResizeEdge)edge
{
doManualResize(self, initialEvent, edge);
uiprivDoManualResize(self, initialEvent, edge);
}
@end

View File

@ -43,7 +43,7 @@ void onMoveDrag(struct onMoveDragParams *p, NSEvent *e)
[p->w setFrameOrigin:frame.origin];
}
void doManualMove(NSWindow *w, NSEvent *initialEvent)
void uiprivDoManualMove(NSWindow *w, NSEvent *initialEvent)
{
__block struct onMoveDragParams mdp;
uiprivNextEventArgs nea;
@ -220,7 +220,7 @@ static void onResizeDrag(struct onResizeDragParams *p, NSEvent *e)
}
// TODO do our events get fired with this? *should* they?
void doManualResize(NSWindow *w, NSEvent *initialEvent, uiWindowResizeEdge edge)
void uiprivDoManualResize(NSWindow *w, NSEvent *initialEvent, uiWindowResizeEdge edge)
{
__block struct onResizeDragParams rdp;
uiprivNextEventArgs nea;