Other build issues fixed. Now for other issues.
This commit is contained in:
parent
13e90c4263
commit
4a9d0081a3
|
@ -10,7 +10,7 @@ struct controlBase {
|
|||
|
||||
static uintmax_t type_uiControl = 0;
|
||||
|
||||
uintmax_t uiTypeControl(void)
|
||||
uintmax_t uiControlType(void)
|
||||
{
|
||||
if (type_uiControl == 0)
|
||||
type_uiControl = uiRegisterType("uiControl", 0, sizeof (uiControl));
|
||||
|
|
|
@ -6,7 +6,7 @@ struct uiCombobox {
|
|||
BOOL editable;
|
||||
NSPopUpButton *pb;
|
||||
NSComboBox *cb;
|
||||
uintptr_t handle; // for uiControlHandle()
|
||||
NSObject *handle; // for uiControlHandle()
|
||||
};
|
||||
|
||||
uiDarwinDefineControl(
|
||||
|
@ -33,13 +33,13 @@ static uiCombobox *finishNewCombobox(BOOL editable)
|
|||
[c->cb setButtonBordered:YES];
|
||||
[c->cb setCompletes:NO];
|
||||
uiDarwinSetControlFont(c->cb, NSRegularControlSize);
|
||||
c->handle = (uintptr_t) (c->cb);
|
||||
c->handle = c->cb;
|
||||
} else {
|
||||
c->pb = [[NSPopUpButton alloc] initWithFrame:NSZeroRect pullsDown:NO];
|
||||
// TODO preferred edge
|
||||
// TODO arrow position
|
||||
// TODO font
|
||||
c->handle = (uintptr_t) (c->pb);
|
||||
c->handle = c->pb;
|
||||
}
|
||||
|
||||
uiDarwinFinishNewControl(c, uiCombobox);
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
|
||||
static uintmax_t type_uiDarwinControl = 0;
|
||||
|
||||
uintmax_t uiTypeMenu(void)
|
||||
uintmax_t uiDarwinControlType(void)
|
||||
{
|
||||
if (type_uiDarwinControl == 0)
|
||||
type_uiDarwinControl = uiRegisterType("uiDarwinControl", uiControlType(), sizeof (uiDarwinControl));
|
||||
|
|
|
@ -8,7 +8,7 @@ struct uiDateTimePicker {
|
|||
|
||||
uiDarwinDefineControl(
|
||||
uiDateTimePicker, // type name
|
||||
uiDaateTimePickerType, // type function
|
||||
uiDateTimePickerType, // type function
|
||||
dp // handle
|
||||
)
|
||||
|
||||
|
|
|
@ -51,7 +51,7 @@ struct uiEntry {
|
|||
{
|
||||
[self->entries setObject:[NSValue valueWithPointer:e]
|
||||
forKey:e->textfield];
|
||||
[e->entry setDelegate:self];
|
||||
[e->textfield setDelegate:self];
|
||||
}
|
||||
|
||||
- (void)unregisterEntry:(uiEntry *)e
|
||||
|
@ -119,6 +119,11 @@ void finishNewTextField(NSTextField *t, BOOL isEntry)
|
|||
[[t cell] setScrollable:YES];
|
||||
}
|
||||
|
||||
static void defaultOnChanged(uiEntry *e, void *data)
|
||||
{
|
||||
// do nothing
|
||||
}
|
||||
|
||||
uiEntry *uiNewEntry(void)
|
||||
{
|
||||
uiEntry *e;
|
||||
|
|
|
@ -12,7 +12,7 @@ uiDarwinDefineControl(
|
|||
textfield // handle
|
||||
)
|
||||
|
||||
char *uiLabelText(uiLabel *ll)
|
||||
char *uiLabelText(uiLabel *l)
|
||||
{
|
||||
return uiDarwinNSStringToText([l->textfield stringValue]);
|
||||
}
|
||||
|
|
|
@ -5,12 +5,14 @@ static NSMutableArray *menus = nil;
|
|||
static BOOL menusFinalized = NO;
|
||||
|
||||
struct uiMenu {
|
||||
uiTyped t;
|
||||
NSMenu *menu;
|
||||
NSMenuItem *item;
|
||||
NSMutableArray *items;
|
||||
};
|
||||
|
||||
struct uiMenuItem {
|
||||
uiTyped t;
|
||||
NSMenuItem *item;
|
||||
int type;
|
||||
BOOL disabled;
|
||||
|
@ -219,7 +221,7 @@ int uiMenuItemChecked(uiMenuItem *item)
|
|||
return [item->item state] != NSOffState;
|
||||
}
|
||||
|
||||
void menuItemSetChecked(uiMenuItem *item, int checked)
|
||||
void uiMenuItemSetChecked(uiMenuItem *item, int checked)
|
||||
{
|
||||
NSInteger state;
|
||||
|
||||
|
@ -237,7 +239,7 @@ static uiMenuItem *newItem(uiMenu *m, int type, const char *name)
|
|||
complain("attempt to create a new menu item after menus have been finalized");
|
||||
|
||||
item = uiNew(uiMenuItem);
|
||||
uiTyped(item)->Type = uiTypeMenuItem();
|
||||
uiTyped(item)->Type = uiMenuItemType();
|
||||
|
||||
item->type = type;
|
||||
switch (item->type) {
|
||||
|
@ -288,7 +290,7 @@ uiMenuItem *uiMenuAppendQuitItem(uiMenu *m)
|
|||
uiMenuItem *uiMenuAppendPreferencesItem(uiMenu *m)
|
||||
{
|
||||
// duplicate check is in the register:to: selector
|
||||
return newItem(mm, typePreferences, NULL);
|
||||
return newItem(m, typePreferences, NULL);
|
||||
}
|
||||
|
||||
uiMenuItem *uiMenuAppendAboutItem(uiMenu *m)
|
||||
|
@ -312,7 +314,7 @@ uiMenu *uiNewMenu(const char *name)
|
|||
menus = [NSMutableArray new];
|
||||
|
||||
m = uiNew(uiMenu);
|
||||
uiTyped(m)->Type = uiTypeMenu();
|
||||
uiTyped(m)->Type = uiMenuType();
|
||||
|
||||
m->menu = [[NSMenu alloc] initWithTitle:toNSString(name)];
|
||||
// use automatic menu item enabling for all menus for consistency's sake
|
||||
|
|
|
@ -12,7 +12,7 @@ uiDarwinDefineControl(
|
|||
pi // handle
|
||||
)
|
||||
|
||||
void uiProgressbarSetValue(uiProgressBar *p, int value)
|
||||
void uiProgressBarSetValue(uiProgressBar *p, int value)
|
||||
{
|
||||
if (value < 0 || value > 100)
|
||||
complain("value %d out of range in progressbarSetValue()", value);
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
|
||||
// TODO events
|
||||
|
||||
type uiSlider {
|
||||
struct uiSlider {
|
||||
uiDarwinControl c;
|
||||
NSSlider *slider;
|
||||
void (*onChanged)(uiSlider *, void *);
|
||||
|
|
|
@ -35,7 +35,7 @@ static void defaultOnChanged(uiSpinbox *s, void *data)
|
|||
// do nothing
|
||||
}
|
||||
|
||||
uiSpinbox *uiNewSpinbox(void)
|
||||
uiSpinbox *uiNewSpinbox(intmax_t min, intmax_t max)
|
||||
{
|
||||
uiSpinbox *s;
|
||||
|
||||
|
@ -44,7 +44,7 @@ uiSpinbox *uiNewSpinbox(void)
|
|||
s->dummy = [[NSTextField alloc] initWithFrame:NSZeroRect];
|
||||
[s->dummy setStringValue:@"TODO uiSpinbox not implemented"];
|
||||
|
||||
uiSpinboxSetOnChanged(s, defaultOnChanged, NULL);
|
||||
uiSpinboxOnChanged(s, defaultOnChanged, NULL);
|
||||
|
||||
uiDarwinFinishNewControl(s, uiSpinbox);
|
||||
|
||||
|
|
|
@ -60,7 +60,7 @@ void uiTabInsertAt(uiTab *t, const char *name, uintmax_t n, uiControl *child)
|
|||
[view addSubview:childView];
|
||||
layoutSingleView(view, childView, 0);
|
||||
|
||||
[t->pages insertObject:[NSValue valueWithPointer:page] atIndex:n];
|
||||
[t->pages insertObject:[NSValue valueWithPointer:child] atIndex:n];
|
||||
[t->views insertObject:view atIndex:n];
|
||||
[t->margined insertObject:[NSNumber numberWithInt:0] atIndex:n];
|
||||
|
||||
|
@ -86,13 +86,13 @@ void uiTabDelete(uiTab *t, uintmax_t n)
|
|||
|
||||
childView = (NSView *) uiControlHandle(child);
|
||||
[childView removeFromSuperview];
|
||||
uiControlSetParent(childView, NULL);
|
||||
uiControlSetParent(child, NULL);
|
||||
|
||||
i = [t->tabview tabViewItemAtIndex:n];
|
||||
[t->tabview removeTabViewItem:i];
|
||||
}
|
||||
|
||||
uintmax_t uITabNumPages(uiTab *t)
|
||||
uintmax_t uiTabNumPages(uiTab *t)
|
||||
{
|
||||
return [t->pages count];
|
||||
}
|
||||
|
@ -108,6 +108,7 @@ int uiTabMargined(uiTab *t, uintmax_t n)
|
|||
void uiTabSetMargined(uiTab *t, uintmax_t n, int margined)
|
||||
{
|
||||
NSNumber *v;
|
||||
NSView *view;
|
||||
NSValue *childv;
|
||||
uiControl *child;
|
||||
NSView *childView;
|
||||
|
|
|
@ -41,7 +41,7 @@ extern void uninitMenus(void);
|
|||
extern void disableAutocorrect(NSTextView *);
|
||||
|
||||
// entry.m
|
||||
extern void finishNewTextField(uiControl *, NSTextField *, BOOL);
|
||||
extern void finishNewTextField(NSTextField *, BOOL);
|
||||
|
||||
// window.m
|
||||
extern uiWindow *windowFromNSWindow(NSWindow *);
|
||||
|
|
|
@ -24,27 +24,3 @@ void complain(const char *fmt, ...)
|
|||
va_end(ap);
|
||||
abort();
|
||||
}
|
||||
|
||||
// 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...
|
||||
// This one is 8 for most pairs of controls that I've tried; the only difference is between two pushbuttons, where it's 12...
|
||||
#define macXPadding 8
|
||||
// Likewise, this one appears to be 12 for pairs of push buttons...
|
||||
#define macYPadding 8
|
||||
|
||||
uiSizing *uiDarwinNewSizing(void)
|
||||
{
|
||||
uiSizing *d;
|
||||
|
||||
d = uiNew(uiSizing);
|
||||
d->XPadding = macXPadding;
|
||||
d->YPadding = macYPadding;
|
||||
d->Sys = uiNew(uiSizingSys);
|
||||
return d;
|
||||
}
|
||||
|
||||
void uiFreeSizing(uiSizing *d)
|
||||
{
|
||||
uiFree(d->Sys);
|
||||
uiFree(d);
|
||||
}
|
||||
|
|
|
@ -78,7 +78,7 @@ static windowDelegateClass *windowDelegate = nil;
|
|||
|
||||
static void onDestroy(uiWindow *);
|
||||
|
||||
uiDarwinDefineControl(
|
||||
uiDarwinDefineControlWithOnDestroy(
|
||||
uiWindow, // type name
|
||||
uiWindowType, // type function
|
||||
window, // handle
|
||||
|
@ -198,8 +198,8 @@ uiWindow *uiNewWindow(const char *title, int width, int height, int hasMenubar)
|
|||
uiWindowOnClosing(w, defaultOnClosing, NULL);
|
||||
|
||||
uiDarwinFinishNewControl(w, uiWindow);
|
||||
uiControl(w)->CommitShow = windowCommitShow;
|
||||
uiControl(w)->CommitHide = windowCommitHide;
|
||||
//TODO uiControl(w)->CommitShow = windowCommitShow;
|
||||
//TODO uiControl(w)->CommitHide = windowCommitHide;
|
||||
|
||||
return w;
|
||||
}
|
||||
|
|
|
@ -4,14 +4,14 @@
|
|||
static uintmax_t type_uiMenu = 0;
|
||||
static uintmax_t type_uiMenuItem = 0;
|
||||
|
||||
uintmax_t uiTypeMenu(void)
|
||||
uintmax_t uiMenuType(void)
|
||||
{
|
||||
if (type_uiMenu == 0)
|
||||
type_uiMenu = uiRegisterType("uiMenu", 0, 0);
|
||||
return type_uiMenu;
|
||||
}
|
||||
|
||||
uintmax_t uiTypeMenuItem(void)
|
||||
uintmax_t uiMenuItemType(void)
|
||||
{
|
||||
if (type_uiMenuItem == 0)
|
||||
type_uiMenuItem = uiRegisterType("uiMenuItem", 0, 0);
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
#include <stdint.h>
|
||||
#include <stdarg.h>
|
||||
#include <string.h>
|
||||
#include "../out/ui.h"
|
||||
#include "../ui.h"
|
||||
|
||||
// main.c
|
||||
extern void die(const char *, ...);
|
||||
|
|
|
@ -191,7 +191,7 @@ _UI_EXTERN uiSlider *uiNewSlider(intmax_t min, intmax_t max);
|
|||
typedef struct uiSeparator uiSeparator;
|
||||
_UI_EXTERN uintmax_t uiSeparatorType(void);
|
||||
#define uiSeparator(this) ((uiSeparator *) uiIsA((this), uiSeparatorType(), 1))
|
||||
_UI_EXTERN uiSeparator *NewHorizontalSeparator(void);
|
||||
_UI_EXTERN uiSeparator *uiNewHorizontalSeparator(void);
|
||||
|
||||
typedef struct uiCombobox uiCombobox;
|
||||
_UI_EXTERN uintmax_t uiComboboxType(void);
|
||||
|
@ -217,7 +217,7 @@ typedef struct uiMenu uiMenu;
|
|||
typedef struct uiMenuItem uiMenuItem;
|
||||
_UI_EXTERN uintmax_t uiMenuType(void);
|
||||
#define uiMenu(this) ((uiMenu *) uiIsA((this), uiMenuType(), 1))
|
||||
_UI_EXTERN uiMenuItem *uiMenuAppendItem(uiMenu *m, char *name);
|
||||
_UI_EXTERN uiMenuItem *uiMenuAppendItem(uiMenu *m, const char *name);
|
||||
_UI_EXTERN uiMenuItem *uiMenuAppendCheckItem(uiMenu *m, const char *name);
|
||||
_UI_EXTERN uiMenuItem *uiMenuAppendQuitItem(uiMenu *m);
|
||||
_UI_EXTERN uiMenuItem *uiMenuAppendPreferencesItem(uiMenu *m);
|
||||
|
@ -233,9 +233,9 @@ _UI_EXTERN void uiMenuItemOnClicked(uiMenuItem *m, void (*f)(uiMenuItem *sender,
|
|||
_UI_EXTERN int uiMenuItemChecked(uiMenuItem *m);
|
||||
_UI_EXTERN void uiMenuItemSetChecked(uiMenuItem *m, int checked);
|
||||
|
||||
_UI_EXTERN char *OpenFile(void);
|
||||
_UI_EXTERN char *SaveFile(void);
|
||||
_UI_EXTERN void MsgBox(const char *title, const char *description);
|
||||
_UI_EXTERN void MsgBoxError(const char *title, const char *description);
|
||||
_UI_EXTERN char *uiOpenFile(void);
|
||||
_UI_EXTERN char *uiSaveFile(void);
|
||||
_UI_EXTERN void uiMsgBox(const char *title, const char *description);
|
||||
_UI_EXTERN void uiMsgBoxError(const char *title, const char *description);
|
||||
|
||||
#endif
|
||||
|
|
Loading…
Reference in New Issue