More OS X control work.
This commit is contained in:
parent
23e1fe0c98
commit
15a3d151cd
|
@ -3,7 +3,9 @@
|
||||||
|
|
||||||
struct combobox {
|
struct combobox {
|
||||||
uiCombobox c;
|
uiCombobox c;
|
||||||
OSTYPE *OSHANDLE;
|
BOOL editable;
|
||||||
|
NSPopUpButton *pb;
|
||||||
|
NSComboBox *cb;
|
||||||
};
|
};
|
||||||
|
|
||||||
uiDefineControlType(uiCombobox, uiTypeCombobox, struct combobox)
|
uiDefineControlType(uiCombobox, uiTypeCombobox, struct combobox)
|
||||||
|
@ -12,7 +14,9 @@ static uintptr_t comboboxHandle(uiControl *cc)
|
||||||
{
|
{
|
||||||
struct combobox *c = (struct combobox *) cc;
|
struct combobox *c = (struct combobox *) cc;
|
||||||
|
|
||||||
return (uintptr_t) (c->OSHANDLE);
|
if (c->editable)
|
||||||
|
return (uintptr_t) (c->cb);
|
||||||
|
return (uintptr_t) (c->pb);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void comboboxAppend(uiCombobox *cc, const char *text)
|
static void comboboxAppend(uiCombobox *cc, const char *text)
|
||||||
|
@ -22,13 +26,28 @@ static void comboboxAppend(uiCombobox *cc, const char *text)
|
||||||
PUT_CODE_HERE;
|
PUT_CODE_HERE;
|
||||||
}
|
}
|
||||||
|
|
||||||
static uiCombobox *finishNewCombobox(OSTHING OSARG)
|
static uiCombobox *finishNewCombobox(BOOL editable)
|
||||||
{
|
{
|
||||||
struct combobox *c;
|
struct combobox *c;
|
||||||
|
|
||||||
c = (struct combobox *) MAKE_CONTROL_INSTANCE(uiTypeCombobox());
|
c = (struct combobox *) uiNewControl(uiTypeCombobox());
|
||||||
|
|
||||||
PUT_CODE_HERE;
|
c->editable = editable;
|
||||||
|
if (c->editable) {
|
||||||
|
c->cb = [[NSComboBox alloc] initWithFrame:NSZeroRect];
|
||||||
|
[c->cb setUsesDataSource:NO];
|
||||||
|
[c->cb setButtonBordered:YES];
|
||||||
|
NSLog(@"TEST intercellSpacing %@", NSStringFromSize([c->cb intercellSpacing]);
|
||||||
|
[c->cb setCompletes:NO];
|
||||||
|
uiDarwinMakeSingleViewControl(uiControl(c), c->cb, YES);
|
||||||
|
NSLog(@"TEST intercellSpacing %@", NSStringFromSize([c->cb intercellSpacing]);
|
||||||
|
} else {
|
||||||
|
c->pb = [[NSPopUpButton alloc] initWithFrame:NSZeroRect pullsDown:NO];
|
||||||
|
// TODO preferred edge
|
||||||
|
// TODO arrow position
|
||||||
|
// TODO font
|
||||||
|
uiDarwinMakeSingleViewControl(uiControl(c), c->cb, YES);
|
||||||
|
}
|
||||||
|
|
||||||
uiControl(c)->Handle = comboboxHandle;
|
uiControl(c)->Handle = comboboxHandle;
|
||||||
|
|
||||||
|
@ -39,10 +58,10 @@ static uiCombobox *finishNewCombobox(OSTHING OSARG)
|
||||||
|
|
||||||
uiCombobox *uiNewCombobox(void)
|
uiCombobox *uiNewCombobox(void)
|
||||||
{
|
{
|
||||||
return finishNewCombobox(OSARGNONEDITABLE);
|
return finishNewCombobox(NO);
|
||||||
}
|
}
|
||||||
|
|
||||||
uiCombobox *uiNewEditableCombobox(void)
|
uiCombobox *uiNewEditableCombobox(void)
|
||||||
{
|
{
|
||||||
return finishNewCombobox(OSARGEDITABLE);
|
return finishNewCombobox(YES);
|
||||||
}
|
}
|
||||||
|
|
|
@ -3,7 +3,7 @@
|
||||||
|
|
||||||
struct group {
|
struct group {
|
||||||
uiGroup g;
|
uiGroup g;
|
||||||
OSTYPE *OSHANDLE;
|
NSBox *box;
|
||||||
uiControl *child;
|
uiControl *child;
|
||||||
int margined;
|
int margined;
|
||||||
};
|
};
|
||||||
|
@ -14,7 +14,7 @@ static uintptr_t groupHandle(uiControl *c)
|
||||||
{
|
{
|
||||||
struct group *g = (struct group *) c;
|
struct group *g = (struct group *) c;
|
||||||
|
|
||||||
return (uintptr_t) (g->OSHANDLE);
|
return (uintptr_t) (g->box);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void groupContainerUpdateState(uiControl *c)
|
static void groupContainerUpdateState(uiControl *c)
|
||||||
|
@ -75,7 +75,16 @@ uiGroup *uiNewGroup(const char *text)
|
||||||
|
|
||||||
g = (struct group *) MAKE_CONTROL_INSTANCE(uiTypeGroup());
|
g = (struct group *) MAKE_CONTROL_INSTANCE(uiTypeGroup());
|
||||||
|
|
||||||
PUT_CODE_HERE;
|
g->box = [[NSBox alloc] initWithFrame:NSZeroRect];
|
||||||
|
[g->box setBoxType:NSBoxPrimary];
|
||||||
|
[g->box setBorderType:TODO];
|
||||||
|
[g->box setTransparent:NO];
|
||||||
|
[g->box setTitlePosition:NSAtTop];
|
||||||
|
|
||||||
|
// can't set title font the way the function does; plus we need to use a different size
|
||||||
|
uiDarwinMakeSingleViewControl(uiControl(g), g->box, NO);
|
||||||
|
// TODO verify if Small in Xcode is this small
|
||||||
|
[g->box setTitleFont:[NSFont systemFontOfSize:[NSFont systemFontSizeForControlSize:NSSmallControlSize]]];
|
||||||
|
|
||||||
uiControl(g)->Handle = groupHandle;
|
uiControl(g)->Handle = groupHandle;
|
||||||
uiControl(g)->ContainerUpdateState = groupContainerUpdateState;
|
uiControl(g)->ContainerUpdateState = groupContainerUpdateState;
|
||||||
|
|
|
@ -1,9 +1,11 @@
|
||||||
// 11 june 2015
|
// 11 june 2015
|
||||||
#include "uipriv_darwin.h"
|
#include "uipriv_darwin.h"
|
||||||
|
|
||||||
|
// TODO sizing
|
||||||
|
|
||||||
struct separator {
|
struct separator {
|
||||||
uiSeparator s;
|
uiSeparator s;
|
||||||
OSTYPE *OSHANDLE;
|
NSBox *box;
|
||||||
};
|
};
|
||||||
|
|
||||||
uiDefineControlType(uiSeparator, uiTypeSeparator, struct separator)
|
uiDefineControlType(uiSeparator, uiTypeSeparator, struct separator)
|
||||||
|
@ -12,7 +14,7 @@ static uintptr_t separatorHandle(uiControl *c)
|
||||||
{
|
{
|
||||||
struct separator *s = (struct separator *) c;
|
struct separator *s = (struct separator *) c;
|
||||||
|
|
||||||
return (uintptr_t) (s->OSHANDLE);
|
return (uintptr_t) (s->box);
|
||||||
}
|
}
|
||||||
|
|
||||||
uiSeparator *uiNewHorizontalSeparator(void)
|
uiSeparator *uiNewHorizontalSeparator(void)
|
||||||
|
@ -21,7 +23,13 @@ uiSeparator *uiNewHorizontalSeparator(void)
|
||||||
|
|
||||||
s = (struct separator *) MAKE_CONTROL_INSTANCE(uiTypeSeparator());
|
s = (struct separator *) MAKE_CONTROL_INSTANCE(uiTypeSeparator());
|
||||||
|
|
||||||
PUT_CODE_HERE;
|
s->box = [[NSBox alloc] initWithFrame:NSZeroRect];
|
||||||
|
[s->box setBoxType:NSBoxSeparator];
|
||||||
|
[s->box setBorderType:TODO];
|
||||||
|
[s->box setTransparent:NO];
|
||||||
|
[s->box setTitlePosition:NSNoTitle];
|
||||||
|
|
||||||
|
uiDarwinMakeSingleViewControl(uiControl(s), s->box, NO);
|
||||||
|
|
||||||
uiControl(s)->Handle = separatorHandle;
|
uiControl(s)->Handle = separatorHandle;
|
||||||
|
|
||||||
|
|
|
@ -54,13 +54,17 @@ uiSlider *uiNewSlider(intmax_t min, intmax_t max)
|
||||||
s = (struct slider *) uiNewControl(uiTypeSlider());
|
s = (struct slider *) uiNewControl(uiTypeSlider());
|
||||||
|
|
||||||
s->slider = [[NSSlider alloc] initWithFrame:NSZeroRect];
|
s->slider = [[NSSlider alloc] initWithFrame:NSZeroRect];
|
||||||
|
NSLog(@"NOTE thickness %f\n", [s->slider knobThickness]);
|
||||||
// TODO vertical is defined by wider than tall
|
// TODO vertical is defined by wider than tall
|
||||||
[s->slider setMinValue:min];
|
[s->slider setMinValue:min];
|
||||||
[s->slider setMaxValue:max];
|
[s->slider setMaxValue:max];
|
||||||
// TODO NSTickMarkAbove?
|
[s->slider setAllowsTickMarkValuesOnly:NO];
|
||||||
|
[s->slider setNumberOfTicks:0];
|
||||||
|
[s->slider setTickMarkPosition:NSTickMarkAbove];
|
||||||
|
|
||||||
cell = (NSSliderCell *) [s->slider cell];
|
cell = (NSSliderCell *) [s->slider cell];
|
||||||
[cell setSliderType:NSLinearSlider];
|
[cell setSliderType:NSLinearSlider];
|
||||||
|
NSLog(@"NOTE thickness %f\n", [s->slider knobThickness]);
|
||||||
|
|
||||||
uiDarwinMakeSingleViewControl(uiControl(s), s->slider, NO);
|
uiDarwinMakeSingleViewControl(uiControl(s), s->slider, NO);
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue