More TODO resolution.
This commit is contained in:
parent
b15554cbd1
commit
478f5d2504
|
@ -3,10 +3,12 @@
|
||||||
#import "uipriv_darwin.h"
|
#import "uipriv_darwin.h"
|
||||||
|
|
||||||
NSMutableArray *allocations;
|
NSMutableArray *allocations;
|
||||||
|
NSMutableArray *delegates;
|
||||||
|
|
||||||
void initAlloc(void)
|
void initAlloc(void)
|
||||||
{
|
{
|
||||||
allocations = [NSMutableArray new];
|
allocations = [NSMutableArray new];
|
||||||
|
delegates = [NSMutableArray new];
|
||||||
}
|
}
|
||||||
|
|
||||||
#define UINT8(p) ((uint8_t *) (p))
|
#define UINT8(p) ((uint8_t *) (p))
|
||||||
|
@ -21,6 +23,11 @@ void initAlloc(void)
|
||||||
void uninitAlloc(void)
|
void uninitAlloc(void)
|
||||||
{
|
{
|
||||||
if ([allocations count] == 0) {
|
if ([allocations count] == 0) {
|
||||||
|
NSInteger i;
|
||||||
|
|
||||||
|
for (i = 0; i < [delegates count]; i++)
|
||||||
|
[[delegates objectAtIndex:i] release];
|
||||||
|
[delegates release];
|
||||||
[allocations release];
|
[allocations release];
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
|
@ -26,7 +26,6 @@ struct uiButton {
|
||||||
return self;
|
return self;
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO have this called
|
|
||||||
- (void)dealloc
|
- (void)dealloc
|
||||||
{
|
{
|
||||||
if ([self->buttons count] != 0)
|
if ([self->buttons count] != 0)
|
||||||
|
@ -103,8 +102,10 @@ uiButton *uiNewButton(const char *text)
|
||||||
[b->button setBezelStyle:NSRoundedBezelStyle];
|
[b->button setBezelStyle:NSRoundedBezelStyle];
|
||||||
uiDarwinSetControlFont(b->button, NSRegularControlSize);
|
uiDarwinSetControlFont(b->button, NSRegularControlSize);
|
||||||
|
|
||||||
if (buttonDelegate == nil)
|
if (buttonDelegate == nil) {
|
||||||
buttonDelegate = [buttonDelegateClass new];
|
buttonDelegate = [buttonDelegateClass new];
|
||||||
|
[delegates addObject:buttonDelegate];
|
||||||
|
}
|
||||||
[buttonDelegate registerButton:b];
|
[buttonDelegate registerButton:b];
|
||||||
uiButtonOnClicked(b, defaultOnClicked, NULL);
|
uiButtonOnClicked(b, defaultOnClicked, NULL);
|
||||||
|
|
||||||
|
|
|
@ -3,13 +3,13 @@
|
||||||
|
|
||||||
struct uiCheckbox {
|
struct uiCheckbox {
|
||||||
uiDarwinControl c;
|
uiDarwinControl c;
|
||||||
NSButton *button; // TODO rename to checkbox?
|
NSButton *button;
|
||||||
void (*onToggled)(uiCheckbox *, void *);
|
void (*onToggled)(uiCheckbox *, void *);
|
||||||
void *onToggledData;
|
void *onToggledData;
|
||||||
};
|
};
|
||||||
|
|
||||||
@interface checkboxDelegateClass : NSObject {
|
@interface checkboxDelegateClass : NSObject {
|
||||||
NSMapTable *buttons; // TODO rename to checkboxes?
|
NSMapTable *buttons;
|
||||||
}
|
}
|
||||||
- (IBAction)onToggled:(id)sender;
|
- (IBAction)onToggled:(id)sender;
|
||||||
- (void)registerCheckbox:(uiCheckbox *)c;
|
- (void)registerCheckbox:(uiCheckbox *)c;
|
||||||
|
@ -26,7 +26,6 @@ struct uiCheckbox {
|
||||||
return self;
|
return self;
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO have this called
|
|
||||||
- (void)dealloc
|
- (void)dealloc
|
||||||
{
|
{
|
||||||
if ([self->buttons count] != 0)
|
if ([self->buttons count] != 0)
|
||||||
|
@ -117,8 +116,10 @@ uiCheckbox *uiNewCheckbox(const char *text)
|
||||||
[c->button setBordered:NO];
|
[c->button setBordered:NO];
|
||||||
uiDarwinSetControlFont(c->button, NSRegularControlSize);
|
uiDarwinSetControlFont(c->button, NSRegularControlSize);
|
||||||
|
|
||||||
if (checkboxDelegate == nil)
|
if (checkboxDelegate == nil) {
|
||||||
checkboxDelegate = [checkboxDelegateClass new];
|
checkboxDelegate = [checkboxDelegateClass new];
|
||||||
|
[delegates addObject:checkboxDelegate];
|
||||||
|
}
|
||||||
[checkboxDelegate registerCheckbox:c];
|
[checkboxDelegate registerCheckbox:c];
|
||||||
uiCheckboxOnToggled(c, defaultOnToggled, NULL);
|
uiCheckboxOnToggled(c, defaultOnToggled, NULL);
|
||||||
|
|
||||||
|
|
|
@ -28,7 +28,6 @@ struct uiEntry {
|
||||||
return self;
|
return self;
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO have this called
|
|
||||||
- (void)dealloc
|
- (void)dealloc
|
||||||
{
|
{
|
||||||
if ([self->entries count] != 0)
|
if ([self->entries count] != 0)
|
||||||
|
@ -131,8 +130,10 @@ uiEntry *uiNewEntry(void)
|
||||||
[e->textfield setSelectable:YES]; // otherwise the setting is masked by the editable default of YES
|
[e->textfield setSelectable:YES]; // otherwise the setting is masked by the editable default of YES
|
||||||
finishNewTextField(e->textfield, YES);
|
finishNewTextField(e->textfield, YES);
|
||||||
|
|
||||||
if (entryDelegate == nil)
|
if (entryDelegate == nil) {
|
||||||
entryDelegate = [entryDelegateClass new];
|
entryDelegate = [entryDelegateClass new];
|
||||||
|
[delegates addObject:entryDelegate];
|
||||||
|
}
|
||||||
[entryDelegate registerEntry:e];
|
[entryDelegate registerEntry:e];
|
||||||
uiEntryOnChanged(e, defaultOnChanged, NULL);
|
uiEntryOnChanged(e, defaultOnChanged, NULL);
|
||||||
|
|
||||||
|
|
|
@ -46,6 +46,7 @@ extern void finishNewTextField(NSTextField *, BOOL);
|
||||||
extern uiWindow *windowFromNSWindow(NSWindow *);
|
extern uiWindow *windowFromNSWindow(NSWindow *);
|
||||||
|
|
||||||
// alloc.m
|
// alloc.m
|
||||||
|
extern NSMutableArray *delegates;
|
||||||
extern void initAlloc(void);
|
extern void initAlloc(void);
|
||||||
extern void uninitAlloc(void);
|
extern void uninitAlloc(void);
|
||||||
|
|
||||||
|
|
|
@ -29,7 +29,6 @@ struct uiWindow {
|
||||||
return self;
|
return self;
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO have this called
|
|
||||||
- (void)dealloc
|
- (void)dealloc
|
||||||
{
|
{
|
||||||
if ([self->windows count] != 0)
|
if ([self->windows count] != 0)
|
||||||
|
@ -191,8 +190,10 @@ uiWindow *uiNewWindow(const char *title, int width, int height, int hasMenubar)
|
||||||
// the only thing that closes the window is us anyway
|
// the only thing that closes the window is us anyway
|
||||||
[w->window setReleasedWhenClosed:YES];
|
[w->window setReleasedWhenClosed:YES];
|
||||||
|
|
||||||
if (windowDelegate == nil)
|
if (windowDelegate == nil) {
|
||||||
windowDelegate = [windowDelegateClass new];
|
windowDelegate = [windowDelegateClass new];
|
||||||
|
[delegates addObject:windowDelegate];
|
||||||
|
}
|
||||||
[windowDelegate registerWindow:w];
|
[windowDelegate registerWindow:w];
|
||||||
uiWindowOnClosing(w, defaultOnClosing, NULL);
|
uiWindowOnClosing(w, defaultOnClosing, NULL);
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue