More basic OS X backend functions work.

This commit is contained in:
Pietro Gagliardi 2015-07-03 23:32:01 -04:00
parent 9f1ef9eaa1
commit 9b5fe800c7
3 changed files with 5 additions and 19 deletions

View File

@ -101,8 +101,8 @@ static int singleViewHasTabStops(uiControl *c)
return 0; // keep compiler happy
}
// called after creating the control's widget
void uiDarwinMakeSingleWidgetControl(uiControl *c, NSView *view)
// called after creating the control's NSView
void uiDarwinMakeSingleViewControl(uiControl *c, NSView *view)
{
// we have to retain the view so we can reparent it
[view retain];

View File

@ -165,7 +165,7 @@ uiWindow *uiNewWindow(const char *title, int width, int height, int hasMenubar)
[w->window setTitle:toNSString(title)];
// a NSWindow is not a NSView, but nothing we're doing in this function is view-specific
uiDarwinMakeSingleWidgetControl(uiControl(w), (NSView *) (w->window));
uiDarwinMakeSingleViewControl(uiControl(w), (NSView *) (w->window));
// explicitly release when closed
// the only thing that closes the window is us anyway

View File

@ -7,11 +7,8 @@ This file assumes that you have imported <Cocoa/Cocoa.h> and "ui.h" beforehand.
#ifndef __UI_UI_DARWIN_H__
#define __UI_UI_DARWIN_H__
// uiDarwinMakeControl() initializes the given uiControl with the given Cocoa control inside.
// The second parameter should come from [RealControlType class].
// The two scrollView parameters allow placing scrollbars on the new control.
// The two onDestroy parameters define a function and its parameter to call when the widget is destroyed.
_UI_EXTERN void uiDarwinMakeControl(uiControl *c, Class class, BOOL inScrollView, BOOL scrollViewHasBorder, void (*onDestroy)(void *), void *onDestroyData);
// TODO document
_UI_EXTERN void uiDarwinMakeSingleViewControl(uiControl *, NSView *);
// You can use this function from within your control implementations to return text strings that can be freed with uiFreeText().
_UI_EXTERN char *uiDarwinNSStringToText(NSString *);
@ -20,15 +17,4 @@ struct uiSizingSys {
// this structure currently left blank
};
struct uiControlSysFuncParams {
int Func;
};
enum {
// These should enable and disable the uiControl while preserving the user enable/disable setting.
// These are needed because enabling and disabling of views on OS X is available on a view-by-view basis, and is not transitive to subviews by default as a result.
uiDarwinSysFuncContainerEnable,
uiDarwinSysFuncContainerDisable,
};
#endif