Version 0.1.2 freatures:
- control anchoring
- mouse enter / leave events
- command events (control, menu, accelerator)
- accelerators
- easy way of subclassing
- easy api window creation
- modal/modeless dialogs
My goals are keep it compatible with PB, easy to use, flexible and procedural based.
EDIT:
I set up a sourceforge project, the framework is removed from here, it will get too big, i only leave the examples.
Version 0.1.2 adds
- accelerators
- command events
DOWNLOAD:
http://sourceforge.net/projects/wfxframework/files/
The download contains all the examples.
Examples:
Code: Select all
XIncludeFile "wfx.pbi"
;Anchoring and mouse enter/leave demo
enableexplicit
procedure eventcallback(hwid.i, code.i, p1.i, p2.i, param.i)
select code
case #WFX_NM_MOUSEENTER
if hwid=0
debug "container mouse enter"
elseif hwid=1
debug "button 1 mouse enter"
endif
case #WFX_NM_MOUSELEAVE
if hwid=0
debug "container mouse leave"
elseif hwid=1
debug "button 1 mouse leave"
endif
endselect
endprocedure
;- CODE
define.i EventID, state
define.i but, hwpbbut, hwbut, win
win = OpenWindow(#pb_any, 100, 200, 300, 300, "WFX Anchoring", #PB_Window_SystemMenu | #PB_Window_MinimizeGadget | #PB_Window_MaximizeGadget | #PB_Window_SizeGadget | #PB_Window_ScreenCentered)
wfx_SetUpPBWindow(win)
ContainerGadget(0, 20,20,260,260, #PB_Container_Raised)
wfx_PutFlag(0, #WFX_TRACKMOUSEEVENTS)
wfx_SetAnchor(0, #WFX_ANCHORALL)
wfx_SetCallback(0, @eventcallback())
ButtonGadget(1,0,0,100,30, "Mouse Hover", #WS_CLIPSIBLINGS)
wfx_PutFlag(1, #WFX_TRACKMOUSEEVENTS)
wfx_SetAnchor(1, #WFX_ANCHORLEFT | #WFX_ANCHORTOP)
wfx_SetCallback(1, @eventcallback())
ButtonGadget(2,160 - 6,0,100,30, "Button 2", #WS_CLIPSIBLINGS)
wfx_SetAnchor(2, #WFX_ANCHORRIGHT | #WFX_ANCHORTOP)
ButtonGadget(3, 0,230 - 6,100,30, "Button 3", #WS_CLIPSIBLINGS)
wfx_SetAnchor(3, #WFX_ANCHORLEFT | #WFX_ANCHORBOTTOM)
ButtonGadget(4, 160 - 6,230 - 6,100,30, "Button 3", #WS_CLIPSIBLINGS)
wfx_SetAnchor(4, #WFX_ANCHORRIGHT | #WFX_ANCHORBOTTOM)
Repeat
EventID = WaitWindowEvent()
Until EventID = #PB_Event_CloseWindow
Code: Select all
xincludefile "wfx.pbi"
;WFX API window that uses PB gadgets
enableexplicit
procedure wndproc(hwnd.i, msg.i, wparam.i, lparam.i, param.i)
define.RECT rc
define.i but
select msg
case #WM_CREATE
GetClientRect_(hwnd, @rc)
usegadgetlist(hwnd)
but = buttongadget(#pb_any, 0, rc\bottom - 20, 80, 20, "Button")
wfx_SetAnchor(but, #WFX_ANCHORBOTTOM)
procedurereturn 0
case #WM_DESTROY
PostQuitMessage_(0)
procedurereturn 0
default : procedurereturn DefWindowProc_(hwnd, msg, wparam, lparam)
endselect
endprocedure
;- CODE
define.i param
param = 10
wfx__OpenWindow(0, "WFX API Window", #WS_OVERLAPPEDWINDOW|#WS_VISIBLE, 10, 10, 300, 200, @wndproc(), param)