For my project i use wx-c with above mentioned designer, and it is almost finished, so i dont want to switch to fltk-c or iup. After creating the main skeleton program with designer one can use the examples of designer in combination with the .bi files. There are a huge number of additional functions. Most of them work out of the box.
If "clientdc01.bas" is used for example:
Code: Select all
#Include "wx-c/wx.bi"
Dim Shared As wxPanel Ptr panel
Dim Shared As wxTextCtrl Ptr textCtrl
Dim Shared As wxApp Ptr app
Sub EventHandler WXCALL ( event As wxEvent Ptr, iListener As wxInt )
' allocate a client DC
Dim As wxDC Ptr dc = wxClientDC_ctor2(Panel)
' use it
wxDC_Clear(dc)
For i As Integer = 1 To 3
wxDC_DrawCircle(dc, Rnd*640, Rnd*480, 1+Rnd*240)
Next
For i As Integer = 1 To 30
wxDC_DrawLine(dc, Rnd*640, Rnd*480, Rnd*640, Rnd*480)
Next
For i As Integer = 1 To 10
wxDC_DrawRotatedText(dc, wxString_ctorUTF8("Hello World!"), Rnd*640, Rnd*480, Rnd*360)
Next
' release it
wxDC_dtor(dc)
End Sub
Function OnInit WXCALL As wxBool
Dim As wxFrame Ptr frame = wxFrame_ctor()
wxFrame_Create(frame, WX_NULL, -1, wxString_ctorUTF8("wxClientDC"), -1, -1, 640, 480, _
wxFRAME_DEFAULT_STYLE Or wxCLOSE_BOX _
Xor wxMAXIMIZE_BOX Xor wxRESIZE_BORDER)
panel = wxPanel_ctor2(frame, -1, -1, -1 , -1, -1 , 0, WX_NULL)
Dim As _wxButton Ptr button = wxButton_ctor()
wxButton_Create(button, panel, -1, wxString_ctorUTF8("click me"), 70, 270, 250, 60)
wxEvtHandler_proxy(button, @EventHandler)
wxEvtHandler_Connect(button, wxEvent_EVT_COMMAND_BUTTON_CLICKED(), -1, -1, 0)
wxWindow_Show(frame,WX_TRUE)
Return wxApp_OnInit(app)
End Function
Function OnExit WXCALL As wxInt
Return wxApp_OnExit(app)
End Function
app = wxApp_ctor()
wxApp_RegisterVirtual(app, @OnInit, @OnExit)
wxApp_Run()
One could go to "freebasic/inc/wx-c folder and use all the functions from "dc.bi" (which is already included from "wx.bi"):
Code: Select all
#Ifndef __dc_bi__
#Define __dc_bi__
#Include Once "common.bi"
' class wxDC
Declare Sub wxDC_dtor WXCALL Alias "wxDC_dtor" (self As wxDC Ptr)
Declare Function wxDC_Ok WXCALL Alias "wxDC_Ok" (self As wxDC Ptr) As wxBool
Declare Sub wxDC_DrawBitmap WXCALL Alias "wxDC_DrawBitmap" (self As wxDC Ptr, bitmap As wxBitmap Ptr, x As wxCoord, y As wxCoord, transp As wxBool)
Declare Sub wxDC_DrawPolygon WXCALL Alias "wxDC_DrawPolygon" (self As wxDC Ptr, n As wxInt, pPonts As wxPoint Ptr, xoffset As wxCoord, yoffset As wxCoord, fill_style As wxPolygonFillStyle)
Declare Sub wxDC_DrawLine WXCALL Alias "wxDC_DrawLine" (self As wxDC Ptr, x1 As wxCoord, y1 As wxCoord, x2 As wxCoord, y2 As wxCoord)
Declare Sub wxDC_DrawRectangle WXCALL Alias "wxDC_DrawRectangle" (self As wxDC Ptr, x1 As wxCoord, y1 As wxCoord, x2 As wxCoord, y2 As wxCoord)
Declare Sub wxDC_DrawText WXCALL Alias "wxDC_DrawText" (self As wxDC Ptr, txt As wxString Ptr, x As wxInt, y As wxInt)
Declare Sub wxDC_DrawEllipse WXCALL Alias "wxDC_DrawEllipse" (self As wxDC Ptr, x As wxInt, y As wxInt, w As wxInt, h As wxInt)
Declare Sub wxDC_DrawPoint WXCALL Alias "wxDC_DrawPoint" (self As wxDC Ptr, x As wxInt, y As wxInt)
Declare Sub wxDC_DrawRoundedRectangle WXCALL Alias "wxDC_DrawRoundedRectangle" (self As wxDC Ptr, x As wxInt, y As wxInt, w As wxInt, h As wxInt, radius As wxDouble)
' shortened to reduce display size
In my experience this works easily in most cases. Some times there may appear problems, then a workaround may be needed.
Similarly with the other examples. There are mostly additional functions in the .bi files.