diff options
| author | Pietro Gagliardi <[email protected]> | 2015-04-16 20:33:28 -0400 |
|---|---|---|
| committer | Pietro Gagliardi <[email protected]> | 2015-04-16 20:33:28 -0400 |
| commit | e34c561ed5bedeb180437ec165882b98d70d38c1 (patch) | |
| tree | d095e5db16d7a23e883526c8c1d3c524639c97cf /new/darwin/entry.m | |
| parent | de9d72299fb89a8b6cdc8963cd6b6ae708a81e80 (diff) | |
Split the rewrite into a new repository.
Diffstat (limited to 'new/darwin/entry.m')
| -rw-r--r-- | new/darwin/entry.m | 73 |
1 files changed, 0 insertions, 73 deletions
diff --git a/new/darwin/entry.m b/new/darwin/entry.m deleted file mode 100644 index 7189156..0000000 --- a/new/darwin/entry.m +++ /dev/null @@ -1,73 +0,0 @@ -// 9 april 2015 -#import "uipriv_darwin.h" - -@interface uiNSTextField : NSTextField -@property uiEntry *uiE; -@end - -@implementation uiNSTextField - -- (void)viewDidMoveToSuperview -{ - if (uiDarwinControlFreeWhenAppropriate(uiControl(self.uiE), [self superview])) { - [self setTarget:nil]; - self.uiE = NULL; - } - [super viewDidMoveToSuperview]; -} - -@end - -static char *entryText(uiEntry *e) -{ - uiNSTextField *t; - - t = (uiNSTextField *) uiControlHandle(uiControl(e)); - return uiDarwinNSStringToText([t stringValue]); -} - -static void entrySetText(uiEntry *e, const char *text) -{ - uiNSTextField *t; - - t = (uiNSTextField *) uiControlHandle(uiControl(e)); - [t setStringValue:toNSString(text)]; -} - -// TOOD move elsewhere -// these are based on interface builder defaults; my comments in the old code weren't very good so I don't really know what talked about what, sorry :/ -void finishNewTextField(NSTextField *t, BOOL isEntry) -{ - setStandardControlFont((id) t); - - // THE ORDER OF THESE CALLS IS IMPORTANT; CHANGE IT AND THE BORDERS WILL DISAPPEAR - [t setBordered:NO]; - [t setBezelStyle:NSTextFieldSquareBezel]; - [t setBezeled:isEntry]; - - // we don't need to worry about substitutions/autocorrect here; see window_darwin.m for details - - [[t cell] setLineBreakMode:NSLineBreakByClipping]; - [[t cell] setScrollable:YES]; -} - -uiEntry *uiNewEntry(void) -{ - uiEntry *e; - uiNSTextField *t; - - e = uiNew(uiEntry); - - uiDarwinNewControl(uiControl(e), [uiNSTextField class], NO, NO); - t = (uiNSTextField *) uiControlHandle(uiControl(e)); - - [t setSelectable:YES]; // otherwise the setting is masked by the editable default of YES - finishNewTextField((NSTextField *) t, YES); - - uiEntry(e)->Text = entryText; - uiEntry(e)->SetText = entrySetText; - - t.uiE = e; - - return t.uiE; -} |
