2000-03-05 19:58:08 +00:00
|
|
|
/* ------------ spinbutt.c ------------- */
|
|
|
|
|
|
|
|
#include "dflat.h"
|
|
|
|
|
2003-06-19 02:48:13 +00:00
|
|
|
int DfSpinButtonProc(DFWINDOW wnd, DFMESSAGE msg, DF_PARAM p1, DF_PARAM p2)
|
2000-03-05 19:58:08 +00:00
|
|
|
{
|
|
|
|
int rtn;
|
2003-06-19 02:48:13 +00:00
|
|
|
DF_CTLWINDOW *ct = DfGetControl(wnd);
|
2000-03-05 19:58:08 +00:00
|
|
|
if (ct != NULL) {
|
|
|
|
switch (msg) {
|
2003-06-19 02:48:13 +00:00
|
|
|
case DFM_CREATE_WINDOW:
|
2000-03-05 19:58:08 +00:00
|
|
|
wnd->wd -= 2;
|
|
|
|
wnd->rc.rt -= 2;
|
|
|
|
break;
|
2003-06-19 02:48:13 +00:00
|
|
|
case DFM_SETFOCUS:
|
|
|
|
rtn = DfBaseWndProc(DF_SPINBUTTON, wnd, msg, p1, p2);
|
2000-03-05 19:58:08 +00:00
|
|
|
if (!(int)p1)
|
2003-06-19 02:48:13 +00:00
|
|
|
DfSendMessage(NULL, DFM_HIDE_CURSOR, 0, 0);
|
|
|
|
DfSetFocusCursor(wnd);
|
2000-03-05 19:58:08 +00:00
|
|
|
return rtn;
|
2003-06-19 02:48:13 +00:00
|
|
|
case DFM_PAINT:
|
|
|
|
DfForeground = DfWndBackground(wnd);
|
|
|
|
DfBackground = DfWndForeground(wnd);
|
|
|
|
DfWPutch(wnd,DF_UPSCROLLBOX,DfWindowWidth(wnd), 0);
|
|
|
|
DfWPutch(wnd,DF_DOWNSCROLLBOX,DfWindowWidth(wnd)+1,0);
|
|
|
|
DfSetFocusCursor(wnd);
|
2000-03-05 19:58:08 +00:00
|
|
|
break;
|
2003-06-19 02:48:13 +00:00
|
|
|
case DFM_LEFT_BUTTON:
|
|
|
|
if (p1 == DfGetRight(wnd) + 1)
|
|
|
|
DfSendMessage(wnd, DFM_KEYBOARD, DF_UP, 0);
|
|
|
|
else if (p1 == DfGetRight(wnd) + 2)
|
|
|
|
DfSendMessage(wnd, DFM_KEYBOARD, DF_DN, 0);
|
|
|
|
if (wnd != DfInFocus)
|
|
|
|
DfSendMessage(wnd, DFM_SETFOCUS, TRUE, 0);
|
2000-03-05 19:58:08 +00:00
|
|
|
return TRUE;
|
2003-06-19 02:48:13 +00:00
|
|
|
case DFM_LB_SETSELECTION:
|
|
|
|
rtn = DfBaseWndProc(DF_SPINBUTTON, wnd, msg, p1, p2);
|
2000-03-05 19:58:08 +00:00
|
|
|
wnd->wtop = (int) p1;
|
2003-06-19 02:48:13 +00:00
|
|
|
DfSendMessage(wnd, DFM_PAINT, 0, 0);
|
2000-03-05 19:58:08 +00:00
|
|
|
return rtn;
|
|
|
|
default:
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
2003-06-19 02:48:13 +00:00
|
|
|
return DfBaseWndProc(DF_SPINBUTTON, wnd, msg, p1, p2);
|
2000-03-05 19:58:08 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/* EOF */
|