Added show/hide/enable/disable to uiSpinbox.

This commit is contained in:
Pietro Gagliardi 2015-06-01 12:29:00 -04:00
parent e3079ce62c
commit e7801222be
1 changed files with 17 additions and 3 deletions

View File

@ -1,8 +1,6 @@
// 8 april 2015 // 8 april 2015
#include "uipriv_windows.h" #include "uipriv_windows.h"
// TODO SHED
struct spinbox { struct spinbox {
uiSpinbox s; uiSpinbox s;
HWND hwnd; HWND hwnd;
@ -118,7 +116,7 @@ static void recreateUpDown(struct spinbox *s)
SendMessageW(s->updown, UDM_SETPOS32, 0, (LPARAM) current); SendMessageW(s->updown, UDM_SETPOS32, 0, (LPARAM) current);
} }
if (uiControlContainerVisible(uiControl(s))) if (uiControlContainerVisible(uiControl(s)))
ShowWindow(s->updown, SW_SHOW); uiWIndowsUtilShow(s->updown);
s->inhibitChanged = FALSE; s->inhibitChanged = FALSE;
} }
@ -130,6 +128,18 @@ static void spinboxResize(uiControl *c, intmax_t x, intmax_t y, intmax_t width,
recreateUpDown(s); recreateUpDown(s);
} }
#define COMMIT(n, f) \
static void spinboxCommit ## n(uiControl *c) \
{ \
struct spinbox *s = (struct spinbox *) c; \
f(s->hwnd); \
f(s->updown); \
}
COMMIT(Show, uiWIndowsUtilShow)
COMMIT(Hide, uiWIndowsUtilHide)
COMMIT(Enable, uiWIndowsUtilEnable)
COMMIT(Disable, uiWIndowsUtilDisable)
// TODO does it go here relative of other things? // TODO does it go here relative of other things?
static void defaultOnChanged(uiSpinbox *s, void *data) static void defaultOnChanged(uiSpinbox *s, void *data)
{ {
@ -189,6 +199,10 @@ uiSpinbox *uiNewSpinbox(intmax_t min, intmax_t max)
uiControl(s)->Resize = spinboxResize; uiControl(s)->Resize = spinboxResize;
s->baseCommitDestroy = uiControl(s)->CommitDestroy; s->baseCommitDestroy = uiControl(s)->CommitDestroy;
uiControl(s)->CommitDestroy = spinboxCommitDestroy; uiControl(s)->CommitDestroy = spinboxCommitDestroy;
uiControl(s)->CommitShow = spinboxCommitShow;
uiControl(s)->CommitHide = spinboxCommitHide;
uiControl(s)->CommitEnable = spinboxCommitEnable;
uiControl(s)->CommitDisable = spinboxCommitDisable;
uiSpinbox(s)->Value = spinboxValue; uiSpinbox(s)->Value = spinboxValue;
uiSpinbox(s)->SetValue = spinboxSetValue; uiSpinbox(s)->SetValue = spinboxSetValue;