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