More OS X control work.

This commit is contained in:
Pietro Gagliardi 2015-07-26 13:53:35 -04:00
parent 75bc1c13bb
commit ce82174013
2 changed files with 41 additions and 8 deletions

View File

@ -17,8 +17,29 @@ separator
seems to be an internal subclass of NSBox seems to be an internal subclass of NSBox
need to generate a nib to observe its properties need to generate a nib to observe its properties
horizontal slider slider
NSSlider check 10.9
Style Linear
Tick Marks Position Above
combo box
bordered button
system regular font
popup button
type popup
arrow bottom
menu edge bottom
font menu 13 ??????????????
check 10.9
radio buttons
mode radio
selection rectangular, not empty
buttons
style radio
type radio
not bordered, not transparent
font system regular
progress bar
style bar
display when stopped

View File

@ -1,9 +1,11 @@
// 11 june 2015 // 11 june 2015
#include "uipriv_darwin.h" #include "uipriv_darwin.h"
// TODO events
struct slider { struct slider {
uiSlider s; uiSlider s;
OSTYPE *OSHANDLE; NSSlider *slider;
void (*onChanged)(uiSlider *, void *); void (*onChanged)(uiSlider *, void *);
void *onChangedData; void *onChangedData;
}; };
@ -14,7 +16,7 @@ static uintptr_t sliderHandle(uiControl *c)
{ {
struct slider *s = (struct slider *) c; struct slider *s = (struct slider *) c;
return (uintptr_t) (s->OSHANDLE); return (uintptr_t) (s->slider);
} }
static void defaultOnChanged(uiSlider *s, void *data) static void defaultOnChanged(uiSlider *s, void *data)
@ -47,10 +49,20 @@ static void sliderOnChanged(uiSlider *ss, void (*f)(uiSlider *, void *), void *d
uiSlider *uiNewSlider(intmax_t min, intmax_t max) uiSlider *uiNewSlider(intmax_t min, intmax_t max)
{ {
struct slider *s; struct slider *s;
NSSliderCell *cell;
s = (struct slider *) MAKE_CONTROL_INSTANCE(uiTypeSlider()); s = (struct slider *) uiNewControl(uiTypeSlider());
PUT_CODE_HERE; s->slider = [[NSSlider alloc] initWithFrame:NSZeroRect];
// TODO vertical is defined by wider than tall
[s->slider setMinValue:min];
[s->slider setMaxValue:max];
// TODO NSTickMarkAbove?
cell = (NSSliderCell *) [s->slider cell];
[cell setSliderType:NSLinearSlider];
uiDarwinMakeSingleViewControl(uiControl(s), s->slider, NO);
s->onChanged = defaultOnChanged; s->onChanged = defaultOnChanged;