Another update for those interested. I've upgraded several more
classes and also made two changes:

1. Applied a fix to allow for c++11 support; if you want to enable it,
you'll need to add -DCMAKE_CXX_FLAGS="-std=c++11" to your cmake call;
I only tested using gcc 4.8.1, but it should work with other versions
as well.
2. Added MacOpenFiles support. From your Lua code you'll need to do
something like the following:

wx.wxGetApp().MacOpenFiles = function(files)
  for _, file in ipairs(files) do
    -- do smth with the file
  end
end

This function is enabled on all platforms, but is only triggered on
OSX. It now allows the files to be dragged to the docked app to be
processed. I also added caching of the files on the initial
drag-n-drop (when the app is not opened yet) as the callback is
triggered before wxlua is setup, so the files are stored and then the
callback is called internally when MainLoop is started, which allows
the wxlua to get initialized properly and give the application a
chance to set MacOpenFiles handler as shown above. If you need to
check if this is the initial callback, you can check for
IsMainLoopRunning, which should still be "false" at that time.

You still need to have a proper plist changes to inform OSX about the
files your application can accept, but I tested with files of various
types (and even folders) and it all works as expected.

I've tested the changes on Windows and OSX with both wxwidgets 3.0 and
the current master branch, but there may still be some glitches, so if
you notice something, don't hesitate to let me know. The latest code
is here: https://github.com/pkulchenko/wxlua/commits/wxwidgets311

I took the liberty to remove some methods that don't exist in
wxwidgets; for example, there was GetColor method in wxAuiDockArt,
which doesn't exist in wxwidgets (it's GetColour); if you really need
it, it's easy to add as an alias. I also updated the example where
GetColor was used. Some classes have Ok() instead of IsOk() and I kept
it for compatibility.

I also tried to stick to the existing hierarchy in wxwidgets and added
some of the missing classes to wxlua (for example wxAppConsole that
wxApp inherits from). This should make no difference to any wxlua
application, but makes automated updates much easier.

Here is the list of classes that have been updated for wxwidgets 3.1.1:

  wxcore_menutool = {
    wxMenu = "menu.h",
    wxMenuItem = "menuitem.h",
  },
  wxcore_controls = {
    wxTreeCtrl = "treectrl.h",
    wxTextEntry = "textentry.h",
    wxTextCtrl = "textctrl.h",
    wxButton = "button.h",
    wxAnyButton = "anybutton.h",
    wxBitmapButton = "bmpbuttn.h",
    wxToggleButton = "tglbtn.h",
    wxBitmapToggleButton = "tglbtn.h",
  },
  wxbase_file = {
    wxDir = "dir.h",
  },
  wxcore_windows = {
    wxWindow = "window.h",
  },
  wxcore_appframe = {
    wxTopLevelWindow = "toplevel.h",
    wxNonOwnedWindow = "nonownedwnd.h",
    wxFrame = "frame.h",
    wxApp = "app.h",
    wxAppConsole = "app.h",
    wxStatusBar = "statusbr.h",
    wxStatusBarPane = "statusbr.h",
  },
  wxbase_base = {
    wxEvtHandler = "event.h",
    wxEvent = "event.h",
    wxEventLoopBase = "evtloop.h",
    wxEventFilter = "eventfilter.h",
  },
  wxcore_gdi = {
    wxColour = "colour.h",
    wxFont = "font.h",
    wxFontInfo = "font.h",
    wxPen = "pen.h",
    wxBrush = "brush.h",
    wxPalette = "palette.h",
    wxIcon = "icon.h",
    wxMask = "bitmap.h",
    wxCursor = "cursor.h",
    wxCaret = "caret.h",
    wxDisplay = "display.h",
    wxBitmap = "bitmap.h",
  },
  wxaui_aui = {
    wxAuiToolBarItem = "aui/auibar.h",
    wxAuiToolBarArt = "aui/auibar.h",
    wxAuiToolBar = "aui/auibar.h",
    wxAuiTabArt = "aui/auibook.h",
    wxAuiNotebook = "aui/auibook.h",
    wxAuiDockArt = "aui/dockart.h",
    wxAuiManager = "aui/framemanager.h",
  },
  wxcore_image = {
    wxImage = "image.h",
  },

I do have one question for those who may be using this: right now the
bindings include wxwidgets3_1_1 as the check (as this is the version
I'm working with), but I suspect that all these changes (except wxSTC)
also work with 3.1.0, which is the latest released version. For those
who may be using that released version instead of the latest master,
would you prefer to have 3.1.0 in the binding, so that you can use all
the new API functions? If so, I can probably update all the bindings
to use 3_1_0 instead of 3_1_1, which should help in that case. I'll
probably keep wxSTC as 3_1_1, as there are several changes that were
not available earlier and I don't plan to separate them.

Paul.

------------------------------------------------------------------------------
What NetFlow Analyzer can do for you? Monitors network bandwidth and traffic
patterns at an interface-level. Reveals which users, apps, and protocols are 
consuming the most bandwidth. Provides multi-vendor support for NetFlow, 
J-Flow, sFlow and other flows. Make informed decisions using capacity 
planning reports. https://ad.doubleclick.net/ddm/clk/305295220;132659582;e
_______________________________________________
wxlua-users mailing list
wxlua-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/wxlua-users

Reply via email to