From e7801222be3d32932cde14aa2dfa4b9c5a95d7f6 Mon Sep 17 00:00:00 2001 From: Pietro Gagliardi Date: Mon, 1 Jun 2015 12:29:00 -0400 Subject: [PATCH] Added show/hide/enable/disable to uiSpinbox. --- redo/windows/spinbox.c | 20 +++++++++++++++++--- 1 file changed, 17 insertions(+), 3 deletions(-) diff --git a/redo/windows/spinbox.c b/redo/windows/spinbox.c index 028707a3..c9ee478c 100644 --- a/redo/windows/spinbox.c +++ b/redo/windows/spinbox.c @@ -1,8 +1,6 @@ // 8 april 2015 #include "uipriv_windows.h" -// TODO SHED - struct spinbox { uiSpinbox s; HWND hwnd; @@ -118,7 +116,7 @@ static void recreateUpDown(struct spinbox *s) SendMessageW(s->updown, UDM_SETPOS32, 0, (LPARAM) current); } if (uiControlContainerVisible(uiControl(s))) - ShowWindow(s->updown, SW_SHOW); + uiWIndowsUtilShow(s->updown); s->inhibitChanged = FALSE; } @@ -130,6 +128,18 @@ static void spinboxResize(uiControl *c, intmax_t x, intmax_t y, intmax_t width, 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? static void defaultOnChanged(uiSpinbox *s, void *data) { @@ -189,6 +199,10 @@ uiSpinbox *uiNewSpinbox(intmax_t min, intmax_t max) uiControl(s)->Resize = spinboxResize; s->baseCommitDestroy = uiControl(s)->CommitDestroy; 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)->SetValue = spinboxSetValue;