Fixed some build issues and added the OS X uiControl code.
This commit is contained in:
parent
d5f2cae243
commit
fa659395c8
|
@ -101,11 +101,11 @@ void uiControlDisable(uiControl *c)
|
||||||
|
|
||||||
static void controlUpdateState(uiControl *c)
|
static void controlUpdateState(uiControl *c)
|
||||||
{
|
{
|
||||||
if (uiControlContainerVisible(c))
|
if (controlContainerVisible(c))
|
||||||
osCommitShow(c);
|
osCommitShow(c);
|
||||||
else
|
else
|
||||||
osCommitHide(c);
|
osCommitHide(c);
|
||||||
if (uiControlContainerEnabled(c))
|
if (controlContainerEnabled(c))
|
||||||
osCommitEnable(c);
|
osCommitEnable(c);
|
||||||
else
|
else
|
||||||
osCommitDisable(c);
|
osCommitDisable(c);
|
||||||
|
|
|
@ -7,6 +7,7 @@ osMFILES = \
|
||||||
darwin/button.m \
|
darwin/button.m \
|
||||||
darwin/checkbox.m \
|
darwin/checkbox.m \
|
||||||
darwin/combobox.m \
|
darwin/combobox.m \
|
||||||
|
darwin/control.m \
|
||||||
darwin/datetimepicker.m \
|
darwin/datetimepicker.m \
|
||||||
darwin/entry.m \
|
darwin/entry.m \
|
||||||
darwin/group.m \
|
darwin/group.m \
|
||||||
|
|
|
@ -237,7 +237,7 @@ void uiBoxSetPadded(uiBox *ss, int padded)
|
||||||
relayout(b);
|
relayout(b);
|
||||||
}
|
}
|
||||||
|
|
||||||
static uiBox *finishBox(BOOL vertical)
|
static uiBox *finishNewBox(BOOL vertical)
|
||||||
{
|
{
|
||||||
uiBox *b;
|
uiBox *b;
|
||||||
|
|
||||||
|
|
|
@ -0,0 +1,49 @@
|
||||||
|
// 16 august 2015
|
||||||
|
#import "uipriv_darwin.h"
|
||||||
|
|
||||||
|
void osCommitShow(uiControl *c)
|
||||||
|
{
|
||||||
|
NSView *view;
|
||||||
|
|
||||||
|
view = (NSView *) uiControlHandle(c);
|
||||||
|
[view setHidden:NO];
|
||||||
|
}
|
||||||
|
|
||||||
|
void osCommitHide(uiControl *c)
|
||||||
|
{
|
||||||
|
NSView *view;
|
||||||
|
|
||||||
|
view = (NSView *) uiControlHandle(c);
|
||||||
|
[view setHidden:YES];
|
||||||
|
}
|
||||||
|
|
||||||
|
void osCommitEnable(uiControl *c)
|
||||||
|
{
|
||||||
|
NSControl *view;
|
||||||
|
|
||||||
|
view = (NSControl *) uiControlHandle(c);
|
||||||
|
if ([view respondsToSelector:@selector(setEnabled:)])
|
||||||
|
[view setEnabled:YES];
|
||||||
|
}
|
||||||
|
|
||||||
|
void osCommitDisable(uiControl *c)
|
||||||
|
{
|
||||||
|
NSControl *view;
|
||||||
|
|
||||||
|
view = (NSControl *) uiControlHandle(c);
|
||||||
|
if ([view respondsToSelector:@selector(setEnabled:)])
|
||||||
|
[view setEnabled:NO];
|
||||||
|
}
|
||||||
|
|
||||||
|
void uiDarwinFinishControl(uiControl *c)
|
||||||
|
{
|
||||||
|
NSView *view;
|
||||||
|
|
||||||
|
view = (NSView *) uiControlHandle(c);
|
||||||
|
[view retain];
|
||||||
|
}
|
||||||
|
|
||||||
|
void uiDarwinSetControlFont(NSControl *c, NSControlSize size)
|
||||||
|
{
|
||||||
|
[c setFont:[NSFont systemFontOfSize:[NSFont systemFontSizeForControlSize:size]]];
|
||||||
|
}
|
|
@ -9,11 +9,6 @@
|
||||||
#define toNSString(str) [NSString stringWithUTF8String:(str)]
|
#define toNSString(str) [NSString stringWithUTF8String:(str)]
|
||||||
#define fromNSString(str) [(str) UTF8String]
|
#define fromNSString(str) [(str) UTF8String]
|
||||||
|
|
||||||
// These are based on measurements from Interface Builder.
|
|
||||||
// These seem to be based on Auto Layout constants, but I don't see an API that exposes these...
|
|
||||||
#define macXMargin 20
|
|
||||||
#define macYMargin 20
|
|
||||||
|
|
||||||
// menu.m
|
// menu.m
|
||||||
@interface menuManager : NSObject {
|
@interface menuManager : NSObject {
|
||||||
// unfortunately NSMutableDictionary copies its keys, meaning we can't use it for pointers
|
// unfortunately NSMutableDictionary copies its keys, meaning we can't use it for pointers
|
||||||
|
@ -43,7 +38,6 @@ extern void uninitMenus(void);
|
||||||
#define appDelegate() ((appDelegate *) [realNSApp() delegate])
|
#define appDelegate() ((appDelegate *) [realNSApp() delegate])
|
||||||
|
|
||||||
// util.m
|
// util.m
|
||||||
extern void setStandardControlFont(NSControl *);
|
|
||||||
extern void disableAutocorrect(NSTextView *);
|
extern void disableAutocorrect(NSTextView *);
|
||||||
|
|
||||||
// entry.m
|
// entry.m
|
||||||
|
@ -56,11 +50,13 @@ extern uiWindow *windowFromNSWindow(NSWindow *);
|
||||||
extern void initAlloc(void);
|
extern void initAlloc(void);
|
||||||
extern void uninitAlloc(void);
|
extern void uninitAlloc(void);
|
||||||
|
|
||||||
// bin.c
|
// autolayout.m
|
||||||
extern uiControl *newBin(void);
|
extern void addConstraint(NSView *, NSString *, NSDictionary *, NSDictionary *);
|
||||||
extern void binSetChild(uiControl *, uiControl *);
|
extern NSLayoutPriority horzHuggingPri(NSView *);
|
||||||
extern int binMargined(uiControl *);
|
extern NSLayoutPriority vertHuggingPri(NSView *);
|
||||||
extern void binSetMargined(uiControl *, int);
|
extern void setHuggingPri(NSView *, NSLayoutPriority, NSLayoutConstraintOrientation);
|
||||||
|
extern void layoutSingleView(NSView *, NSView *, int);
|
||||||
|
extern NSSize fittingAlignmentSize(NSView *);
|
||||||
|
|
||||||
// TODO
|
// TODO
|
||||||
#define PUT_CODE_HERE 0
|
#define PUT_CODE_HERE 0
|
||||||
|
|
|
@ -1,12 +1,6 @@
|
||||||
// 7 april 2015
|
// 7 april 2015
|
||||||
#import "uipriv_darwin.h"
|
#import "uipriv_darwin.h"
|
||||||
|
|
||||||
// also fine for NSCells and NSTexts (NSTextViews)
|
|
||||||
void setStandardControlFont(NSControl *control)
|
|
||||||
{
|
|
||||||
[control setFont:[NSFont systemFontOfSize:[NSFont systemFontSizeForControlSize:NSRegularControlSize]]];
|
|
||||||
}
|
|
||||||
|
|
||||||
void disableAutocorrect(NSTextView *tv)
|
void disableAutocorrect(NSTextView *tv)
|
||||||
{
|
{
|
||||||
[tv setEnabledTextCheckingTypes:0];
|
[tv setEnabledTextCheckingTypes:0];
|
||||||
|
|
|
@ -135,12 +135,12 @@ _UI_EXTERN uintmax_t uiLabelType(void);
|
||||||
#define uiLabel(this) ((uiLabel *) uiIsA((this), uiLabelType(), 1))
|
#define uiLabel(this) ((uiLabel *) uiIsA((this), uiLabelType(), 1))
|
||||||
_UI_EXTERN char *uiLabelText(uiLabel *l);
|
_UI_EXTERN char *uiLabelText(uiLabel *l);
|
||||||
_UI_EXTERN void uiLabelSetText(uiLabel *l, const char *text);
|
_UI_EXTERN void uiLabelSetText(uiLabel *l, const char *text);
|
||||||
_UI_EXTERN uiLable *uiNewLabel(const char *text);
|
_UI_EXTERN uiLabel *uiNewLabel(const char *text);
|
||||||
|
|
||||||
typedef struct uiTab uiTab;
|
typedef struct uiTab uiTab;
|
||||||
_UI_EXTERN uintmax_t uiTabType(void);
|
_UI_EXTERN uintmax_t uiTabType(void);
|
||||||
#define uiTab(this) ((uiTab *) uiIsA((this), uiTabType(), 1))
|
#define uiTab(this) ((uiTab *) uiIsA((this), uiTabType(), 1))
|
||||||
_UI_EXTERN void uiTabAppend(uITab *t, const char *name uiControl *c);
|
_UI_EXTERN void uiTabAppend(uiTab *t, const char *name, uiControl *c);
|
||||||
_UI_EXTERN void uiTabInsertAt(uiTab *t, const char *name, uintmax_t before, uiControl *c);
|
_UI_EXTERN void uiTabInsertAt(uiTab *t, const char *name, uintmax_t before, uiControl *c);
|
||||||
_UI_EXTERN void uiTabDelete(uiTab *t, uintmax_t index);
|
_UI_EXTERN void uiTabDelete(uiTab *t, uintmax_t index);
|
||||||
_UI_EXTERN uintmax_t uiTabNumPages(uiTab *t);
|
_UI_EXTERN uintmax_t uiTabNumPages(uiTab *t);
|
||||||
|
@ -166,7 +166,7 @@ _UI_EXTERN uiGroup *uiNewGroup(const char *title);
|
||||||
typedef struct uiSpinbox uiSpinbox;
|
typedef struct uiSpinbox uiSpinbox;
|
||||||
_UI_EXTERN uintmax_t uiSpinboxType(void);
|
_UI_EXTERN uintmax_t uiSpinboxType(void);
|
||||||
#define uiSpinbox(this) ((uiSpinbox *) uiIsA((this), uiSpinboxType(), 1))
|
#define uiSpinbox(this) ((uiSpinbox *) uiIsA((this), uiSpinboxType(), 1))
|
||||||
_UI_EXTERN intmx_t uiSpinboxValue(uiSpinbox *s);
|
_UI_EXTERN intmax_t uiSpinboxValue(uiSpinbox *s);
|
||||||
_UI_EXTERN void uiSpinboxSetValue(uiSpinbox *s, intmax_t value);
|
_UI_EXTERN void uiSpinboxSetValue(uiSpinbox *s, intmax_t value);
|
||||||
_UI_EXTERN void uiSpinboxOnChanged(uiSpinbox *s, void (*f)(uiSpinbox *s, void *data), void *data);
|
_UI_EXTERN void uiSpinboxOnChanged(uiSpinbox *s, void (*f)(uiSpinbox *s, void *data), void *data);
|
||||||
_UI_EXTERN uiSpinbox *uiNewSpinbox(intmax_t min, intmax_t max);
|
_UI_EXTERN uiSpinbox *uiNewSpinbox(intmax_t min, intmax_t max);
|
||||||
|
@ -175,13 +175,13 @@ typedef struct uiProgressBar uiProgressBar;
|
||||||
_UI_EXTERN uintmax_t uiProgressBarType(void);
|
_UI_EXTERN uintmax_t uiProgressBarType(void);
|
||||||
#define uiProgressBar(this) ((uiProgressBar *) uiIsA((this), uiProgressBarType(), 1))
|
#define uiProgressBar(this) ((uiProgressBar *) uiIsA((this), uiProgressBarType(), 1))
|
||||||
// TODO uiProgressBarValue()
|
// TODO uiProgressBarValue()
|
||||||
_UI_EXTERN uiProgressBarSetValue(uiProgressBar *p, int n);
|
_UI_EXTERN void uiProgressBarSetValue(uiProgressBar *p, int n);
|
||||||
_UI_EXTERN uiProgressBar *uiNewProgressBar(void);
|
_UI_EXTERN uiProgressBar *uiNewProgressBar(void);
|
||||||
|
|
||||||
typedef struct uiSlider uiSlider;
|
typedef struct uiSlider uiSlider;
|
||||||
_UI_EXTERN uintmax_t uiSliderType(void);
|
_UI_EXTERN uintmax_t uiSliderType(void);
|
||||||
#define uiSlider(this) ((uiSlider *) uiIsA((this), uiSliderType(), 1))
|
#define uiSlider(this) ((uiSlider *) uiIsA((this), uiSliderType(), 1))
|
||||||
_UI_EXTERN intmx_t uiSliderValue(uiSlider *s);
|
_UI_EXTERN intmax_t uiSliderValue(uiSlider *s);
|
||||||
_UI_EXTERN void uiSliderSetValue(uiSlider *s, intmax_t value);
|
_UI_EXTERN void uiSliderSetValue(uiSlider *s, intmax_t value);
|
||||||
_UI_EXTERN void uiSliderOnChanged(uiSlider *s, void (*f)(uiSlider *s, void *data), void *data);
|
_UI_EXTERN void uiSliderOnChanged(uiSlider *s, void (*f)(uiSlider *s, void *data), void *data);
|
||||||
_UI_EXTERN uiSlider *uiNewSlider(intmax_t min, intmax_t max);
|
_UI_EXTERN uiSlider *uiNewSlider(intmax_t min, intmax_t max);
|
||||||
|
|
|
@ -35,9 +35,9 @@ This file assumes that you have imported <Cocoa/Cocoa.h> and "ui.h" beforehand.
|
||||||
uiDarwinDefineControlWithOnDestroy(type, typefn, handlefield, (void) this;)
|
uiDarwinDefineControlWithOnDestroy(type, typefn, handlefield, (void) this;)
|
||||||
|
|
||||||
#define uiDarwinFinishNewControl(variable, type) \
|
#define uiDarwinFinishNewControl(variable, type) \
|
||||||
type(variable)->CommitDestroy = _ ## type ## CommitDestroy; \
|
uiControl(variable)->CommitDestroy = _ ## type ## CommitDestroy; \
|
||||||
type(variable)->Handle = _ ## type ## Handle; \
|
uiControl(variable)->Handle = _ ## type ## Handle; \
|
||||||
type(variable)->ContainerUpdateState = _ ## type ## ContainerUpdateState; \
|
uiControl(variable)->ContainerUpdateState = _ ## type ## ContainerUpdateState; \
|
||||||
uiDarwinFinishControl(uiControl(variable));
|
uiDarwinFinishControl(uiControl(variable));
|
||||||
|
|
||||||
// This is a function used to set up a control.
|
// This is a function used to set up a control.
|
||||||
|
|
|
@ -15,7 +15,10 @@ extern void uiFree(void *);
|
||||||
|
|
||||||
extern void complain(const char *, ...);
|
extern void complain(const char *, ...);
|
||||||
|
|
||||||
extern void queueResize(uiControl *);
|
extern void osCommitShow(uiControl *);
|
||||||
|
extern void osCommitHide(uiControl *);
|
||||||
|
extern void osCommitEnable(uiControl *);
|
||||||
|
extern void osCommitDisable(uiControl *);
|
||||||
|
|
||||||
// ptrarray.c
|
// ptrarray.c
|
||||||
struct ptrArray {
|
struct ptrArray {
|
||||||
|
|
Loading…
Reference in New Issue