I thought of that once, too.
It's really a nice idea.
However!! With the current DDgui you can make user widgets very easily.
// a callback for a user defined spinner element
FUNCTION SpinnerFkt: id$, verb$, BYREF info$
SELECT verb$
CASE "DRAW"
// get size of widget
LOCAL w%, h%
w=DDgui_get(id$, "WIDTH")
h=DDgui_get(id$, "HEIGHT")
DRAWRECT 0,0,w,h, RGB(0xc0, 0xc0, 0xc0)
PRINT " ^",0,0
PRINT "#" + DDgui_get(id$, "TEXT"),0,16
PRINT " v",0,32
CASE "CLICKED" // mouse button up (1) or down (-1)
IF DDgui_get(id$, "CLICKED") // a-ha - clicked
// info$ = "XXXX,YYYY,BB" - fixed length string with local coords and button state
LOCAL mx% = MID$(info$,0,4)
LOCAL my% = MID$(info$,5,4)
LOCAL b1% = MID$(info$,10,2)
IF b1=1 // button up
IF my<16 // "up"
LOCAL num% = DDgui_get(id$, "TEXT")
INC num
DDgui_set(id$, "TEXT", num)
ELSEIF my>32
LOCAL num% = DDgui_get(id$, "TEXT")
DEC num
DDgui_set(id$, "TEXT", num)
ENDIF
ENDIF
ENDIF
CASE "INIT" // allocate memory/types/load images/...
DDgui_set(id$, "WIDTH", 64)
DDgui_set(id$, "HEIGHT", 48)
CASE "DESTROY" // free memroy
ENDSELECT
ENDFUNCTION
FUNCTION TestUser:
DDgui_pushdialog(0,0,400,400,TRUE)
DDgui_set("", "TEXT", "User widgets")
DDgui_spacer()
DDgui_set("", "MOVEABLE", TRUE)
DDgui_set("", "SCALEABLE", TRUE)
DDgui_widget("", "a simple spinner")
LOCAL foo AS DDgui_userfunction
foo = SpinnerFkt
DDgui_user("u_spin1", "SPINNER", foo, 0,0)
DDgui_user("u_spin2", "SPINNER", foo, 0,0)
WHILE TRUE
DDgui_show(TRUE)
SHOWSCREEN
WEND
ENDFUNCTION
The main problem might be to have the looks of DDgui now. But you can use the DDgui draing functions - just peek at how I am drawing text DDgui_print_internal (IIRC).
Do you think you can make it?
You can keep a type-reference with a 2D array for the cells in the widget.